Module: Blacklight::ComponentHelperBehavior

Included in:
CatalogHelperBehavior
Defined in:
app/helpers/blacklight/component_helper_behavior.rb

Instance Method Summary collapse

Instance Method Details

#document_actions(document, options: {}) ⇒ Object



47
48
49
# File 'app/helpers/blacklight/component_helper_behavior.rb', line 47

def document_actions(document, options: {})
  filter_partials(blacklight_config.view_config(:show).document_actions, { document: document }.merge(options)).map { |_k, v| v }
end

#render_index_doc_actions(document, wrapping_class: "index-document-functions", component: Blacklight::Document::ActionsComponent) ⇒ String

Render “document actions” area for search results view (normally renders next to title in the list view)

Parameters:

  • document (SolrDocument)
  • wrapping_class (String) (defaults to: "index-document-functions")

    (“index-document-functions”)

  • component (Class) (defaults to: Blacklight::Document::ActionsComponent)

    (Blacklight::Document::ActionsComponent)

Returns:

  • (String)


24
25
26
27
28
# File 'app/helpers/blacklight/component_helper_behavior.rb', line 24

def render_index_doc_actions(document, wrapping_class: "index-document-functions", component: Blacklight::Document::ActionsComponent)
  actions = filter_partials(blacklight_config.view_config(document_index_view_type).document_actions, { document: document }).map { |_k, v| v }

  render(component.new(document: document, actions: actions, classes: wrapping_class))
end

#render_nav_actions(options = {}, &block) ⇒ String

Render “document actions” area for navigation header (normally renders “Saved Searches”, “History”, “Bookmarks”) These things are added by add_nav_action

Parameters:

  • options (Hash) (defaults to: {})

Returns:

  • (String)


12
13
14
# File 'app/helpers/blacklight/component_helper_behavior.rb', line 12

def render_nav_actions(options = {}, &block)
  render_filtered_partials(blacklight_config.navbar.partials, options, &block)
end

#render_results_collection_tools(wrapping_class: "search-widgets", component: Blacklight::Document::ActionsComponent) ⇒ String

Render “collection actions” area for search results view (normally renders next to pagination at the top of the result set)

Parameters:

  • wrapping_class (String) (defaults to: "search-widgets")

    (“search-widgets”)

  • component (Class) (defaults to: Blacklight::Document::ActionsComponent)

    (Blacklight::Document::ActionsComponent)

Returns:

  • (String)


37
38
39
40
41
# File 'app/helpers/blacklight/component_helper_behavior.rb', line 37

def render_results_collection_tools(wrapping_class: "search-widgets", component: Blacklight::Document::ActionsComponent)
  actions = filter_partials(blacklight_config.view_config(document_index_view_type).collection_actions, {}).map { |_k, v| v }

  render(component.new(actions: actions, classes: wrapping_class))
end

#show_doc_actions?(document = @document, options = {}) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
# File 'app/helpers/blacklight/component_helper_behavior.rb', line 43

def show_doc_actions?(document = @document, options = {})
  filter_partials(blacklight_config.view_config(:show).document_actions, { document: document }.merge(options)).any?
end