X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/ef7f3d800cbdd49b692df10d312e5fd880e2e938..4988801dc6c1175bde14b8001dbc91638c316f70:/app/helpers/application_helper.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b4a0ad192..3d0a97243 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,5 +1,5 @@ module ApplicationHelper - require 'rexml/document' + require "rexml/document" def linkify(text) if text.html_safe? @@ -100,4 +100,30 @@ module ApplicationHelper def current_page_class(path) :current if current_page?(path) end + + def application_data + data = { + :locale => I18n.locale, + :preferred_editor => preferred_editor + } + + if @user + data[:user] = @user.id.to_json + + unless @user.home_lon.nil? || @user.home_lat.nil? + data[:user_home] = { :lat => @user.home_lat, :lon => @user.home_lon } + end + end + + data[:location] = session[:location] if session[:location] + + if @oauth + data[:token] = @oauth.token + data[:token_secret] = @oauth.secret + data[:consumer_key] = @oauth.client_application.key + data[:consumer_secret] = @oauth.client_application.secret + end + + data + end end