Sha256: 8898f55306ee353ca83d4d798869206c63fd16ac7f2b5189ee2865a756ed6606

Contents?: true

Size: 861 Bytes

Versions: 1

Compression:

Stored size: 861 Bytes

Contents

module Tuning
  module ActionView
    module Base
      extend ActiveSupport::Concern

      included do
        alias_method_chain :submit_tag, :button
      end

      def set_meta(*args)
        options = args.extract_options!
        @meta_title = t('.meta.title', options)
        @meta_keywords = t('.meta.keywords', options)
        @meta_description = t('.meta.description', options)
      end

      def content_tag_if(condition, name, options=nil, &block)
        condition ? content_tag(name, options, &block) : capture(&block)
      end

      def active_trail?(path)
        (path == '/' && request.path == path) or request.path.start_with?(path)
      end

      def submit_tag_with_button(value='Send', options={})
        button_tag({ type: 'submit', name: 'commit' }.update(options)) { content_tag(:span, value) }
      end
 
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tuning-0.1.2 lib/tuning/action_view/base.rb