diff --git a/app/assets/stylesheets/style.css.scss b/app/assets/stylesheets/style.css.scss index 201cad8..0c314ce 100644 --- a/app/assets/stylesheets/style.css.scss +++ b/app/assets/stylesheets/style.css.scss @@ -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; } \ No newline at end of file diff --git a/app/views/forumthreads/show.html.erb b/app/views/forumthreads/show.html.erb index 71758bf..b8520bf 100644 --- a/app/views/forumthreads/show.html.erb +++ b/app/views/forumthreads/show.html.erb @@ -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? %> +
This thread is locked.
+ <% end %> + + <% if current_user %> + <% if @thread.can_write?(current_user) %> + <%= render partial: "threadreplies/new", locals: {reply: Threadreply.new(forumthread: @thread)} %> + <% else %> +

You don't have the required permission to reply here.

+ <% end %> <% else %> - You cannot reply here. +

Please <%= link_to "Log in", login_path(return_path: request.env['PATH_INFO']), action: "new" %> to post a reply.

<% end %> \ No newline at end of file diff --git a/app/views/threadreplies/_new.html.erb b/app/views/threadreplies/_new.html.erb index a66f9ff..93f227d 100644 --- a/app/views/threadreplies/_new.html.erb +++ b/app/views/threadreplies/_new.html.erb @@ -1,4 +1,4 @@ <%= form_for [reply.thread, reply] do |f| %> <%= render partial: "md_editor", locals: {name: "threadreply[content]", content: reply.content, mini: false} %> -

<%= f.submit "Reply", class: "btn blue" %>

+

<%= f.submit "Reply#{ ' (Locked)' if reply.thread.locked? }", class: "btn blue" %>

<% end %> \ No newline at end of file