Module: RocketCMS::Models::Page
Instance Method Summary
collapse
Methods included from Seoable
admin, #get_og_title, #page_title, seo_config
Instance Method Details
#clean_regexp ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/rocket_cms/models/page.rb', line 55
def clean_regexp
if regexp.blank?
/^#{Regexp.escape(fullpath)}$/
else
begin
/#{regexp}/
rescue
/#{Regexp.escape(regexp)}/
end
end
end
|
#get_fullpath ⇒ Object
24
25
26
|
# File 'lib/rocket_cms/models/page.rb', line 24
def get_fullpath
redirect.blank? ? fullpath : redirect
end
|
#has_content? ⇒ Boolean
28
29
30
|
# File 'lib/rocket_cms/models/page.rb', line 28
def has_content?
@content_used.nil? && !content.blank?
end
|
#is_current?(url) ⇒ Boolean
47
48
49
50
51
52
53
|
# File 'lib/rocket_cms/models/page.rb', line 47
def is_current?(url)
if fullpath == '/'
url == '/'
else
url.match(clean_regexp)
end
end
|
#nav_options ⇒ Object
68
69
70
|
# File 'lib/rocket_cms/models/page.rb', line 68
def nav_options
{highlights_on: clean_regexp}
end
|
#page_content ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/rocket_cms/models/page.rb', line 32
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
|