Skip to content
Snippets Groups Projects
Commit cbf39f97 authored by Marcela Ribeiro de Oliveira's avatar Marcela Ribeiro de Oliveira
Browse files

route to show submissions

parent bafdfca6
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ module SubmissionController
included do
before_action :set_new_submission, only: :submit
before_action :set_submission, only: :show_submission
before_action :authorize!
end
......@@ -22,6 +23,11 @@ module SubmissionController
end
end
def show_submission
return render status: :ok if @learning_object.draft? || @learning_object.published?
render json: @learning_object
end
private
def submitted
......@@ -32,4 +38,8 @@ module SubmissionController
@learning_object = LearningObject.find(params[:id])
end
def set_submission
@learning_object ||= LearningObject.find(params[:id])
end
end
......@@ -11,10 +11,11 @@ class V1::LearningObjectsController < ApplicationController
include ::StageableController
include ::SubmissionController
before_action :authenticate_user!, only: [:create, :update, :destroy, :tagging, :untagging, :submit, :submission]
before_action :authenticate_user!, only: [:create, :update, :destroy, :tagging, :untagging, :submit, :submission, :show_submission]
before_action :set_learning_object, only: [:show, :update, :destroy, :subjecting, :unsubjecting, :add_stages, :remove_stages]
before_action :set_new_learning_object, only: [:index, :submissions]
before_action :set_new_submission, only: :submit
before_action :set_submission, only: :show_submission
before_action :authorize!, except: [:create, :tagging, :untagging, :download, :magnetlink]
before_action :set_paper_trail_whodunnit, except: [:index, :show]
......
......@@ -9,4 +9,9 @@ module SubmissionPolicy
record if user_can_moderate?
end
def show_submission?
return false if user.nil?
record if user_can_moderate?
end
end
......@@ -64,6 +64,7 @@ Rails.application.routes.draw do
end
member do
post :submit
get :show_submission
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment