Class: Spree::Admin::PageSectionsController
- Inherits:
-
ResourceController
- Object
- ResourceController
- Spree::Admin::PageSectionsController
show all
- Includes:
- PageBuilderConcern
- Defined in:
- app/controllers/spree/admin/page_sections_controller.rb
Instance Method Summary
collapse
#collection_url, #create_turbo_stream_enabled?, #default_url_options, #location_after_save, #set_variables, #update_turbo_stream_enabled?
Instance Method Details
#create ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'app/controllers/spree/admin/page_sections_controller.rb', line 8
def create
page_section_type = params.dig(:page_section, :type)
allowed_types = available_page_section_types.map(&:to_s)
if allowed_types.include?(page_section_type)
section_class = available_page_section_types.find { |type| type.to_s == page_section_type }
if section_class
@page_section = section_class.new(permitted_resource_params)
@page_section.pageable = @pageable
@page_section.save!
end
end
end
|
#destroy ⇒ Object
24
25
26
|
# File 'app/controllers/spree/admin/page_sections_controller.rb', line 24
def destroy
@page_section.destroy if @page_section.can_be_deleted?
end
|
#move_higher ⇒ Object
28
29
30
31
32
33
34
|
# File 'app/controllers/spree/admin/page_sections_controller.rb', line 28
def move_higher
if @page_section.first?
head :ok
else
@page_section.move_higher
end
end
|
#move_lower ⇒ Object
36
37
38
39
40
41
42
|
# File 'app/controllers/spree/admin/page_sections_controller.rb', line 36
def move_lower
if @page_section.last?
head :ok
else
@page_section.move_lower
end
end
|
#restore_design_settings_to_defaults ⇒ Object
44
45
46
|
# File 'app/controllers/spree/admin/page_sections_controller.rb', line 44
def restore_design_settings_to_defaults
@page_section.restore_design_settings_to_defaults
end
|