# @return [String]
with yielded block
def form_actions(options={})
options = canonicalize_options(options)
options = ensure_class(options, 'form-actions')
content_tag(:div, options) do
yield
end
end
# Returns similar to +#submit_tag()+ but: x
# * styled like a Bootstrap button, type :primary
# * has +:disable_with+ set to "Processing ..."
# See {Bootstrap::ButtonHelper} for documentation on button type and size
# submit_button_tag('Save')
# submit_button_tag('Delete', :danger)
# submit_button_tag('Big', :large)
# submit_button_tag('With Options', :small, :info, id: 'my-id')
# @overload submit_button_tag(text, type, size, options={})
# @param [String] text value of
# @param [String, Symbol] type type of button
# @param [String, Symbol] size size of button
# @param [Hash] options all options except +:disable_with+ become html attributes for tag
# @option options [String, false] :disable_with either override or turn off the disabling of the button
# @return [String]
def submit_button_tag(*args)
options = canonicalize_options(args.extract_options!)
value = if Bootstrap::ButtonHelper::BUTTON_ALL.include?(args.first.to_s)
"Save changes"
else
args.shift.presence || "Save changes"
end
button_classes = if args.present?
args.each { |e| raise(InvalidButtonModifierError, e.inspect) unless
Bootstrap::ButtonHelper::BUTTON_ALL.include?(e.to_s) }
['btn'] + args.map { |e| "btn-#{e}" }
else
['btn', 'btn-primary']
end
options = ensure_class(options, button_classes)
options[:disable_with] = "Processing ..." unless options.has_key?(:disable_with)
submit_tag(value, options)
end
end