Description:
- add problem manage toggle test interface
- remove old erb file
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r569:47e6e54a036a - - 6 files changed: 28 inserted, 171 deleted
@@ -124,12 +124,20 | |||||
|
124 | @problem.update_attributes(available: !(@problem.available) ) |
|
124 | @problem.update_attributes(available: !(@problem.available) ) |
|
125 | respond_to do |format| |
|
125 | respond_to do |format| |
|
126 | format.js { } |
|
126 | format.js { } |
|
127 | end |
|
127 | end |
|
128 | end |
|
128 | end |
|
129 |
|
129 | ||
|
|
130 | + def toggle_test | ||
|
|
131 | + @problem = Problem.find(params[:id]) | ||
|
|
132 | + @problem.update_attributes(test_allowed: !(@problem.test_allowed?) ) | ||
|
|
133 | + respond_to do |format| | ||
|
|
134 | + format.js { } | ||
|
|
135 | + end | ||
|
|
136 | + end | ||
|
|
137 | + | ||
|
130 | def turn_all_off |
|
138 | def turn_all_off |
|
131 | Problem.find(:all, |
|
139 | Problem.find(:all, |
|
132 | :conditions => "available = 1").each do |problem| |
|
140 | :conditions => "available = 1").each do |problem| |
|
133 | problem.available = false |
|
141 | problem.available = false |
|
134 | problem.save |
|
142 | problem.save |
|
135 | end |
|
143 | end |
@@ -38,15 +38,18 | |||||
|
38 | %a.dropdown-toggle{href: '#', data: {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"} |
|
38 | %a.dropdown-toggle{href: '#', data: {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"} |
|
39 | Report |
|
39 | Report |
|
40 | %span.caret |
|
40 | %span.caret |
|
41 | %ul.dropdown-menu |
|
41 | %ul.dropdown-menu |
|
42 | = add_menu( 'Results', 'user_admin', 'user_stat') |
|
42 | = add_menu( 'Results', 'user_admin', 'user_stat') |
|
43 | = add_menu( 'Report', 'report', 'multiple_login') |
|
43 | = add_menu( 'Report', 'report', 'multiple_login') |
|
44 | - %button.navbar-btn.btn.btn-default.btn-warning |
|
44 | + - if (ungraded = Submission.where('graded_at is null').where('submitted_at < ?', 1.minutes.ago).count) > 0 |
|
45 | - hahaha |
|
45 | + =link_to "#{ungraded} backlogs!", |
|
46 | - |
|
46 | + grader_list_path, |
|
|
47 | + class: 'navbar-btn btn btn-default btn-warning', data: {toggle: 'tooltip'},title: 'Number of ungraded submission' | ||
|
|
48 | + =link_to 'Contest Mode, time remain: 00:20:33',grader_list_path, | ||
|
|
49 | + class: 'navbar-btn btn btn-primary' | ||
|
47 |
|
50 | ||
|
48 | %ul.nav.navbar-nav.navbar-right |
|
51 | %ul.nav.navbar-nav.navbar-right |
|
49 | = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-question-sign')}".html_safe, 'main', 'help') |
|
52 | = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-question-sign')}".html_safe, 'main', 'help') |
|
50 | = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-comment')}".html_safe, 'messages', 'list', {title: I18n.t('menu.messages'), data: {toggle: 'tooltip'}}) |
|
53 | = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-comment')}".html_safe, 'messages', 'list', {title: I18n.t('menu.messages'), data: {toggle: 'tooltip'}}) |
|
51 | - if GraderConfiguration['system.user_setting_enabled'] |
|
54 | - if GraderConfiguration['system.user_setting_enabled'] |
|
52 | = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-cog')}".html_safe, 'users', 'index', {title: I18n.t('menu.settings'), data: {toggle: 'tooltip'}}) |
|
55 | = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-cog')}".html_safe, 'users', 'index', {title: I18n.t('menu.settings'), data: {toggle: 'tooltip'}}) |
@@ -17,28 +17,31 | |||||
|
17 | = text_field 'problem', 'full_name' |
|
17 | = text_field 'problem', 'full_name' |
|
18 | = submit_tag "Create" |
|
18 | = submit_tag "Create" |
|
19 | %table.table.table-condense.table-hover |
|
19 | %table.table.table-condense.table-hover |
|
20 | %thead |
|
20 | %thead |
|
21 | %th Name |
|
21 | %th Name |
|
22 | %th Full name |
|
22 | %th Full name |
|
23 | - %th Full score |
|
23 | + %th.text-right Full score |
|
24 | %th Date added |
|
24 | %th Date added |
|
25 | - %th Avail? |
|
25 | + %th.text-center |
|
26 | - %th Test? |
|
26 | + Avail? |
|
|
27 | + %sup{class: 'text-primary',data: {toggle: 'tooltip'}, title: 'Let user submits to this problem?' } [?] | ||
|
|
28 | + %th.text-center | ||
|
|
29 | + Test? | ||
|
|
30 | + %sup{class: 'text-primary',data: {toggle: 'tooltip'}, title: 'Let user uses test interface on this problem?' } [?] | ||
|
27 | - if GraderConfiguration.multicontests? |
|
31 | - if GraderConfiguration.multicontests? |
|
28 | %th Contests |
|
32 | %th Contests |
|
29 | - for problem in @problems |
|
33 | - for problem in @problems |
|
30 | %tr{:class => "#{(problem.available) ? "success" : "danger"}", :id => "prob-#{problem.id}", :name => "prob-#{problem.id}"} |
|
34 | %tr{:class => "#{(problem.available) ? "success" : "danger"}", :id => "prob-#{problem.id}", :name => "prob-#{problem.id}"} |
|
31 | - @problem=problem |
|
35 | - @problem=problem |
|
32 | %td= in_place_editor_field :problem, :name, {}, :rows=>1 |
|
36 | %td= in_place_editor_field :problem, :name, {}, :rows=>1 |
|
33 | %td= in_place_editor_field :problem, :full_name, {}, :rows=>1 |
|
37 | %td= in_place_editor_field :problem, :full_name, {}, :rows=>1 |
|
34 | - %td= in_place_editor_field :problem, :full_score, {}, :rows=>1 |
|
38 | + %td.text-right= in_place_editor_field :problem, :full_score, {}, :rows=>1 |
|
35 | %td= problem.date_added |
|
39 | %td= problem.date_added |
|
36 |
- %td= toggle_button(@problem.available?, |
|
40 | + %td= toggle_button(@problem.available?, toggle_problem_url(@problem), "problem-avail-#{@problem.id}") |
|
37 | - //%td{}= link_to (@problem.available? ? "Yes" : "No"), url_for(controller: :problems, action: :toggle, id: @problem), { class: "btn btn-block btn-sm btn-#{(@problem.available? ? 'success' : 'default')} ajax-toggle", id: "problem-avail-#{@problem.id}", data: {remote: true, method: 'post' } } |
|
41 | + %td= toggle_button(@problem.test_allowed?, toggle_test_problem_url(@problem), "problem-test-#{@problem.id}") |
|
38 | - %td= problem.test_allowed |
|
||
|
39 | - if GraderConfiguration.multicontests? |
|
42 | - if GraderConfiguration.multicontests? |
|
40 | %td |
|
43 | %td |
|
41 | = problem.contests.collect { |c| c.name }.join(', ') |
|
44 | = problem.contests.collect { |c| c.name }.join(', ') |
|
42 | %td= link_to 'Stat', {:action => 'stat', :id => problem.id}, class: 'btn btn-info btn-xs btn-block' |
|
45 | %td= link_to 'Stat', {:action => 'stat', :id => problem.id}, class: 'btn btn-info btn-xs btn-block' |
|
43 | %td= link_to 'Show', {:action => 'show', :id => problem}, class: 'btn btn-info btn-xs btn-block' |
|
46 | %td= link_to 'Show', {:action => 'show', :id => problem}, class: 'btn btn-info btn-xs btn-block' |
|
44 | %td= link_to 'Edit', {:action => 'edit', :id => problem}, class: 'btn btn-info btn-xs btn-block' |
|
47 | %td= link_to 'Edit', {:action => 'edit', :id => problem}, class: 'btn btn-info btn-xs btn-block' |
@@ -1,26 +1,25 | |||||
|
1 | CafeGrader::Application.routes.draw do |
|
1 | CafeGrader::Application.routes.draw do |
|
2 | get "sources/direct_edit" |
|
2 | get "sources/direct_edit" |
|
3 |
|
3 | ||
|
4 | root :to => 'main#login' |
|
4 | root :to => 'main#login' |
|
5 |
|
5 | ||
|
6 | - |
|
||
|
7 | resources :contests |
|
6 | resources :contests |
|
8 |
|
7 | ||
|
9 | resources :sites |
|
8 | resources :sites |
|
10 |
|
9 | ||
|
11 | resources :announcements do |
|
10 | resources :announcements do |
|
12 | member do |
|
11 | member do |
|
13 | get 'toggle','toggle_front' |
|
12 | get 'toggle','toggle_front' |
|
14 | end |
|
13 | end |
|
15 | end |
|
14 | end |
|
16 |
|
15 | ||
|
17 | - |
|
||
|
18 | resources :problems do |
|
16 | resources :problems do |
|
19 | member do |
|
17 | member do |
|
20 | get 'toggle' |
|
18 | get 'toggle' |
|
|
19 | + get 'toggle_test' | ||
|
21 | end |
|
20 | end |
|
22 | collection do |
|
21 | collection do |
|
23 | get 'turn_all_off' |
|
22 | get 'turn_all_off' |
|
24 | get 'turn_all_on' |
|
23 | get 'turn_all_on' |
|
25 | get 'import' |
|
24 | get 'import' |
|
26 | get 'manage' |
|
25 | get 'manage' |
@@ -32,16 +31,12 | |||||
|
32 | resources :users do |
|
31 | resources :users do |
|
33 | member do |
|
32 | member do |
|
34 | get 'toggle_activate', 'toggle_enable' |
|
33 | get 'toggle_activate', 'toggle_enable' |
|
35 | end |
|
34 | end |
|
36 | end |
|
35 | end |
|
37 |
|
36 | ||
|
38 | - #resources :sources do |
|
||
|
39 | - # collection do |
|
||
|
40 | - # end |
|
||
|
41 | - #end |
|
||
|
42 | get 'sources/direct_edit/:pid', to: 'sources#direct_edit', as: 'direct_edit' |
|
37 | get 'sources/direct_edit/:pid', to: 'sources#direct_edit', as: 'direct_edit' |
|
43 | get 'sources/direct_edit_submission/:sid', to: 'sources#direct_edit_submission', as: 'direct_edit_submission' |
|
38 | get 'sources/direct_edit_submission/:sid', to: 'sources#direct_edit_submission', as: 'direct_edit_submission' |
|
44 |
|
39 | ||
|
45 |
|
40 | ||
|
46 | match 'tasks/view/:file.:ext' => 'tasks#view' |
|
41 | match 'tasks/view/:file.:ext' => 'tasks#view' |
|
47 | match 'tasks/download/:id/:file.:ext' => 'tasks#download' |
|
42 | match 'tasks/download/:id/:file.:ext' => 'tasks#download' |
@@ -52,12 +47,15 | |||||
|
52 | get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission' |
|
47 | get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission' |
|
53 |
|
48 | ||
|
54 | #report |
|
49 | #report |
|
55 | get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof' |
|
50 | get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof' |
|
56 | get "report/login" |
|
51 | get "report/login" |
|
57 |
|
52 | ||
|
|
53 | + #grader | ||
|
|
54 | + get 'graders/list', to: 'graders#list', as: 'grader_list' | ||
|
|
55 | + | ||
|
58 | # See how all your routes lay out with "rake routes" |
|
56 | # See how all your routes lay out with "rake routes" |
|
59 |
|
57 | ||
|
60 | # This is a legacy wild controller route that's not recommended for RESTful applications. |
|
58 | # This is a legacy wild controller route that's not recommended for RESTful applications. |
|
61 | # Note: This route will make all actions in every controller accessible via GET requests. |
|
59 | # Note: This route will make all actions in every controller accessible via GET requests. |
|
62 | match ':controller(/:action(/:id))(.:format)' |
|
60 | match ':controller(/:action(/:id))(.:format)' |
|
63 | end |
|
61 | end |
deleted file |
deleted file |
You need to be logged in to leave comments.
Login now