Description:
[web] added body to problems, added task view page
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@174 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r88:61ad7e926318 - - 10 files changed: 66 inserted, 2 deleted
@@ -0,0 +1,15 | |||
|
1 | + class TasksController < ApplicationController | |
|
2 | + | |
|
3 | + before_filter :authenticate | |
|
4 | + | |
|
5 | + | |
|
6 | + def index | |
|
7 | + redirect_to :action => 'list' | |
|
8 | + end | |
|
9 | + | |
|
10 | + def list | |
|
11 | + @problems = Problem.find_available_problems | |
|
12 | + @user = User.find(session[:user_id]) | |
|
13 | + end | |
|
14 | + | |
|
15 | + end |
@@ -0,0 +1,5 | |||
|
1 | + %a{:name => problem.name} | |
|
2 | + %h3= "#{problem.full_name} (#{problem.name})" | |
|
3 | + %pre | |
|
4 | + %div{:style => "border: 1px solid grey; background: #eeeeee"} | |
|
5 | + = problem.body || "(not available)" |
@@ -0,0 +1,13 | |||
|
1 | + = user_title_bar(@user) | |
|
2 | + | |
|
3 | + %h2 Task Listing | |
|
4 | + | |
|
5 | + %b Task: | |
|
6 | + | |
|
7 | + - @problems.each do |problem| | |
|
8 | + - if problem.body!=nil | |
|
9 | + %a{:href => "\##{problem.name}"} | |
|
10 | + = problem.full_name | |
|
11 | +   | |
|
12 | + | |
|
13 | + = render :partial => 'problem', :collection => @problems |
@@ -0,0 +1,9 | |||
|
1 | + class AddBodyToProblems < ActiveRecord::Migration | |
|
2 | + def self.up | |
|
3 | + add_column :problems, :body, :text | |
|
4 | + end | |
|
5 | + | |
|
6 | + def self.down | |
|
7 | + remove_column :problems, :body | |
|
8 | + end | |
|
9 | + end |
@@ -0,0 +1,8 | |||
|
1 | + require File.dirname(__FILE__) + '/../test_helper' | |
|
2 | + | |
|
3 | + class TasksControllerTest < ActionController::TestCase | |
|
4 | + # Replace this with your real tests. | |
|
5 | + def test_truth | |
|
6 | + assert true | |
|
7 | + end | |
|
8 | + end |
@@ -9,24 +9,25 | |||
|
9 | 9 | # admin menu |
|
10 | 10 | menu_items << "<b>Administrative task:</b> " |
|
11 | 11 | append_to menu_items, '[Problem admin]', 'problems', 'index' |
|
12 | 12 | append_to menu_items, '[User admin]', 'user_admin', 'index' |
|
13 | 13 | append_to menu_items, '[User stat]', 'user_admin', 'user_stat' |
|
14 | 14 | #append_to menu_items, '[Graders]', 'graders', 'list' |
|
15 | 15 | append_to menu_items, '[Site config]', 'configurations', 'index' |
|
16 | 16 | menu_items << "<br/>" |
|
17 | 17 | end |
|
18 | 18 | |
|
19 | 19 | # main page |
|
20 | 20 | append_to menu_items, '[Main]', 'main', 'list' |
|
21 | + append_to menu_items, '[Tasks]', 'tasks', 'list' | |
|
21 | 22 | append_to menu_items, '[Submissions]', 'main', 'submission' |
|
22 | 23 | append_to menu_items, '[Test]', 'test', 'index' |
|
23 | 24 | append_to menu_items, '[Settings]', 'users', 'index' |
|
24 | 25 | append_to menu_items, '[Log out]', 'main', 'login' |
|
25 | 26 | |
|
26 | 27 | menu_items |
|
27 | 28 | end |
|
28 | 29 | |
|
29 | 30 | def append_to(option,label, controller, action) |
|
30 | 31 | option << ' ' if option!='' |
|
31 | 32 | option << link_to_unless_current(label, |
|
32 | 33 | :controller => controller, |
@@ -4,19 +4,22 | |||
|
4 | 4 | <p><label for="problem_name">Name</label><br/> |
|
5 | 5 | <%= text_field 'problem', 'name' %></p> |
|
6 | 6 | |
|
7 | 7 | <p><label for="problem_full_name">Full name</label><br/> |
|
8 | 8 | <%= text_field 'problem', 'full_name' %></p> |
|
9 | 9 | |
|
10 | 10 | <p><label for="problem_full_score">Full score</label><br/> |
|
11 | 11 | <%= text_field 'problem', 'full_score' %></p> |
|
12 | 12 | |
|
13 | 13 | <p><label for="problem_date_added">Date added</label><br/> |
|
14 | 14 | <%= date_select 'problem', 'date_added' %></p> |
|
15 | 15 | |
|
16 | + <p><label for="problem_body">Body</label><br/> | |
|
17 | + <%= text_area 'problem', 'body', :rows => 10 %></p> | |
|
18 | + | |
|
16 | 19 | <p><label for="problem_url">URL</label><br/> |
|
17 | 20 | <%= text_field 'problem', 'url' %></p> |
|
18 | 21 | |
|
19 | 22 | <p><label for="problem_available">Available</label><br/> |
|
20 | 23 | <%= select("problem","available",[['True',true],['False',false]]) %></p> |
|
21 | 24 | <!--[eoform:problem]--> |
|
22 | 25 |
@@ -1,8 +1,15 | |||
|
1 | 1 | <% for column in Problem.content_columns %> |
|
2 | 2 | <p> |
|
3 |
- <b><%= column.human_name %>:</b> |
|
|
3 | + <b><%= column.human_name %>:</b> | |
|
4 | + <% if column.name != 'body' %> | |
|
5 | + <%=h @problem.send(column.name) %> | |
|
6 | + <% else %> | |
|
7 | + <pre> | |
|
8 | + <%= @problem.body %> | |
|
9 | + </pre> | |
|
10 | + <% end %> | |
|
4 | 11 | </p> |
|
5 | 12 | <% end %> |
|
6 | 13 | |
|
7 | 14 | <%= link_to 'Edit', :action => 'edit', :id => @problem %> | |
|
8 | 15 | <%= link_to 'Back', :action => 'list' %> |
@@ -1,24 +1,24 | |||
|
1 | 1 | # This file is auto-generated from the current state of the database. Instead of editing this file, |
|
2 | 2 | # please use the migrations feature of ActiveRecord to incrementally modify your database, and |
|
3 | 3 | # then regenerate this schema definition. |
|
4 | 4 | # |
|
5 | 5 | # Note that this schema.rb definition is the authoritative source for your database schema. If you need |
|
6 | 6 | # to create the application database on another system, you should be using db:schema:load, not running |
|
7 | 7 | # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations |
|
8 | 8 | # you'll amass, the slower it'll run and the greater likelihood for issues). |
|
9 | 9 | # |
|
10 | 10 | # It's strongly recommended to check this file into your version control system. |
|
11 | 11 | |
|
12 |
- ActiveRecord::Schema.define(:version => 2 |
|
|
12 | + ActiveRecord::Schema.define(:version => 26) do | |
|
13 | 13 | |
|
14 | 14 | create_table "configurations", :force => true do |t| |
|
15 | 15 | t.string "key" |
|
16 | 16 | t.string "value_type" |
|
17 | 17 | t.string "value" |
|
18 | 18 | t.datetime "created_at" |
|
19 | 19 | t.datetime "updated_at" |
|
20 | 20 | end |
|
21 | 21 | |
|
22 | 22 | create_table "grader_processes", :force => true do |t| |
|
23 | 23 | t.string "host", :limit => 20 |
|
24 | 24 | t.integer "pid" |
@@ -35,24 +35,25 | |||
|
35 | 35 | t.string "name", :limit => 10 |
|
36 | 36 | t.string "pretty_name" |
|
37 | 37 | t.string "ext", :limit => 10 |
|
38 | 38 | end |
|
39 | 39 | |
|
40 | 40 | create_table "problems", :force => true do |t| |
|
41 | 41 | t.string "name", :limit => 30 |
|
42 | 42 | t.string "full_name" |
|
43 | 43 | t.integer "full_score" |
|
44 | 44 | t.date "date_added" |
|
45 | 45 | t.boolean "available" |
|
46 | 46 | t.string "url" |
|
47 | + t.text "body" | |
|
47 | 48 | end |
|
48 | 49 | |
|
49 | 50 | create_table "rights", :force => true do |t| |
|
50 | 51 | t.string "name" |
|
51 | 52 | t.string "controller" |
|
52 | 53 | t.string "action" |
|
53 | 54 | end |
|
54 | 55 | |
|
55 | 56 | create_table "rights_roles", :id => false, :force => true do |t| |
|
56 | 57 | t.integer "right_id" |
|
57 | 58 | t.integer "role_id" |
|
58 | 59 | end |
You need to be logged in to leave comments.
Login now