-
Notifications
You must be signed in to change notification settings - Fork 904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add permalinks to changeset comments #4789
base: master
Are you sure you want to change the base?
Conversation
@@ -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}"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:time_ago => link_to(friendly_date_ago(comment.created_at), "https://www.openstreetmap.org/changeset/#{@changeset.id}##{comment.id}"), | |
:time_ago => link_to(friendly_date_ago(comment.created_at), "/changeset/#{@changeset.id}##{comment.id}"), |
But there are probably more rail-ish ways to create that url....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Fixes #2796