Module: Hyrax::CollectionsHelper
- Included in:
- HyraxHelperBehavior
- Defined in:
- app/helpers/hyrax/collections_helper.rb
Instance Method Summary collapse
- #button_for_remove_from_collection(collection, document, label = 'Remove From Collection') ⇒ Object
- #button_for_remove_selected_from_collection(collection, label = 'Remove From Collection') ⇒ Object
- #has_collection_search_parameters? ⇒ Boolean
-
#present_terms(presenter, terms = :all, &block) ⇒ Object
TODO: we could move this to CollectionPresenter if it had a view_context.
- #render_collection_links(solr_doc) ⇒ Object
-
#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_remove_from_collection(collection, document, label = 'Remove From Collection') ⇒ Object
25 26 27 |
# File 'app/helpers/hyrax/collections_helper.rb', line 25 def (collection, document, label = 'Remove From Collection') render 'hyrax/dashboard/collections/button_remove_from_collection', collection: collection, label: label, document: document end |
#button_for_remove_selected_from_collection(collection, label = 'Remove From Collection') ⇒ Object
29 30 31 |
# File 'app/helpers/hyrax/collections_helper.rb', line 29 def (collection, label = 'Remove From Collection') render 'hyrax/dashboard/collections/button_for_remove_selected_from_collection', collection: collection, label: label end |
#has_collection_search_parameters? ⇒ Boolean
21 22 23 |
# File 'app/helpers/hyrax/collections_helper.rb', line 21 def has_collection_search_parameters? params[:cq].present? end |
#present_terms(presenter, terms = :all, &block) ⇒ Object
TODO: we could move this to CollectionPresenter if it had a view_context
6 7 8 9 |
# File 'app/helpers/hyrax/collections_helper.rb', line 6 def present_terms(presenter, terms = :all, &block) terms = presenter.terms if terms == :all Hyrax::PresenterRenderer.new(presenter, self).fields(terms, &block) end |
#render_collection_links(solr_doc) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/helpers/hyrax/collections_helper.rb', line 11 def render_collection_links(solr_doc) collection_list = Hyrax::CollectionMemberService.run(solr_doc) return if collection_list.empty? links = collection_list.map do |collection| link_to collection.title_or_label, collection_path(collection.id) end content_tag :span, safe_join([t('hyrax.collection.is_part_of'), ': '] + links) end |
#single_item_action_remove_form_fields(form, document) ⇒ Object
add hidden fields to a form for removing a single document from a collection
34 35 36 |
# File 'app/helpers/hyrax/collections_helper.rb', line 34 def single_item_action_remove_form_fields(form, document) single_item_action_form_fields(form, document, 'remove') end |