diff --git a/app/assets/javascripts/discourse/helpers/application_helpers.js b/app/assets/javascripts/discourse/helpers/application_helpers.js index 19be3d12035..46035e1f3f5 100644 --- a/app/assets/javascripts/discourse/helpers/application_helpers.js +++ b/app/assets/javascripts/discourse/helpers/application_helpers.js @@ -61,7 +61,7 @@ function categoryLinkHTML(category, options) { if (options.hash) { if (options.hash.allowUncategorized) { categoryOptions.allowUncategorized = true; } if (options.hash.showParent) { categoryOptions.showParent = true; } - if (options.hash.clearChildColor) { categoryOptions.clearChildColor = true; } + if (options.hash.onlyStripe) { categoryOptions.onlyStripe = true; } if (options.hash.link !== undefined) { categoryOptions.link = options.hash.link; } if (options.hash.extraClasses) { categoryOptions.extraClasses = options.hash.extraClasses; } if (options.hash.categories) { diff --git a/app/assets/javascripts/discourse/lib/html.js b/app/assets/javascripts/discourse/lib/html.js index a462a1f9909..4ca0e163012 100644 --- a/app/assets/javascripts/discourse/lib/html.js +++ b/app/assets/javascripts/discourse/lib/html.js @@ -89,18 +89,19 @@ Discourse.HTML = { url = Discourse.getURL("/category/") + Discourse.Category.slugFor(category), elem = (opts.link === false ? 'span' : 'a'), extraClasses = (opts.extraClasses ? (' ' + opts.extraClasses) : ''), - html = "<" + elem + " href=\"" + (opts.link === false ? '' : url) + "\" "; + html = "<" + elem + " href=\"" + (opts.link === false ? '' : url) + "\" ", + categoryStyle; html += "data-drop-close=\"true\" class=\"badge-category" + (restricted ? ' restricted' : '' ) + - (opts.clearChildColor ? ' clear-badge' : '') + + (opts.onlyStripe ? ' clear-badge' : '') + extraClasses + "\" "; name = Handlebars.Utils.escapeExpression(name); // Add description if we have it, without tags. Server has sanitized the description value. if (description) html += "title=\"" + $("
").html(description).text() + "\" "; - if (!opts.clearChildColor) { - var categoryStyle = Discourse.HTML.categoryStyle(category); + if (!opts.onlyStripe) { + categoryStyle = Discourse.HTML.categoryStyle(category); if (categoryStyle) { html += "style=\"" + categoryStyle + "\" "; } @@ -114,7 +115,8 @@ Discourse.HTML = { if (opts.showParent && category.get('parent_category_id')) { var parent = Discourse.Category.findById(category.get('parent_category_id')); - html = "<" + elem + " class='badge-category-parent" + extraClasses + "' style=\"" + (Discourse.HTML.categoryStyle(parent)||'') + + categoryStyle = Discourse.HTML.categoryStyle(opts.onlyStripe ? category : parent) || ''; + html = "<" + elem + " class='badge-category-parent" + extraClasses + "' style=\"" + categoryStyle + "\" href=\"" + (opts.link === false ? '' : url) + "\">" + (Em.get(parent, 'read_restricted') ? " " : "") + Em.get(parent, 'name') + "" + diff --git a/app/assets/javascripts/discourse/templates/discovery/categories.js.handlebars b/app/assets/javascripts/discourse/templates/discovery/categories.js.handlebars index 7e7b6f4576f..68cb456bec2 100644 --- a/app/assets/javascripts/discourse/templates/discovery/categories.js.handlebars +++ b/app/assets/javascripts/discourse/templates/discovery/categories.js.handlebars @@ -37,7 +37,7 @@ {{#if subcategories}}
{{#each subcategories}} - {{category-link this showParent=true clearChildColor=true}} + {{category-link this showParent=true onlyStripe=true}} {{#if unreadTopics}} {{unbound unreadTopics}} {{/if}}