FEATURE: Add support for Boxes with Subcategories desktop style

This commit is contained in:
tshenry 2022-02-10 20:00:58 -08:00
parent f4c11bab64
commit 6dcdb39f19
No known key found for this signature in database
GPG Key ID: E2C7B0D57EBBF419
3 changed files with 45 additions and 1 deletions

View File

@ -6,6 +6,7 @@ const rawCategoryPreviews = settings.category_previews.split("|");
export default Component.extend({
noCategoryStyle: equal("siteSettings.category_style", "none"),
boxStyle: equal("siteSettings.desktop_category_page_style", "categories_boxes"),
@discourseComputed()
preview() {

View File

@ -0,0 +1 @@
{{category-preview tagName="" args=(hash category=category)}}

View File

@ -35,6 +35,48 @@
</tbody>
</table>
</div>
{{else if boxStyle}}
<div style={{unless noCategoryStyle (border-color p.color)}} class="category category-box {{if noCategoryStyle "no-category-boxes-style"}} {{p.className}}">
<div class="category-box-inner">
<div class="category-logo">
{{#if p.uploaded_logo.url}}
{{cdn-img
src=p.uploaded_logo.url
class="logo"
width=p.uploaded_logo.width
height=p.uploaded_logo.height
alt=""
}}
{{/if}}
</div>
<div class="category-details">
<div class="category-box-heading">
{{#if p.href}}
<a class="parent-box-link" href={{p.href}}>
<h3>
{{#if (theme-setting 'locked_icon')}}
{{d-icon (theme-setting 'locked_icon')}}
{{/if}}
{{p.title}}
</h3>
</a>
{{else}}
<h3>
{{#if (theme-setting 'locked_icon')}}
{{d-icon (theme-setting 'locked_icon')}}
{{/if}}
{{p.title}}
</h3>
{{/if}}
</div>
{{#if p.description}}
<div class="description">
{{html-safe p.description}}
</div>
{{/if}}
</div>
</div>
</div>
{{else}}
<tr class={{p.className}}>
<td colspan=2 class="category {{if noCategoryStyle "no-category-style"}}" style={{unless noCategoryStyle (border-color p.color)}}>
@ -58,7 +100,7 @@
{{/if}}
</h3>
{{#if p.description}}
<div class="category-description">{{p.description}}</div>
<div class="category-description">{{html-safe p.description}}</div>
{{/if}}
</td>
</tr>