Module: Blacklight::LayoutHelperBehavior
- Included in:
- BlacklightHelperBehavior
- Defined in:
- app/helpers/blacklight/layout_helper_behavior.rb
Overview
A module for useful methods used in layout configuration
Instance Method Summary collapse
-
#container_classes ⇒ String
Class used for specifying main layout container classes.
-
#extra_body_classes ⇒ Array<String>
List of classes to be applied to the <body> element.
-
#html_tag_attributes ⇒ Hash
Attributes to add to the <html> tag (e.g. lang and dir).
-
#main_content_classes ⇒ String
Classes used for sizing the main content of a Blacklight page.
-
#opensearch_description_tag(title, href) ⇒ String
Open Search discovery tag for HTML <head> links.
-
#render_body_class ⇒ String
Render classes for the <body> element.
-
#render_link_rel_alternates(document = @document, options = {}) ⇒ String
Create <link rel=“alternate”> links from a documents dynamically provided export formats.
-
#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.
-
#render_page_title ⇒ String
Get the page’s HTML title.
-
#show_content_classes ⇒ String
Classes added to a document’s show content div.
-
#show_sidebar_classes ⇒ String
Classes added to a document’s sidebar div.
-
#sidebar_classes ⇒ String
Classes used for sizing the sidebar content of a Blacklight page.
Instance Method Details
#container_classes ⇒ String
Class used for specifying main layout container classes. Set config.full_width_layout to true to use a fluid layout.
47 48 49 |
# File 'app/helpers/blacklight/layout_helper_behavior.rb', line 47 def container_classes blacklight_config.full_width_layout ? 'container-fluid' : 'container' end |
#extra_body_classes ⇒ Array<String>
List of classes to be applied to the <body> element
106 107 108 |
# File 'app/helpers/blacklight/layout_helper_behavior.rb', line 106 def extra_body_classes @extra_body_classes ||= ["blacklight-#{controller.controller_name}", "blacklight-#{[controller.controller_name, controller.action_name].join('-')}"] end |
#html_tag_attributes ⇒ Hash
Attributes to add to the <html> tag (e.g. lang and dir)
18 19 20 |
# File 'app/helpers/blacklight/layout_helper_behavior.rb', line 18 def html_tag_attributes { lang: I18n.locale } end |
#main_content_classes ⇒ String
Classes used for sizing the main content of a Blacklight page
32 33 34 |
# File 'app/helpers/blacklight/layout_helper_behavior.rb', line 32 def main_content_classes 'col-lg-9' end |
#opensearch_description_tag(title, href) ⇒ String
Open Search discovery tag for HTML <head> links
65 66 67 |
# File 'app/helpers/blacklight/layout_helper_behavior.rb', line 65 def opensearch_description_tag title, href tag :link, href: href, title: title, type: "application/opensearchdescription+xml", rel: "search" end |
#render_body_class ⇒ String
Render classes for the <body> element
98 99 100 |
# File 'app/helpers/blacklight/layout_helper_behavior.rb', line 98 def render_body_class extra_body_classes.join " " end |
#render_link_rel_alternates(document = @document, options = {}) ⇒ String
Create <link rel=“alternate”> links from a documents dynamically provided export formats.
Returns empty string if no links available.
89 90 91 92 93 |
# File 'app/helpers/blacklight/layout_helper_behavior.rb', line 89 def render_link_rel_alternates(document = @document, = {}) return if document.nil? document_presenter(document).link_rel_alternates() 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
58 59 60 |
# File 'app/helpers/blacklight/layout_helper_behavior.rb', line 58 def render_nav_actions( = {}, &block) render_filtered_partials(blacklight_config..partials, , &block) end |
#render_page_title ⇒ String
Get the page’s HTML title
73 74 75 |
# File 'app/helpers/blacklight/layout_helper_behavior.rb', line 73 def render_page_title (content_for(:page_title) if content_for?(:page_title)) || @page_title || application_name end |
#show_content_classes ⇒ String
Classes added to a document’s show content div
11 12 13 |
# File 'app/helpers/blacklight/layout_helper_behavior.rb', line 11 def show_content_classes "#{main_content_classes} show-document" end |
#show_sidebar_classes ⇒ String
Classes added to a document’s sidebar div
25 26 27 |
# File 'app/helpers/blacklight/layout_helper_behavior.rb', line 25 def end |
#sidebar_classes ⇒ String
Classes used for sizing the sidebar content of a Blacklight page
39 40 41 |
# File 'app/helpers/blacklight/layout_helper_behavior.rb', line 39 def 'page-sidebar col-lg-3' end |