Sha256: 81f2b52de3ed9d840542796d87b51c44391808d777e2cb749cdee0b1f537dde5

Contents?: true

Size: 1.75 KB

Versions: 36

Compression:

Stored size: 1.75 KB

Contents

module Hyrax
  class Admin::CollectionTypeParticipantsController < ApplicationController
    before_action do
      authorize! :manage, :collection_types
    end

    class_attribute :form_class
    self.form_class = Hyrax::Forms::Admin::CollectionTypeParticipantForm

    def create
      @collection_type_participant = Hyrax::CollectionTypeParticipant.new(collection_type_participant_params)
      if @collection_type_participant.save
        redirect_to(
          edit_admin_collection_type_path(@collection_type_participant.hyrax_collection_type_id, anchor: 'participants'),
          notice: I18n.t('update_notice', scope: 'hyrax.admin.collection_types.form_participants')
        )
      else
        redirect_to(
          edit_admin_collection_type_path(@collection_type_participant.hyrax_collection_type_id, anchor: 'participants'),
          alert: @collection_type_participant.errors.full_messages.to_sentence
        )
      end
    end

    def destroy
      @collection_type_participant = Hyrax::CollectionTypeParticipant.find(params[:id])
      if @collection_type_participant.destroy
        redirect_to(
          edit_admin_collection_type_path(@collection_type_participant.hyrax_collection_type_id, anchor: 'participants'),
          notice: I18n.t('remove_success', scope: 'hyrax.admin.collection_types.form_participants')
        )
      else
        redirect_to(
          edit_admin_collection_type_path(@collection_type_participant.hyrax_collection_type_id, anchor: 'participants'),
          alert: @collection_type_participant.errors.full_messages.to_sentence
        )
      end
    end

    def collection_type_participant_params
      params.require(:collection_type_participant).permit(:access, :agent_id, :agent_type, :hyrax_collection_type_id)
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-2.9.5 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-2.9.4 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-2.9.3 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-2.9.2 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-2.9.1 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-2.9.0 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-2.8.0 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-2.7.2 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-2.7.1 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-2.7.0 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-2.6.0 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-3.0.0.pre.rc1 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-3.0.0.pre.beta3 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-2.5.1 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-2.5.0 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-3.0.0.pre.beta2 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-2.4.1 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-3.0.0.pre.beta1 app/controllers/hyrax/admin/collection_type_participants_controller.rb
hyrax-2.4.0 app/controllers/hyrax/admin/collection_type_participants_controller.rb