diff --git a/assets/javascripts/discourse/connectors/below-site-header/donations-category-header-container.hbs b/assets/javascripts/discourse/connectors/below-site-header/donations-category-header-container.hbs index 8de7bcd..6e2c7bb 100644 --- a/assets/javascripts/discourse/connectors/below-site-header/donations-category-header-container.hbs +++ b/assets/javascripts/discourse/connectors/below-site-header/donations-category-header-container.hbs @@ -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}} diff --git a/assets/javascripts/discourse/widgets/donations-category-header-widget.js.es6 b/assets/javascripts/discourse/widgets/donations-category-header-widget.js.es6 index 9c011b1..515d70a 100644 --- a/assets/javascripts/discourse/widgets/donations-category-header-widget.js.es6 +++ b/assets/javascripts/discourse/widgets/donations-category-header-widget.js.es6 @@ -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 = [