Sha256: 337f7bbe22886ef91b199e51a36140310674dca571f19b0b7683b36df7c25e13
Contents?: true
Size: 1.93 KB
Versions: 3
Compression:
Stored size: 1.93 KB
Contents
class CurationConcern::GenericFilesController < CurationConcern::BaseController respond_to(:html) before_filter :parent def parent @parent ||= if params[:id] curation_concern.batch else ActiveFedora::Base.find(namespaced_parent_id,cast: true) end end helper_method :parent def namespaced_parent_id Sufia::Noid.namespaceize(params[:parent_id]) end protected :namespaced_parent_id before_filter :authorize_edit_parent_rights!, except: [:show] def authorize_edit_parent_rights! authorize! :edit, parent end protected :authorize_edit_parent_rights! before_filter :curation_concern load_and_authorize_resource :curation_concern, class: "ActiveFedora::Base", except: [:new, :create] def curation_concern @curation_concern ||= if params[:id] GenericFile.find(params[:id]) else GenericFile.new(params[:generic_file]) end end def new respond_with(curation_concern) end def create curation_concern.batch = parent actor.create! respond_with([:curation_concern, parent]) rescue ActiveFedora::RecordInvalid respond_with([:curation_concern, curation_concern]) { |wants| wants.html { render 'new', status: :unprocessable_entity } } end def show respond_with(curation_concern) end def edit respond_with(curation_concern) end def update actor.update! respond_with([:curation_concern, curation_concern]) rescue ActiveFedora::RecordInvalid respond_with([:curation_concern, curation_concern]) { |wants| wants.html { render 'edit', status: :unprocessable_entity } } end def destroy parent = curation_concern.batch title = curation_concern.to_s curation_concern.destroy flash[:notice] = "Deleted #{title}" respond_with([:curation_concern, parent]) end include Morphine register :actor do CurationConcern.actor(curation_concern, current_user, params[:generic_file]) end end
Version data entries
3 entries across 3 versions & 1 rubygems