[openstreetmap/openstreetmap-website] Element version pages (PR #4480)

Tom Hughes notifications at github.com
Sun Jan 21 15:30:44 UTC 2024


@tomhughes commented on this pull request.



> @@ -355,6 +355,17 @@ $(document).ready(function () {
     return page;
   };
 
+  OSM.OldBrowse = function () {
+    var page = {};
+
+    page.pushstate = page.popstate = function (path) {
+      OSM.loadSidebarContent(path, function () {

You can just drop the second argument here as `loadSidebarContent` will only try and call the callback if one is passed.

> @@ -369,8 +380,11 @@ $(document).ready(function () {
     "/user/:display_name/history": history,
     "/note/:id": OSM.Note(map),
     "/node/:id(/history)": OSM.Browse(map, "node"),
+    "/node/:id/history/:version": OSM.OldBrowse(map, "node"),

As `oldBrowse` doesn't take any arguments there's no need to pass anything here, or to the other two calls.

> @@ -0,0 +1,19 @@
+class OldNodesController < ApplicationController
+  layout :map_layout
+
+  before_action :authorize_web
+  before_action :set_locale
+  before_action -> { check_database_readable(:need_api => true) }
+  before_action :require_oauth
+
+  authorize_resource
+
+  around_action :web_timeout
+
+  def show
+    @type = "node"
+    @feature = OldNode.preload(:old_tags, :changeset => [:changeset_tags, :user]).find([params[:id], params[:version]])

In the `browse#node` action for the current view we preload the containing relations here - is that not possible for the historical objects? We still seem to be rendering them?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4480#pullrequestreview-1835360339
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/4480/review/1835360339 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240121/b5b46cf4/attachment.htm>


More information about the rails-dev mailing list