[openstreetmap/openstreetmap-website] Make "Load more" button on history pages work as a link to the next page (PR #3829)

Tom Hughes notifications at github.com
Fri Dec 9 17:45:37 UTC 2022


@tomhughes requested changes on this pull request.



> @@ -173,7 +178,14 @@ OSM.History = function (map) {
 
     map.on("zoomend", updateBounds);
 
-    loadFirstChangesets();
+    var maxId;
+    var paramsIndex = path.indexOf("?");
+    if (paramsIndex >= 0) {
+      var params = Qs.parse(path.substring(paramsIndex + 1));
+      maxId = params.max_id;
+    }
+
+    loadFirstChangesets(maxId);

I don't understand the point of this, indeed of any of this commit, when you remove it all again in the next commit?

> @@ -4,7 +4,7 @@
   </ol>
 <% if @changesets.size == 20 -%>
   <div class="changeset_more mt-3 text-center">
-    <%= link_to t(".load_more"), url_for(@params.merge(:max_id => @changesets.last.id - 1)), :class => "btn btn-primary" %>
+    <%= link_to t(".load_more"), "#{url_for}/#{@changesets.last.id - 1}", :class => "btn btn-primary" %>

That way of constructing the URL is not a good idea - doesn't `url_for(:max_id => @changesets.last.id - 1)` work? If not then there will something which does and which doesn't rely on manually gluing the component together like that.

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

Message ID: <openstreetmap/openstreetmap-website/pull/3829/review/1211989461 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20221209/0e8c3896/attachment.htm>


More information about the rails-dev mailing list