Module: Worthwhile::CollectionsHelper
- Included in:
- MainAppHelpers
- Defined in:
- app/helpers/worthwhile/collections_helper.rb
Instance Method Summary collapse
- #collection_modal_id(collectible) ⇒ Object
- #collection_options_for_select(exclude_item = nil) ⇒ Object
- #has_collection_search_parameters? ⇒ Boolean
- #icon(type) ⇒ Object
-
#link_to_remove_from_collection(document, label = 'Remove From Collection') ⇒ Object
override hydra-collections.
- #link_to_select_collection(collectible, opts = {}) ⇒ Object
Instance Method Details
#collection_modal_id(collectible) ⇒ Object
6 7 8 |
# File 'app/helpers/worthwhile/collections_helper.rb', line 6 def collection_modal_id(collectible) "#{collectible.to_param.gsub(/:/, '-')}-modal" end |
#collection_options_for_select(exclude_item = nil) ⇒ Object
30 31 32 |
# File 'app/helpers/worthwhile/collections_helper.rb', line 30 def (exclude_item = nil) (available_collections(exclude_item)) end |
#has_collection_search_parameters? ⇒ Boolean
2 3 4 |
# File 'app/helpers/worthwhile/collections_helper.rb', line 2 def has_collection_search_parameters? params[:cq].present? end |
#icon(type) ⇒ Object
26 27 28 |
# File 'app/helpers/worthwhile/collections_helper.rb', line 26 def icon(type) content_tag :span, '', class: "glyphicon glyphicon-#{type}" end |
#link_to_remove_from_collection(document, label = 'Remove From Collection') ⇒ Object
override hydra-collections
19 20 21 22 23 24 |
# File 'app/helpers/worthwhile/collections_helper.rb', line 19 def link_to_remove_from_collection(document, label = 'Remove From Collection') link_to collections.collection_path(@collection.id, collection: { members: 'remove'}, batch_document_ids: [ document.id ]), method: :put do icon('minus-sign') + ' ' + label end end |
#link_to_select_collection(collectible, opts = {}) ⇒ Object
10 11 12 13 14 15 16 |
# File 'app/helpers/worthwhile/collections_helper.rb', line 10 def link_to_select_collection(collectible, opts={}) html_class = opts[:class] link_to '#', data: { toggle: "modal", target: '#' + collection_modal_id(collectible) }, class: "add-to-collection #{html_class}", title: "Add #{collectible.human_readable_type} to Collection" do icon('plus-sign') + ' Add to a Collection' end end |