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
# File 'lib/templates/page_extensions.rb', line 3

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

Instance Method Details

#is_a_blank_page?Boolean

Returns:

  • (Boolean)


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

def is_a_blank_page?
  ! template_id?
end

#match_with_templateObject



9
10
11
12
13
14
# File 'lib/templates/page_extensions.rb', line 9

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



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

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