mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Add mobile support for subcategories-with-featured-topics (#16118)
Follow-up to eb2e3b510d
This commit is contained in:
parent
5335b40a87
commit
3ad9c2cdb6
@ -11,6 +11,11 @@ const subcategoryStyleComponentNames = {
|
|||||||
boxes_with_featured_topics: "categories_boxes_with_topics",
|
boxes_with_featured_topics: "categories_boxes_with_topics",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const mobileCompatibleViews = [
|
||||||
|
"categories_with_featured_topics",
|
||||||
|
"subcategories_with_featured_topics",
|
||||||
|
];
|
||||||
|
|
||||||
export default DiscoveryController.extend({
|
export default DiscoveryController.extend({
|
||||||
discovery: controller(),
|
discovery: controller(),
|
||||||
|
|
||||||
@ -21,9 +26,11 @@ export default DiscoveryController.extend({
|
|||||||
|
|
||||||
@discourseComputed("model.parentCategory")
|
@discourseComputed("model.parentCategory")
|
||||||
categoryPageStyle(parentCategory) {
|
categoryPageStyle(parentCategory) {
|
||||||
let style = this.site.mobileView
|
let style = this.siteSettings.desktop_category_page_style;
|
||||||
? "categories_with_featured_topics"
|
|
||||||
: this.siteSettings.desktop_category_page_style;
|
if (this.site.mobileView && !mobileCompatibleViews.includes(style)) {
|
||||||
|
style = mobileCompatibleViews[0];
|
||||||
|
}
|
||||||
|
|
||||||
if (parentCategory) {
|
if (parentCategory) {
|
||||||
style =
|
style =
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<table class="category-list subcategory-list with-topics">
|
<table class="category-list subcategory-list with-topics">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="category">
|
<th class="parent-category">
|
||||||
{{category-title-link category=category}}
|
{{category-title-link category=category}}
|
||||||
<span class="stat" title={{category.statTitle}}>{{html-safe category.stat}}</span>
|
<span class="stat" title={{category.statTitle}}>{{html-safe category.stat}}</span>
|
||||||
</th>
|
</th>
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
{{#each categories as |category|}}
|
||||||
|
<div class="category-list subcategory-list with-topics">
|
||||||
|
<div class="parent-category">
|
||||||
|
{{category-title-link category=category}}
|
||||||
|
<span class="stat" title={{category.statTitle}}>{{html-safe category.stat}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="subcategories">
|
||||||
|
{{#each category.subcategories as |subCategory|}}
|
||||||
|
{{parent-category-row category=subCategory showTopics=true}}
|
||||||
|
{{else}}
|
||||||
|
{{!-- No subcategories... so just show the parent to avoid confusion --}}
|
||||||
|
{{parent-category-row category=category showTopics=true}}
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
@ -28,7 +28,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.subcategory-list {
|
.subcategory-list {
|
||||||
th.category {
|
.parent-category {
|
||||||
h3 {
|
h3 {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user