[openstreetmap/openstreetmap-website] Add permalinks to changeset comments (PR #4789)
Andy Allan
notifications at github.com
Tue May 14 12:41:10 UTC 2024
@gravitystorm commented on this pull request.
> @@ -33,7 +33,7 @@
<li id="c<%= comment.id %>">
<small class='text-muted'>
<%= t comment.visible ? ".comment_by_html" : ".hidden_comment_by_html",
- :time_ago => friendly_date_ago(comment.created_at),
+ :time_ago => link_to(friendly_date_ago(comment.created_at), "https://www.openstreetmap.org/changeset/#{@changeset.id}##{comment.id}"),
You can generally get the path to an object using `*_path` helpers, e.g. `changeset_path`. So `changeset_path(changeset)` will link to the changeset. If you need an anchor (i.e. a `#something` in the url) then have a look through the views for other places that use the word "anchor", like for diary entry comments.
You will also find that in some circumstances you can simplify the `link_to("foo", changeset_path(changeset)) further, since (most of the time) rails knows how to build a path for an object, e.g. `link_to("foo", changeset)`. You can check other places in the existing codebase to learn what works.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4789#discussion_r1599960939
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4789/review/2055246262 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240514/fe216444/attachment.htm>
More information about the rails-dev
mailing list