From: Andy Allan Date: Wed, 26 Feb 2020 14:55:48 +0000 (+0100) Subject: Merge pull request #2485 from mmd-osm/patch/json2 X-Git-Tag: live~2762 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/73c95847a6680bea7f35fe5b3da6eb4e52757b9c?hp=7fcb76aa9a627ef18bfdecf77dfb096ba03d0490 Merge pull request #2485 from mmd-osm/patch/json2 JSON output nodes, ways, relations, map --- diff --git a/.travis.yml b/.travis.yml index 996495c0d..31f4aec53 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -dist: xenial +dist: bionic language: ruby rvm: - 2.5.3 @@ -9,11 +9,11 @@ addons: apt: packages: - libarchive-dev + - libgd-dev + - libffi-dev + - libbz2-dev services: - memcached -env: - global: - - OSM_MEMCACHE_SERVERS="127.0.0.1" before_script: - sed -e 's/ IMMUTABLE / /' -e "/^--/d" db/structure.sql > db/structure.expected - psql -U postgres -c "CREATE DATABASE openstreetmap" @@ -22,6 +22,7 @@ before_script: - cp config/travis.database.yml config/database.yml - cp config/example.storage.yml config/storage.yml - touch config/settings.local.yml + - echo -e "---\nmemcache_servers:\n - 127.0.0.1" > config/settings/test.local.yml - bundle exec rake db:migrate - bundle exec rake i18n:js:export - bundle exec rake yarn:install diff --git a/Gemfile b/Gemfile index 60c155459..9a3fb1f6b 100644 --- a/Gemfile +++ b/Gemfile @@ -93,8 +93,8 @@ gem "SystemTimer", ">= 1.1.3", :require => "system_timer", :platforms => :ruby_1 # Load faraday for mockable HTTP client gem "faraday" -# Load geoip for querying Maxmind GeoIP database -gem "geoip" +# Load maxminddb for querying Maxmind GeoIP database +gem "maxminddb" # Load rotp to generate TOTP tokens gem "rotp" diff --git a/Gemfile.lock b/Gemfile.lock index 3ea9cd6fa..7761ee733 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,7 +52,7 @@ GEM activerecord (6.0.2.1) activemodel (= 6.0.2.1) activesupport (= 6.0.2.1) - activerecord-import (1.0.3) + activerecord-import (1.0.4) activerecord (>= 3.2) activestorage (6.0.2.1) actionpack (= 6.0.2.1) @@ -71,19 +71,19 @@ GEM activerecord (>= 3.2, < 7.0) rake (>= 10.4, < 14.0) ast (2.4.0) - autoprefixer-rails (9.7.3) + autoprefixer-rails (9.7.4) execjs aws-eventstream (1.0.3) - aws-partitions (1.257.0) - aws-sdk-core (3.86.0) + aws-partitions (1.272.0) + aws-sdk-core (3.90.0) aws-eventstream (~> 1.0, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) - aws-sdk-kms (1.27.0) + aws-sdk-kms (1.29.0) aws-sdk-core (~> 3, >= 3.71.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.60.0) + aws-sdk-s3 (1.60.2) aws-sdk-core (~> 3, >= 3.83.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) @@ -110,14 +110,14 @@ GEM autoprefixer-rails (>= 9.1.0) popper_js (>= 1.14.3, < 2) sassc-rails (>= 2.0.0) - browser (2.7.1) + browser (3.0.3) builder (3.2.4) bzip2-ffi (1.0.0) ffi (~> 1.0) - cancancan (3.0.1) + cancancan (3.0.2) canonical-rails (0.2.6) rails (>= 4.1, < 6.1) - capybara (3.29.0) + capybara (3.31.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -130,11 +130,10 @@ GEM coderay (1.1.2) composite_primary_keys (12.0.1) activerecord (~> 6.0.0) - concurrent-ruby (1.1.5) - config (2.0.0) - activesupport (>= 4.2) + concurrent-ruby (1.1.6) + config (2.2.1) deep_merge (~> 1.2, >= 1.2.1) - dry-schema (~> 1.0) + dry-validation (~> 1.0, >= 1.0.0) coveralls (0.8.23) json (>= 1.8, < 3) simplecov (~> 0.16.1) @@ -143,7 +142,7 @@ GEM tins (~> 1.6) crack (0.4.3) safe_yaml (~> 1.0.0) - crass (1.0.5) + crass (1.0.6) dalli (2.7.10) debug_inspector (0.0.3) deep_merge (1.2.1) @@ -163,12 +162,12 @@ GEM concurrent-ruby (~> 1.0) dry-equalizer (0.3.0) dry-inflector (0.2.0) - dry-initializer (3.0.2) - dry-logic (1.0.5) + dry-initializer (3.0.3) + dry-logic (1.0.6) concurrent-ruby (~> 1.0) dry-core (~> 0.2) dry-equalizer (~> 0.2) - dry-schema (1.4.1) + dry-schema (1.4.3) concurrent-ruby (~> 1.0) dry-configurable (~> 0.8, >= 0.8.3) dry-core (~> 0.4) @@ -176,20 +175,27 @@ GEM dry-initializer (~> 3.0) dry-logic (~> 1.0) dry-types (~> 1.2) - dry-types (1.2.2) + dry-types (1.3.0) concurrent-ruby (~> 1.0) dry-container (~> 0.3) dry-core (~> 0.4, >= 0.4.4) dry-equalizer (~> 0.3) dry-inflector (~> 0.1, >= 0.1.2) dry-logic (~> 1.0, >= 1.0.2) + dry-validation (1.4.2) + concurrent-ruby (~> 1.0) + dry-container (~> 0.7, >= 0.7.1) + dry-core (~> 0.4) + dry-equalizer (~> 0.2) + dry-initializer (~> 3.0) + dry-schema (~> 1.4, >= 1.4.3) dynamic_form (1.1.4) - erb_lint (0.0.30) + erb_lint (0.0.31) activesupport better_html (~> 1.0.7) html_tokenizer rainbow - rubocop (~> 0.51) + rubocop (~> 0.79.0) smart_properties erubi (1.9.0) execjs (2.7.0) @@ -199,16 +205,15 @@ GEM factory_bot_rails (5.1.1) factory_bot (~> 5.1.0) railties (>= 4.2.0) - fakefs (0.20.1) - faraday (0.17.1) + fakefs (1.0.0) + faraday (1.0.0) multipart-post (>= 1.2, < 3) - ffi (1.11.3) - ffi-libarchive (0.4.10) + ffi (1.12.2) + ffi-libarchive (1.0.0) ffi (~> 1.0) fspath (3.1.2) gd2-ffij (0.4.0) ffi (>= 1.0.0) - geoip (1.6.4) globalid (0.4.2) activesupport (>= 4.2.0) hashdiff (1.0.0) @@ -218,7 +223,7 @@ GEM http_accept_language (2.0.5) i18n (0.9.5) concurrent-ruby (~> 1.0) - i18n-js (3.5.0) + i18n-js (3.5.1) i18n (>= 0.6.6) image_optim (0.26.5) exifr (~> 1.2, >= 1.2.2) @@ -231,10 +236,10 @@ GEM rails sprockets image_size (2.0.2) - in_threads (1.5.3) + in_threads (1.5.4) jaro_winkler (1.5.4) - jbuilder (2.9.1) - activesupport (>= 4.2.0) + jbuilder (2.10.0) + activesupport (>= 5.0.0) jmespath (1.4.0) jquery-rails (4.3.5) rails-dom-testing (>= 1, < 3) @@ -242,7 +247,7 @@ GEM thor (>= 0.14, < 2.0) json (2.3.0) jwt (2.2.1) - kgio (2.11.2) + kgio (2.11.3) kramdown (2.1.0) libxml-ruby (3.1.0) listen (3.2.1) @@ -260,18 +265,19 @@ GEM mini_mime (>= 0.1.1) marcel (0.3.3) mimemagic (~> 0.3.2) + maxminddb (0.1.22) method_source (0.9.2) - mimemagic (0.3.3) - mini_magick (4.9.5) + mimemagic (0.3.4) + mini_magick (4.10.1) mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.13.0) - msgpack (1.3.1) + minitest (5.14.0) + msgpack (1.3.3) multi_json (1.14.1) multi_xml (0.6.0) multipart-post (2.1.1) nio4r (2.5.2) - nokogiri (1.10.7) + nokogiri (1.10.8) mini_portile2 (~> 2.4.0) nokogumbo (2.0.2) nokogiri (~> 1.8, >= 1.8.4) @@ -281,7 +287,7 @@ GEM oauth (~> 0.4.4) oauth2 (>= 0.5.0) rack - oauth2 (1.4.2) + oauth2 (1.4.4) faraday (>= 0.8, < 2.0) jwt (>= 1.0, < 3.0) multi_json (~> 1.3) @@ -290,9 +296,9 @@ GEM omniauth (1.9.0) hashie (>= 3.4.6, < 3.7.0) rack (>= 1.6.2, < 3) - omniauth-facebook (5.0.0) + omniauth-facebook (6.0.0) omniauth-oauth2 (~> 1.2) - omniauth-github (1.3.0) + omniauth-github (1.4.0) omniauth (~> 1.5) omniauth-oauth2 (>= 1.4.0, < 2.0) omniauth-google-oauth2 (0.8.0) @@ -316,22 +322,22 @@ GEM omniauth-oauth2 (~> 1.4) openstreetmap-deadlock_retry (1.3.0) parallel (1.19.1) - parser (2.6.5.0) + parser (2.7.0.2) ast (~> 2.4.0) - pg (1.1.4) + pg (1.2.2) poltergeist (1.18.1) capybara (>= 2.1, < 4) cliver (~> 0.3.1) websocket-driver (>= 0.2.0) - popper_js (1.14.5) + popper_js (1.16.0) progress (3.5.2) psych (3.1.0) - public_suffix (4.0.1) + public_suffix (4.0.3) puma (3.12.2) quad_tile (1.0.1) r2 (0.2.7) - rack (2.0.8) - rack-cors (1.1.0) + rack (2.2.2) + rack-cors (1.1.1) rack (>= 2.0.0) rack-openid (1.3.1) rack (>= 1.1.0) @@ -375,29 +381,29 @@ GEM rainbow (3.0.0) rake (13.0.1) rb-fsevent (0.10.3) - rb-inotify (0.10.0) + rb-inotify (0.10.1) ffi (~> 1.0) regexp_parser (1.6.0) - request_store (1.4.1) + request_store (1.5.0) rack (>= 1.4) rinku (2.0.6) rotp (5.1.0) addressable (~> 2.5) - rubocop (0.78.0) + rubocop (0.79.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) - parser (>= 2.6) + parser (>= 2.7.0.1) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.7) - rubocop-performance (1.5.1) + rubocop-performance (1.5.2) rubocop (>= 0.71.0) - rubocop-rails (2.4.0) + rubocop-rails (2.4.2) rack (>= 1.1) rubocop (>= 0.72.0) ruby-openid (2.9.2) ruby-progressbar (1.10.1) - rubyzip (2.0.0) + rubyzip (2.2.0) safe_yaml (1.0.5) sanitize (5.1.0) crass (~> 1.0.2) @@ -411,8 +417,8 @@ GEM sprockets (> 3.0) sprockets-rails tilt - secure_headers (6.1.1) - selenium-webdriver (3.142.6) + secure_headers (6.3.0) + selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) simplecov (0.16.1) @@ -428,23 +434,25 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - strong_migrations (0.5.1) + strong_migrations (0.6.2) activerecord (>= 5) + sync (0.5.0) term-ansicolor (1.7.1) tins (~> 1.0) thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) - tins (1.22.2) - tzinfo (1.2.5) + tins (1.24.1) + sync + tzinfo (1.2.6) thread_safe (~> 0.1) uglifier (4.2.0) execjs (>= 0.3.0, < 3) - unicode-display_width (1.6.0) + unicode-display_width (1.6.1) validates_email_format_of (1.6.3) i18n vendorer (0.2.0) - webmock (3.7.6) + webmock (3.8.2) addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -489,7 +497,6 @@ DEPENDENCIES faraday ffi-libarchive gd2-ffij (>= 0.4.0) - geoip htmlentities http_accept_language (~> 2.0.0) i18n-js (>= 3.0.0) @@ -502,6 +509,7 @@ DEPENDENCIES libxml-ruby (>= 2.0.5) listen logstasher + maxminddb mimemagic mini_magick minitest (~> 5.1) diff --git a/INSTALL.md b/INSTALL.md index e414a12e4..3dca16677 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -86,17 +86,7 @@ Installing other dependencies: * Install Homebrew from https://brew.sh/ * Install the latest version of Ruby: `brew install ruby` -* Install ImageMagick: `brew install imagemagick` -* Install libxml2: `brew install libxml2` -* Install libgd: `brew install gd` -* Install Yarn: `brew install yarn` -* Install pngcrush: `brew install pngcrush` -* Install optipng: `brew install optipng` -* Install pngquant: `brew install pngquant` -* Install jhead: `brew install jhead` -* Install jpegoptim: `brew install jpegoptim` -* Install gifsicle: `brew install gifsicle` -* Install svgo: `brew install svgo` +* Install other dependencies: `brew install imagemagick libxml2 gd yarn pngcrush optipng pngquant jhead jpegoptim gifsicle svgo` * Install Bundler: `gem install bundler` (you might need to `sudo gem install bundler` if you get an error about permissions - or see note below about [developer Ruby setup](#rbenv)) You will need to tell `bundler` that `libxml2` is installed in a Homebrew location. If it uses the system-installed one then you will get errors installing the `libxml-ruby` gem later on. @@ -311,4 +301,4 @@ Where `$VERSION` is the version you installed. Then install bundler: gem install bundler ``` -You should now be able to proceed with the rest of the installation. If you're on MacOSX, make sure you set up the [config override for the libxml2 location])(#macosx-bundle-config) _after_ installing bundler. +You should now be able to proceed with the rest of the installation. If you're on MacOSX, make sure you set up the [config override for the libxml2 location](#macosx-bundle-config) _after_ installing bundler. diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index fbc76e4a8..e99a8f351 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -3,8 +3,8 @@ //= require jquery.timers //= require jquery.cookie //= require jquery.throttle-debounce -//= require bootstrap.tooltip -//= require bootstrap.dropdown +//= require popper +//= require bootstrap-sprockets //= require osm //= require leaflet //= require leaflet.osm diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 704016c66..6584864d5 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -109,6 +109,8 @@ $(document).ready(function () { iconLoading: "icon geolocate", strings: { title: I18n.t("javascripts.map.locate.title"), + metersUnit: I18n.t("javascripts.map.locate.metersUnit"), + feetUnit: I18n.t("javascripts.map.locate.feetUnit"), popup: I18n.t("javascripts.map.locate.popup") } }).addTo(map); diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 4c39d6781..1c095a36b 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -142,12 +142,20 @@ OSM.Directions = function (map) { $(".directions_form .reverse_directions").on("click", function () { var from = endpoints[0].latlng, - to = endpoints[1].latlng; + to = endpoints[1].latlng, + routeFrom = "", + routeTo = ""; + if (from) { + routeFrom = from.lat + "," + from.lng; + } + if (to) { + routeTo = to.lat + "," + to.lng; + } OSM.router.route("/directions?" + querystring.stringify({ from: $("#route_to").val(), to: $("#route_from").val(), - route: to.lat + "," + to.lng + ";" + from.lat + "," + from.lng + route: routeTo + ";" + routeFrom })); }); diff --git a/app/assets/javascripts/index/query.js b/app/assets/javascripts/index/query.js index 5c6e58170..7d02760ce 100644 --- a/app/assets/javascripts/index/query.js +++ b/app/assets/javascripts/index/query.js @@ -214,28 +214,28 @@ OSM.Query = function (map) { if (interestingFeature(element)) { var $li = $("
  • ") - .addClass("query-result") + .addClass("query-result list-group-item") .data("geometry", featureGeometry(element)) - .appendTo($ul); - var $p = $("

    ") .text(featurePrefix(element) + " ") - .appendTo($li); + .appendTo($ul); $("") .attr("href", "/" + element.type + "/" + element.id) .text(featureName(element)) - .appendTo($p); + .appendTo($li); } } if (results.remark) { $("

  • ") + .addClass("query-result list-group-item") .text(I18n.t("javascripts.query.error", { server: url, error: results.remark })) .appendTo($ul); } if ($ul.find("li").length === 0) { $("
  • ") + .addClass("query-result list-group-item") .text(I18n.t("javascripts.query.nothing_found")) .appendTo($ul); } @@ -244,6 +244,7 @@ OSM.Query = function (map) { $section.find(".loader").stopTime("loading").hide(); $("
  • ") + .addClass("query-result list-group-item") .text(I18n.t("javascripts.query." + status, { server: url, error: error })) .appendTo($ul); } diff --git a/app/assets/javascripts/index/search.js b/app/assets/javascripts/index/search.js index ba66f4782..9ed243466 100644 --- a/app/assets/javascripts/index/search.js +++ b/app/assets/javascripts/index/search.js @@ -45,9 +45,9 @@ OSM.Search = function (map) { $("#sidebar_content") .on("click", ".search_more a", clickSearchMore) .on("click", ".search_results_entry a.set_position", clickSearchResult) - .on("mouseover", "p.search_results_entry:has(a.set_position)", showSearchResult) - .on("mouseout", "p.search_results_entry:has(a.set_position)", hideSearchResult) - .on("mousedown", "p.search_results_entry:has(a.set_position)", function () { + .on("mouseover", "li.search_results_entry:has(a.set_position)", showSearchResult) + .on("mouseout", "li.search_results_entry:has(a.set_position)", hideSearchResult) + .on("mousedown", "li.search_results_entry:has(a.set_position)", function () { var moved = false; $(this).one("click", function (e) { if (!moved && !$(e.target).is("a")) { diff --git a/app/assets/javascripts/leaflet.layers.js b/app/assets/javascripts/leaflet.layers.js index 241880a20..87ff87370 100644 --- a/app/assets/javascripts/leaflet.layers.js +++ b/app/assets/javascripts/leaflet.layers.js @@ -34,7 +34,7 @@ L.OSM.layers = function (options) { .attr("class", "section base-layers") .appendTo($ui); - var baseLayers = $("
      ") + var baseLayers = $("
        ") .appendTo(baseSection); layers.forEach(function (layer) { @@ -119,7 +119,7 @@ L.OSM.layers = function (options) { .attr("class", "deemphasize") .appendTo(overlaySection); - var overlays = $("
          ") + var overlays = $("
            ") .appendTo(overlaySection); var addOverlay = function (layer, name, maxArea) { diff --git a/app/assets/javascripts/leaflet.share.js b/app/assets/javascripts/leaflet.share.js index eedfe3ab3..8b1446ff8 100644 --- a/app/assets/javascripts/leaflet.share.js +++ b/app/assets/javascripts/leaflet.share.js @@ -48,7 +48,7 @@ L.OSM.share = function (options) { .appendTo($linkSection); $("
            ") - .attr("class", "form-row") + .attr("class", "standard-form-row") .appendTo($form) .append( $("