Method: EffectiveResourcesHelper#simple_form_submit
- Defined in:
- app/helpers/effective_resources_helper.rb
#simple_form_submit(form, options = {}, &block) ⇒ Object
effective_form_inputs
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/helpers/effective_resources_helper.rb', line 18 def simple_form_submit(form, = {}, &block) actions = controller.try(:submits) || raise('controller must be an Effective::CrudController') actions = permitted_resource_actions(form.object, actions) submits = actions.map { |name, opts| form.(:submit, name, opts.except(:action, :title, 'data-method')) } # I think this is a bug. I can't override default button class when passing my own class: variable. it merges them. if (btn_class = SimpleForm.).present? submits = submits.map { |submit| submit.sub(btn_class, '') } end submits = submits.join(' ').html_safe = { class: 'form-actions' }.merge(.delete(:wrapper_html) || {}) content_tag(:div, ) do (block_given? ? capture(&block) : ''.html_safe) + submits end end |