From: Tom Hughes Date: Mon, 29 Jun 2009 16:50:34 +0000 (+0000) Subject: Merge 16110:16216 from trunk. X-Git-Tag: live~7385^2~10 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/6baccfaddd190d730b626204e9cf81c2504995bf?hp=c807e9ba66af36280597594a48767c8562a9451b Merge 16110:16216 from trunk. --- diff --git a/app/controllers/geocoder_controller.rb b/app/controllers/geocoder_controller.rb index f286ab9d3..c7efec154 100644 --- a/app/controllers/geocoder_controller.rb +++ b/app/controllers/geocoder_controller.rb @@ -3,6 +3,8 @@ class GeocoderController < ApplicationController require 'net/http' require 'rexml/document' + before_filter :set_locale + def search query = params[:query] results = Array.new diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb index 2a826770d..1478c5773 100644 --- a/app/controllers/site_controller.rb +++ b/app/controllers/site_controller.rb @@ -1,5 +1,5 @@ class SiteController < ApplicationController - layout 'site',:except => [:key] + layout 'site', :except => [:key, :permalink] before_filter :authorize_web before_filter :set_locale @@ -9,6 +9,24 @@ class SiteController < ApplicationController render :action => 'index' end + def permalink + lon, lat, zoom = ShortLink::decode(params[:code]) + new_params = params.clone + new_params.delete :code + if new_params.has_key? :m + new_params.delete :m + new_params[:mlat] = lat + new_params[:mlon] = lon + else + new_params[:lat] = lat + new_params[:lon] = lon + end + new_params[:zoom] = zoom + new_params[:controller] = 'site' + new_params[:action] = 'index' + redirect_to new_params + end + def key expires_in 7.days, :public => true end diff --git a/app/helpers/browse_helper.rb b/app/helpers/browse_helper.rb index 67420151c..879d516ef 100644 --- a/app/helpers/browse_helper.rb +++ b/app/helpers/browse_helper.rb @@ -4,12 +4,12 @@ module BrowseHelper end def printable_name(object, version=false) - name = object.id.to_s + name = t 'printable_name.with_id', :id => object.id.to_s if version - name = "#{name}, v#{object.version.to_s}" + name = t 'printable_name.with_version', :id => name, :version => object.version.to_s end if object.tags.include? 'name' - name = "#{object.tags['name'].to_s} (#{name})" + name = t 'printable_name.with_name', :name => object.tags['name'].to_s, :id => name end return name end diff --git a/app/views/browse/_containing_relation.html.erb b/app/views/browse/_containing_relation.html.erb index ee704acc8..474e80f78 100644 --- a/app/views/browse/_containing_relation.html.erb +++ b/app/views/browse/_containing_relation.html.erb @@ -1,8 +1,11 @@ - - <%= link_to t('browse.containing_relation.relation', :relation_name => h(printable_name(containing_relation.relation))), :action => "relation", :id => containing_relation.relation.id.to_s %> - <% unless containing_relation.member_role.blank? %> - <%= t 'browse.containing_relation.relation_as', :relation_role => h(containing_relation.member_role) %> - <% end %> - + <%= + linked_name = link_to h(printable_name(containing_relation.relation)), :action => "relation", :id => containing_relation.relation.id.to_s + + if containing_relation.member_role.blank? + t 'browse.containing_relation.entry', :relation_name => linked_name + else + t 'browse.containing_relation.entry_role', :relation_name => linked_name, :relation_role => h(containing_relation.member_role) + end + %> diff --git a/app/views/browse/_map.html.erb b/app/views/browse/_map.html.erb index 248cf27dd..f84a2ec9f 100644 --- a/app/views/browse/_map.html.erb +++ b/app/views/browse/_map.html.erb @@ -6,77 +6,67 @@
<%= t 'browse.map.loading' %> - + + <% unless map.instance_of? Changeset %> +
+ + <% end %> <% else %> <%= t 'browse.map.deleted' %> <% end %> - + window.onload = init; + +<% end %> diff --git a/app/views/browse/_relation_member.html.erb b/app/views/browse/_relation_member.html.erb index 39b89bc01..cee2e0e75 100644 --- a/app/views/browse/_relation_member.html.erb +++ b/app/views/browse/_relation_member.html.erb @@ -1,10 +1,12 @@ - - <%= relation_member.member_type.capitalize %> - <%= link_to h(printable_name(relation_member.member)), :action => relation_member.member_type.downcase, :id => relation_member.member_id.to_s %> - <% unless relation_member.member_role.blank? %> - <%= t'browse.relation_member.as' %> - <%= h(relation_member.member_role) %> - <% end %> - + <%= + linked_name = link_to h(printable_name(relation_member.member)), :action => relation_member.member_type.downcase, :id => relation_member.member_id.to_s + type_str = t'browse.relation_member.type.' + relation_member.member_type.downcase + + if relation_member.member_role.blank? + t'browse.relation_member.entry', :type => type_str, :name => linked_name + else + t'browse.relation_member.entry_role', :type => type_str, :name => linked_name, :role => h(relation_member.member_role) + end + %> diff --git a/app/views/browse/node_history.html.erb b/app/views/browse/node_history.html.erb index 4a34e3452..fe6c79812 100644 --- a/app/views/browse/node_history.html.erb +++ b/app/views/browse/node_history.html.erb @@ -2,7 +2,7 @@ @name = printable_name @node @title = t('browse.node_history.node_history') + ' | ' + @name %> -

Node History: <%= h(@name) %>

+

<%= t'browse.node_history.node_history_title', :node_name => link_to(h(@name), :action => "node", :id => @node.id) %>

diff --git a/app/views/browse/relation_history.html.erb b/app/views/browse/relation_history.html.erb index 45f3d1400..649638a76 100644 --- a/app/views/browse/relation_history.html.erb +++ b/app/views/browse/relation_history.html.erb @@ -2,7 +2,7 @@ @name = printable_name @relation @title = t('browse.relation_history.relation_history') + ' | ' + @name %> -

<%= t'browse.relation_history.relation_history_title', :relation_name => h(@name) %>

+

<%= t'browse.relation_history.relation_history_title', :relation_name => link_to(h(@name), :action => "relation", :id => @relation.id) %>

diff --git a/app/views/browse/way_history.html.erb b/app/views/browse/way_history.html.erb index edb967e9e..f61fa6fa1 100644 --- a/app/views/browse/way_history.html.erb +++ b/app/views/browse/way_history.html.erb @@ -2,7 +2,7 @@ @name = printable_name @way @title = t('browse.way_history.way_history') + ' | ' + @name %> -

<%= t'browse.way_history.way_history_title', :way_name => h(@name) %>

+

<%= t'browse.way_history.way_history_title', :way_name => link_to(h(@name), :action => "way", :id => @way.id) %>

diff --git a/app/views/site/_search.html.erb b/app/views/site/_search.html.erb index b57a1f984..d6c1e38fa 100644 --- a/app/views/site/_search.html.erb +++ b/app/views/site/_search.html.erb @@ -1,7 +1,7 @@