Description:
master
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r801:33c0929c92ed - - 24 files changed: 201 inserted, 117 deleted
@@ -0,0 +1,8 | |||||
|
|
1 | + = render partial: 'toggle_button', | ||
|
|
2 | + locals: {button_id: "#group-enabled-#{@group.id}",button_on: @group.enabled } | ||
|
|
3 | + :plain | ||
|
|
4 | + r = $("#group-#{@group.id}"); | ||
|
|
5 | + r.removeClass('success'); | ||
|
|
6 | + r.removeClass('danger'); | ||
|
|
7 | + r.addClass("#{@group.enabled? ? 'success' : 'danger'}"); | ||
|
|
8 | + |
@@ -0,0 +1,5 | |||||
|
|
1 | + class AddEnabledToGroup < ActiveRecord::Migration[5.2] | ||
|
|
2 | + def change | ||
|
|
3 | + add_column :groups, :enabled, :boolean, default: true | ||
|
|
4 | + end | ||
|
|
5 | + end |
@@ -149,14 +149,15 | |||||
|
149 | return true |
|
149 | return true |
|
150 | end |
|
150 | end |
|
151 |
|
151 | ||
|
152 | def is_request_ip_allowed? |
|
152 | def is_request_ip_allowed? |
|
153 | unless GraderConfiguration[WHITELIST_IGNORE_CONF_KEY] |
|
153 | unless GraderConfiguration[WHITELIST_IGNORE_CONF_KEY] |
|
154 | user_ip = IPAddr.new(request.remote_ip) |
|
154 | user_ip = IPAddr.new(request.remote_ip) |
|
|
155 | + allowed = GraderConfiguration[WHITELIST_IP_CONF_KEY] || '' | ||
|
155 |
|
156 | ||
|
156 |
- |
|
157 | + allowed.delete(' ').split(',').each do |ips| |
|
157 | allow_ips = IPAddr.new(ips) |
|
158 | allow_ips = IPAddr.new(ips) |
|
158 | if allow_ips.include?(user_ip) |
|
159 | if allow_ips.include?(user_ip) |
|
159 | return true |
|
160 | return true |
|
160 | end |
|
161 | end |
|
161 | end |
|
162 | end |
|
162 | return false |
|
163 | return false |
@@ -1,10 +1,11 | |||||
|
1 | class GroupsController < ApplicationController |
|
1 | class GroupsController < ApplicationController |
|
2 | before_action :set_group, only: [:show, :edit, :update, :destroy, |
|
2 | before_action :set_group, only: [:show, :edit, :update, :destroy, |
|
3 | :add_user, :remove_user,:remove_all_user, |
|
3 | :add_user, :remove_user,:remove_all_user, |
|
4 | :add_problem, :remove_problem,:remove_all_problem, |
|
4 | :add_problem, :remove_problem,:remove_all_problem, |
|
|
5 | + :toggle, | ||
|
5 | ] |
|
6 | ] |
|
6 | before_action :admin_authorization |
|
7 | before_action :admin_authorization |
|
7 |
|
8 | ||
|
8 | # GET /groups |
|
9 | # GET /groups |
|
9 | def index |
|
10 | def index |
|
10 | @groups = Group.all |
|
11 | @groups = Group.all |
@@ -46,12 +47,17 | |||||
|
46 | # DELETE /groups/1 |
|
47 | # DELETE /groups/1 |
|
47 | def destroy |
|
48 | def destroy |
|
48 | @group.destroy |
|
49 | @group.destroy |
|
49 | redirect_to groups_url, notice: 'Group was successfully destroyed.' |
|
50 | redirect_to groups_url, notice: 'Group was successfully destroyed.' |
|
50 | end |
|
51 | end |
|
51 |
|
52 | ||
|
|
53 | + def toggle | ||
|
|
54 | + @group.enabled = @group.enabled? ? false : true | ||
|
|
55 | + @group.save | ||
|
|
56 | + end | ||
|
|
57 | + | ||
|
52 | def remove_user |
|
58 | def remove_user |
|
53 | user = User.find(params[:user_id]) |
|
59 | user = User.find(params[:user_id]) |
|
54 | @group.users.delete(user) |
|
60 | @group.users.delete(user) |
|
55 | redirect_to group_path(@group), flash: {success: "User #{user.login} was removed from the group #{@group.name}"} |
|
61 | redirect_to group_path(@group), flash: {success: "User #{user.login} was removed from the group #{@group.name}"} |
|
56 | end |
|
62 | end |
|
57 |
|
63 | ||
@@ -96,9 +102,9 | |||||
|
96 | def set_group |
|
102 | def set_group |
|
97 | @group = Group.find(params[:id]) |
|
103 | @group = Group.find(params[:id]) |
|
98 | end |
|
104 | end |
|
99 |
|
105 | ||
|
100 | # Only allow a trusted parameter "white list" through. |
|
106 | # Only allow a trusted parameter "white list" through. |
|
101 | def group_params |
|
107 | def group_params |
|
102 | - params.require(:group).permit(:name, :description) |
|
108 | + params.require(:group).permit(:name, :description, :enabled) |
|
103 | end |
|
109 | end |
|
104 | end |
|
110 | end |
@@ -185,13 +185,13 | |||||
|
185 | redirect_to :action => 'list' |
|
185 | redirect_to :action => 'list' |
|
186 | else |
|
186 | else |
|
187 | @contests = user.contests |
|
187 | @contests = user.contests |
|
188 | @user = user |
|
188 | @user = user |
|
189 | end |
|
189 | end |
|
190 | end |
|
190 | end |
|
191 | - |
|
191 | + |
|
192 | protected |
|
192 | protected |
|
193 |
|
193 | ||
|
194 | def prepare_announcements(recent=nil) |
|
194 | def prepare_announcements(recent=nil) |
|
195 | if GraderConfiguration.show_tasks_to?(@user) |
|
195 | if GraderConfiguration.show_tasks_to?(@user) |
|
196 | @announcements = Announcement.published(true) |
|
196 | @announcements = Announcement.published(true) |
|
197 | else |
|
197 | else |
@@ -13,14 +13,14 | |||||
|
13 | if params[:problem_id]==nil |
|
13 | if params[:problem_id]==nil |
|
14 | @problem = nil |
|
14 | @problem = nil |
|
15 | @submissions = nil |
|
15 | @submissions = nil |
|
16 | else |
|
16 | else |
|
17 | @problem = Problem.find_by_id(params[:problem_id]) |
|
17 | @problem = Problem.find_by_id(params[:problem_id]) |
|
18 | if (@problem == nil) or (not @problem.available) |
|
18 | if (@problem == nil) or (not @problem.available) |
|
19 |
- redirect_to |
|
19 | + redirect_to list_main_path |
|
20 | - flash[:notice] = 'Error: submissions for that problem are not viewable.' |
|
20 | + flash[:error] = 'Authorization error: You have no right to view submissions for this problem' |
|
21 | return |
|
21 | return |
|
22 | end |
|
22 | end |
|
23 | @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id).order(id: :desc) |
|
23 | @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id).order(id: :desc) |
|
24 | end |
|
24 | end |
|
25 | end |
|
25 | end |
|
26 |
|
26 | ||
@@ -91,15 +91,14 | |||||
|
91 | end |
|
91 | end |
|
92 |
|
92 | ||
|
93 | protected |
|
93 | protected |
|
94 |
|
94 | ||
|
95 | def submission_authorization |
|
95 | def submission_authorization |
|
96 | #admin always has privileged |
|
96 | #admin always has privileged |
|
97 | - if @current_user.admin? |
|
97 | + return true if @current_user.admin? |
|
98 | - return true |
|
98 | + return true if @current_user.has_role?('TA') && (['show','download'].include? action_name) |
|
99 | - end |
|
||
|
100 |
|
99 | ||
|
101 | sub = Submission.find(params[:id]) |
|
100 | sub = Submission.find(params[:id]) |
|
102 | if @current_user.available_problems.include? sub.problem |
|
101 | if @current_user.available_problems.include? sub.problem |
|
103 | return true if GraderConfiguration["right.user_view_submission"] or sub.user == @current_user |
|
102 | return true if GraderConfiguration["right.user_view_submission"] or sub.user == @current_user |
|
104 | end |
|
103 | end |
|
105 |
|
104 |
@@ -24,23 +24,25 | |||||
|
24 | end |
|
24 | end |
|
25 |
|
25 | ||
|
26 | # this has problem-level access control |
|
26 | # this has problem-level access control |
|
27 | def download |
|
27 | def download |
|
28 | problem = Problem.find(params[:id]) |
|
28 | problem = Problem.find(params[:id]) |
|
29 | unless @current_user.can_view_problem? problem |
|
29 | unless @current_user.can_view_problem? problem |
|
30 |
- flash[: |
|
30 | + flash[:error] = 'You are not authorized to access this file' |
|
31 | - redirect_to :action => 'index' and return |
|
31 | + redirect_to list_main_path |
|
|
32 | + return | ||
|
32 | end |
|
33 | end |
|
33 |
|
34 | ||
|
34 | base_name = params[:file] |
|
35 | base_name = params[:file] |
|
35 | base_filename = File.basename("#{base_name}.#{params[:ext]}") |
|
36 | base_filename = File.basename("#{base_name}.#{params[:ext]}") |
|
36 | filename = "#{Problem.download_file_basedir}/#{params[:id]}/#{base_filename}" |
|
37 | filename = "#{Problem.download_file_basedir}/#{params[:id]}/#{base_filename}" |
|
37 |
|
38 | ||
|
38 | if !FileTest.exists?(filename) |
|
39 | if !FileTest.exists?(filename) |
|
39 | flash[:notice] = 'File does not exists' |
|
40 | flash[:notice] = 'File does not exists' |
|
40 | - redirect_to :action => 'index' and return |
|
41 | + redirect_to list_main_path |
|
|
42 | + return | ||
|
41 | end |
|
43 | end |
|
42 |
|
44 | ||
|
43 | send_file_to_user(filename, base_filename) |
|
45 | send_file_to_user(filename, base_filename) |
|
44 | end |
|
46 | end |
|
45 |
|
47 | ||
|
46 | protected |
|
48 | protected |
@@ -55,43 +55,53 | |||||
|
55 | note = [] |
|
55 | note = [] |
|
56 | error_note = [] |
|
56 | error_note = [] |
|
57 | error_msg = nil |
|
57 | error_msg = nil |
|
58 | ok_user = [] |
|
58 | ok_user = [] |
|
59 |
|
59 | ||
|
60 | lines.split("\n").each do |line| |
|
60 | lines.split("\n").each do |line| |
|
61 | - items = line.chomp.split(',') |
|
61 | + #split with large limit, this will cause consecutive ',' to be result in a blank |
|
|
62 | + items = line.chomp.split(',',1000) | ||
|
62 | if items.length>=2 |
|
63 | if items.length>=2 |
|
63 | login = items[0] |
|
64 | login = items[0] |
|
64 | full_name = items[1] |
|
65 | full_name = items[1] |
|
65 | remark ='' |
|
66 | remark ='' |
|
66 | user_alias = '' |
|
67 | user_alias = '' |
|
67 |
|
68 | ||
|
68 | added_random_password = false |
|
69 | added_random_password = false |
|
69 | - if items.length >= 3 and items[2].chomp(" ").length > 0; |
|
70 | + added_password = false |
|
70 | - password = items[2].chomp(" ") |
|
71 | + if items.length >= 3 |
|
|
72 | + if items[2].chomp(" ").length > 0 | ||
|
|
73 | + password = items[2].chomp(" ") | ||
|
|
74 | + added_password = true | ||
|
|
75 | + end | ||
|
71 | else |
|
76 | else |
|
72 | password = random_password |
|
77 | password = random_password |
|
73 | added_random_password=true; |
|
78 | added_random_password=true; |
|
74 | end |
|
79 | end |
|
75 |
|
80 | ||
|
76 | if items.length>= 4 and items[3].chomp(" ").length > 0; |
|
81 | if items.length>= 4 and items[3].chomp(" ").length > 0; |
|
77 | user_alias = items[3].chomp(" ") |
|
82 | user_alias = items[3].chomp(" ") |
|
78 | else |
|
83 | else |
|
79 | user_alias = login |
|
84 | user_alias = login |
|
80 | end |
|
85 | end |
|
81 |
|
86 | ||
|
|
87 | + | ||
|
|
88 | + has_remark = false | ||
|
82 | if items.length>=5 |
|
89 | if items.length>=5 |
|
83 | remark = items[4].strip; |
|
90 | remark = items[4].strip; |
|
|
91 | + has_remark = true | ||
|
84 | end |
|
92 | end |
|
85 |
|
93 | ||
|
86 | user = User.find_by_login(login) |
|
94 | user = User.find_by_login(login) |
|
87 | if (user) |
|
95 | if (user) |
|
88 | user.full_name = full_name |
|
96 | user.full_name = full_name |
|
89 | - user.password = password |
|
97 | + user.remark = remark if has_remark |
|
90 | - user.remark = remark |
|
98 | + user.password = password if added_password || added_random_password |
|
91 | else |
|
99 | else |
|
|
100 | + #create a random password if none are given | ||
|
|
101 | + password = random_password unless password | ||
|
92 | user = User.new({:login => login, |
|
102 | user = User.new({:login => login, |
|
93 | :full_name => full_name, |
|
103 | :full_name => full_name, |
|
94 | :password => password, |
|
104 | :password => password, |
|
95 | :password_confirmation => password, |
|
105 | :password_confirmation => password, |
|
96 | :alias => user_alias, |
|
106 | :alias => user_alias, |
|
97 | :remark => remark}) |
|
107 | :remark => remark}) |
@@ -342,42 +352,39 | |||||
|
342 | redirect_to :action => 'contest_management' |
|
352 | redirect_to :action => 'contest_management' |
|
343 | end |
|
353 | end |
|
344 |
|
354 | ||
|
345 | # admin management |
|
355 | # admin management |
|
346 |
|
356 | ||
|
347 | def admin |
|
357 | def admin |
|
348 | - @admins = User.all.find_all {|user| user.admin? } |
|
358 | + @admins = Role.where(name: 'admin').take.users |
|
|
359 | + @tas = Role.where(name: 'ta').take.users | ||
|
349 | end |
|
360 | end |
|
350 |
|
361 | ||
|
351 | - def grant_admin |
|
362 | + def modify_role |
|
352 |
- |
|
363 | + user = User.find_by_login(params[:login]) |
|
353 | - user = User.find_by_login(login) |
|
364 | + role = Role.find_by_name(params[:role]) |
|
354 | - if user!=nil |
|
365 | + unless user && role |
|
355 | - admin_role = Role.find_by_name('admin') |
|
366 | + flash[:error] = 'Unknown user or role' |
|
356 | - user.roles << admin_role |
|
367 | + redirect_to admin_user_admin_index_path |
|
357 | - else |
|
368 | + return |
|
358 | - flash[:notice] = 'Unknown user' |
|
||
|
359 | end |
|
369 | end |
|
360 | - flash[:notice] = 'User added as admins' |
|
370 | + if params[:commit] == 'Grant' |
|
361 | - redirect_to :action => 'admin' |
|
371 | + #grant role |
|
362 | - end |
|
372 | + user.roles << role |
|
363 | - |
|
373 | + flash[:notice] = "User '#{user.login}' has been granted the role '#{role.name}'" |
|
364 | - def revoke_admin |
|
374 | + else |
|
365 | - user = User.find(params[:id]) |
|
375 | + #revoke role |
|
366 | - if user==nil |
|
376 | + if user.login == 'root' && role.name == 'admin' |
|
367 | - flash[:notice] = 'Unknown user' |
|
377 | + flash[:error] = 'You cannot revoke admisnistrator permission from root.' |
|
368 | - redirect_to :action => 'admin' and return |
|
378 | + redirect_to admin_user_admin_index_path |
|
369 | - elsif user.login == 'root' |
|
379 | + return |
|
370 | - flash[:notice] = 'You cannot revoke admisnistrator permission from root.' |
|
380 | + end |
|
371 | - redirect_to :action => 'admin' and return |
|
381 | + user.roles.delete(role) |
|
|
382 | + flash[:notice] = "The role '#{role.name}' has been revoked from User '#{user.login}'" | ||
|
372 | end |
|
383 | end |
|
373 | - |
|
384 | + redirect_to admin_user_admin_index_path |
|
374 | - admin_role = Role.find_by_name('admin') |
|
||
|
375 | - user.roles.delete(admin_role) |
|
||
|
376 | - flash[:notice] = 'User permission revoked' |
|
||
|
377 | - redirect_to :action => 'admin' |
|
||
|
378 | end |
|
385 | end |
|
379 |
|
386 | ||
|
380 | # mass mailing |
|
387 | # mass mailing |
|
381 |
|
388 | ||
|
382 | def mass_mailing |
|
389 | def mass_mailing |
|
383 | end |
|
390 | end |
@@ -110,14 +110,15 | |||||
|
110 | nil |
|
110 | nil |
|
111 | end |
|
111 | end |
|
112 | end |
|
112 | end |
|
113 |
|
113 | ||
|
114 | def toggle_button(on,toggle_url,id, option={}) |
|
114 | def toggle_button(on,toggle_url,id, option={}) |
|
115 | btn_size = option[:size] || 'btn-xs' |
|
115 | btn_size = option[:size] || 'btn-xs' |
|
|
116 | + btn_block = option[:block] || 'btn-block' | ||
|
116 | link_to (on ? "Yes" : "No"), toggle_url, |
|
117 | link_to (on ? "Yes" : "No"), toggle_url, |
|
117 |
- {class: "btn |
|
118 | + {class: "btn #{btn_block} #{btn_size} btn-#{on ? 'success' : 'default'} ajax-toggle", |
|
118 | id: id, |
|
119 | id: id, |
|
119 | data: {remote: true, method: 'get'}} |
|
120 | data: {remote: true, method: 'get'}} |
|
120 | end |
|
121 | end |
|
121 |
|
122 | ||
|
122 | def get_ace_mode(language) |
|
123 | def get_ace_mode(language) |
|
123 | # return ace mode string from Language |
|
124 | # return ace mode string from Language |
@@ -178,15 +179,12 | |||||
|
178 | result = <<TITLEBAR |
|
179 | result = <<TITLEBAR |
|
179 | <div class="title"> |
|
180 | <div class="title"> |
|
180 | <table> |
|
181 | <table> |
|
181 | #{header} |
|
182 | #{header} |
|
182 | <tr> |
|
183 | <tr> |
|
183 | <td class="left-col"> |
|
184 | <td class="left-col"> |
|
184 | - #{user.full_name}<br/> |
|
||
|
185 | - #{t 'title_bar.current_time'} #{format_short_time(Time.zone.now)} |
|
||
|
186 | - #{time_left} |
|
||
|
187 | <br/> |
|
185 | <br/> |
|
188 | </td> |
|
186 | </td> |
|
189 | <td class="right-col">#{contest_name}</td> |
|
187 | <td class="right-col">#{contest_name}</td> |
|
190 | </tr> |
|
188 | </tr> |
|
191 | </table> |
|
189 | </table> |
|
192 | </div> |
|
190 | </div> |
@@ -1,20 +1,14 | |||||
|
1 | module MainHelper |
|
1 | module MainHelper |
|
2 |
|
2 | ||
|
3 |
- def link_to_description_if_any(name, problem |
|
3 | + def link_to_description_if_any(name, problem) |
|
4 | if !problem.url.blank? |
|
4 | if !problem.url.blank? |
|
5 |
- return link_to name, problem.url |
|
5 | + return link_to name, problem.url |
|
6 | elsif !problem.description_filename.blank? |
|
6 | elsif !problem.description_filename.blank? |
|
7 | - #build a link to a problem (via task controller) |
|
||
|
8 | basename, ext = problem.description_filename.split('.') |
|
7 | basename, ext = problem.description_filename.split('.') |
|
9 | - options[:controller] = 'tasks' |
|
8 | + return link_to name, download_task_path(problem.id,basename,ext), target: '_blank' |
|
10 | - options[:action] = 'download' |
|
||
|
11 | - options[:id] = problem.id |
|
||
|
12 | - options[:file] = basename |
|
||
|
13 | - options[:ext] = ext |
|
||
|
14 | - return link_to name, options |
|
||
|
15 | else |
|
9 | else |
|
16 | return '' |
|
10 | return '' |
|
17 | end |
|
11 | end |
|
18 | end |
|
12 | end |
|
19 |
|
13 | ||
|
20 | end |
|
14 | end |
@@ -151,13 +151,13 | |||||
|
151 | errors.add('problem',"must be specified.") |
|
151 | errors.add('problem',"must be specified.") |
|
152 | else |
|
152 | else |
|
153 | #admin always have right |
|
153 | #admin always have right |
|
154 | return if self.user.admin? |
|
154 | return if self.user.admin? |
|
155 |
|
155 | ||
|
156 | #check if user has the right to submit the problem |
|
156 | #check if user has the right to submit the problem |
|
157 |
- errors |
|
157 | + errors[:base] << "Authorization error: you have no right to submit to this problem" if (!self.user.available_problems.include?(self.problem)) and (self.new_record?) |
|
158 | end |
|
158 | end |
|
159 | end |
|
159 | end |
|
160 |
|
160 | ||
|
161 | # callbacks |
|
161 | # callbacks |
|
162 | def assign_latest_number_if_new_recond |
|
162 | def assign_latest_number_if_new_recond |
|
163 | return if !self.new_record? |
|
163 | return if !self.new_record? |
@@ -80,13 +80,17 | |||||
|
80 | else |
|
80 | else |
|
81 | false |
|
81 | false |
|
82 | end |
|
82 | end |
|
83 | end |
|
83 | end |
|
84 |
|
84 | ||
|
85 | def admin? |
|
85 | def admin? |
|
86 | - self.roles.where(name: 'admin').count > 0 |
|
86 | + has_role?('admin') |
|
|
87 | + end | ||
|
|
88 | + | ||
|
|
89 | + def has_role?(role) | ||
|
|
90 | + self.roles.where(name: role).count > 0 | ||
|
87 | end |
|
91 | end |
|
88 |
|
92 | ||
|
89 | def email_for_editing |
|
93 | def email_for_editing |
|
90 | if self.email==nil |
|
94 | if self.email==nil |
|
91 | "(unknown)" |
|
95 | "(unknown)" |
|
92 | elsif self.email=='' |
|
96 | elsif self.email=='' |
@@ -272,15 +276,16 | |||||
|
272 | end |
|
276 | end |
|
273 | other_avaiable_problems = Problem.available.find_all {|p| pin[p.id]==nil and p.contests.length==0} |
|
277 | other_avaiable_problems = Problem.available.find_all {|p| pin[p.id]==nil and p.contests.length==0} |
|
274 | return contest_problems + other_avaiable_problems |
|
278 | return contest_problems + other_avaiable_problems |
|
275 | end |
|
279 | end |
|
276 | end |
|
280 | end |
|
277 |
|
281 | ||
|
|
282 | + # new feature, get list of available problem in all enabled group that the user belongs to | ||
|
278 | def available_problems_in_group |
|
283 | def available_problems_in_group |
|
279 | problem = [] |
|
284 | problem = [] |
|
280 | - self.groups.each do |group| |
|
285 | + self.groups.where(enabled: true).each do |group| |
|
281 | group.problems.where(available: true).each { |p| problem << p } |
|
286 | group.problems.where(available: true).each { |p| problem << p } |
|
282 | end |
|
287 | end |
|
283 | problem.uniq! |
|
288 | problem.uniq! |
|
284 | if problem |
|
289 | if problem |
|
285 | problem.sort! do |a,b| |
|
290 | problem.sort! do |a,b| |
|
286 | case |
|
291 | case |
@@ -295,12 +300,14 | |||||
|
295 | return problem |
|
300 | return problem |
|
296 | else |
|
301 | else |
|
297 | return [] |
|
302 | return [] |
|
298 | end |
|
303 | end |
|
299 | end |
|
304 | end |
|
300 |
|
305 | ||
|
|
306 | + #check if the user has the right to view that problem | ||
|
|
307 | + #this also consider group based problem policy | ||
|
301 | def can_view_problem?(problem) |
|
308 | def can_view_problem?(problem) |
|
302 | return true if admin? |
|
309 | return true if admin? |
|
303 | return available_problems.include? problem |
|
310 | return available_problems.include? problem |
|
304 | end |
|
311 | end |
|
305 |
|
312 | ||
|
306 | def self.clear_last_login |
|
313 | def self.clear_last_login |
@@ -7,13 +7,13 | |||||
|
7 | %td |
|
7 | %td |
|
8 | = l submission.submitted_at, format: :long |
|
8 | = l submission.submitted_at, format: :long |
|
9 | = "( #{time_ago_in_words(submission.submitted_at)} ago)" |
|
9 | = "( #{time_ago_in_words(submission.submitted_at)} ago)" |
|
10 | %td |
|
10 | %td |
|
11 | = submission.source_filename |
|
11 | = submission.source_filename |
|
12 | = " (#{submission.language.pretty_name}) " |
|
12 | = " (#{submission.language.pretty_name}) " |
|
13 | - = link_to('[load]',{:action => 'source', :id => submission.id}) |
|
13 | + = link_to '[load]', download_submission_path(submission) |
|
14 | %td |
|
14 | %td |
|
15 | - if submission.graded_at |
|
15 | - if submission.graded_at |
|
16 | = "Graded at #{format_short_time(submission.graded_at)}." |
|
16 | = "Graded at #{format_short_time(submission.graded_at)}." |
|
17 | %br/ |
|
17 | %br/ |
|
18 | = "Score: #{(submission.points*100/submission.problem.full_score).to_i} " if GraderConfiguration['ui.show_score'] |
|
18 | = "Score: #{(submission.points*100/submission.problem.full_score).to_i} " if GraderConfiguration['ui.show_score'] |
|
19 | = " [" |
|
19 | = " [" |
@@ -7,16 +7,16 | |||||
|
7 | = link_to 'Refresh', { :action => 'list' }, class: 'btn btn-info' |
|
7 | = link_to 'Refresh', { :action => 'list' }, class: 'btn btn-info' |
|
8 |
|
8 | ||
|
9 | .panel.panel-primary |
|
9 | .panel.panel-primary |
|
10 | .panel-heading |
|
10 | .panel-heading |
|
11 | Grader control: |
|
11 | Grader control: |
|
12 | .panel-body |
|
12 | .panel-body |
|
13 |
- =link_to 'Start Graders in grading env', { action: 'start_grading'}, class: 'btn btn-default' |
|
13 | + =link_to 'Start Graders in grading env', { action: 'start_grading'}, class: 'btn btn-default' |
|
14 |
- =link_to 'Start Graders in exam env', { action: 'start_exam'}, class: 'btn btn-default' |
|
14 | + =link_to 'Start Graders in exam env', { action: 'start_exam'}, class: 'btn btn-default' |
|
15 |
- =link_to 'Stop all running Graders', { action: 'stop_all'}, class: 'btn btn-default' |
|
15 | + =link_to 'Stop all running Graders', { action: 'stop_all'}, class: 'btn btn-default' |
|
16 |
- =link_to 'Clear all data', { action: 'clear_all'}, class: 'btn btn-default' |
|
16 | + =link_to 'Clear all data', { action: 'clear_all'}, class: 'btn btn-default' |
|
17 |
|
17 | ||
|
18 | .row |
|
18 | .row |
|
19 | .col-md-6 |
|
19 | .col-md-6 |
|
20 | - if @last_task |
|
20 | - if @last_task |
|
21 | Last task: |
|
21 | Last task: |
|
22 | = link_to "#{@last_task.id}", :action => 'view', :id => @last_task.id, :type => 'Task' |
|
22 | = link_to "#{@last_task.id}", :action => 'view', :id => @last_task.id, :type => 'Task' |
@@ -2,15 +2,26 | |||||
|
2 | - if @group.errors.any? |
|
2 | - if @group.errors.any? |
|
3 | #error_explanation |
|
3 | #error_explanation |
|
4 | %h2= "#{pluralize(@group.errors.count, "error")} prohibited this group from being saved:" |
|
4 | %h2= "#{pluralize(@group.errors.count, "error")} prohibited this group from being saved:" |
|
5 | %ul |
|
5 | %ul |
|
6 | - @group.errors.full_messages.each do |msg| |
|
6 | - @group.errors.full_messages.each do |msg| |
|
7 | %li= msg |
|
7 | %li= msg |
|
8 | - |
|
8 | + .row |
|
9 | - .form-group.field |
|
9 | + .col-md-6 |
|
10 | - = f.label :name |
|
10 | + .form-group.field |
|
11 | - = f.text_field :name, class: 'form-control' |
|
11 | + = f.label :name |
|
12 | - .form-group.field |
|
12 | + = f.text_field :name, class: 'form-control' |
|
13 | - = f.label :description |
|
13 | + .row |
|
14 | - = f.text_field :description, class: 'form-control' |
|
14 | + .col-md-6 |
|
15 |
- .form-group. |
|
15 | + .form-group.field |
|
16 | - = f.submit 'Save', class: 'btn btn-primary' |
|
16 | + = f.label :description |
|
|
17 | + = f.text_field :description, class: 'form-control' | ||
|
|
18 | + .row | ||
|
|
19 | + .col-md-6 | ||
|
|
20 | + .checkbox | ||
|
|
21 | + = f.label :enabled do | ||
|
|
22 | + = f.check_box :enabled | ||
|
|
23 | + Enabled | ||
|
|
24 | + .row | ||
|
|
25 | + .col-md-6 | ||
|
|
26 | + .form-group.actions | ||
|
|
27 | + = f.submit 'Save', class: 'btn btn-primary' |
@@ -4,19 +4,21 | |||||
|
4 | = link_to 'New Group', new_group_path, class: 'btn btn-primary' |
|
4 | = link_to 'New Group', new_group_path, class: 'btn btn-primary' |
|
5 | %table.table.table-hover |
|
5 | %table.table.table-hover |
|
6 | %thead |
|
6 | %thead |
|
7 | %tr |
|
7 | %tr |
|
8 | %th Name |
|
8 | %th Name |
|
9 | %th Description |
|
9 | %th Description |
|
|
10 | + %th Enabled? | ||
|
10 | %th |
|
11 | %th |
|
11 | %th |
|
12 | %th |
|
12 |
|
13 | ||
|
13 | %tbody |
|
14 | %tbody |
|
14 | - @groups.each do |group| |
|
15 | - @groups.each do |group| |
|
15 | - %tr |
|
16 | + %tr{:class => "#{(group.enabled?) ? "success" : "danger"}", id: "group-#{group.id}"} |
|
16 | %td= group.name |
|
17 | %td= group.name |
|
17 | %td= group.description |
|
18 | %td= group.description |
|
|
19 | + %td= toggle_button(group.enabled?, toggle_group_path(group), "group-enabled-#{group.id}", size: ' ', block: ' ') | ||
|
18 | %td= link_to 'View', group, class: 'btn btn-default' |
|
20 | %td= link_to 'View', group, class: 'btn btn-default' |
|
19 | %td= link_to 'Destroy', group, :method => :delete, :data => { :confirm => 'Are you sure?' }, class: 'btn btn-danger' |
|
21 | %td= link_to 'Destroy', group, :method => :delete, :data => { :confirm => 'Are you sure?' }, class: 'btn btn-danger' |
|
20 |
|
22 | ||
|
21 | %br |
|
23 | %br |
|
22 |
|
24 |
@@ -65,13 +65,13 | |||||
|
65 | = add_menu( 'Current Score', 'report', 'current_score') |
|
65 | = add_menu( 'Current Score', 'report', 'current_score') |
|
66 | = add_menu( 'Score Report', 'report', 'max_score') |
|
66 | = add_menu( 'Score Report', 'report', 'max_score') |
|
67 | = add_menu( 'Submission Report', 'report', 'submission') |
|
67 | = add_menu( 'Submission Report', 'report', 'submission') |
|
68 | = add_menu( 'Login Report', 'report', 'login') |
|
68 | = add_menu( 'Login Report', 'report', 'login') |
|
69 | - if (ungraded = Submission.where('graded_at is null').where('submitted_at < ?', 1.minutes.ago).count) > 0 |
|
69 | - if (ungraded = Submission.where('graded_at is null').where('submitted_at < ?', 1.minutes.ago).count) > 0 |
|
70 | =link_to "#{ungraded} backlogs!", |
|
70 | =link_to "#{ungraded} backlogs!", |
|
71 | - grader_list_path, |
|
71 | + graders_list_path, |
|
72 | class: 'navbar-btn btn btn-default btn-warning', data: {toggle: 'tooltip'},title: 'Number of ungraded submission' |
|
72 | class: 'navbar-btn btn btn-default btn-warning', data: {toggle: 'tooltip'},title: 'Number of ungraded submission' |
|
73 |
|
73 | ||
|
74 | %ul.nav.navbar-nav.navbar-right |
|
74 | %ul.nav.navbar-nav.navbar-right |
|
75 | = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-question-sign')}".html_safe, 'main', 'help') |
|
75 | = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-question-sign')}".html_safe, 'main', 'help') |
|
76 | = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-comment')}".html_safe, 'messages', 'index', {title: I18n.t('menu.messages'), data: {toggle: 'tooltip'}}) |
|
76 | = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-comment')}".html_safe, 'messages', 'index', {title: I18n.t('menu.messages'), data: {toggle: 'tooltip'}}) |
|
77 | - if GraderConfiguration['system.user_setting_enabled'] |
|
77 | - if GraderConfiguration['system.user_setting_enabled'] |
@@ -40,8 +40,8 | |||||
|
40 | %table{:border => '1'} |
|
40 | %table{:border => '1'} |
|
41 | %tr |
|
41 | %tr |
|
42 | %td{:width => '300px'} |
|
42 | %td{:width => '300px'} |
|
43 | %tt <tt>{<br/>LANG: Pascal<br/>TASK: mobiles<br/>}</tt> |
|
43 | %tt <tt>{<br/>LANG: Pascal<br/>TASK: mobiles<br/>}</tt> |
|
44 |
|
44 | ||
|
45 | %p |
|
45 | %p |
|
46 |
- = raw(t('help.ask_questions_at_messages',:message_link_name => (t 'menu.messages'), |
|
46 | + = raw(t('help.ask_questions_at_messages',:message_link_name => (t 'menu.messages'),url: messages_path )) |
|
47 |
|
47 |
@@ -3,25 +3,29 | |||||
|
3 | font-family: "Consolas, Monaco, Droid Sans Mono,Mono, Monospace,Courier" |
|
3 | font-family: "Consolas, Monaco, Droid Sans Mono,Mono, Monospace,Courier" |
|
4 | } |
|
4 | } |
|
5 |
|
5 | ||
|
6 | %h1 Problem stat: #{@problem.name} |
|
6 | %h1 Problem stat: #{@problem.name} |
|
7 | %h2 Overview |
|
7 | %h2 Overview |
|
8 |
|
8 | ||
|
|
9 | + .row | ||
|
|
10 | + .col-md-2 | ||
|
|
11 | + %strong Name: | ||
|
|
12 | + .col-md-10 | ||
|
|
13 | + = @problem.full_name #in_place_editor_field :problem, :full_name, {}, :rows=>1 | ||
|
|
14 | + = link_to_description_if_any "[#{t 'main.problem_desc'}] <span class='glyphicon glyphicon-file'></span>".html_safe, @problem | ||
|
|
15 | + .row | ||
|
|
16 | + .col-md-2.strong | ||
|
|
17 | + %strong Submissions: | ||
|
|
18 | + .col-md-10 | ||
|
|
19 | + = @submissions.count | ||
|
|
20 | + .row | ||
|
|
21 | + .col-md-2.strong | ||
|
|
22 | + %strong Solved/Attemped User | ||
|
|
23 | + .col-md-10 | ||
|
|
24 | + #{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%) | ||
|
9 |
|
25 | ||
|
10 | - %table.info |
|
||
|
11 | - %thead |
|
||
|
12 | - %tr.info-head |
|
||
|
13 | - %th Stat |
|
||
|
14 | - %th Value |
|
||
|
15 | - %tbody |
|
||
|
16 | - %tr{class: cycle('info-even','info-odd')} |
|
||
|
17 | - %td Submissions |
|
||
|
18 | - %td= @submissions.count |
|
||
|
19 | - %tr{class: cycle('info-even','info-odd')} |
|
||
|
20 | - %td Solved/Attempted User |
|
||
|
21 | - %td #{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%) |
|
||
|
22 |
|
26 | ||
|
23 | %h2 Submissions Count |
|
27 | %h2 Submissions Count |
|
24 | = render partial: 'application/bar_graph', locals: { histogram: @histogram } |
|
28 | = render partial: 'application/bar_graph', locals: { histogram: @histogram } |
|
25 |
|
29 | ||
|
26 | %h2 Submissions |
|
30 | %h2 Submissions |
|
27 | - if @submissions and @submissions.count > 0 |
|
31 | - if @submissions and @submissions.count > 0 |
@@ -39,12 +39,13 | |||||
|
39 | %td.text-right |
|
39 | %td.text-right |
|
40 | %strong Task |
|
40 | %strong Task |
|
41 | %td |
|
41 | %td |
|
42 | - if @submission.problem!=nil |
|
42 | - if @submission.problem!=nil |
|
43 | = link_to "[#{@submission.problem.name}]", stat_problem_path(@submission.problem) |
|
43 | = link_to "[#{@submission.problem.name}]", stat_problem_path(@submission.problem) |
|
44 | = @submission.problem.full_name |
|
44 | = @submission.problem.full_name |
|
|
45 | + = link_to_description_if_any "[download] <span class='glyphicon glyphicon-file'></span>".html_safe, @submission.problem | ||
|
45 | - else |
|
46 | - else |
|
46 | = "(n/a)" |
|
47 | = "(n/a)" |
|
47 | %tr |
|
48 | %tr |
|
48 | %td.text-right |
|
49 | %td.text-right |
|
49 | %strong Tries |
|
50 | %strong Tries |
|
50 | %td= @submission.number |
|
51 | %td= @submission.number |
@@ -1,25 +1,54 | |||||
|
1 | - %h1 Administrators |
|
1 | + %h1 Modify Role |
|
|
2 | + .row | ||
|
|
3 | + .col-md-6 | ||
|
|
4 | + %h4 Administrators | ||
|
|
5 | + = form_tag modify_role_user_admin_index_path, method: 'post', class: 'form-inline' do | ||
|
|
6 | + = hidden_field_tag :role, 'admin' | ||
|
|
7 | + .form-group | ||
|
|
8 | + = label_tag :login, 'Grant admin role to:' | ||
|
|
9 | + = text_field_tag 'login',nil, class: 'form-control' | ||
|
|
10 | + .form-group | ||
|
|
11 | + = submit_tag 'Grant', class: 'btn btn-primary' | ||
|
|
12 | + %br | ||
|
|
13 | + %table.table.table-condense.table-hover.table-striped.table-bordered | ||
|
|
14 | + %thead{:class => 'info-head'} | ||
|
|
15 | + %th # | ||
|
|
16 | + %th Login | ||
|
|
17 | + %th Full name | ||
|
|
18 | + %th | ||
|
|
19 | + - @admins.each_with_index do |user, i| | ||
|
|
20 | + %tr | ||
|
|
21 | + %td= i+1 | ||
|
|
22 | + %td= user.login | ||
|
|
23 | + %td= user.full_name | ||
|
|
24 | + %td | ||
|
|
25 | + - if user.login!='root' | ||
|
|
26 | + = link_to '[revoke]', modify_role_user_admin_index_path( login: user.login, role: 'admin', commit: 'revoke') | ||
|
|
27 | + .col-md-6 | ||
|
|
28 | + %h4 Teacher Assistants (TA) | ||
|
|
29 | + = form_tag modify_role_user_admin_index_path, method: 'post', class: 'form-inline' do | ||
|
|
30 | + = hidden_field_tag :role, 'TA' | ||
|
|
31 | + .form-group | ||
|
|
32 | + = label_tag :login, 'Grant TA role to:' | ||
|
|
33 | + = text_field_tag 'login',nil, class: 'form-control' | ||
|
|
34 | + .form-group | ||
|
|
35 | + = submit_tag 'Grant', class: 'btn btn-primary' | ||
|
|
36 | + %br | ||
|
|
37 | + %table.table.table-condense.table-hover.table-striped.table-bordered | ||
|
|
38 | + %thead{:class => 'info-head'} | ||
|
|
39 | + %th # | ||
|
|
40 | + %th Login | ||
|
|
41 | + %th Full name | ||
|
|
42 | + %th | ||
|
|
43 | + - @tas.each_with_index do |user, i| | ||
|
|
44 | + %tr | ||
|
|
45 | + %td= i+1 | ||
|
|
46 | + %td= user.login | ||
|
|
47 | + %td= user.full_name | ||
|
|
48 | + %td | ||
|
|
49 | + - if user.login!='root' | ||
|
|
50 | + = link_to '[revoke]', modify_role_user_admin_index_path( login: user.login, role: 'TA', commit: 'revoke') | ||
|
2 |
|
51 | ||
|
3 | - %table{:class => 'info'} |
|
||
|
4 | - %tr{:class => 'info-head'} |
|
||
|
5 | - %th # |
|
||
|
6 | - %th Login |
|
||
|
7 | - %th Full name |
|
||
|
8 | - %th |
|
||
|
9 | - - @admins.each_with_index do |user, i| |
|
||
|
10 | - %tr |
|
||
|
11 | - %td= i+1 |
|
||
|
12 | - %td= user.login |
|
||
|
13 | - %td= user.full_name |
|
||
|
14 | - %td |
|
||
|
15 | - - if user.login!='root' |
|
||
|
16 | - = link_to '[revoke]', :action => 'revoke_admin', :id => user.id |
|
||
|
17 | - %hr |
|
||
|
18 | - |
|
||
|
19 | - = form_tag :action => 'grant_admin' do |
|
||
|
20 | - = label_tag :login, 'Grant admin permission to:' |
|
||
|
21 | - = text_field_tag 'login',nil, class: 'input-field' |
|
||
|
22 | - = submit_tag 'Grant', class: 'btn btn-primary' |
|
||
|
23 |
|
52 | ||
|
24 | %hr/ |
|
53 | %hr/ |
|
25 | = link_to '[go back to index]', :action => 'index' |
|
54 | = link_to '[go back to index]', :action => 'index' |
@@ -23,12 +23,21 | |||||
|
23 | %tt passwd |
|
23 | %tt passwd |
|
24 | or |
|
24 | or |
|
25 | %tt alias |
|
25 | %tt alias |
|
26 | is empty, the original value will be used instead. |
|
26 | is empty, the original value will be used instead. |
|
27 | %li |
|
27 | %li |
|
28 | If the users with the same user_id already exists, existing information will be overwritten. |
|
28 | If the users with the same user_id already exists, existing information will be overwritten. |
|
|
29 | + Example: | ||
|
|
30 | + %ol | ||
|
|
31 | + %li | ||
|
|
32 | + %pre user1,Somchai Jaidee | ||
|
|
33 | + will create (or update) a user with login "user1" and setting the fullname to "Somchai Jaidee", also setting a random password. | ||
|
|
34 | + %li | ||
|
|
35 | + %pre user1,Somchai Jaidee, | ||
|
|
36 | + will create (or update) a user with login "user1" and and setting the fullname "Somchai Jaidee". No change is made to the password unless this is a new user. If this is a new user, a random password will be generated. | ||
|
|
37 | + | ||
|
29 |
|
38 | ||
|
30 | .row |
|
39 | .row |
|
31 | .col-md-6 |
|
40 | .col-md-6 |
|
32 | = form_tag :action => 'create_from_list' do |
|
41 | = form_tag :action => 'create_from_list' do |
|
33 | .form-group |
|
42 | .form-group |
|
34 | = submit_tag 'Create following users',class: 'btn btn-success' |
|
43 | = submit_tag 'Create following users',class: 'btn btn-success' |
@@ -51,12 +51,13 | |||||
|
51 | post 'add_user', to: 'groups#add_user', as: 'add_user' |
|
51 | post 'add_user', to: 'groups#add_user', as: 'add_user' |
|
52 | delete 'remove_user/:user_id', to: 'groups#remove_user', as: 'remove_user' |
|
52 | delete 'remove_user/:user_id', to: 'groups#remove_user', as: 'remove_user' |
|
53 | delete 'remove_all_user', to: 'groups#remove_all_user', as: 'remove_all_user' |
|
53 | delete 'remove_all_user', to: 'groups#remove_all_user', as: 'remove_all_user' |
|
54 | post 'add_problem', to: 'groups#add_problem', as: 'add_problem' |
|
54 | post 'add_problem', to: 'groups#add_problem', as: 'add_problem' |
|
55 | delete 'remove_problem/:problem_id', to: 'groups#remove_problem', as: 'remove_problem' |
|
55 | delete 'remove_problem/:problem_id', to: 'groups#remove_problem', as: 'remove_problem' |
|
56 | delete 'remove_all_problem', to: 'groups#remove_all_problem', as: 'remove_all_problem' |
|
56 | delete 'remove_all_problem', to: 'groups#remove_all_problem', as: 'remove_all_problem' |
|
|
57 | + get 'toggle' | ||
|
57 | end |
|
58 | end |
|
58 | collection do |
|
59 | collection do |
|
59 |
|
60 | ||
|
60 | end |
|
61 | end |
|
61 | end |
|
62 | end |
|
62 |
|
63 | ||
@@ -89,13 +90,12 | |||||
|
89 |
|
90 | ||
|
90 | resources :submissions do |
|
91 | resources :submissions do |
|
91 | member do |
|
92 | member do |
|
92 | get 'download' |
|
93 | get 'download' |
|
93 | get 'compiler_msg' |
|
94 | get 'compiler_msg' |
|
94 | get 'rejudge' |
|
95 | get 'rejudge' |
|
95 | - get 'source' |
|
||
|
96 | end |
|
96 | end |
|
97 | collection do |
|
97 | collection do |
|
98 | get 'prob/:problem_id', to: 'submissions#index', as: 'problem' |
|
98 | get 'prob/:problem_id', to: 'submissions#index', as: 'problem' |
|
99 | get 'direct_edit_problem/:problem_id(/:user_id)', to: 'submissions#direct_edit_problem', as: 'direct_edit_problem' |
|
99 | get 'direct_edit_problem/:problem_id(/:user_id)', to: 'submissions#direct_edit_problem', as: 'direct_edit_problem' |
|
100 | get 'get_latest_submission_status/:uid/:pid', to: 'submissions#get_latest_submission_status', as: 'get_latest_submission_status' |
|
100 | get 'get_latest_submission_status/:uid/:pid', to: 'submissions#get_latest_submission_status', as: 'get_latest_submission_status' |
|
101 | end |
|
101 | end |
@@ -110,14 +110,13 | |||||
|
110 | get 'user_stat' |
|
110 | get 'user_stat' |
|
111 | get 'import' |
|
111 | get 'import' |
|
112 | get 'new_list' |
|
112 | get 'new_list' |
|
113 | get 'admin' |
|
113 | get 'admin' |
|
114 | get 'active' |
|
114 | get 'active' |
|
115 | get 'mass_mailing' |
|
115 | get 'mass_mailing' |
|
116 | - get 'revoke_admin' |
|
116 | + match 'modify_role', via: [:get, :post] |
|
117 | - post 'grant_admin' |
|
||
|
118 | match 'create_from_list', via: [:get, :post] |
|
117 | match 'create_from_list', via: [:get, :post] |
|
119 | match 'random_all_passwords', via: [:get, :post] |
|
118 | match 'random_all_passwords', via: [:get, :post] |
|
120 | end |
|
119 | end |
|
121 | member do |
|
120 | member do |
|
122 | get 'clear_last_ip' |
|
121 | get 'clear_last_ip' |
|
123 | end |
|
122 | end |
@@ -181,28 +180,29 | |||||
|
181 | #post 'main/submit', to: 'main#submit' |
|
180 | #post 'main/submit', to: 'main#submit' |
|
182 | #get 'main/announcements', to: 'main#announcements' |
|
181 | #get 'main/announcements', to: 'main#announcements' |
|
183 |
|
182 | ||
|
184 |
|
183 | ||
|
185 | # |
|
184 | # |
|
186 | get 'tasks/view/:file.:ext' => 'tasks#view' |
|
185 | get 'tasks/view/:file.:ext' => 'tasks#view' |
|
187 | - get 'tasks/download/:id/:file.:ext' => 'tasks#download' |
|
186 | + get 'tasks/download/:id/:file.:ext' => 'tasks#download', as: 'download_task' |
|
188 | get 'heartbeat/:id/edit' => 'heartbeat#edit' |
|
187 | get 'heartbeat/:id/edit' => 'heartbeat#edit' |
|
189 |
|
188 | ||
|
190 | #grader |
|
189 | #grader |
|
191 | - get 'graders/list', to: 'graders#list', as: 'grader_list' |
|
190 | + #get 'graders/list', to: 'graders#list', as: 'grader_list' |
|
192 | namespace :graders do |
|
191 | namespace :graders do |
|
193 | get 'task/:id/:type', action: 'task', as: 'task' |
|
192 | get 'task/:id/:type', action: 'task', as: 'task' |
|
194 | get 'view/:id/:type', action: 'view', as: 'view' |
|
193 | get 'view/:id/:type', action: 'view', as: 'view' |
|
195 | get 'clear/:id', action: 'clear', as: 'clear' |
|
194 | get 'clear/:id', action: 'clear', as: 'clear' |
|
196 | - get 'stop' |
|
||
|
197 | - get 'stop_all' |
|
||
|
198 | - get 'clear_all' |
|
||
|
199 | - get 'clear_terminated' |
|
||
|
200 | get 'start_grading' |
|
195 | get 'start_grading' |
|
201 | get 'start_exam' |
|
196 | get 'start_exam' |
|
|
197 | + get 'clear_all' | ||
|
|
198 | + get 'stop_all' | ||
|
202 |
|
199 | ||
|
|
200 | + get 'stop' | ||
|
|
201 | + get 'clear_terminated' | ||
|
|
202 | + get 'list' | ||
|
203 | end |
|
203 | end |
|
204 |
|
204 | ||
|
205 |
|
205 | ||
|
206 | # See how all your routes lay out with "rake routes" |
|
206 | # See how all your routes lay out with "rake routes" |
|
207 |
|
207 | ||
|
208 | # This is a legacy wild controller route that's not recommended for RESTful applications. |
|
208 | # This is a legacy wild controller route that's not recommended for RESTful applications. |
@@ -222,12 +222,13 | |||||
|
222 | conf[:default_value], |
|
222 | conf[:default_value], |
|
223 | desc) |
|
223 | desc) |
|
224 | end |
|
224 | end |
|
225 | end |
|
225 | end |
|
226 |
|
226 | ||
|
227 | def seed_roles |
|
227 | def seed_roles |
|
|
228 | + Role.find_or_create_by(name: 'TA') | ||
|
228 | return if Role.find_by_name('admin') |
|
229 | return if Role.find_by_name('admin') |
|
229 |
|
230 | ||
|
230 | role = Role.create(:name => 'admin') |
|
231 | role = Role.create(:name => 'admin') |
|
231 | user_admin_right = Right.create(:name => 'user_admin', |
|
232 | user_admin_right = Right.create(:name => 'user_admin', |
|
232 | :controller => 'user_admin', |
|
233 | :controller => 'user_admin', |
|
233 | :action => 'all') |
|
234 | :action => 'all') |
You need to be logged in to leave comments.
Login now