Module: FlexaFormtasticBootstrap::Helpers::ButtonsHelper
- Defined in:
- lib/flexa_formtastic_bootstrap/helpers/buttons_helper.rb
Instance Method Summary collapse
-
#buttons(*args, &block) ⇒ Object
include Formtastic::Helpers::ButtonsHelper.
- #commit_button(*args) ⇒ Object
Instance Method Details
#buttons(*args, &block) ⇒ Object
include Formtastic::Helpers::ButtonsHelper
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/flexa_formtastic_bootstrap/helpers/buttons_helper.rb', line 7 def (*args, &block) = args. [:class] ||= "actions" if .has_key?(:name) ActiveSupport::Deprecation.warn('The :name option is not supported') end if block_given? template.content_tag(:div, ) do yield end else args = [:commit] if args.empty? contents = args.map { || send(:"#{}_button") } template.content_tag(:div, .except(:builder, :parent, :name)) do Formtastic::Util.html_safe(contents.join) end end end |
#commit_button(*args) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/flexa_formtastic_bootstrap/helpers/buttons_helper.rb', line 30 def (*args) = args. text = .delete(:label) || args.shift text = (localized_string(, text, :action, :model => ) || Formtastic::I18n.t(, :model => )) unless text.is_a?(::String) = .delete(:button_html) || {} .merge!(:class => [[:class], "btn commit", ].compact.join(' ')) # TODO We don't have a wrapper. Add deprecation message. # wrapper_html = options.delete(:wrapper_html) || {} # wrapper_html[:class] = (commit_button_wrapper_html_class << wrapper_html[:class]).flatten.compact.join(' ') accesskey = (.delete(:accesskey) || ) unless .has_key?(:accesskey) = .merge(:accesskey => accesskey) if accesskey Formtastic::Util.html_safe(submit(text, )) end |