Sha256: 4a3b5e8b089befa0ed537bf35470457bad54f375e1b83c55a610bcb63f89f30f

Contents?: true

Size: 1.49 KB

Versions: 22

Compression:

Stored size: 1.49 KB

Contents

module Binco
  module ButtonLinkHelper
    def button_link_to(name = nil, options = nil, html_options = {}, &block)
      html_options[:type] ||= :default
      html_options[:class] ||= ''
      html_options[:class] << ' ' if html_options[:class].length > 1
      html_options[:class] << "btn btn-#{html_options[:type]}"
      link_to(name, options, html_options.except(:type), &block)
    end

    def button_primary_link_to(name = nil, options = nil, html_options = {}, &block)
      html_options[:type] = :primary
      button_link_to(name, options, html_options, &block)
    end

    def button_default_link_to(name = nil, options = nil, html_options = {}, &block)
      html_options[:type] = :default
      button_link_to(name, options, html_options, &block)
    end

    def button_danger_link_to(name = nil, options = nil, html_options = {}, &block)
      html_options[:type] = :danger
      button_link_to(name, options, html_options, &block)
    end

    def button_warning_link_to(name = nil, options = nil, html_options = {}, &block)
      html_options[:type] = :warning
      button_link_to(name, options, html_options, &block)
    end

    def button_success_link_to(name = nil, options = nil, html_options = {}, &block)
      html_options[:type] = :success
      button_link_to(name, options, html_options, &block)
    end

    def button_info_link_to(name = nil, options = nil, html_options = {}, &block)
      html_options[:type] = :info
      button_link_to(name, options, html_options, &block)
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
binco-0.0.2 app/helpers/binco/button_link_helper.rb
binco-0.0.1 app/helpers/binco/button_link_helper.rb