Support forcing badge styles
This commit is contained in:
parent
061cc17a65
commit
82230a1830
|
@ -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);
|
||||
|
|
|
@ -5,6 +5,7 @@ registerUnbound('category-badge', function(cat, options) {
|
|||
return categoryLinkHTML(cat, {
|
||||
hideParent: options.hideParent,
|
||||
allowUncategorized: options.allowUncategorized,
|
||||
categoryStyle: options.categoryStyle,
|
||||
link: false
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -2,4 +2,4 @@ h3 .top-title-buttons button {
|
|||
margin-right: 10px;
|
||||
clear: both;
|
||||
margin-top: 5px;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue