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
26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/hyrax/dashboard/nest_collections_controller.rb', line 26 def create_collection_under :deposit, form_params[:parent_id] if form.validate_add redirect_to new_dashboard_collection_path(collection_type_id: parent_type_id_for(form), 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
37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/hyrax/dashboard/nest_collections_controller.rb', line 37 def create_relationship_under :read, form_params[:parent_id] 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
14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/hyrax/dashboard/nest_collections_controller.rb', line 14 def create_relationship_within :read, form_params[:child_id] 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
49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/hyrax/dashboard/nest_collections_controller.rb', line 49 def remove_relationship_above :edit, form_params[:parent_id] 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
60 61 62 63 64 65 66 67 68 69 |
# File 'app/controllers/hyrax/dashboard/nest_collections_controller.rb', line 60 def remove_relationship_under :edit, form_params[:parent_id] 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 |