Class: Refinery::Pages::Url::Localised
Class Method Summary
collapse
Instance Method Summary
collapse
build, #initialize
Class Method Details
.handle?(page) ⇒ Boolean
6
7
8
|
# File 'pages/lib/refinery/pages/url.rb', line 6
def self.handle?(page)
page.link_url.present?
end
|
Instance Method Details
#url ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'pages/lib/refinery/pages/url.rb', line 10
def url
current_url = page.link_url
return current_url if current_url =~ %r{\A(https?:)?//}
if Refinery::I18n.url_filter_enabled? && current_url =~ %r{^/} &&
Refinery::I18n.current_frontend_locale != Refinery::I18n.default_frontend_locale
current_url = "/#{Refinery::I18n.current_frontend_locale}#{current_url}"
end
if current_url == '/'
Refinery::Core.mounted_path
else
[Refinery::Core.mounted_path, current_url.sub(%r{\A/}, '')].
join("/").sub("//", "/").sub(%r{/\z}, '')
end
end
|