Module: CurationConcerns::CollectionsHelper

Included in:
MainAppHelpers
Defined in:
app/helpers/curation_concerns/collections_helper.rb

Instance Method Summary collapse

Instance Method Details

#collection_modal_id(collectible) ⇒ Object



2
3
4
# File 'app/helpers/curation_concerns/collections_helper.rb', line 2

def collection_modal_id(collectible)
  "#{collectible.to_param.tr(':', '-')}-modal"
end

#collection_options_for_select(exclude_item = nil) ⇒ Object



27
28
29
# File 'app/helpers/curation_concerns/collections_helper.rb', line 27

def collection_options_for_select(exclude_item = nil)
  options_for_select(available_collections(exclude_item))
end

#icon(type) ⇒ Object



23
24
25
# File 'app/helpers/curation_concerns/collections_helper.rb', line 23

def icon(type)
   :span, '', class: "glyphicon glyphicon-#{type}"
end

override hydra-collections



15
16
17
18
19
20
21
# File 'app/helpers/curation_concerns/collections_helper.rb', line 15

def link_to_remove_from_collection(document, label = 'Remove From Collection')
  collection_id = @collection ? @collection.id : @presenter.id
  link_to collection_path(collection_id, collection: { members: 'remove' },
                                         batch_document_ids: [document.id]), method: :put do
    icon('minus-sign') + ' ' + label
  end
end


6
7
8
9
10
11
12
# File 'app/helpers/curation_concerns/collections_helper.rb', line 6

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