Module: Spurs::Modal::ControllerMods
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/spurs/modal/controller_mods.rb
Instance Method Summary collapse
- #spawn_close_modal(title, file, options = { }) ⇒ Object
- #spawn_form_modal(title, partial, object, options = { }) ⇒ Object
- #spawn_modal(title, partial, object, options = { }) ⇒ Object
Instance Method Details
#spawn_close_modal(title, file, options = { }) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/spurs/modal/controller_mods.rb', line 18 def spawn_close_modal(title, file, ={ }) opts = { :actions => [ { :name => :cancel, :position => :left, :action => :close_modal, :class => "btn-large" } ] }.merge() spawn_modal(title, file, nil, opts) end |
#spawn_form_modal(title, partial, object, options = { }) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/spurs/modal/controller_mods.rb', line 6 def spawn_form_modal(title, partial, object, ={ }) opts = { :actions => [ { :name => :cancel, :position => :left, :action => :close_modal, :class => "btn-large" }, { :name => :save, :position => :right, :action => :submit_form_and_close_modal, :class => "btn-primary btn-large" }, ] }.merge() spawn_modal(title, partial, object, opts) end |
#spawn_modal(title, partial, object, options = { }) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/spurs/modal/controller_mods.rb', line 29 def spawn_modal(title, partial, object, ={ }) opts = { :header => { :title => title.titlecase, :icon => [:title_icon] ? .delete(:title_icon) : nil }, }.merge() render :file => "spurs/modals/spawn", :locals => { :modal_file_or_partial => partial, :modal_object => object, :modal_options => opts } end |