]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/4926'
authorTom Hughes <tom@compton.nu>
Sat, 15 Feb 2025 17:07:59 +0000 (17:07 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 15 Feb 2025 17:07:59 +0000 (17:07 +0000)
1  2 
app/assets/javascripts/index.js
config/locales/en.yml
config/routes.rb

index a5916d3ed13682be79bc664840aa9529caf9f9f9,9b825caad0aa77c76932cc3d0c163f6d4d66537c..810327e3fe15bd48a13dd4f5212bcb3bf932fbb7
@@@ -21,6 -21,7 +21,7 @@@
  //= require index/directions
  //= require index/changeset
  //= require index/query
+ //= require index/home
  //= require router
  
  $(document).ready(function () {
  
      $("#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();
  
      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,
      };
  
      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);
      "/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 b52bd137f6f4960d64a87add7dbc4d1d4ab3a164,5f9f706a0032937d9c8c34add43c3d0495ffbca1..1f9792d39608c15770e62285b2d5185de26b4eaf
@@@ -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
        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 7e9cd8dfde78f76e26a78150576561518772c791,0041362666aae10d66f1c8b6e2e1b1d43b325a1b..b3fc5af15900002fe06d4fe8e5cef36315528d5e
@@@ -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
        resource :terms, :only => [:show, :update]
        resource :pd_declaration, :only => [:show, :create]
        resource :deletion, :only => :show
+       resource :home, :only => :show
      end
    end