redirect to proper page for thread replies

This commit is contained in:
jomo
2015-02-08 00:47:17 +01:00
parent e887e3d1da
commit f82af96759
7 changed files with 36 additions and 8 deletions

View File

@@ -20,7 +20,11 @@
<% if last_reply && last_reply.created_at > last_thread.created_at %>
<% if last_reply.thread.can_read?(current_user) %>
<%= last_reply.author.name %>
<%= link_to "replied", forumthread_path(last_reply.thread) + "#reply-#{last_reply.id}" %>
<%
position = last_reply.thread.replies.count - 1
page = position / Kaminari.config.default_per_page + 1
%>
<%= link_to "replied", forumthread_path(last_reply.thread, page: page) + "#reply-#{last_reply.id}" %>
<%= ago last_reply.created_at %>.
<% else %>
Hidden

View File

@@ -29,7 +29,11 @@
<div class="item-info">
<% if rpl = thread.replies.last %>
<%= rpl.author.name %>
<%= link_to "replied", forumthread_path(thread) + "#reply-#{rpl.id}" %>
<%
position = thread.replies.count - 1
page = position / Kaminari.config.default_per_page + 1
%>
<%= link_to "replied", forumthread_path(thread, page: page) + "#reply-#{rpl.id}" %>
<%= ago rpl.created_at %>.
<% else %>
No replies yet.