simple_form_extensions.rb revision 25f979bdee494bf6a6aeb54d753352832212dd24
904N/A# https://github.com/plataformatec/simple_form/wiki/Twitter-Bootstrap-v2-and-simple_form-v2
904N/Amodule WrappedButton
904N/A def wrapped_button(*args, &block)
904N/A template.content_tag :div, :class => "form-group" do
904N/A template.content_tag :div, class: 'col-lg-offset-2 col-lg-10' do
904N/A options = args.extract_options!
904N/A loading = self.object.new_record? ? I18n.t('simple_form.creating') : I18n.t('simple_form.updating')
904N/A options["data-disable-with"] = [loading, options["data-disable-with"]].compact
904N/A options[:class] = ['btn btn-primary', options[:class]].compact
904N/A args << options
904N/A if cancel = options.delete(:cancel)
904N/A submit(*args, &block) + ' ' + I18n.t('simple_form.buttons.or') + ' ' + template.link_to(I18n.t('simple_form.buttons.cancel'), cancel)
904N/A else
904N/A submit(*args, &block)
904N/A end
904N/A end
904N/A end
904N/A end
904N/Aend
904N/A
3469N/ASimpleForm::FormBuilder.send :include, WrappedButton
904N/A