Module: Blacklight::ComponentHelperBehavior
- Included in:
- CatalogHelperBehavior
- Defined in:
- app/helpers/blacklight/component_helper_behavior.rb
Instance Method Summary collapse
- #document_actions(document, options: {}) ⇒ Object
- #filter_partials(partials, options) ⇒ Object
-
#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).
-
#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).
- #show_doc_actions?(document = @document, options = {}) ⇒ Boolean
Instance Method Details
#document_actions(document, options: {}) ⇒ Object
36 37 38 |
# File 'app/helpers/blacklight/component_helper_behavior.rb', line 36 def document_actions(document, options: {}) filter_partials(blacklight_config.view_config(:show).document_actions, { document: document }.merge()).map { |_k, v| v } end |
#filter_partials(partials, options) ⇒ Object
40 41 42 |
# File 'app/helpers/blacklight/component_helper_behavior.rb', line 40 def filter_partials(partials, ) partials.select { |_, config| blacklight_configuration_context.evaluate_if_unless_configuration config, } 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)
13 14 15 16 17 |
# File 'app/helpers/blacklight/component_helper_behavior.rb', line 13 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_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)
26 27 28 29 30 |
# File 'app/helpers/blacklight/component_helper_behavior.rb', line 26 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
32 33 34 |
# File 'app/helpers/blacklight/component_helper_behavior.rb', line 32 def show_doc_actions?(document = @document, = {}) filter_partials(blacklight_config.view_config(:show).document_actions, { document: document }.merge()).any? end |