Module: HelpersView::RenderButton

Included in:
RailsHtml
Defined in:
lib/helpers_view/render_button.rb

Overview

module RenderButton

Instance Method Summary collapse

Instance Method Details

#render_button_html(options = { text: 'Button', class: 'btn btn-primary', onclick: '', id: '', style: '' }, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/helpers_view/render_button.rb', line 6

def render_button_html(options = { text: 'Button', class: 'btn btn-primary', onclick: '', id: '', style: '' }, &block)
  options[:class] = default_class_button_of_gem(options)
  options[:type] = default_type_button_of_gem(options)
  tag.button(class: options[:class], onclick: options[:onclick], id: options[:id], style: options[:style],
             type: options[:type]) do
    if block_given?
      yield
    else
      default_text_button_of_gem(options)
    end
  end
end