Description:
* DRY the toggle button via application_helper.rb#toggle_button and _toggle_button.js.haml
* bootrapize the user_admin
* now considering user.enabled
* tidy up route
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r562:ede66b5a6449 - - 14 files changed: 169 inserted, 50 deleted
@@ -0,0 +1,7 | |||||
|
|
1 | + :plain | ||
|
|
2 | + var t = $("#{button_id}"); | ||
|
|
3 | + t.removeClass('btn-default'); | ||
|
|
4 | + t.removeClass('btn-success'); | ||
|
|
5 | + t.removeClass('btn-warning'); | ||
|
|
6 | + t.addClass("btn-#{button_on ? 'success' : 'default'}"); | ||
|
|
7 | + t.text("#{button_on ? 'Yes' : 'No'}"); |
@@ -0,0 +1,86 | |||||
|
|
1 | + %h1 Listing users | ||
|
|
2 | + .submitbox | ||
|
|
3 | + %b Quick add | ||
|
|
4 | + = form_tag :action => 'create' do | ||
|
|
5 | + %table{:border => "0"} | ||
|
|
6 | + %tr | ||
|
|
7 | + %td | ||
|
|
8 | + %label{:for => "user_login"} Login | ||
|
|
9 | + %td | ||
|
|
10 | + %label{:for => "user_full_name"} Full name | ||
|
|
11 | + %td | ||
|
|
12 | + %label{:for => "user_password"} Password | ||
|
|
13 | + %td | ||
|
|
14 | + %label{:for => "user_password_confirmation"} Confirm | ||
|
|
15 | + %td | ||
|
|
16 | + %label{:for => "user_email"} Email | ||
|
|
17 | + %tr | ||
|
|
18 | + %td= text_field 'user', 'login', :size => 10 | ||
|
|
19 | + %td= text_field 'user', 'full_name', :size => 30 | ||
|
|
20 | + %td= password_field 'user', 'password', :size => 10 | ||
|
|
21 | + %td= password_field 'user', 'password_confirmation', :size => 10 | ||
|
|
22 | + %td= email_field 'user', 'email', :size => 15 | ||
|
|
23 | + %td= submit_tag "Create" | ||
|
|
24 | + %br/ | ||
|
|
25 | + %b Import from site management | ||
|
|
26 | + = form_tag({:action => 'import'}, :multipart => true) do | ||
|
|
27 | + File: #{file_field_tag 'file'} #{submit_tag 'Import'} | ||
|
|
28 | + %br/ | ||
|
|
29 | + %b What else: | ||
|
|
30 | + = link_to 'New user', {:action => 'new'}, { class: 'btn btn-default btn-sm'} | ||
|
|
31 | + = link_to 'New list of users',{ :action => 'new_list'}, { class: 'btn btn-default btn-sm'} | ||
|
|
32 | + = link_to 'View administrators',{ :action => 'admin'}, { class: 'btn btn-default btn-sm'} | ||
|
|
33 | + = link_to 'Random passwords',{ :action => 'random_all_passwords'}, { class: 'btn btn-default btn-sm'} | ||
|
|
34 | + = link_to 'View active users',{ :action => 'active'}, { class: 'btn btn-default btn-sm'} | ||
|
|
35 | + = link_to 'Mass mailing',{ :action => 'mass_mailing'}, { class: 'btn btn-default btn-sm'} | ||
|
|
36 | + - if GraderConfiguration.multicontests? | ||
|
|
37 | + %br/ | ||
|
|
38 | + %b Multi-contest: | ||
|
|
39 | + = link_to '[Manage bulk users in contests]', :action => 'contest_management' | ||
|
|
40 | + View users in: | ||
|
|
41 | + - @contests.each do |contest| | ||
|
|
42 | + = link_to "[#{contest.name}]", :action => 'contests', :id => contest.id | ||
|
|
43 | + = link_to "[no contest]", :action => 'contests', :id => 'none' | ||
|
|
44 | + Total #{@user_count} users | | ||
|
|
45 | + - if !@paginated | ||
|
|
46 | + Display all users. | ||
|
|
47 | + \#{link_to '[show in pages]', :action => 'index', :page => '1'} | ||
|
|
48 | + - else | ||
|
|
49 | + Display in pages. | ||
|
|
50 | + \#{link_to '[display all]', :action => 'index', :page => 'all'} | | ||
|
|
51 | + \#{will_paginate @users, :container => false} | ||
|
|
52 | + | ||
|
|
53 | + | ||
|
|
54 | + %table.table.table-hover.table-condense | ||
|
|
55 | + %thead | ||
|
|
56 | + %th Login | ||
|
|
57 | + %th Full name | ||
|
|
58 | + %th email | ||
|
|
59 | + %th Remark | ||
|
|
60 | + %th | ||
|
|
61 | + Activated | ||
|
|
62 | + %sup{class: 'text-primary',data: {toggle: 'tooltip', placement: 'top'}, title: 'User has already confirmed the email?' } [?] | ||
|
|
63 | + %th | ||
|
|
64 | + Enabled | ||
|
|
65 | + %sup{class: 'text-primary',data: {toggle: 'tooltip', placement: 'top'}, title: 'Allow the user to login?' } [?] | ||
|
|
66 | + %th Last IP | ||
|
|
67 | + %th | ||
|
|
68 | + %th | ||
|
|
69 | + %th | ||
|
|
70 | + %th | ||
|
|
71 | + - for user in @users | ||
|
|
72 | + %tr | ||
|
|
73 | + %td= link_to user.login, controller: :users, :action => 'profile', :id => user | ||
|
|
74 | + %td= user.full_name | ||
|
|
75 | + %td= user.email | ||
|
|
76 | + %td= user.remark | ||
|
|
77 | + %td= toggle_button(user.activated?, toggle_activate_user_url(user),"toggle_activate_user_#{user.id}") | ||
|
|
78 | + %td= toggle_button(user.enabled?, toggle_enable_user_url(user),"toggle_enable_user_#{user.id}") | ||
|
|
79 | + %td= user.last_ip | ||
|
|
80 | + %td= link_to 'Clear IP', {:action => 'clear_last_ip', :id => user, :page=>params[:page]}, :confirm => 'This will reset last logging in ip of the user, are you sure?', class: 'btn btn-default btn-xs btn-block' | ||
|
|
81 | + %td= link_to 'Show', {:action => 'show', :id => user}, class: 'btn btn-default btn-xs btn-block' | ||
|
|
82 | + %td= link_to 'Edit', {:action => 'edit', :id => user}, class: 'btn btn-default btn-xs btn-block' | ||
|
|
83 | + %td= link_to 'Destroy', { :action => 'destroy', :id => user }, :confirm => 'Are you sure?', :method => :post, class: 'btn btn-danger btn-xs btn-block' | ||
|
|
84 | + %br/ | ||
|
|
85 | + = link_to '[New user]', :action => 'new' | ||
|
|
86 | + = link_to '[New list of users]', :action => 'new_list' |
@@ -1,14 +1,6 | |||||
|
1 | #js for announcement |
|
1 | #js for announcement |
|
2 | $ -> |
|
2 | $ -> |
|
3 | - $('.ajax-toggle').on 'click', (event) -> |
|
||
|
4 | - target = $(event.target) |
|
||
|
5 | - target.removeClass 'btn-default' |
|
||
|
6 | - target.removeClass 'btn-success' |
|
||
|
7 | - target.addClass 'btn-warning' |
|
||
|
8 | - target.text '...' |
|
||
|
9 | - return |
|
||
|
10 | - |
|
||
|
11 | $(document).ajaxError (event, jqxhr, settings, exception) -> |
|
3 | $(document).ajaxError (event, jqxhr, settings, exception) -> |
|
12 | if jqxhr.status |
|
4 | if jqxhr.status |
|
13 | alert 'We\'re sorry, but something went wrong (' + jqxhr.status + ')' |
|
5 | alert 'We\'re sorry, but something went wrong (' + jqxhr.status + ')' |
|
14 | return |
|
6 | return |
@@ -27,9 +27,15 | |||||
|
27 | $(".go-button").on 'click', (event) -> |
|
27 | $(".go-button").on 'click', (event) -> |
|
28 | link = $(this).attr("data-source") |
|
28 | link = $(this).attr("data-source") |
|
29 | url = $(link).val() |
|
29 | url = $(link).val() |
|
30 | if url |
|
30 | if url |
|
31 | window.location.href = url |
|
31 | window.location.href = url |
|
32 | return |
|
32 | return |
|
|
33 | + $('.ajax-toggle').on 'click', (event) -> | ||
|
|
34 | + target = $(event.target) | ||
|
|
35 | + target.removeClass 'btn-default' | ||
|
|
36 | + target.removeClass 'btn-success' | ||
|
|
37 | + target.addClass 'btn-warning' | ||
|
|
38 | + target.text '...' | ||
|
33 | return |
|
39 | return |
|
34 |
|
40 | ||
|
35 | - |
|
41 | + return |
@@ -80,13 +80,14 | |||||
|
80 | end |
|
80 | end |
|
81 |
|
81 | ||
|
82 | def toggle |
|
82 | def toggle |
|
83 | @announcement = Announcement.find(params[:id]) |
|
83 | @announcement = Announcement.find(params[:id]) |
|
84 | @announcement.update_attributes( published: !@announcement.published? ) |
|
84 | @announcement.update_attributes( published: !@announcement.published? ) |
|
85 | respond_to do |format| |
|
85 | respond_to do |format| |
|
86 | - format.js {} |
|
86 | + format.js { render partial: 'toggle_button', |
|
|
87 | + locals: {button_id: "#announcement_toggle_#{@announcement.id}",button_on: @announcement.published? } } | ||
|
87 | end |
|
88 | end |
|
88 | end |
|
89 | end |
|
89 |
|
90 | ||
|
90 | # DELETE /announcements/1 |
|
91 | # DELETE /announcements/1 |
|
91 | # DELETE /announcements/1.xml |
|
92 | # DELETE /announcements/1.xml |
|
92 | def destroy |
|
93 | def destroy |
@@ -44,18 +44,23 | |||||
|
44 | redirect_to :controller => 'main', :action => 'login' |
|
44 | redirect_to :controller => 'main', :action => 'login' |
|
45 | return false |
|
45 | return false |
|
46 | end |
|
46 | end |
|
47 |
|
47 | ||
|
48 | # check if run in single user mode |
|
48 | # check if run in single user mode |
|
49 | if GraderConfiguration[SINGLE_USER_MODE_CONF_KEY] |
|
49 | if GraderConfiguration[SINGLE_USER_MODE_CONF_KEY] |
|
50 | - user = User.find(session[:user_id]) |
|
50 | + user = User.find_by_id(session[:user_id]) |
|
51 | if user==nil or (not user.admin?) |
|
51 | if user==nil or (not user.admin?) |
|
52 | flash[:notice] = 'You cannot log in at this time' |
|
52 | flash[:notice] = 'You cannot log in at this time' |
|
53 | redirect_to :controller => 'main', :action => 'login' |
|
53 | redirect_to :controller => 'main', :action => 'login' |
|
54 | return false |
|
54 | return false |
|
55 | end |
|
55 | end |
|
|
56 | + unless user.enabled? | ||
|
|
57 | + flash[:notice] = 'Your account is disabled' | ||
|
|
58 | + redirect_to :controller => 'main', :action => 'login' | ||
|
|
59 | + return false | ||
|
|
60 | + end | ||
|
56 | return true |
|
61 | return true |
|
57 | end |
|
62 | end |
|
58 |
|
63 | ||
|
59 | if GraderConfiguration.multicontests? |
|
64 | if GraderConfiguration.multicontests? |
|
60 | user = User.find(session[:user_id]) |
|
65 | user = User.find(session[:user_id]) |
|
61 | return true if user.admin? |
|
66 | return true if user.admin? |
@@ -14,13 +14,12 | |||||
|
14 | :bulk_mail |
|
14 | :bulk_mail |
|
15 | ], |
|
15 | ], |
|
16 | :redirect_to => { :action => :list } |
|
16 | :redirect_to => { :action => :list } |
|
17 |
|
17 | ||
|
18 | def index |
|
18 | def index |
|
19 | list |
|
19 | list |
|
20 | - render :action => 'list' |
|
||
|
21 | end |
|
20 | end |
|
22 |
|
21 | ||
|
23 | def list |
|
22 | def list |
|
24 | @user_count = User.count |
|
23 | @user_count = User.count |
|
25 | if params[:page] == 'all' |
|
24 | if params[:page] == 'all' |
|
26 | @users = User.all |
|
25 | @users = User.all |
@@ -130,12 +130,30 | |||||
|
130 |
|
130 | ||
|
131 | @histogram[:summary][:max] = [@histogram[:data].max,1].max |
|
131 | @histogram[:summary][:max] = [@histogram[:data].max,1].max |
|
132 | @summary[:attempt] = problem.count |
|
132 | @summary[:attempt] = problem.count |
|
133 | problem.each_value { |v| @summary[:solve] += 1 if v == 1 } |
|
133 | problem.each_value { |v| @summary[:solve] += 1 if v == 1 } |
|
134 | end |
|
134 | end |
|
135 |
|
135 | ||
|
|
136 | + def toggle_activate | ||
|
|
137 | + @user = User.find(params[:id]) | ||
|
|
138 | + @user.update_attributes( activated: !@user.activated? ) | ||
|
|
139 | + respond_to do |format| | ||
|
|
140 | + format.js { render partial: 'toggle_button', | ||
|
|
141 | + locals: {button_id: "#toggle_activate_user_#{@user.id}",button_on: @user.activated? } } | ||
|
|
142 | + end | ||
|
|
143 | + end | ||
|
|
144 | + | ||
|
|
145 | + def toggle_enable | ||
|
|
146 | + @user = User.find(params[:id]) | ||
|
|
147 | + @user.update_attributes( enabled: !@user.enabled? ) | ||
|
|
148 | + respond_to do |format| | ||
|
|
149 | + format.js { render partial: 'toggle_button', | ||
|
|
150 | + locals: {button_id: "#toggle_enable_user_#{@user.id}",button_on: @user.enabled? } } | ||
|
|
151 | + end | ||
|
|
152 | + end | ||
|
|
153 | + | ||
|
136 | protected |
|
154 | protected |
|
137 |
|
155 | ||
|
138 | def verify_online_registration |
|
156 | def verify_online_registration |
|
139 | if !GraderConfiguration['system.online_registration'] |
|
157 | if !GraderConfiguration['system.online_registration'] |
|
140 | redirect_to :controller => 'main', :action => 'login' |
|
158 | redirect_to :controller => 'main', :action => 'login' |
|
141 | end |
|
159 | end |
@@ -189,7 +207,8 | |||||
|
189 | return true if GraderConfiguration["right.user_view_submission"] |
|
207 | return true if GraderConfiguration["right.user_view_submission"] |
|
190 |
|
208 | ||
|
191 | #finally, we allow only admin |
|
209 | #finally, we allow only admin |
|
192 | admin_authorization |
|
210 | admin_authorization |
|
193 | end |
|
211 | end |
|
194 |
|
212 | ||
|
|
213 | + | ||
|
195 | end |
|
214 | end |
@@ -104,22 +104,17 | |||||
|
104 | File.open(fname).read(max_size) |
|
104 | File.open(fname).read(max_size) |
|
105 | rescue |
|
105 | rescue |
|
106 | nil |
|
106 | nil |
|
107 | end |
|
107 | end |
|
108 | end |
|
108 | end |
|
109 |
|
109 | ||
|
110 | - def problem_select(problems, options = {}) |
|
110 | + def toggle_button(on,toggle_url,id) |
|
111 | - prefix = options[:with_specific_in_header] ? [[(t 'main.specified_in_header'),'-1']] : [] |
|
111 | + link_to (on ? "Yes" : "No"), toggle_url, |
|
112 | - selected = options[:selected] || (options[:with_specific_in_header] ? -1 : nil) |
|
112 | + {class: "btn btn-block btn-xs btn-#{on ? 'success' : 'default'} ajax-toggle", |
|
113 | - puts "selected = #{selected} hehe" |
|
113 | + id: id, |
|
114 | - html_options = {class: 'select2 form-control'} |
|
114 | + data: {remote: true, method: 'get'}} |
|
115 | - html_options[:id] = options[:id]if options[:id] |
|
||
|
116 | - select 'submission', |
|
||
|
117 | - 'problem_id', prefix + problems.collect {|p| ["[#{p.name}] #{p.full_name}", p.id]}, |
|
||
|
118 | - (selected ? { selected: "#{selected}"} : {} ), |
|
||
|
119 | - html_options |
|
||
|
120 | end |
|
115 | end |
|
121 |
|
116 | ||
|
122 | def user_title_bar(user) |
|
117 | def user_title_bar(user) |
|
123 | header = '' |
|
118 | header = '' |
|
124 | time_left = '' |
|
119 | time_left = '' |
|
125 |
|
120 |
@@ -24,14 +24,13 | |||||
|
24 | - if !announcement.notes.blank? |
|
24 | - if !announcement.notes.blank? |
|
25 | %b |
|
25 | %b |
|
26 | Notes: #{h announcement.notes} |
|
26 | Notes: #{h announcement.notes} |
|
27 | %br/ |
|
27 | %br/ |
|
28 | = h announcement.body |
|
28 | = h announcement.body |
|
29 | %td= h announcement.author |
|
29 | %td= h announcement.author |
|
30 | - // %td= check_box_tag :published, 1, announcement.published, { class: 'bootstrap-toggle', id: "published-#{announcement.id}", data: {remote: true, method: 'PUT', url: url_for(controller: :announcements, action: :toggle, id: announcement), size: 'small', toggle: 'toggle' } } |
|
30 | + %td= toggle_button(announcement.published?, toggle_announcement_url(@announcement), "announcement_toggle_#{@announcement.id}") |
|
31 | - // <td><haml_loud> in_place_editor_field :announcement, :published, {}, :rows => 1 </haml_loud></td> |
|
31 | + //%td= link_to (announcement.published? ? "Yes" : "No"), url_for(controller: :announcements, action: :toggle, id: announcement), { class: "btn btn-block btn-sm btn-#{(announcement.published? ? 'success' : 'default')} ajax-toggle", id: "published-#{announcement.id}", data: {remote: true, method: 'post' } } |
|
32 | - %td= link_to (announcement.published? ? "Yes" : "No"), url_for(controller: :announcements, action: :toggle, id: announcement), { class: "btn btn-block btn-sm btn-#{(announcement.published? ? 'success' : 'default')} ajax-toggle", id: "published-#{announcement.id}", data: {remote: true, method: 'post' } } |
|
||
|
33 | %td= link_to 'Edit', edit_announcement_path(announcement), class: 'btn btn-block btn-sm btn-info' |
|
32 | %td= link_to 'Edit', edit_announcement_path(announcement), class: 'btn btn-block btn-sm btn-info' |
|
34 | %td= link_to 'Destroy', announcement, :confirm => 'Are you sure?', :method => :delete, class: "btn btn-block btn-sm btn-danger" |
|
33 | %td= link_to 'Destroy', announcement, :confirm => 'Are you sure?', :method => :delete, class: "btn btn-block btn-sm btn-danger" |
|
35 | %br |
|
34 | %br |
|
36 |
|
35 | ||
|
37 | = link_to '+ Add announcement', new_announcement_path, class: 'btn btn-success' |
|
36 | = link_to '+ Add announcement', new_announcement_path, class: 'btn btn-success' |
@@ -13,13 +13,13 | |||||
|
13 | %label{:for => "problem_name"} Name |
|
13 | %label{:for => "problem_name"} Name |
|
14 | = text_field 'problem', 'name' |
|
14 | = text_field 'problem', 'name' |
|
15 | | |
|
15 | | |
|
16 | %label{:for => "problem_full_name"} Full name |
|
16 | %label{:for => "problem_full_name"} Full name |
|
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 |
|
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 Full score |
|
24 | %th Date added |
|
24 | %th Date added |
|
25 | %th Avail? |
|
25 | %th Avail? |
@@ -30,17 +30,18 | |||||
|
30 | %tr{:class => "#{(problem.available) ? "success" : "danger"}", :id => "prob-#{problem.id}", :name => "prob-#{problem.id}"} |
|
30 | %tr{:class => "#{(problem.available) ? "success" : "danger"}", :id => "prob-#{problem.id}", :name => "prob-#{problem.id}"} |
|
31 | - @problem=problem |
|
31 | - @problem=problem |
|
32 | %td= in_place_editor_field :problem, :name, {}, :rows=>1 |
|
32 | %td= in_place_editor_field :problem, :name, {}, :rows=>1 |
|
33 | %td= in_place_editor_field :problem, :full_name, {}, :rows=>1 |
|
33 | %td= in_place_editor_field :problem, :full_name, {}, :rows=>1 |
|
34 | %td= in_place_editor_field :problem, :full_score, {}, :rows=>1 |
|
34 | %td= in_place_editor_field :problem, :full_score, {}, :rows=>1 |
|
35 | %td= problem.date_added |
|
35 | %td= problem.date_added |
|
36 | - %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: "prob-#{@problem.id}-avail", data: {remote: true, method: 'post' } } |
|
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' } } | ||
|
37 | %td= problem.test_allowed |
|
38 | %td= problem.test_allowed |
|
38 | - if GraderConfiguration.multicontests? |
|
39 | - if GraderConfiguration.multicontests? |
|
39 | %td |
|
40 | %td |
|
40 | = problem.contests.collect { |c| c.name }.join(', ') |
|
41 | = problem.contests.collect { |c| c.name }.join(', ') |
|
41 |
- %td= link_to 'Stat', {:action => 'stat', :id => problem.id}, class: 'btn btn- |
|
42 | + %td= link_to 'Stat', {:action => 'stat', :id => problem.id}, class: 'btn btn-info btn-xs btn-block' |
|
42 |
- %td= link_to 'Show', {:action => 'show', :id => problem}, class: 'btn btn- |
|
43 | + %td= link_to 'Show', {:action => 'show', :id => problem}, class: 'btn btn-info btn-xs btn-block' |
|
43 |
- %td= link_to 'Edit', {:action => 'edit', :id => problem}, class: 'btn btn- |
|
44 | + %td= link_to 'Edit', {:action => 'edit', :id => problem}, class: 'btn btn-info btn-xs btn-block' |
|
44 |
- %td= link_to 'Destroy', { :action => 'destroy', :id => problem }, :confirm => 'Are you sure?', :method => :post, class: 'btn btn-danger btn- |
|
45 | + %td= link_to 'Destroy', { :action => 'destroy', :id => problem }, :confirm => 'Are you sure?', :method => :post, class: 'btn btn-danger btn-xs btn-block' |
|
45 | %br/ |
|
46 | %br/ |
|
46 | = link_to '[New problem]', :action => 'new' |
|
47 | = link_to '[New problem]', :action => 'new' |
@@ -1,12 +1,8 | |||||
|
|
1 | + = render partial: 'toggle_button', | ||
|
|
2 | + locals: {button_id: "#problem-avail-#{@problem.id}",button_on: @problem.available } | ||
|
1 | :plain |
|
3 | :plain |
|
2 | - b = $("#prob-#{@problem.id}-avail"); |
|
||
|
3 | - b.removeClass('btn-default'); |
|
||
|
4 | - b.removeClass('btn-success'); |
|
||
|
5 | - b.removeClass('btn-warning'); |
|
||
|
6 | - b.addClass("btn-#{@problem.available? ? 'success' : 'default'}"); |
|
||
|
7 | - b.text("#{@problem.available? ? 'Yes' : 'No'}"); |
|
||
|
8 | r = $("#prob-#{@problem.id}"); |
|
4 | r = $("#prob-#{@problem.id}"); |
|
9 | r.removeClass('success'); |
|
5 | r.removeClass('success'); |
|
10 | r.removeClass('danger'); |
|
6 | r.removeClass('danger'); |
|
11 | r.addClass("#{@problem.available? ? 'success' : 'danger'}"); |
|
7 | r.addClass("#{@problem.available? ? 'success' : 'danger'}"); |
|
12 |
|
8 |
@@ -1,32 +1,53 | |||||
|
1 | CafeGrader::Application.routes.draw do |
|
1 | CafeGrader::Application.routes.draw do |
|
2 | root :to => 'main#login' |
|
2 | root :to => 'main#login' |
|
3 |
|
3 | ||
|
4 | - get "report/login" |
|
||
|
5 |
|
4 | ||
|
6 | resources :contests |
|
5 | resources :contests |
|
7 |
|
6 | ||
|
8 | - resources :announcements |
|
||
|
9 | - match 'announcements/toggle/:id' => 'announcements#toggle' |
|
||
|
10 | - |
|
||
|
11 | resources :sites |
|
7 | resources :sites |
|
12 |
|
8 | ||
|
13 |
- resources : |
|
9 | + resources :announcements do |
|
|
10 | + member do | ||
|
|
11 | + get 'toggle' | ||
|
|
12 | + end | ||
|
|
13 | + end | ||
|
|
14 | + | ||
|
|
15 | + | ||
|
|
16 | + resources :problems do | ||
|
|
17 | + member do | ||
|
|
18 | + get 'toggle' | ||
|
|
19 | + end | ||
|
|
20 | + collection do | ||
|
|
21 | + get 'turn_all_off' | ||
|
|
22 | + get 'turn_all_on' | ||
|
|
23 | + get 'import' | ||
|
|
24 | + get 'manage' | ||
|
|
25 | + end | ||
|
|
26 | + end | ||
|
14 |
|
27 | ||
|
15 | resources :grader_configuration, controller: 'configurations' |
|
28 | resources :grader_configuration, controller: 'configurations' |
|
16 |
|
29 | ||
|
|
30 | + resources :users do | ||
|
|
31 | + member do | ||
|
|
32 | + get 'toggle_activate', 'toggle_enable' | ||
|
|
33 | + end | ||
|
|
34 | + end | ||
|
|
35 | + | ||
|
|
36 | + | ||
|
17 | match 'tasks/view/:file.:ext' => 'tasks#view' |
|
37 | match 'tasks/view/:file.:ext' => 'tasks#view' |
|
18 | match 'tasks/download/:id/:file.:ext' => 'tasks#download' |
|
38 | match 'tasks/download/:id/:file.:ext' => 'tasks#download' |
|
19 | match 'heartbeat/:id/edit' => 'heartbeat#edit' |
|
39 | match 'heartbeat/:id/edit' => 'heartbeat#edit' |
|
20 |
|
40 | ||
|
21 | #main |
|
41 | #main |
|
22 | get "main/list" |
|
42 | get "main/list" |
|
23 | get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission' |
|
43 | get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission' |
|
24 |
|
44 | ||
|
25 | #report |
|
45 | #report |
|
26 | get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof' |
|
46 | get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof' |
|
|
47 | + get "report/login" | ||
|
27 |
|
48 | ||
|
28 | # See how all your routes lay out with "rake routes" |
|
49 | # See how all your routes lay out with "rake routes" |
|
29 |
|
50 | ||
|
30 | # This is a legacy wild controller route that's not recommended for RESTful applications. |
|
51 | # This is a legacy wild controller route that's not recommended for RESTful applications. |
|
31 | # Note: This route will make all actions in every controller accessible via GET requests. |
|
52 | # Note: This route will make all actions in every controller accessible via GET requests. |
|
32 | match ':controller(/:action(/:id))(.:format)' |
|
53 | match ':controller(/:action(/:id))(.:format)' |
deleted file |
You need to be logged in to leave comments.
Login now