BUGFIX: JSON requests don't exclude categories from filters

This commit is contained in:
Régis Hanol
2014-01-31 14:36:00 +01:00
parent 59253c937e
commit ae401f0dc7
3 changed files with 5 additions and 13 deletions
+1 -1
View File
@@ -201,7 +201,7 @@ class ListController < ApplicationController
def build_topic_list_options
# html format means we need to parse exclude category (aka filter) from the site options top menu
menu_items = SiteSetting.top_menu_items
menu_item = menu_items.select { |item| item.query_should_exclude_category?(action_name, params[:format]) }.first
menu_item = menu_items.select { |item| item.query_should_exclude_category?(action_name) }.first
# exclude_category = 1. from params / 2. parsed from top menu / 3. nil
options = {
+2 -6
View File
@@ -43,12 +43,8 @@ class TopMenuItem
name.split('/')[1]
end
def query_should_exclude_category?(action_name, format)
if format.blank? || format == "html"
matches_action?(action_name) && has_filter?
else
false
end
def query_should_exclude_category?(action_name)
matches_action?(action_name) && has_filter?
end
def matches_action?(action_name)