redirect to proper page for thread replies
This commit is contained in:
@@ -18,7 +18,9 @@ class ThreadrepliesController < ApplicationController
|
||||
if @reply.save
|
||||
@reply.send_new_reply_mail
|
||||
@reply.send_new_mention_mail
|
||||
redirect_to forumthread_path(@reply.thread) + "#reply-#{@reply.id}", notice: 'Reply created!'
|
||||
position = thread.replies.count - 1
|
||||
page = position / Kaminari.config.default_per_page + 1
|
||||
redirect_to forumthread_path(@reply.thread, page: page) + "#reply-#{@reply.id}", notice: 'Reply created!'
|
||||
else
|
||||
flash[:alert] = "Could not create reply."
|
||||
redirect_to Forumthread.find(params[:forumthread_id])
|
||||
@@ -36,7 +38,9 @@ class ThreadrepliesController < ApplicationController
|
||||
if @reply.update_attributes(reply_params)
|
||||
@reply.send_new_mention_mail(old_content)
|
||||
flash[:notice] = "Reply updated!"
|
||||
redirect_to forumthread_path(@reply.thread) + "#reply-#{@reply.id}"
|
||||
position = @reply.thread.replies.count - 1
|
||||
page = position / Kaminari.config.default_per_page + 1
|
||||
redirect_to forumthread_path(@reply.thread, page: page) + "#reply-#{@reply.id}"
|
||||
else
|
||||
flash[:alert] = "There was a problem while updating your reply"
|
||||
render action: "edit"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
<%= render_md(@comment.content).html_safe %>
|
||||
</blockquote>
|
||||
|
||||
<p><%= link_to "Click here", blogpost_url(@comment.blogpost) + "#comment-#{@comment.id}", style: "text-decoration: none; color: #4096EE;" %> to view the blog post.</p>
|
||||
<%
|
||||
position = @comment.blogpost.comments.count - 1
|
||||
page = position / Kaminari.config.default_per_page + 1
|
||||
%>
|
||||
<p><%= link_to "Click here", blogpost_url(@comment.blogpost, page: page) + "#comment-#{@comment.id}", style: "text-decoration: none; color: #4096EE;" %> to view the blog post.</p>
|
||||
|
||||
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(role: "staff"), style: "text-decoration: none; color: #4096EE;" %> in-game or on the forums!</p>
|
||||
<p>Your Redstoner team</p>
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
<%= render_md(@comment.content).html_safe %>
|
||||
</blockquote>
|
||||
|
||||
<p><%= link_to "Click here", blogpost_url(@comment.blogpost) + "#comment-#{@comment.id}", style: "text-decoration: none; color: #4096EE;" %> to view the blog post.</p>
|
||||
<%
|
||||
position = @comment.blogpost.comments.count - 1
|
||||
page = position / Kaminari.config.default_per_page + 1
|
||||
%>
|
||||
<p><%= link_to "Click here", blogpost_url(@comment.blogpost, page: page) + "#comment-#{@comment.id}", style: "text-decoration: none; color: #4096EE;" %> to view the blog post.</p>
|
||||
|
||||
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(role: "staff"), style: "text-decoration: none; color: #4096EE;" %> in-game or on the forums!</p>
|
||||
<p>Your Redstoner team</p>
|
||||
|
||||
@@ -9,7 +9,11 @@
|
||||
<%= render_md(@reply.content).html_safe %>
|
||||
</blockquote>
|
||||
|
||||
<p><%= link_to "Click here", forumthread_url(@reply.thread) + "#reply-#{@reply.id}", style: "text-decoration: none; color: #4096EE;" %> to view the thread.</p>
|
||||
<%
|
||||
position = @reply.thread.replies.count - 1
|
||||
page = position / Kaminari.config.default_per_page + 1
|
||||
%>
|
||||
<p><%= link_to "Click here", forumthread_url(@reply.thread, page: page) + "#reply-#{@reply.id}", style: "text-decoration: none; color: #4096EE;" %> to view the thread.</p>
|
||||
|
||||
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(role: "staff"), style: "text-decoration: none; color: #4096EE;" %> in-game or on the forums!</p>
|
||||
<p>Your Redstoner team</p>
|
||||
|
||||
@@ -9,7 +9,11 @@
|
||||
<%= render_md(@reply.content).html_safe %>
|
||||
</blockquote>
|
||||
|
||||
<p><%= link_to "Click here", forumthread_url(@reply.thread) + "#reply-#{@reply.id}", style: "text-decoration: none; color: #4096EE;" %> to view the thread.</p>
|
||||
<%
|
||||
position = @reply.thread.replies.count - 1
|
||||
page = position / Kaminari.config.default_per_page + 1
|
||||
%>
|
||||
<p><%= link_to "Click here", forumthread_url(@reply.thread, page: page) + "#reply-#{@reply.id}", style: "text-decoration: none; color: #4096EE;" %> to view the thread.</p>
|
||||
|
||||
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(role: "staff"), style: "text-decoration: none; color: #4096EE;" %> in-game or on the forums!</p>
|
||||
<p>Your Redstoner team</p>
|
||||
|
||||
Reference in New Issue
Block a user