Class: Pageflow::ChaptersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Pageflow::ChaptersController
- Defined in:
- app/controllers/pageflow/chapters_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/chapters_controller.rb', line 7 def create entry = DraftEntry.find(params[:entry_id]) chapter = entry.chapters.build(chapter_params) (:create, chapter) verify_edit_lock!(chapter.entry) chapter.save respond_with(chapter) end |
#destroy ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/pageflow/chapters_controller.rb', line 40 def destroy chapter = Chapter.find(params[:id]) (:destroy, chapter) verify_edit_lock!(chapter.entry) chapter.entry.snapshot(:creator => current_user) chapter.destroy respond_with(chapter) end |
#order ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/pageflow/chapters_controller.rb', line 28 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.chapters.update(id, :position => index) end head :no_content end |
#update ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/pageflow/chapters_controller.rb', line 18 def update chapter = Chapter.find(params[:id]) (:update, chapter) verify_edit_lock!(chapter.entry) chapter.update_attributes(chapter_params) respond_with(chapter) end |