add link to mod+ topics

This commit is contained in:
r888888888
2017-01-23 12:27:27 -08:00
parent 16e7043477
commit 98b305b4db
2 changed files with 9 additions and 1 deletions

View File

@@ -71,6 +71,10 @@ class ForumTopic < ActiveRecord::Base
q = permitted
return q if params.blank?
if params[:mod_only].present?
q = q.where("min_level >= ?", MIN_LEVELS[:Moderator])
end
if params[:title_matches].present?
q = q.title_matches(params[:title_matches])
end

View File

@@ -4,7 +4,11 @@
<p>
Categories:
<%= link_to "All", forum_topics_path %>, <%= ForumTopic::CATEGORIES.map {|id, name| link_to_unless_current(name, forum_topics_path(:search => {:category_id => id}))}.join(", ").html_safe %>
<%= link_to "All", forum_topics_path %>,
<% if CurrentUser.is_moderator? %>
<%= link_to "Mod+", forum_topics_path(:search => {:mod_only => true}) %>,
<% end %>
<%= ForumTopic::CATEGORIES.map {|id, name| link_to_unless_current(name, forum_topics_path(:search => {:category_id => id}))}.join(", ").html_safe %>
</p>
<%= render "listing", :forum_topics => @forum_topics %>