class Refinery::Pages::Url::Localised
Public Class Methods
handle?(page)
click to toggle source
# File lib/refinery/pages/url.rb, line 6 def self.handle?(page) page.link_url.present? end
Public Instance Methods
url()
click to toggle source
# File lib/refinery/pages/url.rb, line 10 def url current_url = page.link_url # Don't mess around with absolute URLs, just accept them. Examples: # # * https://github.com/parndt # * http://github.com/parndt # * //github.com/parndt 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 # See https://github.com/refinery/refinerycms/issues/2740 if current_url == '/' Refinery::Core.mounted_path else [Refinery::Core.mounted_path, current_url.sub(%r{\A/}, '')]. join("/").sub("//", "/").sub(%r{/\z}, '') end end