[openstreetmap/openstreetmap-website] Show changeset element counts using badges (PR #4872)

Marwin Hochfelsner notifications at github.com
Fri Mar 21 09:41:30 UTC 2025


@hlfan commented on this pull request.



> +<% if pages.page_count == 1 %>
+  <h4 class="fs-5">
+    <%= t ".#{type.pluralize}_title" %>
+    <span class="badge count-number">
+      <%= pages.item_count %>
+    </span>
+  </h4>
+<% elsif pages.page_count > 1 %>
+  <h4 class="fs-5">
+    <%= t ".#{type.pluralize}_title" %>
+    <span class="badge count-number">
+      <%= t ".range", :x => pages.current_page.first_item,
+                      :y => pages.current_page.last_item,
+                      :count => pages.item_count %>
+    </span>
+  </h4>
+

I'd find a duplicated if easier to read than a duplicated h4.
```suggestion
  <h4 class="fs-5">
    <%= t ".#{type.pluralize}_title" %>
    <span class="badge count-number">
      <%= if pages.page_count == 1
            pages.item_count
          elsif pages.page_count > 1
            t(".range", x: pages.current_page.first_item,
                        y: pages.current_page.last_item,
                        count: pages.item_count)
          end %>
    </span>
  </h4>
<% if pages.page_count > 1 %>
```

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

Message ID: <openstreetmap/openstreetmap-website/pull/4872/review/2705300418 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250321/d173d5ef/attachment-0001.htm>


More information about the rails-dev mailing list