Support forcing badge styles

This commit is contained in:
Robin Ward 2017-08-03 14:55:25 -04:00
parent 061cc17a65
commit 82230a1830
4 changed files with 9 additions and 2 deletions

View File

@ -44,6 +44,11 @@ export default Combobox.extend({
const value = this.get('value');
const topic = this.get('topic');
// In case it's not a valid topic
if (!topic.get('id')) {
return;
}
const refresh = () => {
this._createContent();
this.set('value', null);

View File

@ -5,6 +5,7 @@ registerUnbound('category-badge', function(cat, options) {
return categoryLinkHTML(cat, {
hideParent: options.hideParent,
allowUncategorized: options.allowUncategorized,
categoryStyle: options.categoryStyle,
link: false
});
});

View File

@ -52,7 +52,7 @@ export function categoryBadgeHTML(category, opts) {
let classNames = "badge-category clear-badge";
if (restricted) { classNames += " restricted"; }
const categoryStyle = Discourse.SiteSettings.category_style;
const categoryStyle = opts.categoryStyle || Discourse.SiteSettings.category_style;
let style = "";
if (categoryStyle === "box") {
@ -93,6 +93,7 @@ export function categoryLinkHTML(category, options) {
if (options.link !== undefined) { categoryOptions.link = options.link; }
if (options.extraClasses) { categoryOptions.extraClasses = options.extraClasses; }
if (options.hideParent) { categoryOptions.hideParent = true; }
if (options.categoryStyle) { categoryOptions.categoryStyle = options.categoryStyle; }
}
return new Handlebars.SafeString(categoryBadgeHTML(category, categoryOptions));
}

View File

@ -2,4 +2,4 @@ h3 .top-title-buttons button {
margin-right: 10px;
clear: both;
margin-top: 5px;
}
}