Sha256: e97c09a82c92f7db12b7468f0c617f844fdd343979e3a3d2c933f6f92cd2484a

Contents?: true

Size: 1.55 KB

Versions: 9

Compression:

Stored size: 1.55 KB

Contents

# frozen_string_literal: true

module BootstrapLeather
  # Helpers to add things to the head (and foot) of the html document
  module HeadHelper
    def responsive_meta_tag
      tag(
        :meta,
        name: :viewport,
        content: 'width=device-width, initial-scale=1.0'
      )
    end

    def add_title(title)
      content_for :title, title
    end

    def add_subtitle(subtitle)
      content_for :subtitle, subtitle
    end

    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

    def add_description(description)
      content_for :description, description
    end

    def render_description
      description = content_for(:description)
      description ||= BootstrapLeather.configuration.application_description
      tag(
        :meta,
        name: :description,
        content: description
      )
    end

    def add_keywords(keywords)
      content_for :keywords, keywords
    end

    def render_keywords
      keywords = content_for(:keywords)
      keywords ||= BootstrapLeather.configuration.application_keywords
      tag(
        :meta,
        name: :keywords,
        content: keywords
      )
    end

    def add_head_css(&block)
      content_for :head_css, &block
    end

    def render_head_css
      render(partial: 'bootstrap_leather/head/head_css')
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bootstrap_leather-0.10.13 app/helpers/bootstrap_leather/head_helper.rb
bootstrap_leather-0.10.11 app/helpers/bootstrap_leather/head_helper.rb
bootstrap_leather-0.10.10 app/helpers/bootstrap_leather/head_helper.rb
bootstrap_leather-0.10.9 app/helpers/bootstrap_leather/head_helper.rb
bootstrap_leather-0.10.8 app/helpers/bootstrap_leather/head_helper.rb
bootstrap_leather-0.10.7 app/helpers/bootstrap_leather/head_helper.rb
bootstrap_leather-0.10.6 app/helpers/bootstrap_leather/head_helper.rb
bootstrap_leather-0.10.5 app/helpers/bootstrap_leather/head_helper.rb
bootstrap_leather-0.10.4 app/helpers/bootstrap_leather/head_helper.rb