Merge branch 'master' into dashboard
This commit is contained in:
@@ -4,14 +4,10 @@ module ApplicationHelper
|
||||
return false if user_signed_in?
|
||||
# Using path because fullpath yields false negatives since it contains
|
||||
# parameters too
|
||||
request.path == '/'
|
||||
request.path == "/"
|
||||
end
|
||||
|
||||
def opendata_page?
|
||||
request.path == '/opendata'
|
||||
end
|
||||
|
||||
# if current path is /debates current_path_with_query_params(foo: 'bar') returns /debates?foo=bar
|
||||
# if current path is /debates current_path_with_query_params(foo: "bar") returns /debates?foo=bar
|
||||
# notice: if query_params have a param which also exist in current path, it "overrides" (query_params is merged last)
|
||||
def current_path_with_query_params(query_parameters)
|
||||
url_for(request.query_parameters.merge(query_parameters))
|
||||
@@ -67,4 +63,11 @@ module ApplicationHelper
|
||||
base64 = Base64.encode64(asset.to_s).gsub(/\s+/, "")
|
||||
"data:#{asset.content_type};base64,#{Rack::Utils.escape(base64)}"
|
||||
end
|
||||
|
||||
def render_custom_partial(partial_name)
|
||||
controller_action = @virtual_path.split("/").last
|
||||
custom_partial_path = "custom/#{@virtual_path.remove(controller_action)}#{partial_name}"
|
||||
render custom_partial_path if lookup_context.exists?(custom_partial_path, [], true)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user