Sha256: 9bce02c87f6577d871701c8d983cc032c0834d6e2574dfdc4483557e1f11beed

Contents?: true

Size: 697 Bytes

Versions: 1

Compression:

Stored size: 697 Bytes

Contents

module Tuning
  module ActionView
    module Base
      extend ActiveSupport::Concern

      included do
        alias_method_chain :submit_tag, :button
      end

      def conditional_tag(tag, condition, options=nil, &block)
        condition ? content_tag(tag, options, &block) : capture(&block)
      end

      def active_menu?(path)
        if path == '/'
          request.path == path ? 'active' : ''
        else
          request.path.start_with?(path) ? 'active' : ''
        end
      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.0.9 lib/tuning/action_view/base.rb