ensure widget is hidden on non-category paths

This commit is contained in:
Angus McLeod 2018-09-23 08:36:28 +10:00
parent b4fd0287ed
commit b8cf45aa7f
2 changed files with 5 additions and 3 deletions

View File

@ -1,3 +1,3 @@
{{#if siteSettings.discourse_donations_cause_category}}
{{mount-widget widget="category-header-widget"}}
{{mount-widget widget="category-header-widget" args=(hash currentPath=currentPath)}}
{{/if}}

View File

@ -12,13 +12,15 @@ function donationDisplay(amount, type) {
createWidget('category-header-widget', {
tagName: 'span',
html() {
html(args) {
if (args.currentPath.toLowerCase().indexOf('category') === -1) return;
let category;
const controller = this.container.lookup('controller:navigation/category');
category = controller.get("category");
if(category && category.donations_cause) {
if (category && category.donations_cause) {
$("body").addClass("donations-category");
let contents = [