forum: make status labels into clickable filters.
* Make it so that you can click the stickied / locked / deleted icons or the new / approved / pending / rejected labels to filter topics by that status. * Replace the `mod_only` search param with `is_private`.
This commit is contained in:
@@ -1,31 +1,33 @@
|
||||
<%= table_for forum_topics, width: "100%" do |t| %>
|
||||
<% t.column "Title" do |topic| %>
|
||||
<% if !topic.is_read? %>
|
||||
<span class="topic-status label new">New</span>
|
||||
<%= link_to forum_topics_path(search: { is_read: false }) do %>
|
||||
<span class="topic-status label new">New</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if topic.is_sticky? %>
|
||||
<span class="topic-status icon stickied">
|
||||
<i class="fas fa-thumbtack" title="Stickied"></i>
|
||||
</span>
|
||||
<%= link_to forum_topics_path(search: { is_sticky: true }) do %>
|
||||
<i class="topic-status icon stickied fas fa-thumbtack" title="Stickied"></i>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if topic.is_locked? %>
|
||||
<span class="topic-status icon locked">
|
||||
<i class="fas fa-lock" title="Locked"></i>
|
||||
</span>
|
||||
<%= link_to forum_topics_path(search: { is_locked: true }) do %>
|
||||
<i class="topic-status icon locked fas fa-lock" title="Locked"></i>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if topic.is_deleted? %>
|
||||
<span class="topic-status icon deleted">
|
||||
<i class="fas fa-trash-alt" title="Deleted"></i>
|
||||
</span>
|
||||
<%= link_to forum_topics_path(search: { is_deleted: true }) do %>
|
||||
<i class="topic-status icon deleted fas fa-trash-alt" title="Deleted"></i>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if topic.min_level > 0 %>
|
||||
<span class="topic-status icon restricted">
|
||||
<i class="fas fa-hand-paper" title="<%= User.level_string(topic.min_level) %> only"></i>
|
||||
</span>
|
||||
<% if topic.is_private? %>
|
||||
<%= link_to forum_topics_path(search: { is_private: true }) do %>
|
||||
<i class="topic-status icon private fas fa-hand-paper" title="<%= User.level_string(topic.min_level) %> only"></i>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if forum_topic_status(topic).present? %>
|
||||
@@ -40,7 +42,9 @@
|
||||
<% end %>
|
||||
<% t.column "Status", width: "1%" do |topic| %>
|
||||
<% status = forum_topic_status(topic) %>
|
||||
<span class="topic-status label <%= status %>"><%= status %></span>
|
||||
<%= link_to forum_topics_path(search: { status: status }) do %>
|
||||
<span class="topic-status label <%= status %>"><%= status %></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% t.column "Creator", width: "8%" do |topic| %>
|
||||
<%= link_to_user topic.creator %>
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
<p>
|
||||
Categories:
|
||||
<%= link_to "All", forum_topics_path %>,
|
||||
<%= link_to "New", forum_topics_path(search: { is_read: false }) %>,
|
||||
<% if CurrentUser.is_moderator? %>
|
||||
<%= link_to "Mod+", forum_topics_path(:search => {:mod_only => true}) %>,
|
||||
<%= link_to "Private", forum_topics_path(search: { is_private: true }) %>,
|
||||
<% end %>
|
||||
<%= ForumTopic::CATEGORIES.map {|id, name| link_to_unless_current(name, forum_topics_path(:search => {:category_id => id}))}.join(", ").html_safe %>
|
||||
</p>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<h1>
|
||||
<%= @forum_topic.title %>
|
||||
|
||||
<% if @forum_topic.min_level >= User::Levels::MODERATOR %>
|
||||
<% if @forum_topic.is_private? %>
|
||||
<span class="level-topic">(<%= User.level_string(@forum_topic.min_level).downcase %>+ only)</span>
|
||||
<% end %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user