From: Ævar Arnfjörð Bjarmason Date: Fri, 2 Oct 2009 20:19:28 +0000 (+0000) Subject: Some of our JavaScript files have UI messages but we don't want to X-Git-Tag: live~6583 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/b0e15608750417351c2ac3d9ffa6d13fcf6c8ccb?hp=d0f228879741a8d35ae7d9e98d3fe3c9e227a1fa Some of our JavaScript files have UI messages but we don't want to make them dynamic. So I'm creating a globally scoped JavaScript array called rails_i18n which holds some of these messages. It's loaded in before any of the JavaScript files so it should always be available. --- diff --git a/app/views/layouts/site.html.erb b/app/views/layouts/site.html.erb index 386fd8b26..82efdefce 100644 --- a/app/views/layouts/site.html.erb +++ b/app/views/layouts/site.html.erb @@ -1,6 +1,12 @@ + <%= javascript_include_tag 'prototype' %> <%= javascript_include_tag 'site' %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 025c73357..7e096def5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -429,8 +429,10 @@ en: view_tooltip: View maps edit: Edit edit_tooltip: Edit maps + edit_zoom_alert: You must zoom in to edit the map history: History history_tooltip: Changeset history + history_zoom_alert: You must zoom in to see the editing history export: Export export_tooltip: Export map data gps_traces: GPS Traces diff --git a/public/javascripts/site.js b/public/javascripts/site.js index b6566fa81..17b2f0668 100644 --- a/public/javascripts/site.js +++ b/public/javascripts/site.js @@ -1,3 +1,4 @@ + /* * Called as the user scrolls/zooms around to aniplate hrefs of the * view tab and various other links @@ -61,7 +62,7 @@ function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,objtype,obj node.href = setArgs("/edit", args); node.style.fontStyle = 'normal'; } else { - node.href = 'javascript:alert("zoom in to edit map");'; + node.href = 'javascript:alert(rails_i18n["layouts.edit_zoom_alert"]);'; node.style.fontStyle = 'italic'; } } @@ -86,7 +87,7 @@ function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,objtype,obj node.href = setArgs("/history", args); node.style.fontStyle = 'normal'; } else { - node.href = 'javascript:alert("zoom in to see editing history");'; + node.href = 'javascript:alert(rails_i18n["layouts.history_zoom_alert"]);'; node.style.fontStyle = 'italic'; } }