Module: Templates::PageExtensions

Defined in:
lib/templates/page_extensions.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/templates/page_extensions.rb', line 3

def self.included(base)
  base.class_eval do
    before_save :match_with_template

    def allowed_children
      [default_child, Template.all].flatten
    end

  end
end

Instance Method Details

#is_a_blank_page?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/templates/page_extensions.rb', line 25

def is_a_blank_page?
  ! template_id?
end

#match_with_templateObject



14
15
16
17
18
19
# File 'lib/templates/page_extensions.rb', line 14

def match_with_template
  unless self.template.blank?
    self.class_name = self.template.page_class_name
    self.layout_id = self.template.layout_id
  end
end

#template_nameObject



21
22
23
# File 'lib/templates/page_extensions.rb', line 21

def template_name
  template ? template.name : "Blank Page"
end