summaryrefslogtreecommitdiff
path: root/app/views/forumthreads/show.html.erb
blob: b29d29e66ed14605a57964e08e717cd0fd041e2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<%= 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 %>
  <%= link_to "Reverse Replies", forumthread_path(@thread, reverse: params[:reverse] != "true"), class: "btn right blue" %>
</h1>
<div class="item-group thread with-avatar" id="thread-<%= @thread.id %>">
  <div class="header">
    <%= link_to(@thread.author.avatar(64), @thread.author, title: @thread.author.ign) %>
    <%= render partial: "users/username", locals: { user: @thread.author } %>
    <%= link_to p do %>
      <%= ago @thread.created_at %>
    <% end %>
    <%= link_to "edit", edit_forumthread_path( @thread), class: "editlink" if mod? || @thread.author.is?(current_user) %>
    <div class="clear-right"></div>
  </div>
  <div class="items">
    <% if @thread.edited? %>
      <div class="item edited">
        Last edited <%= ago @thread.updated_at %> by <%= link_to @thread.editor.name, @thread.editor %>.
      </div>
    <% end %>
    <div class="item content">
      <%= render_md(@thread.content).html_safe %>
    </div>
  </div>
</div>
<div id="replies">
  <h3><%= "#{pluralize(@thread.replies.size, 'reply')}." %></h3>
  <% @replies.each do |reply| %>
    <%= render partial: "threadreplies/reply", locals: {reply: reply} %>
  <% end %>

  <%= paginate @replies %>


  <% if @thread.locked? %>
    <div class="lockednote">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 %>
    <p>Please <%= link_to "Log in", login_path(return_path: request.env['PATH_INFO']), action: "new" %> to post a reply.</p>
  <% end %>
</div>