Sha256: 03e337eb4cfde7905002c6acf2e212ab1dd99a8ae90553636b7d732c17a5e315

Contents?: true

Size: 635 Bytes

Versions: 22

Compression:

Stored size: 635 Bytes

Contents

module Alchemy
  module Ingredients
    class HeadlineView < BaseView
      def initialize(ingredient, level: nil, html_options: {})
        super(ingredient, html_options: html_options)
        @level = level
      end

      def call
        content_tag tag_name, id: dom_id, class: css_classes do
          ingredient.value
        end.html_safe
      end

      private

      def tag_name = "h#{@level || ingredient.level}"

      def dom_id = ingredient.dom_id.presence

      def css_classes
        [
          ingredient.size ? "h#{ingredient.size}" : nil,
          html_options[:class]
        ]
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
alchemy_cms-7.3.4 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.3.3 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.3.2 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.2.7 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.3.1 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.3.0 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.2.6 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.2.5 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.1.12 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.0.15 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.2.4 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.1.11 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.2.3 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.1.10 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.2.2 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.1.9 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.0.14 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.2.1 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.0.13 app/components/alchemy/ingredients/headline_view.rb
alchemy_cms-7.1.8 app/components/alchemy/ingredients/headline_view.rb