2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/simple_form_ext/ext/wrapped_button.rb', line 2
def wrapped_button(*args, &block)
template.content_tag :div, :class => "form-actions" do
options = args.
loading = self.object.new_record? ? I18n.t('simple_form.creating') : I18n.t('simple_form.updating')
options[:"data-loading-text"] = [loading, options[:"data-loading-text"]].compact
options[:class] = ['btn-primary', options[:class]].compact
args << options
if cancel = options.delete(:cancel)
submit(*args, &block) + ' ' + I18n.t('simple_form.buttons.or') + ' ' + template.link_to(I18n.t('simple_form.buttons.cancel'), cancel)
else
submit(*args, &block)
end
end
end
|