indicating locked thread at bottom, asking to log in before reply

This commit is contained in:
jomo
2014-10-12 21:46:29 +02:00
parent b91bb8e0aa
commit 36792c6dc1
3 changed files with 24 additions and 4 deletions

View File

@@ -961,4 +961,13 @@ nav.pagination {
text-align: left; // just in case it's changed in a parent node
}
}
}
.locked {
background: #ffa500;
border: 1px solid;
border-radius: 3px;
color: #000;
display: inline-block;
padding: 2px 5px;
}

View File

@@ -24,10 +24,21 @@
<% @replies.each do |reply| %>
<%= render partial: "threadreplies/reply", locals: {reply: reply} %>
<% end %>
<%= paginate @replies %>
<% if @thread.can_write?(current_user) %>
<%= render partial: "threadreplies/new", locals: {reply: Threadreply.new(forumthread: @thread)} %>
<% if @thread.locked? %>
<div class="locked">This thread is locked.</div>
<% end %>
<% if current_user %>
<% if @thread.can_write?(current_user) %>
<%= render partial: "threadreplies/new", locals: {reply: Threadreply.new(forumthread: @thread)} %>
<% else %>
<p>You don't have the required permission to reply here.</p>
<% end %>
<% else %>
You cannot reply here.
<p>Please <%= link_to "Log in", login_path(return_path: request.env['PATH_INFO']), action: "new" %> to post a reply.</p>
<% end %>
</div>

View File

@@ -1,4 +1,4 @@
<%= form_for [reply.thread, reply] do |f| %>
<%= render partial: "md_editor", locals: {name: "threadreply[content]", content: reply.content, mini: false} %>
<p><%= f.submit "Reply", class: "btn blue" %></p>
<p><%= f.submit "Reply#{ ' (Locked)' if reply.thread.locked? }", class: "btn blue" %></p>
<% end %>