Class: Hyrax::Admin::CollectionTypesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Hyrax::Admin::CollectionTypesController
- Defined in:
- app/controllers/hyrax/admin/collection_types_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/hyrax/admin/collection_types_controller.rb', line 27 def create @collection_type = Hyrax::CollectionType.new(collection_type_params) if @collection_type.save Hyrax::CollectionTypes::CreateService.add_default_participants(@collection_type.id) redirect_to hyrax.edit_admin_collection_type_path(@collection_type), notice: t(:'hyrax.admin.collection_types.create.notification', name: @collection_type.title) else report_error_msg setup_form t(:'hyrax.admin.collection_types.new.header'), hyrax.new_admin_collection_type_path render :new end end |
#destroy ⇒ Object
59 60 61 62 63 64 65 |
# File 'app/controllers/hyrax/admin/collection_types_controller.rb', line 59 def destroy if @collection_type.destroy redirect_to hyrax.admin_collection_types_path, notice: t(:'hyrax.admin.collection_types.delete.notification', name: @collection_type.title) else redirect_to hyrax.admin_collection_types_path, alert: @collection_type.errors..to_sentence end end |
#edit ⇒ Object
41 42 43 44 45 46 |
# File 'app/controllers/hyrax/admin/collection_types_controller.rb', line 41 def edit setup_form setup_participants_form t(:'hyrax.admin.collection_types.edit.header'), hyrax.edit_admin_collection_type_path end |
#index ⇒ Object
14 15 16 17 18 19 |
# File 'app/controllers/hyrax/admin/collection_types_controller.rb', line 14 def index # TODO: How do we know if a collection_type has existing collections? # Will that be a property on @collection_types here? @collection_types = Hyrax::CollectionType.all end |
#new ⇒ Object
21 22 23 24 25 |
# File 'app/controllers/hyrax/admin/collection_types_controller.rb', line 21 def new setup_form t(:'hyrax.admin.collection_types.new.header'), hyrax.new_admin_collection_type_path end |
#update ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/hyrax/admin/collection_types_controller.rb', line 48 def update if @collection_type.update(collection_type_params) redirect_to update_referer, notice: t(:'hyrax.admin.collection_types.update.notification', name: @collection_type.title) else setup_form t(:'hyrax.admin.collection_types.edit.header'), hyrax.edit_admin_collection_type_path render :edit end end |