Sha256: 6c3e962be0664c0f2945ea323cb74ce39e81e0e96e516b85c89b66c04258fc89
Contents?: true
Size: 1.18 KB
Versions: 8
Compression:
Stored size: 1.18 KB
Contents
module Hyrax class WorkflowActionsController < ApplicationController before_action :authenticate_user! def update @curation_concern = ActiveFedora::Base.find(params[:id]) workflow_action_form = Hyrax::Forms::WorkflowActionForm.new( current_ability: current_ability, work: @curation_concern, attributes: workflow_action_params ) if workflow_action_form.save after_update_response else respond_to do |wants| wants.html { render 'hyrax/base/unauthorized', status: :unauthorized } wants.json { render_json_response(response_type: :unprocessable_entity, options: { errors: @curation_concern.errors }) } end end end private def workflow_action_params params.require(:workflow_action).permit(:name, :comment) end def after_update_response respond_to do |wants| wants.html { redirect_to [main_app, @curation_concern], notice: "The #{@curation_concern.human_readable_type} has been updated." } wants.json { render 'hyrax/base/show', status: :ok, location: polymorphic_path([main_app, @curation_concern]) } end end end end
Version data entries
8 entries across 8 versions & 1 rubygems