openstreetmap / openstreetmap-website

The Rails application that powers OpenStreetMap
https://www.openstreetmap.org/
GNU General Public License v2.0
2.21k stars 918 forks source link

Show "node also part of ways" as nested lists on way pages #5317

Open AntonKhorev opened 1 week ago

AntonKhorev commented 1 week ago

Way pages have lists of nodes. Every way node can be shared with other ways, and if it is, then all of those ways are also listed. Currently it's done as "(part of ways ...)" phrases with ways listed using to_sentence. Those are cumbersome to deal with. You can never be sure about grammar in translations. Also it's more difficult to style because each way may or may not have an icon, there's a space reserved for that icon, that icon has to be positioned into that space probably with a bunch of pixel values. That's what #5080 does and that's one thing I don't like about it.

In this PR I convert those phrases with inline icons into nested lists. After that icons are going to be located at the beginning of <li>s both for nested lists of ways and outer lists of nodes. This will make icons easier to position.

Also fixes #1147. Inner lists of ways contain only unique ways to avoid https://github.com/openstreetmap/openstreetmap-website/issues/1147#issuecomment-2189648596. The outer list of all nodes has details collapsed for any node that was already written (see node 2071 on screenshots below).

Before: image

After: image