mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 02:53:41 +08:00
DEV: Convert helpers to native class syntax (#27279)
This commit is contained in:
parent
c0abae054d
commit
0a9be3bfd8
|
@ -45,14 +45,13 @@ function routeAction(actionName, router, ...params) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Helper.extend({
|
export default class RouteAction extends Helper {
|
||||||
router: computed({
|
@computed
|
||||||
get() {
|
get router() {
|
||||||
return getOwner(this).lookup("router:main");
|
return getOwner(this).lookup("router:main");
|
||||||
},
|
}
|
||||||
}),
|
|
||||||
|
|
||||||
compute([actionName, ...params]) {
|
compute([actionName, ...params]) {
|
||||||
return routeAction(actionName, get(this, "router"), ...params);
|
return routeAction(actionName, get(this, "router"), ...params);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import ArrayProxy from "@ember/array/proxy";
|
import ArrayProxy from "@ember/array/proxy";
|
||||||
|
|
||||||
export default ArrayProxy.extend({
|
class TopicStatusIconArrayProxy extends ArrayProxy {
|
||||||
render(topic, renderIcon) {
|
render(topic, renderIcon) {
|
||||||
const renderIconIf = (conditionProp, name, key) => {
|
const renderIconIf = (conditionProp, name, key) => {
|
||||||
if (!topic.get(conditionProp)) {
|
if (!topic.get(conditionProp)) {
|
||||||
|
@ -17,8 +17,10 @@ export default ArrayProxy.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
this.forEach((args) => renderIconIf(...args));
|
this.forEach((args) => renderIconIf(...args));
|
||||||
},
|
}
|
||||||
}).create({
|
}
|
||||||
|
|
||||||
|
export default TopicStatusIconArrayProxy.create({
|
||||||
content: [
|
content: [
|
||||||
["is_warning", "envelope", "warning"],
|
["is_warning", "envelope", "warning"],
|
||||||
["pinned", "thumbtack", "pinned"],
|
["pinned", "thumbtack", "pinned"],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user