mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Support forcing badge styles
This commit is contained in:
@@ -44,6 +44,11 @@ export default Combobox.extend({
|
|||||||
const value = this.get('value');
|
const value = this.get('value');
|
||||||
const topic = this.get('topic');
|
const topic = this.get('topic');
|
||||||
|
|
||||||
|
// In case it's not a valid topic
|
||||||
|
if (!topic.get('id')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const refresh = () => {
|
const refresh = () => {
|
||||||
this._createContent();
|
this._createContent();
|
||||||
this.set('value', null);
|
this.set('value', null);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ registerUnbound('category-badge', function(cat, options) {
|
|||||||
return categoryLinkHTML(cat, {
|
return categoryLinkHTML(cat, {
|
||||||
hideParent: options.hideParent,
|
hideParent: options.hideParent,
|
||||||
allowUncategorized: options.allowUncategorized,
|
allowUncategorized: options.allowUncategorized,
|
||||||
|
categoryStyle: options.categoryStyle,
|
||||||
link: false
|
link: false
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export function categoryBadgeHTML(category, opts) {
|
|||||||
let classNames = "badge-category clear-badge";
|
let classNames = "badge-category clear-badge";
|
||||||
if (restricted) { classNames += " restricted"; }
|
if (restricted) { classNames += " restricted"; }
|
||||||
|
|
||||||
const categoryStyle = Discourse.SiteSettings.category_style;
|
const categoryStyle = opts.categoryStyle || Discourse.SiteSettings.category_style;
|
||||||
|
|
||||||
let style = "";
|
let style = "";
|
||||||
if (categoryStyle === "box") {
|
if (categoryStyle === "box") {
|
||||||
@@ -93,6 +93,7 @@ export function categoryLinkHTML(category, options) {
|
|||||||
if (options.link !== undefined) { categoryOptions.link = options.link; }
|
if (options.link !== undefined) { categoryOptions.link = options.link; }
|
||||||
if (options.extraClasses) { categoryOptions.extraClasses = options.extraClasses; }
|
if (options.extraClasses) { categoryOptions.extraClasses = options.extraClasses; }
|
||||||
if (options.hideParent) { categoryOptions.hideParent = true; }
|
if (options.hideParent) { categoryOptions.hideParent = true; }
|
||||||
|
if (options.categoryStyle) { categoryOptions.categoryStyle = options.categoryStyle; }
|
||||||
}
|
}
|
||||||
return new Handlebars.SafeString(categoryBadgeHTML(category, categoryOptions));
|
return new Handlebars.SafeString(categoryBadgeHTML(category, categoryOptions));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ h3 .top-title-buttons button {
|
|||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
clear: both;
|
clear: both;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user