Class: Pageflow::StorylinesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Pageflow::StorylinesController
- Defined in:
- app/controllers/pageflow/storylines_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/pageflow/storylines_controller.rb', line 7 def create entry = DraftEntry.find(params[:entry_id]) storyline = entry.storylines.build(storyline_params) (:create, storyline) verify_edit_lock!(entry.to_model) storyline.save respond_with(storyline) end |
#destroy ⇒ Object
51 52 53 54 55 56 57 58 59 60 |
# File 'app/controllers/pageflow/storylines_controller.rb', line 51 def destroy storyline = Storyline.find(params[:id]) (:destroy, storyline) verify_edit_lock!(storyline.entry) storyline.destroy respond_with(storyline) end |
#order ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/pageflow/storylines_controller.rb', line 39 def order entry = DraftEntry.find(params[:entry_id]) (:edit_outline, entry.to_model) verify_edit_lock!(entry) params.require(:ids).each_with_index do |id, index| entry.storylines.find(id).update(position: index) end head :no_content end |
#scaffold ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/pageflow/storylines_controller.rb', line 18 def scaffold entry = DraftEntry.find(params[:entry_id]) storyline_scaffold = StorylineScaffold.build(entry, storyline_params, params.slice(:depth)) (:create, storyline_scaffold.to_model) verify_edit_lock!(entry.to_model) storyline_scaffold.save! respond_with(storyline_scaffold) end |
#update ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/pageflow/storylines_controller.rb', line 29 def update storyline = Storyline.find(params[:id]) (:update, storyline) verify_edit_lock!(storyline.entry) storyline.update(storyline_params) respond_with(storyline) end |