Merge branch 'master' into dashboard

This commit is contained in:
decabeza
2019-03-26 16:45:48 +01:00
2476 changed files with 62613 additions and 84405 deletions

View File

@@ -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