Sha256: 60bde76c44865b22c06021695f4d659ce7f0572d59b1b6442e1823ef5f26fb85

Contents?: true

Size: 512 Bytes

Versions: 2

Compression:

Stored size: 512 Bytes

Contents

require 'type_station/blocks/base'

module TypeStation
  module Blocks
    class StaticLink < Base

      def render(content)
        content_tag(tag_name, content.html_safe, class: tag_class, href: href)
      end
      
      private

      def tag_name
        options[:content_tag] || :a
      end

      def tag_class
        options[:class]
      end

      def tag_data
        {}
      end

      def href 
        model.try(key).try(:value) || options[:default] || '#nolink'
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
type_station-0.1.3 lib/type_station/blocks/static_link.rb
type_station-0.1.1 lib/type_station/blocks/static_link.rb