Added Reply Reversal And Toggle

This commit is contained in:
MrYummy
2017-05-29 00:10:58 +02:00
parent e4d86d4bb0
commit 888c863b10
2 changed files with 15 additions and 5 deletions
@@ -7,8 +7,12 @@ class ForumthreadsController < ApplicationController
end end
def show def show
if params[:reverse]
@replies = @thread.replies.reverse_order.page(params[:page])
else
@replies = @thread.replies.page(params[:page]) @replies = @thread.replies.page(params[:page])
end end
end
def edit def edit
unless mod? || @thread.author.is?(current_user) unless mod? || @thread.author.is?(current_user)
+8 -2
View File
@@ -1,6 +1,12 @@
<%= link_to @thread.forum.group, forumgroup_path(@thread.forum.group) %><%= link_to @thread.forum, @thread.forum %><%=truncate(@thread.title, length: 60, omission: " …") %> <%= link_to @thread.forum.group, forumgroup_path(@thread.forum.group) %><%= link_to @thread.forum, @thread.forum %><%=truncate(@thread.title, length: 60, omission: " …") %>
<h1><%= render partial: "labels/label", locals: {label: @thread.label} %><%= title @thread.title %></h1> <h1>
<%= render partial: "labels/label", locals: {label: @thread.label} %><%= title @thread.title %>
<% if params[:reverse] %>
<%= link_to "Reverse Replies", @thread, class: "btn right blue" %>
<% else %>
<%= link_to "Reverse Replies", forumthread_path(@thread, reverse: true), class: "btn right blue" %>
<% end %>
</h1>
<div class="item-group thread with-avatar" id="thread-<%= @thread.id %>"> <div class="item-group thread with-avatar" id="thread-<%= @thread.id %>">
<div class="header"> <div class="header">
<%= link_to(@thread.author.avatar(64), @thread.author, title: @thread.author.ign) %> <%= link_to(@thread.author.avatar(64), @thread.author, title: @thread.author.ign) %>