discourse/lib/global_path.rb

19 lines
306 B
Ruby
Raw Normal View History

module GlobalPath
def path(p)
"#{GlobalSetting.relative_url_root}#{p}"
end
def cdn_path(p)
"#{GlobalSetting.cdn_url}#{path(p)}"
end
2016-04-01 05:33:25 +08:00
def cdn_relative_path(path)
if (cdn_url = GlobalSetting.cdn_url).present?
URI.parse(cdn_url).path + path
else
path
end
end
end