Module: RocketCMS::Models::Page
Constant Summary
Constants included
from Seoable
Seoable::FIELDS, Seoable::LOCALIZED_FIELDS
Instance Method Summary
collapse
Methods included from SeoHelpers
#get_og_title, #page_title
Instance Method Details
#clean_regexp ⇒ Object
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/rocket_cms/models/page.rb', line 61
def clean_regexp
if regexp.blank?
/^#{regexp_prefix}#{Regexp.escape(fullpath)}$/
else
begin
/#{regexp}/
rescue
/#{Regexp.escape(regexp)}/
end
end
end
|
#get_fullpath ⇒ Object
26
27
28
|
# File 'lib/rocket_cms/models/page.rb', line 26
def get_fullpath
redirect.blank? ? fullpath : redirect
end
|
#has_content? ⇒ Boolean
30
31
32
|
# File 'lib/rocket_cms/models/page.rb', line 30
def has_content?
@content_used.nil? && !content.blank?
end
|
#is_current?(url) ⇒ Boolean
49
50
51
52
53
54
55
|
# File 'lib/rocket_cms/models/page.rb', line 49
def is_current?(url)
if fullpath == '/'
url == '/'
else
url.match(clean_regexp)
end
end
|
#nav_options ⇒ Object
74
75
76
|
# File 'lib/rocket_cms/models/page.rb', line 74
def nav_options
{highlights_on: clean_regexp}
end
|
#page_content ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/rocket_cms/models/page.rb', line 34
def page_content
if @content_used.nil?
@content_used = true
if content.nil?
''
else
content.gsub(/\{\{(.*?)\}\}/) do
Settings.get($1).val
end
end
else
''
end
end
|
#regexp_prefix ⇒ Object
57
58
59
|
# File 'lib/rocket_cms/models/page.rb', line 57
def regexp_prefix
""
end
|