Cross Reference: simple_form_extensions.rb
xref
: /
ontohub
/
lib
/
simple_form_extensions.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
simple_form_extensions.rb revision 25f979bdee494bf6a6aeb54d753352832212dd24
904
N/A
#
https://github.com/plataformatec/simple_form/wiki/Twitter-Bootstrap-v2-and-simple_form-v2
904
N/A
module
WrappedButton
904
N/A
def
wrapped_button
(*
args
, &
block
)
904
N/A
template.content
_tag
:
div
, :
class
=>
"form-group"
do
904
N/A
template.content
_tag
:
div
,
class
:
'col-lg-offset-2 col-lg-10'
do
904
N/A
options
=
args.extract
_options
!
904
N/A
loading
=
self.object.new
_record
? ?
I18n.t
(
'
simple_form.creating
'
)
:
I18n.t
(
'
simple_form.updating
'
)
904
N/A
options
[
"data-disable-with"
] = [
loading
,
options
[
"data-disable-with"
]].
compact
904
N/A
options
[:
class
] = [
'btn btn-primary'
,
options
[:
class
]].
compact
904
N/A
args
<< options
904
N/A
if cancel = options.delete(:cancel)
904
N/A
submit(*args, &block) + ' ' + I18n.t('simple_form.buttons.or') + ' ' + template.link_to(I18n.t('simple_form.buttons.cancel'), cancel)
904
N/A
else
904
N/A
submit(*args, &block)
904
N/A
end
904
N/A
end
904
N/A
end
904
N/A
end
904
N/A
end
904
N/A
3469
N/A
SimpleForm::FormBuilder.send :include, WrappedButton
904
N/A