Class: Spree::Pages::Custom
Instance Method Summary
collapse
Methods inherited from Spree::Page
#create_preview, #custom?, #display_name, #duplicate, #icon_name, #layout_sections?, #preview_url, #store, #theme
#preview?
Instance Method Details
#customizable? ⇒ Boolean
4
5
6
|
# File 'app/models/spree/pages/custom.rb', line 4
def customizable?
true
end
|
#default_sections ⇒ Object
18
19
20
21
22
23
|
# File 'app/models/spree/pages/custom.rb', line 18
def default_sections
[
Spree::PageSections::PageTitle.new,
Spree::PageSections::RichText.new
]
end
|
#linkable? ⇒ Boolean
8
9
10
|
# File 'app/models/spree/pages/custom.rb', line 8
def linkable?
true
end
|
#page_builder_url ⇒ Object
12
13
14
15
16
|
# File 'app/models/spree/pages/custom.rb', line 12
def page_builder_url
return unless page_builder_url_exists?(:page_path)
Spree::Core::Engine.routes.url_helpers.page_path(self)
end
|
25
26
27
28
29
30
31
32
33
34
35
|
# File 'app/models/spree/pages/custom.rb', line 25
def promote
return unless preview?
ApplicationRecord.transaction do
old_page = parent
old_page.page_links.update_all(linkable_id: id)
update(parent: nil)
Spree::Page.find(old_page.id).destroy
update_columns(slug: old_page.slug)
end
end
|