Sha256: 66e887ff995503d2d19379c450737c13e7f360985f78644f49f185e19c0bf49a
Contents?: true
Size: 1.27 KB
Versions: 46
Compression:
Stored size: 1.27 KB
Contents
module Hyrax class WorkflowActionsController < ApplicationController before_action :authenticate_user! def update 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 curation_concern @curation_concern ||= ActiveFedora::Base.find(params[:id]) end def workflow_action_form @workflow_action_form ||= Hyrax::Forms::WorkflowActionForm.new( current_ability: current_ability, work: curation_concern, attributes: workflow_action_params ) end 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
46 entries across 46 versions & 1 rubygems