This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/lib/html-builder.js.es6
2014-12-17 09:31:41 -05:00

20 lines
900 B
JavaScript

export function categoryLinkHTML(category, options) {
var categoryOptions = {};
// TODO: This is a compatibility layer with the old helper structure.
// Can be removed once we migrate to `registerUnbound` fully
if (options && options.hash) { options = options.hash; }
if (options) {
if (options.allowUncategorized) { categoryOptions.allowUncategorized = true; }
if (options.showParent) { categoryOptions.showParent = true; }
if (options.onlyStripe) { categoryOptions.onlyStripe = true; }
if (options.link !== undefined) { categoryOptions.link = options.link; }
if (options.extraClasses) { categoryOptions.extraClasses = options.extraClasses; }
if (options.categories) {
categoryOptions.categories = Em.Handlebars.get(this, options.categories, options);
}
}
return new Handlebars.SafeString(Discourse.HTML.categoryBadge(category, categoryOptions));
}