Description:
add link to announcement management in main
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r651:23fc3f2d9ad1 - - 2 files changed: 1 inserted, 1 deleted

@@ -40,70 +40,69
40 @submission = Submission.find(params[:id])
40 @submission = Submission.find(params[:id])
41 send_data(@submission.source, {:filename => @submission.download_filename, :type => 'text/plain'})
41 send_data(@submission.source, {:filename => @submission.download_filename, :type => 'text/plain'})
42 end
42 end
43
43
44 def compiler_msg
44 def compiler_msg
45 @submission = Submission.find(params[:id])
45 @submission = Submission.find(params[:id])
46 respond_to do |format|
46 respond_to do |format|
47 format.js
47 format.js
48 end
48 end
49 end
49 end
50
50
51 #on-site new submission on specific problem
51 #on-site new submission on specific problem
52 def direct_edit_problem
52 def direct_edit_problem
53 @problem = Problem.find(params[:problem_id])
53 @problem = Problem.find(params[:problem_id])
54 @source = ''
54 @source = ''
55 render 'edit'
55 render 'edit'
56 end
56 end
57
57
58 # GET /submissions/1/edit
58 # GET /submissions/1/edit
59 def edit
59 def edit
60 @submission = Submission.find(params[:id])
60 @submission = Submission.find(params[:id])
61 @source = @submission.source.to_s
61 @source = @submission.source.to_s
62 @problem = @submission.problem
62 @problem = @submission.problem
63 @lang_id = @submission.language.id
63 @lang_id = @submission.language.id
64 end
64 end
65
65
66
66
67 def get_latest_submission_status
67 def get_latest_submission_status
68 @problem = Problem.find(params[:pid])
68 @problem = Problem.find(params[:pid])
69 @submission = Submission.find_last_by_user_and_problem(params[:uid],params[:pid])
69 @submission = Submission.find_last_by_user_and_problem(params[:uid],params[:pid])
70 puts User.find(params[:uid]).login
70 puts User.find(params[:uid]).login
71 puts Problem.find(params[:pid]).name
71 puts Problem.find(params[:pid]).name
72 puts 'nil' unless @submission
72 puts 'nil' unless @submission
73 respond_to do |format|
73 respond_to do |format|
74 format.js
74 format.js
75 end
75 end
76 end
76 end
77
77
78 # GET /submissions/:id/rejudge
78 # GET /submissions/:id/rejudge
79 def rejudge
79 def rejudge
80 @submission = Submission.find(params[:id])
80 @submission = Submission.find(params[:id])
81 @task = @submission.task
81 @task = @submission.task
82 @task.status_inqueue! if @task
82 @task.status_inqueue! if @task
83 respond_to do |format|
83 respond_to do |format|
84 format.js
84 format.js
85 end
85 end
86 end
86 end
87
87
88 -
89 protected
88 protected
90
89
91 def submission_authorization
90 def submission_authorization
92 #admin always has privileged
91 #admin always has privileged
93 if @current_user.admin?
92 if @current_user.admin?
94 return true
93 return true
95 end
94 end
96
95
97 sub = Submission.find(params[:id])
96 sub = Submission.find(params[:id])
98 if sub.problem.available?
97 if sub.problem.available?
99 puts "sub = #{sub.user.id}, current = #{@current_user.id}"
98 puts "sub = #{sub.user.id}, current = #{@current_user.id}"
100 return true if GraderConfiguration["right.user_view_submission"] or sub.user == @current_user
99 return true if GraderConfiguration["right.user_view_submission"] or sub.user == @current_user
101 end
100 end
102
101
103 #default to NO
102 #default to NO
104 unauthorized_redirect
103 unauthorized_redirect
105 return false
104 return false
106 end
105 end
107
106
108
107
109 end
108 end
@@ -1,63 +1,64
1 - content_for :head do
1 - content_for :head do
2 = javascript_include_tag "announcement_refresh"
2 = javascript_include_tag "announcement_refresh"
3
3
4 = user_title_bar(@user)
4 = user_title_bar(@user)
5
5
6 - if (GraderConfiguration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true)
6 - if (GraderConfiguration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true)
7 %p=t 'main.start_soon'
7 %p=t 'main.start_soon'
8
8
9 .row
9 .row
10 .col-md-7
10 .col-md-7
11 - if GraderConfiguration.show_submitbox_to?(@user)
11 - if GraderConfiguration.show_submitbox_to?(@user)
12 .panel.panel-primary
12 .panel.panel-primary
13 .panel-heading
13 .panel-heading
14 Submission
14 Submission
15 .panel-body
15 .panel-body
16 = render :partial => 'submission_box'
16 = render :partial => 'submission_box'
17 - if GraderConfiguration.show_tasks_to?(@user)
17 - if GraderConfiguration.show_tasks_to?(@user)
18 - if not GraderConfiguration.multicontests?
18 - if not GraderConfiguration.multicontests?
19 %table.table.table-striped.table-condensed
19 %table.table.table-striped.table-condensed
20 %thead
20 %thead
21 %tr
21 %tr
22 %th Task name
22 %th Task name
23 %th Full name
23 %th Full name
24 %th # of sub(s)
24 %th # of sub(s)
25 %th Results
25 %th Results
26 %th
26 %th
27 %tbody
27 %tbody
28 = render :partial => 'problem', :collection => @problems
28 = render :partial => 'problem', :collection => @problems
29 - else
29 - else
30 - @contest_problems.each do |cp|
30 - @contest_problems.each do |cp|
31 - if cp[:problems].length > 0
31 - if cp[:problems].length > 0
32 %h2{:class =>'contest-title'}
32 %h2{:class =>'contest-title'}
33 = "#{cp[:contest] ? cp[:contest].title : 'Public problems'}"
33 = "#{cp[:contest] ? cp[:contest].title : 'Public problems'}"
34 %table.info
34 %table.info
35 %tr.info-head
35 %tr.info-head
36 %th Task name
36 %th Task name
37 %th Full name
37 %th Full name
38 %th # of sub(s)
38 %th # of sub(s)
39 %th Results
39 %th Results
40 %th
40 %th
41 = render :partial => 'problem', :collection => cp[:problems]
41 = render :partial => 'problem', :collection => cp[:problems]
42 .col-md-5
42 .col-md-5
43 .panel.panel-info
43 .panel.panel-info
44 .panel-heading
44 .panel-heading
45 Announcement
45 Announcement
46 + = link_to 'Manage', announcements_path, class: 'btn btn-xs btn-default'
46 %ul.list-group
47 %ul.list-group
47 = render :partial => 'announcement', :collection => @announcements
48 = render :partial => 'announcement', :collection => @announcements
48
49
49 %script{:type => 'text/javascript'}
50 %script{:type => 'text/javascript'}
50 = "Announcement.refreshUrl = '#{url_for :controller => 'main', :action => 'announcements'}';"
51 = "Announcement.refreshUrl = '#{url_for :controller => 'main', :action => 'announcements'}';"
51 Announcement.registerRefreshEventTimer();
52 Announcement.registerRefreshEventTimer();
52
53
53 .modal.fade#compiler{tabindex: -1,role: 'dialog'}
54 .modal.fade#compiler{tabindex: -1,role: 'dialog'}
54 .modal-dialog.modal-lg{role:'document'}
55 .modal-dialog.modal-lg{role:'document'}
55 .modal-content
56 .modal-content
56 .modal-header
57 .modal-header
57 %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}}
58 %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}}
58 %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} ×
59 %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} ×
59 %h4 Compiler message
60 %h4 Compiler message
60 .modal-body
61 .modal-body
61 %pre#compiler_msg
62 %pre#compiler_msg
62 .modal-footer
63 .modal-footer
63 %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close
64 %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close
You need to be logged in to leave comments. Login now