DEV: Address Discourse.category deprecation, cleanup
This commit is contained in:
parent
8d4a4b1884
commit
b4ab43ba30
|
@ -1,5 +1,5 @@
|
||||||
<script type="text/discourse-plugin" version="0.8.26">
|
<script type="text/discourse-plugin" version="0.8.26">
|
||||||
// modified RCO Jan 2019 to allow partial match on category-slug
|
const Category = require("discourse/models/category").default;
|
||||||
let categoryThemeList = settings.category_icon_list.split('|');
|
let categoryThemeList = settings.category_icon_list.split('|');
|
||||||
let lockIcon = settings.category_lock_icon || 'lock';
|
let lockIcon = settings.category_lock_icon || 'lock';
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
let restricted = get(category, "read_restricted");
|
let restricted = get(category, "read_restricted");
|
||||||
let url = opts.url
|
let url = opts.url
|
||||||
? opts.url
|
? opts.url
|
||||||
: Discourse.getURL("/c/") + Discourse.Category.slugFor(category);
|
: Discourse.getURL("/c/") + Category.slugFor(category);
|
||||||
let href = opts.link === false ? "" : url;
|
let href = opts.link === false ? "" : url;
|
||||||
let tagName = opts.link === false || opts.link === "false" ? "span" : "a";
|
let tagName = opts.link === false || opts.link === "false" ? "span" : "a";
|
||||||
let extraClasses = opts.extraClasses ? " " + opts.extraClasses : "";
|
let extraClasses = opts.extraClasses ? " " + opts.extraClasses : "";
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
let categoryDir = "";
|
let categoryDir = "";
|
||||||
|
|
||||||
if (!opts.hideParent) {
|
if (!opts.hideParent) {
|
||||||
parentCat = Discourse.Category.findById(
|
parentCat = Category.findById(
|
||||||
get(category, "parent_category_id")
|
get(category, "parent_category_id")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue