Module: Enjoy::Models::Page
Constant Summary
SitemapDataField::FIELDS
Constants included
from Seoable
Seoable::FIELDS, Seoable::LOCALIZED_FIELDS
Instance Method Summary
collapse
Methods included from Seoable
#get_og_title, #og_image_jcrop_options, #page_title
#text_slug, #text_slug=
#text_slug, #text_slug=
Instance Method Details
#clean_regexp ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/enjoy/models/page.rb', line 68
def clean_regexp
if regexp.blank?
/^#{regexp_prefix}#{Regexp.escape(fullpath)}$/
else
begin
/#{regexp}/
rescue
/#{Regexp.escape(regexp)}/
end
end
end
|
#get_fullpath ⇒ Object
33
34
35
|
# File 'lib/enjoy/models/page.rb', line 33
def get_fullpath
redirect.blank? ? fullpath : redirect
end
|
#has_content? ⇒ Boolean
37
38
39
|
# File 'lib/enjoy/models/page.rb', line 37
def has_content?
@content_used.nil? && !content.blank?
end
|
#is_current?(url) ⇒ Boolean
56
57
58
59
60
61
62
|
# File 'lib/enjoy/models/page.rb', line 56
def is_current?(url)
if fullpath == '/'
url == '/'
else
url.match(clean_regexp)
end
end
|
#nav_options ⇒ Object
81
82
83
|
# File 'lib/enjoy/models/page.rb', line 81
def nav_options
{highlights_on: clean_regexp}
end
|
#page_content ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/enjoy/models/page.rb', line 41
def page_content
if @content_used.nil?
@content_used = true
if content.nil?
''
else
content.gsub(/\{\{(.*?)\}\}/) do
Settings ? Settings.get($1).val : ""
end
end
else
''
end
end
|
#page_h1 ⇒ Object
26
27
28
29
30
31
|
# File 'lib/enjoy/models/page.rb', line 26
def page_h1
_ret = seo ? seo.h1 : nil
_ret = name if _ret.blank?
_ret = title if _ret.blank?
_ret
end
|
#regexp_prefix ⇒ Object
64
65
66
|
# File 'lib/enjoy/models/page.rb', line 64
def regexp_prefix
""
end
|