From: Tom Hughes Date: Thu, 20 Sep 2012 15:01:24 +0000 (+0100) Subject: Merge branch 'master' into openstreetbugs X-Git-Tag: live~5659^2~103 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/4d91fe3dd95c1058cb8d24fd4c900223e30b9059 Merge branch 'master' into openstreetbugs Conflicts: Gemfile app/helpers/application_helper.rb app/views/site/index.html.erb --- 4d91fe3dd95c1058cb8d24fd4c900223e30b9059 diff --cc Gemfile index 25b10fe7b,ad2f04c29..5193881af --- a/Gemfile +++ b/Gemfile @@@ -24,7 -24,7 +24,8 @@@ gem 'composite_primary_keys', '>= 5.0.8 gem 'http_accept_language', '>= 1.0.2' gem 'paperclip', '~> 2.0' gem 'deadlock_retry', '>= 1.2.0' + gem 'i18n-js', '>= 3.0.0.rc2' +gem 'jsonify-rails' # We need ruby-openid 2.2.0 or later for ruby 1.9 support gem 'ruby-openid', '>= 2.2.0' diff --cc Gemfile.lock index 158694564,1ec7948d1..666b6a094 --- a/Gemfile.lock +++ b/Gemfile.lock @@@ -31,9 -31,8 +31,8 @@@ GE multi_json (~> 1.0) arel (3.0.2) bigdecimal (1.1.0) - browser (0.1.4) -- builder (3.0.0) -- cocaine (0.2.1) ++ builder (3.0.3) ++ cocaine (0.3.0) coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) @@@ -55,10 -54,12 +54,12 @@@ http_accept_language (1.0.2) httpauth (0.1) httpclient (2.2.7) -- i18n (0.6.0) ++ i18n (0.6.1) + i18n-js (3.0.0.rc2) + i18n iconv (0.1) journey (1.0.4) -- jquery-rails (2.1.1) ++ jquery-rails (2.1.2) railties (>= 3.1.0, < 5.0) thor (~> 0.14) json (1.7.5) @@@ -75,13 -71,13 +76,13 @@@ i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) -- memcached (1.4.3) ++ memcached (1.4.5) mime-types (1.19) -- minitest (3.3.0) ++ minitest (3.4.0) multi_json (1.3.6) multipart-post (1.1.5) nokogiri (1.5.5) -- oauth (0.4.6) ++ oauth (0.4.7) oauth-plugin (0.4.1) multi_json oauth (~> 0.4.4) @@@ -100,7 -96,7 +101,7 @@@ activesupport (>= 2.3.2) cocaine (>= 0.0.2) mime-types -- pg (0.14.0) ++ pg (0.14.1) polyglot (0.3.3) rack (1.4.1) rack-cache (1.2) @@@ -120,7 -116,7 +121,7 @@@ activesupport (= 3.2.8) bundler (~> 1.0) railties (= 3.2.8) -- rails-i18n (0.6.5) ++ rails-i18n (0.6.6) i18n (~> 0.5) railties (3.2.8) actionpack (= 3.2.8) @@@ -150,14 -146,14 +151,14 @@@ libv8 (~> 3.3.10) thor (0.16.0) tilt (1.3.3) -- timecop (0.4.5) ++ timecop (0.5.1) treetop (1.4.10) polyglot polyglot (>= 0.3.1) tzinfo (0.3.33) -- uglifier (1.2.7) ++ uglifier (1.3.0) execjs (>= 0.3.0) -- multi_json (~> 1.3) ++ multi_json (~> 1.0, >= 1.0.2) validates_email_format_of (1.5.3) PLATFORMS @@@ -174,9 -169,9 +174,10 @@@ DEPENDENCIE htmlentities http_accept_language (>= 1.0.2) httpclient + i18n-js (>= 3.0.0.rc2) iconv jquery-rails + jsonify-rails libxml-ruby (>= 2.0.5) memcached (>= 1.4.1) minitest diff --cc app/assets/javascripts/application.js index 311798aa5,e345f3074..71eb71711 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@@ -2,6 -2,28 +2,29 @@@ //= require jquery_ujs //= require jquery.autogrowtextarea //= require jquery.timers + //= require jquery.cookie + //= require augment + //= require openlayers + //= require i18n/translations + //= require globals + //= require params + //= require piwik + //= require browse + //= require export + //= require map + //= require key + //= require menu + //= require sidebar + //= require richtext + //= require resize ++//= require notes + + function zoomPrecision(zoom) { + var decimals = Math.pow(10, Math.floor(zoom/3)); + return function(x) { + return Math.round(x * decimals) / decimals; + }; + } /* * Called as the user scrolls/zooms around to aniplate hrefs of the diff --cc app/helpers/application_helper.rb index e6a1e58e6,e0c299ca5..fb422cc17 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@@ -106,33 -87,4 +87,16 @@@ module ApplicationHelpe end end end + + def friendly_date(date) + content_tag(:span, time_ago_in_words(date), :title => l(date, :format => :friendly)) + end + + def note_author(object, link_options = {}) + if object.author.nil? + h(object.author_name) + else + link_to h(object.author_name), link_options.merge({:controller => "user", :action => "view", :display_name => object.author_name}) + end + end - - private - - def javascript_strings_for_key(key) - js = "" - value = I18n.t(key, :locale => "en") - - if value.is_a?(String) - js << "i18n_strings['#{key}'] = '" << escape_javascript(t(key)) << "';\n" - else - value.each_key do |k| - js << javascript_strings_for_key("#{key}.#{k}") - end - end - - return js - end end diff --cc app/views/browse/_map.html.erb index d8ca30a15,6dba6cff3..44823218b --- a/app/views/browse/_map.html.erb +++ b/app/views/browse/_map.html.erb @@@ -43,10 -36,8 +40,8 @@@ -<% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible %> +<% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible? %>