Sha256: 2026297f8a8097ff466733d4eb183cd9a4b741536eb2ecea2f6d18e637a72db3

Contents?: true

Size: 852 Bytes

Versions: 40

Compression:

Stored size: 852 Bytes

Contents

module Optimacms
  module SimpleFormExtensions
    module ButtonComponents
      def submit_cancel(*args, &block)
        template.content_tag :div, :class => "form-group" do
        template.content_tag :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

    end

    SimpleForm::FormBuilder.send :include, ButtonComponents
  end
end


Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
optimacms-0.2.13 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.2.12 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.2.11 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.2.9 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.2.3 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.1.59 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.1.58 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.1.57 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.1.56 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.1.54 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.1.51 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.1.50 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.1.49 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.1.48 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.1.47 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.1.45 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.1.44 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.1.43 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.1.41 lib/optimacms/simple_form_extensions/button_components.rb
optimacms-0.1.40 lib/optimacms/simple_form_extensions/button_components.rb