Class: Hyrax::Dashboard::NestCollectionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Hyrax::Dashboard::NestCollectionsController
- Includes:
- Blacklight::Base
- Defined in:
- app/controllers/hyrax/dashboard/nest_collections_controller.rb
Instance Method Summary collapse
-
#create_collection_under ⇒ Object
create and link a NEW subcollection under this collection, with this collection as parent.
-
#create_relationship_under ⇒ Object
link this collection as parent by adding existing collection as subcollection under this one.
-
#create_relationship_within ⇒ Object
Add this collection as a subcollection within another existing collection.
-
#remove_relationship_above ⇒ Object
remove a parent collection relationship from this collection.
-
#remove_relationship_under ⇒ Object
remove a subcollection relationship from this collection.
Instance Method Details
#create_collection_under ⇒ Object
create and link a NEW subcollection under this collection, with this collection as parent
21 22 23 24 25 26 27 28 |
# File 'app/controllers/hyrax/dashboard/nest_collections_controller.rb', line 21 def create_collection_under @form = build_create_collection_form if @form.validate_add redirect_to new_dashboard_collection_path(collection_type_id: @form.parent.collection_type.id, parent_id: @form.parent) else redirect_to redirect_path(item: @form.parent), flash: { error: @form.errors. } end end |
#create_relationship_under ⇒ Object
link this collection as parent by adding existing collection as subcollection under this one
31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/hyrax/dashboard/nest_collections_controller.rb', line 31 def create_relationship_under @form = build_under_form if @form.save notice = I18n.t('create_under', scope: 'hyrax.dashboard.nest_collections_form', child_title: @form.child.title.first, parent_title: @form.parent.title.first) redirect_to redirect_path(item: @form.parent), notice: notice else redirect_to redirect_path(item: @form.parent), flash: { error: @form.errors. } end end |
#create_relationship_within ⇒ Object
Add this collection as a subcollection within another existing collection
10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/hyrax/dashboard/nest_collections_controller.rb', line 10 def create_relationship_within @form = build_within_form if @form.save notice = I18n.t('create_within', scope: 'hyrax.dashboard.nest_collections_form', child_title: @form.child.title.first, parent_title: @form.parent.title.first) redirect_to redirect_path(item: @form.child), notice: notice else redirect_to redirect_path(item: @form.child), flash: { error: @form.errors. } end end |
#remove_relationship_above ⇒ Object
remove a parent collection relationship from this collection
42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/hyrax/dashboard/nest_collections_controller.rb', line 42 def remove_relationship_above @form = build_remove_form if @form.remove notice = I18n.t('removed_relationship', scope: 'hyrax.dashboard.nest_collections_form', child_title: @form.child.title.first, parent_title: @form.parent.title.first) redirect_to redirect_path(item: @form.child), notice: notice else redirect_to redirect_path(item: @form.child), flash: { error: @form.errors. } end end |
#remove_relationship_under ⇒ Object
remove a subcollection relationship from this collection
53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/hyrax/dashboard/nest_collections_controller.rb', line 53 def remove_relationship_under @form = build_remove_form if @form.remove notice = I18n.t('removed_relationship', scope: 'hyrax.dashboard.nest_collections_form', child_title: @form.child.title.first, parent_title: @form.parent.title.first) redirect_to redirect_path(item: @form.parent), notice: notice else redirect_to redirect_path(item: @form.parent), flash: { error: @form.errors. } end end |