41 lines
1.5 KiB
Plaintext
41 lines
1.5 KiB
Plaintext
<% 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> |