Method: Effective::CrudController::Dsl#submit
- Defined in:
- app/controllers/concerns/effective/crud_controller/dsl.rb
#submit(action, label, args = {}) ⇒ Object
This controls the form submit options of effective_submit Takes precidence over any ‘on’ dsl commands
Effective::Resource will populate this with all crud actions And you can control the details with this DSL:
submit :approve, ‘Save and Approve’, unless: -> { resource.approved? }, redirect: :show
submit :toggle, ‘Blacklist’, if: -> { sync? }, class: ‘btn btn-primary’ submit :toggle, ‘Whitelist’, if: -> { !sync? }, class: ‘btn btn-primary’ submit :save, ‘Save’, success: -> { “#Effective::CrudController#resource was saved okay!” }
37 38 39 40 41 |
# File 'app/controllers/concerns/effective/crud_controller/dsl.rb', line 37 def submit(action, label, args = {}) instance_exec do before_action { _insert_submit(action, label, args) } end end |