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 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);

View File

@ -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
}); });
}); });

View File

@ -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));
} }

View File

@ -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;
} }