Class: Maglev::Editor::SectionBlocksController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Maglev::Editor::SectionBlocksController
- Includes:
- LockVersionConcern
- Defined in:
- app/controllers/maglev/editor/section_blocks_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #show ⇒ Object
- #sort ⇒ Object
- #update ⇒ Object
Methods included from ResourceIdConcern
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/maglev/editor/section_blocks_controller.rb', line 21 def create services.add_section_block.call( page: current_maglev_page, section_id: @section.id, block_type: params[:block_type], parent_id: params[:parent_id], lock_version: params[:lock_version] ) redirect_to_section_blocks_path end |
#destroy ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'app/controllers/maglev/editor/section_blocks_controller.rb', line 51 def destroy services.delete_section_block.call( page: current_maglev_page, section_id: params[:section_id], block_id: params[:id] ) redirect_to_section_blocks_path end |
#edit ⇒ Object
32 |
# File 'app/controllers/maglev/editor/section_blocks_controller.rb', line 32 def edit; end |
#index ⇒ Object
13 14 15 |
# File 'app/controllers/maglev/editor/section_blocks_controller.rb', line 13 def index @blocks = @section.blocks end |
#show ⇒ Object
17 18 19 |
# File 'app/controllers/maglev/editor/section_blocks_controller.rb', line 17 def show redirect_to edit_editor_section_block_path(params[:section_id], params[:id], maglev_editing_route_context) end |
#sort ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/maglev/editor/section_blocks_controller.rb', line 40 def sort services.sort_section_blocks.call( page: current_maglev_page, section_id: @section.id, block_ids: params[:item_ids], parent_id: params[:parent_id], lock_version: params[:lock_version] ) redirect_to_section_blocks_path end |
#update ⇒ Object
34 35 36 37 38 |
# File 'app/controllers/maglev/editor/section_blocks_controller.rb', line 34 def update update_section_block reload_lock_source flash.now[:notice] = flash_t(:success) end |