From: John Firebaugh Date: Sat, 16 Nov 2013 00:47:49 +0000 (-0800) Subject: Merge branch 'master' into redesign X-Git-Tag: live~4625^2~53 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/2b4f8e92c969a5508b73ae7af45811a118fda6b1?hp=-c Merge branch 'master' into redesign Conflicts: app/controllers/browse_controller.rb app/views/layouts/_head.html.erb config/environments/production.rb config/routes.rb --- 2b4f8e92c969a5508b73ae7af45811a118fda6b1 diff --combined app/controllers/geocoder_controller.rb index 592ff020a,6db70a6f3..87eb329ab --- a/app/controllers/geocoder_controller.rb +++ b/app/controllers/geocoder_controller.rb @@@ -13,6 -13,7 +13,7 @@@ class GeocoderController < ApplicationC @sources = [] if params[:lat] && params[:lon] + @sources.push "latlon" @sources.push "osm_nominatim_reverse" @sources.push "geonames_reverse" elsif params[:query].match(/^\d{5}(-\d{4})?$/) @@@ -28,10 -29,26 +29,28 @@@ @sources.push "osm_nominatim" @sources.push "geonames" if defined?(GEONAMES_USERNAME) end + + render :layout => map_layout end + def search_latlon + lat = params[:lat].to_f + lon = params[:lon].to_f + if lat < -90 or lat > 90 + @error = "Latitude #{lat} out of range" + render :action => "error" + elsif lon < -180 or lon > 180 + @error = "Longitude #{lon} out of range" + render :action => "error" + else + @results = [{:lat => lat, :lon => lon, + :zoom => params[:zoom], + :name => "#{lat}, #{lon}"}] + + render :action => "results" + end + end + def search_us_postcode # get query parameters query = params[:query] @@@ -143,7 -160,11 +162,11 @@@ type = place.attributes["type"].to_s name = place.attributes["display_name"].to_s min_lat,max_lat,min_lon,max_lon = place.attributes["boundingbox"].to_s.split(",") - prefix_name = t "geocoder.search_osm_nominatim.prefix.#{klass}.#{type}", :default => type.gsub("_", " ").capitalize + if type.empty? + prefix_name = "" + else + prefix_name = t "geocoder.search_osm_nominatim.prefix.#{klass}.#{type}", :default => type.gsub("_", " ").capitalize + end if klass == 'boundary' and type == 'administrative' rank = (place.attributes["place_rank"].to_i + 1) / 2 prefix_name = t "geocoder.search_osm_nominatim.admin_levels.level#{rank}", :default => prefix_name diff --combined app/controllers/site_controller.rb index 997973922,cea37fbf3..1757e771a --- a/app/controllers/site_controller.rb +++ b/app/controllers/site_controller.rb @@@ -1,10 -1,9 +1,10 @@@ class SiteController < ApplicationController - layout 'site', :except => [:key, :permalink] - layout false, :only => [:key, :permalink] + layout 'site' + layout :map_layout, :only => [:index, :export] before_filter :authorize_web before_filter :set_locale + before_filter :redirect_browse_params, :only => :index before_filter :redirect_map_params, :only => [:index, :edit, :export] before_filter :require_user, :only => [:edit, :welcome] before_filter :require_oauth, :only => [:index] @@@ -34,17 -33,19 +34,18 @@@ def key expires_in 7.days, :public => true + render :layout => false end def edit editor = preferred_editor if editor == "remote" + require_oauth render :action => :index return end - @extra_body_class = "site-edit-#{editor}" - if params[:node] bbox = Node.find(params[:node]).bbox.to_unscaled @lat = bbox.centre_lat @@@ -71,12 -72,6 +72,12 @@@ def welcome end + def help + end + + def about + end + def preview render :text => RichText.new(params[:format], params[:text]).to_html end @@@ -87,18 -82,6 +88,18 @@@ private + def redirect_browse_params + if params[:node] + redirect_to node_path(params[:node]) + elsif params[:way] + redirect_to way_path(params[:way]) + elsif params[:relation] + redirect_to relation_path(params[:relation]) + elsif params[:note] + redirect_to browse_note_path(params[:note]) + end + end + def redirect_map_params anchor = [] diff --combined app/views/layouts/_head.html.erb index 46fe40f04,93b48c315..9951737bc --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@@ -1,10 -1,9 +1,10 @@@ + + <%= javascript_include_tag "application" %> - - <%= stylesheet_link_tag "small-#{dir}", :media => "only screen and (max-width:641px)" %> - <%= stylesheet_link_tag "large-#{dir}", :media => "screen and (min-width: 642px)" %> + <%= stylesheet_link_tag "small-#{dir}", :media => "only screen and (max-width:721px)" %> + <%= stylesheet_link_tag "large-#{dir}", :media => "screen and (min-width: 722px)" %> <%= stylesheet_link_tag "print-#{dir}", :media => "print" %> <%= stylesheet_link_tag "leaflet-all", :media => "screen, print" %>