FEATURE: Introduce 'Subcategories with featured topics' view (#16083)

This categories view is designed for sites which make heavy use of subcategories, and use top-level categories mainly for grouping
This commit is contained in:
David Taylor
2022-03-04 21:11:59 +00:00
committed by GitHub
parent 07e80b52ef
commit eb2e3b510d
9 changed files with 252 additions and 68 deletions

View File

@ -23,11 +23,14 @@ class CategoriesController < ApplicationController
parent_category = Category.find_by_slug(params[:parent_category_id]) || Category.find_by(id: params[:parent_category_id].to_i)
include_subcategories = SiteSetting.desktop_category_page_style == "subcategories_with_featured_topics" ||
params[:include_subcategories] == "true"
category_options = {
is_homepage: current_homepage == "categories",
parent_category_id: params[:parent_category_id],
include_topics: include_topics(parent_category),
include_subcategories: params[:include_subcategories] == "true"
include_subcategories: include_subcategories
}
@category_list = CategoryList.new(guardian, category_options)
@ -377,6 +380,7 @@ class CategoriesController < ApplicationController
params[:include_topics] ||
(parent_category && parent_category.subcategory_list_includes_topics?) ||
style == "categories_with_featured_topics" ||
style == "subcategories_with_featured_topics" ||
style == "categories_boxes_with_topics" ||
style == "categories_with_top_topics"
end