Description:
fix direct edit link
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r641:2a2038aee8bd - - 1 file changed: 1 inserted, 1 deleted

@@ -1,51 +1,51
1 1 class SubmissionsController < ApplicationController
2 2 before_filter :authenticate
3 - before_filter :submission_authorization, only: [:show, :direct_edit_submission, :download]
3 + before_filter :submission_authorization, only: [:show, :direct_edit_submission, :download, :edit]
4 4
5 5 # GET /submissions
6 6 # GET /submissions.json
7 7 # Show problem selection and user's submission of that problem
8 8 def index
9 9 @user = @current_user
10 10 @problems = @user.available_problems
11 11
12 12 if params[:problem_id]==nil
13 13 @problem = nil
14 14 @submissions = nil
15 15 else
16 16 @problem = Problem.find_by_id(params[:problem_id])
17 17 if (@problem == nil) or (not @problem.available)
18 18 redirect_to main_list_path
19 19 flash[:notice] = 'Error: submissions for that problem are not viewable.'
20 20 return
21 21 end
22 22 @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id)
23 23 end
24 24 end
25 25
26 26 # GET /submissions/1
27 27 # GET /submissions/1.json
28 28 def show
29 29 @submission = Submission.find(params[:id])
30 30
31 31 #log the viewing
32 32 user = User.find(session[:user_id])
33 33 SubmissionViewLog.create(user_id: session[:user_id],submission_id: @submission.id) unless user.admin?
34 34 end
35 35
36 36 def download
37 37 @submission = Submission.find(params[:id])
38 38 send_data(@submission.source, {:filename => @submission.download_filename, :type => 'text/plain'})
39 39 end
40 40
41 41 def compiler_msg
42 42 @submission = Submission.find(params[:id])
43 43 respond_to do |format|
44 44 format.js
45 45 end
46 46 end
47 47
48 48 #on-site new submission on specific problem
49 49 def direct_edit_problem
50 50 @problem = Problem.find(params[:problem_id])
51 51 @source = ''
You need to be logged in to leave comments. Login now