Use a mixin for the `path` function to DRY it up
This commit is contained in:
parent
31ca464c31
commit
3ad12d44f3
|
@ -8,11 +8,13 @@ require_dependency 'crawler_detection'
|
|||
require_dependency 'json_error'
|
||||
require_dependency 'letter_avatar'
|
||||
require_dependency 'distributed_cache'
|
||||
require_dependency 'global_path'
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
include CurrentUser
|
||||
include CanonicalURL::ControllerExtensions
|
||||
include JsonError
|
||||
include GlobalPath
|
||||
|
||||
serialization_scope :guardian
|
||||
|
||||
|
@ -404,10 +406,6 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
protected
|
||||
|
||||
def path(p)
|
||||
"#{GlobalSetting.relative_url_root}#{p}"
|
||||
end
|
||||
|
||||
def render_post_json(post, add_raw=true)
|
||||
post_serializer = PostSerializer.new(post, scope: guardian, root: false)
|
||||
post_serializer.add_raw = add_raw
|
||||
|
|
|
@ -6,11 +6,13 @@ require_dependency 'age_words'
|
|||
require_dependency 'configurable_urls'
|
||||
require_dependency 'mobile_detection'
|
||||
require_dependency 'category_badge'
|
||||
require_dependency 'global_path'
|
||||
|
||||
module ApplicationHelper
|
||||
include CurrentUser
|
||||
include CanonicalURL::Helpers
|
||||
include ConfigurableUrls
|
||||
include GlobalPath
|
||||
|
||||
def shared_session_key
|
||||
if SiteSetting.long_polling_base_url != '/'.freeze && current_user
|
||||
|
@ -23,10 +25,6 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
def path(path)
|
||||
"#{GlobalSetting.relative_url_root}#{path}"
|
||||
end
|
||||
|
||||
def script(*args)
|
||||
if SiteSetting.enable_cdn_js_debugging && GlobalSetting.cdn_url
|
||||
tags = javascript_include_tag(*args, "crossorigin" => "anonymous")
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
module GlobalPath
|
||||
def path(p)
|
||||
"#{GlobalSetting.relative_url_root}#{p}"
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue