Module: BootstrapLeather::HeadHelper
- Included in:
- ApplicationHelper
- Defined in:
- app/helpers/bootstrap_leather/head_helper.rb
Overview
Helpers to add things to the head (and foot) of the html document
Instance Method Summary collapse
- #add_description(description) ⇒ Object
- #add_head_css(&block) ⇒ Object
- #add_keywords(keywords) ⇒ Object
- #add_subtitle(subtitle) ⇒ Object
- #add_title(title) ⇒ Object
- #render_description ⇒ Object
- #render_head_css ⇒ Object
- #render_keywords ⇒ Object
- #render_title ⇒ Object
- #responsive_meta_tag ⇒ Object
Instance Method Details
#add_description(description) ⇒ Object
31 32 33 |
# File 'app/helpers/bootstrap_leather/head_helper.rb', line 31 def add_description(description) content_for :description, description end |
#add_head_css(&block) ⇒ Object
59 60 61 |
# File 'app/helpers/bootstrap_leather/head_helper.rb', line 59 def add_head_css(&block) content_for :head_css, &block end |
#add_keywords(keywords) ⇒ Object
45 46 47 |
# File 'app/helpers/bootstrap_leather/head_helper.rb', line 45 def add_keywords(keywords) content_for :keywords, keywords end |
#add_subtitle(subtitle) ⇒ Object
18 19 20 |
# File 'app/helpers/bootstrap_leather/head_helper.rb', line 18 def add_subtitle(subtitle) content_for :subtitle, subtitle end |
#add_title(title) ⇒ Object
14 15 16 |
# File 'app/helpers/bootstrap_leather/head_helper.rb', line 14 def add_title(title) content_for :title, title end |
#render_description ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'app/helpers/bootstrap_leather/head_helper.rb', line 35 def render_description description = content_for(:description) description ||= BootstrapLeather.configuration.application_description tag( :meta, name: :description, content: description ) end |
#render_head_css ⇒ Object
63 64 65 |
# File 'app/helpers/bootstrap_leather/head_helper.rb', line 63 def render_head_css render(partial: 'bootstrap_leather/head/head_css') end |
#render_keywords ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'app/helpers/bootstrap_leather/head_helper.rb', line 49 def render_keywords keywords = content_for(:keywords) keywords ||= BootstrapLeather.configuration.application_keywords tag( :meta, name: :keywords, content: keywords ) end |
#render_title ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'app/helpers/bootstrap_leather/head_helper.rb', line 22 def render_title page_title = [] page_title << content_for(:title) page_title << content_for(:subtitle) page_title << BootstrapLeather.configuration.application_title page_title << content_for(:keywords) content_tag :title, CGI.unescapeHTML(page_title.compact.join(': ')) end |
#responsive_meta_tag ⇒ Object
6 7 8 9 10 11 12 |
# File 'app/helpers/bootstrap_leather/head_helper.rb', line 6 def tag( :meta, name: :viewport, content: 'width=device-width, initial-scale=1.0' ) end |