implements #2658: private forum topics

This commit is contained in:
Albert Yi
2016-10-24 16:56:18 -07:00
parent 0757f201a0
commit 589df5f301
10 changed files with 121 additions and 60 deletions

View File

@@ -22,6 +22,10 @@
<%= f.input :is_locked %>
<% end %>
<% if CurrentUser.is_builder? %>
<%= f.input :min_level, :as => :select, :collection => User.level_hash.to_a %>
<% end %>
<%= f.button :submit, "Submit", :data => { :disable_with => "Submitting..." } %>
<%= dtext_preview_button "forum_post", "body", :input_id => "forum_post_body_for_#{forum_topic.original_post.id}", :preview_id => "dtext-preview-for-#{forum_topic.original_post.id}" %>
<% end %>

View File

@@ -9,30 +9,36 @@
</thead>
<tbody>
<% forum_topics.each do |topic| %>
<tr class="forum-topic-row forum-topic-category-<%= topic.category_id %>">
<td>
<% if topic.is_sticky? %>
<span class="sticky">Sticky:</span>
<% end %>
<% if CurrentUser.user.level >= topic.min_level %>
<tr class="forum-topic-row forum-topic-category-<%= topic.category_id %>">
<td>
<% if topic.is_sticky? %>
<span class="sticky">Sticky:</span>
<% end %>
<% unless topic.read_by?(CurrentUser.user) %>
<span class="new">NEW</span>
<% end %>
<% unless topic.read_by?(CurrentUser.user) %>
<span class="new">NEW</span>
<% end %>
<%= link_to topic.title, forum_topic_path(topic) %>
<%= link_to topic.title, forum_topic_path(topic) %>
<% if topic.response_count > Danbooru.config.posts_per_page %>
<%= link_to "page #{topic.last_page}", forum_topic_path(topic, :page => topic.last_page), :class => "last-page" %>
<% end %>
<% if topic.response_count > Danbooru.config.posts_per_page %>
<%= link_to "page #{topic.last_page}", forum_topic_path(topic, :page => topic.last_page), :class => "last-page" %>
<% end %>
<% if topic.is_locked? %>
<span class="locked-topic">(locked)</span>
<% end %>
</td>
<td><%= link_to_user topic.creator %></td>
<td><%= link_to_user topic.updater %></td>
<td><%= compact_time topic.updated_at %></td>
</tr>
<% if topic.is_locked? %>
<span class="locked-topic">(locked)</span>
<% end %>
<% if topic.min_level > 0 %>
<span class="level-topic">(<%= User.level_string(topic.min_level).downcase %> only)</span>
<% end %>
</td>
<td><%= link_to_user topic.creator %></td>
<td><%= link_to_user topic.updater %></td>
<td><%= compact_time topic.updated_at %></td>
</tr>
<% end %>
<% end %>
</tbody>
</table>

View File

@@ -2,8 +2,13 @@
<div id="a-show">
<h1>
Topic: <%= @forum_topic.title %>
<% if @forum_topic.min_level >= User::Levels::BUILDER %>
<span class="level-topic">(<%= User.level_string(@forum_topic.min_level).downcase %> only)</span>
<% end %>
<% if @forum_topic.is_deleted? %>
(deleted)
<span class="locked-topic">(deleted)</span>
<% end %>
</h1>