From: Tom Hughes Date: Sun, 15 Jun 2014 13:54:39 +0000 (+0100) Subject: Merge branch 'master' into overpass X-Git-Tag: live~4334^2~8 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/a70b61315c2331c18123a0b36782d6ef6bb3ab3e?hp=-c Merge branch 'master' into overpass --- a70b61315c2331c18123a0b36782d6ef6bb3ab3e diff --combined app/assets/javascripts/index.js index 54ccb88ed,cfee031fd..236ed44fc --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@@ -5,7 -5,6 +5,7 @@@ //= require leaflet.key //= require leaflet.note //= require leaflet.share +//= require leaflet.query //= require index/search //= require index/browse //= require index/export @@@ -13,7 -12,6 +13,7 @@@ //= require index/history //= require index/note //= require index/new_note +//= require index/query //= require router (function() { @@@ -125,11 -123,6 +125,11 @@@ $(document).ready(function () sidebar: sidebar }).addTo(map); + L.OSM.query({ + position: position, + sidebar: sidebar + }).addTo(map); + L.control.scale() .addTo(map); @@@ -302,8 -295,7 +302,8 @@@ "/node/:id(/history)": OSM.Browse(map, 'node'), "/way/:id(/history)": OSM.Browse(map, 'way'), "/relation/:id(/history)": OSM.Browse(map, 'relation'), - "/changeset/:id": OSM.Browse(map, 'changeset') + "/changeset/:id": OSM.Browse(map, 'changeset'), + "/query": OSM.Query(map) }); if (OSM.preferred_editor == "remote" && document.location.pathname == "/edit") { @@@ -342,9 -334,10 +342,10 @@@ $(".describe_location").on("click", function(e) { e.preventDefault(); - var precision = OSM.zoomPrecision(map.getZoom()); + var center = map.getCenter().wrap(), + precision = OSM.zoomPrecision(map.getZoom()); OSM.router.route("/search?query=" + encodeURIComponent( - map.getCenter().lat.toFixed(precision) + "," + - map.getCenter().lng.toFixed(precision))); + center.lat.toFixed(precision) + "," + center.lng.toFixed(precision) + )); }); }); diff --combined app/assets/stylesheets/common.css.scss index 9e614f906,7c400b4f3..d3268f43b --- a/app/assets/stylesheets/common.css.scss +++ b/app/assets/stylesheets/common.css.scss @@@ -171,7 -171,7 +171,7 @@@ small, aside .icon.close:hover { background-position: -200px -20px; } .icon.check { background-position: -220px 0; } .icon.note { background-position: -240px 0; } -.icon.gear { background-position: -260px 0; } +.icon.query { background-position: -260px 0; } /* Rules for links */ @@@ -683,14 -683,6 +683,14 @@@ nav.secondary #map { height: 100%; overflow: hidden; + + &.query-active { + cursor: help; + } + + &.query-disabled { + cursor: not-allowed; + } } #map-ui { @@@ -977,7 -969,9 +977,9 @@@ header .search_form .search_results_entry { ul li { border-bottom: $keyline; + cursor: pointer; &:first-child { border-top: $keyline; } + &.selected { background: #FFFFE6; } } .search_details { @@@ -1127,38 -1121,6 +1129,38 @@@ overflow: hidden; margin: 0 0 10px 10px; } + + .query-intro p { + padding: $lineheight $lineheight $lineheight/2; + } + + .query-results { + display: none; + + h3 { + padding: $lineheight $lineheight $lineheight/2; + margin: 0; + } + + ul { + li { + padding: 15px 20px; + border-bottom: 1px solid #ddd; + + &.query-result { + cursor: pointer; + } + + &.selected { + background: #FFFFE6; + } + + a { + color: #000; + } + } + } + } } /* Rules for export sidebar */ @@@ -2439,13 -2401,6 +2441,6 @@@ input.richtext_title[type="text"] background-size: cover; background-attachment: fixed; - &.photo-0 { background-image: image-url('about/0.jpg'); .photo-0 { display: block; } } - &.photo-1 { background-image: image-url('about/1.jpg'); .photo-1 { display: block; } } - &.photo-2 { background-image: image-url('about/2.jpg'); .photo-2 { display: block; } } - &.photo-3 { background-image: image-url('about/4.jpg'); .photo-3 { display: block; } } - &.photo-4 { background-image: image-url('about/4.jpg'); .photo-4 { display: block; } } - &.photo-5 { background-image: image-url('about/5.jpg'); .photo-5 { display: block; } } - .caption { max-width: 200px; font: 13px/20px Helvetica, Arial, sans-serif; diff --combined config/locales/en.yml index 3e452571b,fe5f58d51..eb2991d4e --- a/config/locales/en.yml +++ b/config/locales/en.yml @@@ -79,7 -79,7 +79,7 @@@ en printable_name: with_id: "%{id}" with_version: "%{id}, v%{version}" - with_name: "%{name} (%{id})" + with_name_html: "%{name} (%{id})" editor: default: "Default (currently %{name})" potlatch: @@@ -181,6 -181,7 +181,7 @@@ key: "The wiki description page for the %{key} tag" tag: "The wiki description page for the %{key}=%{value} tag" wikipedia_link: "The %{page} article on Wikipedia" + telephone_link: "Call %{phone_number}" note: title: "Note: %{id}" new_note: "New Note" @@@ -197,11 -198,6 +198,11 @@@ reopened_by: "Reactivated by %{user} %{when} ago" reopened_by_anonymous: "Reactivated by anonymous %{when} ago" hidden_by: "Hidden by %{user} %{when} ago" + query: + title: "Query Features" + introduction: "Click on the map to find nearby features." + nearby: "Nearby features" + enclosing: "Enclosing features" changeset: changeset_paging_nav: showing_page: "Page %{page}" @@@ -512,7 -508,7 +513,7 @@@ primary_link: "Primary Road" proposed: "Proposed Road" raceway: "Raceway" - residential: "Residential" + residential: "Residential Road" rest_area: "Rest Area" road: "Road" secondary: "Secondary Road" @@@ -723,8 -719,6 +724,8 @@@ tram: "Tramway" tram_stop: "Tram Stop" yard: "Railway Yard" + route: + bus: "Bus Route" shop: alcohol: "Off License" antiques: "Antiques" @@@ -2108,11 -2102,9 +2109,11 @@@ createnote_disabled_tooltip: Zoom in to add a note to the map map_notes_zoom_in_tooltip: Zoom in to see map notes map_data_zoom_in_tooltip: Zoom in to see map data + queryfeature_tooltip: Query features + queryfeature_disabled_tooltip: Zoom in to query features notes: new: - intro: "Spotted a mistake or something missing? Let other mappers know so we can fix it. Move the marker to the correct position and type a note to explain the problem. (Please don't enter personal information here.)" + intro: "Spotted a mistake or something missing? Let other mappers know so we can fix it. Move the marker to the correct position and type a note to explain the problem. (Please don't enter personal information or information from copyrighted maps or directory listings.)" add: Add Note show: anonymous_warning: This note includes comments from anonymous users which should be independently verified. @@@ -2122,13 -2114,6 +2123,13 @@@ comment_and_resolve: Comment & Resolve comment: Comment edit_help: Move the map and zoom in on a location you want to edit, then click here. + query: + node: Node + way: Way + relation: Relation + nothing_found: No features found + error: "Error contacting %{server}: %{error}" + timeout: "Timeout contacting %{server}" redaction: edit: description: "Description" diff --combined config/routes.rb index e03c5d632,3357f911d..9af0c1099 --- a/config/routes.rb +++ b/config/routes.rb @@@ -150,7 -150,6 +150,7 @@@ OpenStreetMap::Application.routes.draw match '/offline' => 'site#offline', :via => :get match '/key' => 'site#key', :via => :get match '/id' => 'site#id', :via => :get + match '/query' => 'browse#query', :via => :get match '/user/new' => 'user#new', :via => :get match '/user/new' => 'user#create', :via => :post match '/user/terms' => 'user#terms', :via => :get @@@ -195,7 -194,7 +195,7 @@@ match '/traces/mine/page/:page' => 'trace#mine', :via => :get match '/traces/mine' => 'trace#mine', :via => :get match '/trace/create' => 'trace#create', :via => [:get, :post] - match '/trace/:id/data' => 'trace#data', :via => :get, :id => /\d+/ + match '/trace/:id/data' => 'trace#data', :via => :get, :id => /\d+/, :as => "trace_data" match '/trace/:id/edit' => 'trace#edit', :via => [:get, :post, :patch], :id => /\d+/, :as => "trace_edit" match '/trace/:id/delete' => 'trace#delete', :via => :post, :id => /\d+/