Module: Hydra::Collections::CollectionsHelperBehavior
- Included in:
- CollectionsHelper
- Defined in:
- app/helpers/hydra/collections/collections_helper_behavior.rb
Instance Method Summary collapse
-
#button_for_create_collection(label = 'Create Collection') ⇒ Object
Displays the Collections create collection button.
-
#button_for_delete_collection(collection, label = 'Delete Collection', confirm = 'Are you sure?') ⇒ Object
Displays the Collections delete collection button.
- #button_for_remove_from_collection(collection, document, label = 'Remove From Collection') ⇒ Object
- #button_for_remove_selected_from_collection(collection, label = 'Remove From Collection') ⇒ Object
-
#button_for_update_collection(label = 'Update Collection', collection_id = 'collection_replace_id') ⇒ Object
Displays the Collections update collection button.
- #has_collection_search_parameters? ⇒ Boolean
- #hidden_collection_members ⇒ Object
-
#single_item_action_add_form_fields(form, document) ⇒ Object
add hidden fields to a form for adding a single document to a collection.
-
#single_item_action_form_fields(form, document, action) ⇒ Object
add hidden fields to a form for performing an action on a single document on a collection.
-
#single_item_action_remove_form_fields(form, document) ⇒ Object
add hidden fields to a form for removing a single document from a collection.
Instance Method Details
#button_for_create_collection(label = 'Create Collection') ⇒ Object
Displays the Collections create collection button. Put this in your search result page template. We recommend putting it in catalog/_sort_and_per_page.html.erb
9 10 11 |
# File 'app/helpers/hydra/collections/collections_helper_behavior.rb', line 9 def (label = 'Create Collection') render '/collections/button_create_collection', label: label end |
#button_for_delete_collection(collection, label = 'Delete Collection', confirm = 'Are you sure?') ⇒ Object
Displays the Collections delete collection button. Put this in your search result page for each collection found.
19 20 21 |
# File 'app/helpers/hydra/collections/collections_helper_behavior.rb', line 19 def (collection, label = 'Delete Collection', confirm = 'Are you sure?') render '/collections/button_for_delete_collection', collection: collection, label: label, confirm: confirm end |
#button_for_remove_from_collection(collection, document, label = 'Remove From Collection') ⇒ Object
23 24 25 |
# File 'app/helpers/hydra/collections/collections_helper_behavior.rb', line 23 def (collection, document, label = 'Remove From Collection') render '/collections/button_remove_from_collection', collection: collection, label: label, document: document end |
#button_for_remove_selected_from_collection(collection, label = 'Remove From Collection') ⇒ Object
27 28 29 |
# File 'app/helpers/hydra/collections/collections_helper_behavior.rb', line 27 def (collection, label = 'Remove From Collection') render '/collections/button_for_remove_selected_from_collection', collection: collection, label: label end |
#button_for_update_collection(label = 'Update Collection', collection_id = 'collection_replace_id') ⇒ Object
Displays the Collections update collection button. Put this in your search result page template. We recommend putting it in catalog/_sort_and_per_page.html.erb
14 15 16 |
# File 'app/helpers/hydra/collections/collections_helper_behavior.rb', line 14 def (label = 'Update Collection', collection_id = 'collection_replace_id') render '/collections/button_for_update_collection', label: label, collection_id: collection_id end |
#has_collection_search_parameters? ⇒ Boolean
4 5 6 |
# File 'app/helpers/hydra/collections/collections_helper_behavior.rb', line 4 def has_collection_search_parameters? !params[:cq].blank? end |
#hidden_collection_members ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'app/helpers/hydra/collections/collections_helper_behavior.rb', line 46 def hidden_collection_members _erbout = '' if params[:batch_document_ids].present? params[:batch_document_ids].each do |batch_item| _erbout.concat hidden_field_tag('batch_document_ids[]', batch_item) end end _erbout.html_safe end |
#single_item_action_add_form_fields(form, document) ⇒ Object
add hidden fields to a form for adding a single document to a collection
37 38 39 |
# File 'app/helpers/hydra/collections/collections_helper_behavior.rb', line 37 def single_item_action_add_form_fields(form, document) single_item_action_form_fields(form, document, 'add') end |
#single_item_action_form_fields(form, document, action) ⇒ Object
add hidden fields to a form for performing an action on a single document on a collection
42 43 44 |
# File 'app/helpers/hydra/collections/collections_helper_behavior.rb', line 42 def single_item_action_form_fields(form, document, action) render '/collections/single_item_action_fields', form: form, document: document, action: action end |
#single_item_action_remove_form_fields(form, document) ⇒ Object
add hidden fields to a form for removing a single document from a collection
32 33 34 |
# File 'app/helpers/hydra/collections/collections_helper_behavior.rb', line 32 def single_item_action_remove_form_fields(form, document) single_item_action_form_fields(form, document, 'remove') end |