Module: RocketCMS::Models::Page

Extended by:
ActiveSupport::Concern
Includes:
Enableable, ManualSlug, ElasticSearch, RocketCMS::Model, Seoable, SitemapData
Included in:
Page
Defined in:
lib/rocket_cms/models/page.rb

Constant Summary

Constants included from SitemapData

SitemapData::SITEMAP_CHANGEFREQ_ARRAY

Constants included from Seoable

Seoable::FIELDS, Seoable::LOCALIZED_FIELDS

Instance Method Summary collapse

Methods included from SitemapData

admin

Methods included from ManualSlug::ActiveRecord

#text_slug, #text_slug=

Methods included from ManualSlug::Mongoid

#text_slug, #text_slug=

Methods included from Seoable

admin, #og_image_jcrop_options

Methods included from SeoHelpers

#get_og_title, #page_title

Instance Method Details

#clean_regexpObject



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/rocket_cms/models/page.rb', line 62

def clean_regexp
  if regexp.blank?
    /^#{regexp_prefix}#{Regexp.escape(fullpath)}$/
  else
    begin
      /#{regexp}/
    rescue
      # not a valid regexp - treat as literal search string
      /#{Regexp.escape(regexp)}/
    end
  end
end

#get_fullpathObject



27
28
29
# File 'lib/rocket_cms/models/page.rb', line 27

def get_fullpath
  redirect.blank? ? fullpath : redirect
end

#has_content?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/rocket_cms/models/page.rb', line 31

def has_content?
  @content_used.nil? && !content.blank?
end

#is_current?(url) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
53
54
55
56
# File 'lib/rocket_cms/models/page.rb', line 50

def is_current?(url)
  if fullpath == '/'
    url == '/'
  else
    url.match(clean_regexp)
  end
end


75
76
77
# File 'lib/rocket_cms/models/page.rb', line 75

def nav_options
  {highlights_on: clean_regexp}
end

#page_contentObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rocket_cms/models/page.rb', line 35

def page_content
  if @content_used.nil?
    @content_used = true
    if content.nil?
      ''
    else
      content.gsub(/\{\{(.*?)\}\}/) do
        Settings ? Settings.get($1).val : "" #temp
      end
    end
  else
    ''
  end
end

#regexp_prefixObject



58
59
60
# File 'lib/rocket_cms/models/page.rb', line 58

def regexp_prefix
  ""
end