forum posts, comments: make timestamps into permalinks.

Make the timestamp beneath the username on forum posts into a permalink
that links to the post in full context of the thread. For comments, make
the timestamp link to the comment in full context of the post.

* Make the timestamp in forum posts link to /forum_posts/123.
* Make the timestamp in comments link to /posts/456#comment_123.
* Make /forum_posts/123 redirect to /forum_topics/456#forum_post_123.
* Make /comments/123 redirect to /posts/456#comment_123.
* Remove the "ID: ###" and "Permalink" fields from forum posts.
This commit is contained in:
evazion
2019-09-29 15:57:15 -05:00
parent 9ba46105dd
commit fc3441606e
9 changed files with 28 additions and 45 deletions

View File

@@ -33,10 +33,12 @@ class ForumPostsController < ApplicationController
end
def show
if request.format == "text/html" && @forum_post.id == @forum_post.topic.original_post.id
redirect_to(forum_topic_path(@forum_post.topic, :page => params[:page]))
else
respond_with(@forum_post)
respond_with(@forum_post) do |format|
format.html do
page = @forum_post.forum_topic_page
page = nil if page == 1
redirect_to forum_topic_path(@forum_post.topic, page: page, anchor: "forum_post_#{@forum_post.id}")
end
end
end