Class: Maglev::Editor::SectionBlocksController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Maglev::Editor::SectionBlocksController
- 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
20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/maglev/editor/section_blocks_controller.rb', line 20 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
49 50 51 52 53 54 55 56 |
# File 'app/controllers/maglev/editor/section_blocks_controller.rb', line 49 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
31 |
# File 'app/controllers/maglev/editor/section_blocks_controller.rb', line 31 def edit; end |
#index ⇒ Object
12 13 14 |
# File 'app/controllers/maglev/editor/section_blocks_controller.rb', line 12 def index @blocks = @section.blocks end |
#show ⇒ Object
16 17 18 |
# File 'app/controllers/maglev/editor/section_blocks_controller.rb', line 16 def show redirect_to edit_editor_section_block_path(params[:section_id], params[:id], maglev_editing_route_context) end |
#sort ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'app/controllers/maglev/editor/section_blocks_controller.rb', line 38 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
33 34 35 36 |
# File 'app/controllers/maglev/editor/section_blocks_controller.rb', line 33 def update update_section_block flash.now[:notice] = flash_t(:success) end |