Class: Pageflow::PagesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Pageflow::PagesController
- Defined in:
- app/controllers/pageflow/pages_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/pages_controller.rb', line 7 def create chapter = Chapter.find(params[:chapter_id]) page = chapter.pages.build(page_params) (:create, page) verify_edit_lock!(page.chapter.entry) page.save respond_with(page) end |
#destroy ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/pageflow/pages_controller.rb', line 41 def destroy page = Page.find(params[:id]) (:destroy, page) verify_edit_lock!(page.chapter.entry) page.chapter.entry.snapshot(:creator => current_user) page.destroy respond_with(page) end |
#order ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/pageflow/pages_controller.rb', line 28 def order chapter = Chapter.find(params[:chapter_id]) entry = DraftEntry.new(chapter.entry) (:edit_outline, entry.to_model) verify_edit_lock!(chapter.entry) params.require(:ids).each_with_index do |id, index| entry.pages.find(id).update(chapter_id: chapter.id, position: index) end head :no_content end |
#update ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/pageflow/pages_controller.rb', line 18 def update page = Page.find(params[:id]) (:update, page) verify_edit_lock!(page.chapter.entry) page.update(page_params) respond_with(page) end |