History

Sanity-check decaffeinate app.views.DocList

Simon Legner committed 2 years ago

Commit 01440d21 parent 0c3f1811 file · +17 −29Browse files

Unified · Split

assets/javascripts/views/sidebar/doc_list.js+17−29
@@ -1,30 +1,19 @@
1// TODO: This file was created by bulk-decaffeinate.
2// Sanity-check the conversion and remove this comment.
3/*
4 * decaffeinate suggestions:
5 * DS101: Remove unnecessary use of Array.from
6 * DS206: Consider reworking classes to avoid initClass
7 * DS207: Consider shorter variations of null checks
8 * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
9 */
10app.views.DocList = class DocList extends app.View {1app.views.DocList = class DocList extends app.View {
11 static initClass() {2 static className = "_list";
12 this.className = "_list";3 static attributes = { role: "navigation" };
13 this.attributes = { role: "navigation" };4
14 5 static events = {
15 this.events = {6 open: "onOpen",
16 open: "onOpen",7 close: "onClose",
17 close: "onClose",8 click: "onClick",
18 click: "onClick",9 };
19 };10
20 11 static routes = { after: "afterRoute" };
21 this.routes = { after: "afterRoute" };12
22 13 static elements = {
23 this.elements = {14 disabledTitle: "._list-title",
24 disabledTitle: "._list-title",15 disabledList: "._disabled-list",
25 disabledList: "._disabled-list",16 };
26 };
27 }
28 17
29 init() {18 init() {
30 this.lists = {};19 this.lists = {};
@@ -57,7 +46,7 @@ app.views.DocList = class DocList extends app.View { · 26 unmodified lines
57 46
58 render() {47 render() {
59 let html = "";48 let html = "";
60 for (var doc of Array.from(app.docs.all())) {49 for (var doc of app.docs.all()) {
61 html += this.tmpl("sidebarDoc", doc, {50 html += this.tmpl("sidebarDoc", doc, {
62 fullName: app.docs.countAllBy("name", doc.name) > 1,51 fullName: app.docs.countAllBy("name", doc.name) > 1,
63 });52 });
@@ -87,7 +76,7 @@ app.views.DocList = class DocList extends app.View { · 23 unmodified lines
87 appendDisabledList() {76 appendDisabledList() {
88 let doc;77 let doc;
89 let html = "";78 let html = "";
90 const docs = [].concat(...Array.from(app.disabledDocs.all() || []));79 const docs = [].concat(...(app.disabledDocs.all() || []));
91 80
92 while ((doc = docs.shift())) {81 while ((doc = docs.shift())) {
93 if (doc.version != null) {82 if (doc.version != null) {
@@ -258,4 +247,3 @@ app.views.DocList = class DocList extends app.View { · 164 unmodified lines
258 }247 }
259 }248 }
260};249};
261app.views.DocList.initClass();