Description:
- add problem manage toggle test interface - remove old erb file
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r569:47e6e54a036a - - 6 files changed: 28 inserted, 171 deleted

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