Module: RocketCMS::Models::Page
Instance Method Summary
collapse
Methods included from ManualSlug
#text_slug, #text_slug=
Methods included from Seoable
admin, #get_og_title, #page_title, seo_config
Instance Method Details
#clean_regexp ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/rocket_cms/models/page.rb', line 68
def clean_regexp
if regexp.blank?
/^#{Regexp.escape(fullpath)}$/
else
begin
/#{regexp}/
rescue
/#{Regexp.escape(regexp)}/
end
end
end
|
#get_fullpath ⇒ Object
37
38
39
|
# File 'lib/rocket_cms/models/page.rb', line 37
def get_fullpath
redirect.blank? ? fullpath : redirect
end
|
#has_content? ⇒ Boolean
41
42
43
|
# File 'lib/rocket_cms/models/page.rb', line 41
def has_content?
@content_used.nil? && !content.blank?
end
|
#is_current?(url) ⇒ Boolean
60
61
62
63
64
65
66
|
# File 'lib/rocket_cms/models/page.rb', line 60
def is_current?(url)
if fullpath == '/'
url == '/'
else
url.match(clean_regexp)
end
end
|
#nav_options ⇒ Object
81
82
83
|
# File 'lib/rocket_cms/models/page.rb', line 81
def nav_options
{highlights_on: clean_regexp}
end
|
#page_content ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/rocket_cms/models/page.rb', line 45
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
|