Sha256: 5e3bd7547a523f78a8bf05313652613590ea07d65af86815261dd4c7942ab9d1

Contents?: true

Size: 685 Bytes

Versions: 12

Compression:

Stored size: 685 Bytes

Contents

module Alchemy
  module Ingredients
    class LinkView < BaseView
      attr_reader :link_text

      # @param ingredient [Alchemy::Ingredient]
      # @param text [String] The link text. If not given, the ingredient's text setting or the value will be used.
      # @param html_options [Hash] Options that will be passed to the a tag.
      def initialize(ingredient, text: nil, html_options: {})
        super(ingredient, html_options: html_options)
        @link_text = settings_value(:text, value: text, default: value)
      end

      def call
        link_to(link_text, value, {target: ingredient.link_target.presence}.merge(html_options)).html_safe
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
alchemy_cms-7.3.4 app/components/alchemy/ingredients/link_view.rb
alchemy_cms-7.3.3 app/components/alchemy/ingredients/link_view.rb
alchemy_cms-7.3.2 app/components/alchemy/ingredients/link_view.rb
alchemy_cms-7.2.7 app/components/alchemy/ingredients/link_view.rb
alchemy_cms-7.3.1 app/components/alchemy/ingredients/link_view.rb
alchemy_cms-7.3.0 app/components/alchemy/ingredients/link_view.rb
alchemy_cms-7.2.6 app/components/alchemy/ingredients/link_view.rb
alchemy_cms-7.2.5 app/components/alchemy/ingredients/link_view.rb
alchemy_cms-7.2.4 app/components/alchemy/ingredients/link_view.rb
alchemy_cms-7.2.3 app/components/alchemy/ingredients/link_view.rb
alchemy_cms-7.2.2 app/components/alchemy/ingredients/link_view.rb
alchemy_cms-7.2.1 app/components/alchemy/ingredients/link_view.rb