Module: Optimacms::SimpleFormExtensions::ButtonComponents

Defined in:
lib/optimacms/simple_form_extensions/button_components.rb

Instance Method Summary collapse

Instance Method Details

#submit_cancel(*args, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/optimacms/simple_form_extensions/button_components.rb', line 4

def submit_cancel(*args, &block)
  template. :div, :class => "form-group" do
  template. :div, :class => "col-sm-offset-1 col-sm-6" do
    options = args.extract_options!

    # class
    options[:class] = [options[:class], 'btn', 'btn-primary', 'btn-lg'].compact

    #
    args << options


    # with cancel link
    if cancel = options.delete(:cancel)
      submit(*args, &block) + '&nbsp;&nbsp;'.html_safe + template.link_to(I18n.t('simple_form.buttons.cancel'), cancel)
    else
      submit(*args, &block)
    end

  end
  end
end