show page for pages (a start)
This commit is contained in:
@ -1,13 +1,18 @@
|
||||
module Merged
|
||||
class Page < ViewBase
|
||||
|
||||
fields :name , :type , :options
|
||||
|
||||
fields :name , :tempate
|
||||
alias :template :type
|
||||
|
||||
def sections
|
||||
Section.where(page_id: id).order(index: :asc)
|
||||
end
|
||||
|
||||
def template_style
|
||||
PageStyle.find_by_type( type )
|
||||
end
|
||||
|
||||
def new_section(section_template)
|
||||
section_template = "section_spacer" if section_template.blank?
|
||||
section = Section.new_section(section_template, self.id , sections.length + 1)
|
||||
|
@ -11,6 +11,10 @@ module Merged
|
||||
Card.where(section_id: id).order(index: :asc)
|
||||
end
|
||||
|
||||
def template_style
|
||||
SectionStyle.find_by_template( template )
|
||||
end
|
||||
|
||||
def set_template(new_template)
|
||||
self.template = new_template
|
||||
new_style = template_style
|
||||
|
@ -10,10 +10,6 @@ module Merged
|
||||
|
||||
fields :options , :updated_at , :updated_by
|
||||
|
||||
def template_style
|
||||
SectionStyle.find_by_template( template )
|
||||
end
|
||||
|
||||
def has_option?(option)
|
||||
options.has_key?(option) and !options[option].blank?
|
||||
end
|
||||
|
Reference in New Issue
Block a user