From: Tom Hughes Date: Mon, 15 Jul 2019 07:19:30 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/pull/2296' X-Git-Tag: live~3500 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/c162c065c6f6db5dc584599f5639b296b627a165?hp=75e60acf661e39f3ab01d486ed17616bab036f73 Merge remote-tracking branch 'upstream/pull/2296' --- diff --git a/.rubocop.yml b/.rubocop.yml index 7d2df0445..87abac9a3 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -23,6 +23,10 @@ Metrics/BlockLength: Exclude: - 'config/routes.rb' +Metrics/ClassLength: + Exclude: + - 'test/**/*' + Naming/FileName: Exclude: - 'script/deliver-message' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 4d772ed6e..809cde374 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -50,7 +50,7 @@ Metrics/BlockNesting: # Offense count: 68 # Configuration parameters: CountComments. Metrics/ClassLength: - Max: 1397 + Max: 645 # Offense count: 73 Metrics/CyclomaticComplexity: diff --git a/INSTALL.md b/INSTALL.md index d2d2b79b4..097d4500e 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -218,7 +218,7 @@ Rails comes with a built-in webserver, so that you can test on your own machine bundle exec rails server ``` -You can now view the site in your favourite web-browser at `http://localhost:3000/` +You can now view the site in your favourite web-browser at [http://localhost:3000/](http://localhost:3000/) Note that the OSM map tiles you see aren't created from your local database - they are just the standard map tiles. diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 4a310f22b..7c2e4665e 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -17,7 +17,7 @@ //= require richtext //= require querystring -var querystring = require("querystring-component"); +var qs = require("querystring-component"); /* * Called as the user scrolls/zooms around to maniplate hrefs of the @@ -26,8 +26,8 @@ var querystring = require("querystring-component"); window.updateLinks = function (loc, zoom, layers, object) { $(".geolink").each(function (index, link) { var href = link.href.split(/[?#]/)[0], - args = querystring.parse(link.search.substring(1)), - editlink = $(link).hasClass("editlink"); + args = qs.parse(link.search.substring(1)), + editlink = $(link).hasClass("editlink"); delete args.node; delete args.way; @@ -38,7 +38,7 @@ window.updateLinks = function (loc, zoom, layers, object) { args[object.type] = object.id; } - var query = querystring.stringify(args); + var query = qs.stringify(args); if (query) href += "?" + query; args = { diff --git a/app/assets/javascripts/id.js b/app/assets/javascripts/id.js index 0aae749f7..ba16d9df2 100644 --- a/app/assets/javascripts/id.js +++ b/app/assets/javascripts/id.js @@ -27,8 +27,8 @@ document.addEventListener("DOMContentLoaded", function () { id.map().on("move.embed", parent.$.throttle(250, function () { if (id.inIntro()) return; var zoom = ~~id.map().zoom(), - center = id.map().center(), - llz = { lon: center[0], lat: center[1], zoom: zoom }; + center = id.map().center(), + llz = { lon: center[0], lat: center[1], zoom: zoom }; parent.updateLinks(llz, zoom); diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 6228b2376..935889ace 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -32,6 +32,8 @@ $(document).ready(function () { }); OSM.loadSidebarContent = function (path, callback) { + var content_path = path; + map.setSidebarOverlaid(false); clearTimeout(loaderTimeout); @@ -42,17 +44,17 @@ $(document).ready(function () { // IE<10 doesn't respect Vary: X-Requested-With header, so // prevent caching the XHR response as a full-page URL. - if (path.indexOf("?") >= 0) { - path += "&xhr=1"; + if (content_path.indexOf("?") >= 0) { + content_path += "&xhr=1"; } else { - path += "?xhr=1"; + content_path += "?xhr=1"; } $("#sidebar_content") .empty(); $.ajax({ - url: path, + url: content_path, dataType: "html", complete: function (xhr) { clearTimeout(loaderTimeout); @@ -234,7 +236,7 @@ $(document).ready(function () { e.preventDefault(); var data = $(this).data(), - center = L.latLng(data.lat, data.lon); + center = L.latLng(data.lat, data.lon); map.setView(center, data.zoom); L.marker(center, { icon: OSM.getUserIcon() }).addTo(map); @@ -260,13 +262,13 @@ $(document).ready(function () { if (object) query.select = object.type + object.id; var iframe = $("