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
|
<% title "Edit Thread: #{@thread}" %>
<%
forums = []
Forum.all.sort_by{ |f| f.forumgroup && f.forumgroup.position || 0 }.each do |f|
forums << ["#{f.forumgroup.name} → #{f.name}", f.id] if f.forumgroup
end
labels = [["Label", nil]]
Label.order(:name).each do |l|
labels << [l.name, l.id]
end
%>
<h1>Edit Thread</h1>
<%= link_to @thread.forum.group, forumgroup_path(@thread.forum.group) %> → <%= link_to @thread.forum, @thread.forum %> → <%= link_to @thread, @thread %> → Edit thread
<%= form_for @thread do |f|%>
<table>
<% if mod? %>
<tr>
<td><%= f.check_box :sticky %> <%= f.label :sticky %></td>
</tr>
<tr>
<td><%= f.check_box :locked %> <%= f.label :locked %></td>
</tr>
<tr>
<td><%= f.label :forum_id, "Move thread" %></td>
<td><%= f.select :forum_id, forums %></td>
</tr>
<% end %>
</table>
<div class="table-cell">
<%= f.select :label_id, labels, {}, class: "auto-width", disabled: (@thread.locked? && !mod?) %>
</div>
<div class="table-cell full-width">
<%= f.text_field :title, placeholder: "Title" %>
</div>
<%= render partial: "md_editor", locals: {name: "forumthread[content]", content: @thread.content} %>
<p><%= f.submit "Update Thread", class: "btn blue left" %></p>
<% end %>
<%= button_to "Delete Thread", @thread, :method => "delete", data: {confirm: "Delete thread & comments forever?"}, class: "btn red right" %>
<div class="clear"></div>
|