From: Tom Hughes Date: Sat, 15 Feb 2025 17:07:59 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/4926' X-Git-Tag: live~130 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/29d322c364dcbe5b1adf386d51132296b5809604?hp=-c Merge remote-tracking branch 'upstream/pull/4926' --- 29d322c364dcbe5b1adf386d51132296b5809604 diff --combined app/assets/javascripts/index.js index a5916d3ed,9b825caad..810327e3f --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@@ -21,6 -21,7 +21,7 @@@ //= require index/directions //= require index/changeset //= require index/query + //= require index/home //= require router $(document).ready(function () { @@@ -38,14 -39,6 +39,14 @@@ $("#sidebar_loader").show().addClass("delayed-fade-in"); + // Prevent caching the XHR response as a full-page URL + // https://github.com/openstreetmap/openstreetmap-website/issues/5663 + if (content_path.indexOf("?") >= 0) { + content_path += "&xhr=1"; + } else { + content_path += "?xhr=1"; + } + $("#sidebar_content") .empty(); @@@ -221,16 -214,6 +222,6 @@@ L.marker([params.mlat, params.mlon]).addTo(map); } - $("#homeanchor").on("click", function (e) { - e.preventDefault(); - - var data = $(this).data(), - center = L.latLng(data.lat, data.lon); - - map.setView(center, data.zoom); - L.marker(center, { icon: OSM.getUserIcon() }).addTo(map); - }); - function remoteEditHandler(bbox, object) { var remoteEditHost = "http://127.0.0.1:8111", osmHost = location.protocol + "//" + location.host, @@@ -317,9 -300,8 +308,9 @@@ }; function addObject(type, id, center) { + var hashParams = OSM.parseHash(window.location.hash); map.addObject({ type: type, id: parseInt(id, 10) }, function (bounds) { - if (!window.location.hash && bounds.isValid() && + if (!hashParams.center && bounds.isValid() && (center || !map.getBounds().contains(bounds))) { OSM.router.withoutMoveListener(function () { map.fitBounds(bounds); @@@ -365,7 -347,8 +356,8 @@@ "/relation/:id(/history)": OSM.Browse(map, "relation"), "/relation/:id/history/:version": OSM.OldBrowse(), "/changeset/:id": OSM.Changeset(map), - "/query": OSM.Query(map) + "/query": OSM.Query(map), + "/account/home": OSM.Home(map) }); if (OSM.preferred_editor === "remote" && document.location.pathname === "/edit") { diff --combined config/locales/en.yml index b52bd137f,5f9f706a0..1f9792d39 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@@ -2713,7 -2713,6 +2713,7 @@@ en write_gpx: Upload GPS traces write_notes: Modify notes write_redactions: Redact map data + write_blocks: Create and revoke user blocks read_email: Read user email address consume_messages: Read, update status and delete user messages send_messages: Send private messages to other users @@@ -3317,6 -3316,9 +3317,9 @@@ show_address: Show address query_features: Query features centre_map: Centre map here + home: + marker_title: My home location + not_set: Home location is not set for your account redactions: edit: heading: "Edit Redaction" diff --combined config/routes.rb index 7e9cd8dfd,004136266..b3fc5af15 --- a/config/routes.rb +++ b/config/routes.rb @@@ -121,7 -121,7 +121,7 @@@ OpenStreetMap::Application.routes.draw resource :subscription, :only => [:create, :destroy], :controller => "note_subscriptions" end - resources :user_blocks, :only => :show, :id => /\d+/, :controller => "user_blocks" + resources :user_blocks, :only => [:show, :create], :id => /\d+/, :controller => "user_blocks" namespace :user_blocks, :path => "user/blocks" do resource :active_list, :path => "active", :only => :show end @@@ -300,6 -300,7 +300,7 @@@ resource :terms, :only => [:show, :update] resource :pd_declaration, :only => [:show, :create] resource :deletion, :only => :show + resource :home, :only => :show end end