Module: Gluttonberg::Content::PageDescriptionInfo

Extended by:
ActiveSupport::Concern
Defined in:
lib/gluttonberg/content/page_description_info.rb

Overview

Mixin which provides page description related funtionality to page model

Instance Method Summary collapse

Instance Method Details

#descriptionObject

Returns the PageDescription associated with this page.



8
9
10
11
# File 'lib/gluttonberg/content/page_description_info.rb', line 8

def description
  @description = PageDescription[self.description_name.to_sym] if self.description_name
  @description
end

#generate_rewrite_path(path) ⇒ Object

Takes a path and rewrites it to point at an alternate route. The idea being that this path points to a controller.



49
50
51
# File 'lib/gluttonberg/content/page_description_info.rb', line 49

def generate_rewrite_path(path)
  path.gsub(current_localization.path, self.description.rewrite_route)
end

#layoutObject

Returns the name of the layout template specified for this page — determined via the associated PageDescription



28
29
30
31
# File 'lib/gluttonberg/content/page_description_info.rb', line 28

def layout
  self.description if @description.blank?
  @description[:layout] if @description
end

#page_optionsObject

Returns the page_options set in the PageDescription



14
15
16
17
# File 'lib/gluttonberg/content/page_description_info.rb', line 14

def page_options
  @page_options = description.options[:page_options]
  @page_options
end

#redirect_required?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/gluttonberg/content/page_description_info.rb', line 33

def redirect_required?
  self.description.redirection_required?
end

#redirect_urlObject



37
38
39
# File 'lib/gluttonberg/content/page_description_info.rb', line 37

def redirect_url
  self.description.redirect_url(self,{})
end

#rewrite_required?Boolean

Indicates if the page is used as a mount point for a public-facing controller, e.g. a blog, message board etc.

Returns:

  • (Boolean)


43
44
45
# File 'lib/gluttonberg/content/page_description_info.rb', line 43

def rewrite_required?
  self.description.rewrite_required?
end

#viewObject

Returns the name of the view template specified for this page — determined via the associated PageDescription



21
22
23
24
# File 'lib/gluttonberg/content/page_description_info.rb', line 21

def view
  self.description if @description.blank?
  @description[:view] if @description
end