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− */
101 app.views.DocList = class DocList extends app.View {
11− static initClass() {
12− this.className = "_list";
13− this.attributes = { role: "navigation" };
14−
15− this.events = {
16− open: "onOpen",
17− close: "onClose",
18− click: "onClick",
19− };
20−
21− this.routes = { after: "afterRoute" };
22−
23− this.elements = {
24− disabledTitle: "._list-title",
25− disabledList: "._disabled-list",
26− };
27− }
2+ static className = "_list";
3+ static attributes = { role: "navigation" };
4+
5+ static events = {
6+ open: "onOpen",
7+ close: "onClose",
8+ click: "onClick",
9+ };
10+
11+ static routes = { after: "afterRoute" };
12+
13+ static elements = {
14+ disabledTitle: "._list-title",
15+ disabledList: "._disabled-list",
16+ };
2817
2918 init() {
3019 this.lists = {};
@@ -57,7 +46,7 @@ app.views.DocList = class DocList extends app.View { · 26 unmodified lines
5746
5847 render() {
5948 let html = "";
60− for (var doc of Array.from(app.docs.all())) {
49+ for (var doc of app.docs.all()) {
6150 html += this.tmpl("sidebarDoc", doc, {
6251 fullName: app.docs.countAllBy("name", doc.name) > 1,
6352 });
@@ -87,7 +76,7 @@ app.views.DocList = class DocList extends app.View { · 23 unmodified lines
8776 appendDisabledList() {
8877 let doc;
8978 let html = "";
90− const docs = [].concat(...Array.from(app.disabledDocs.all() || []));
79+ const docs = [].concat(...(app.disabledDocs.all() || []));
9180
9281 while ((doc = docs.shift())) {
9382 if (doc.version != null) {
@@ -258,4 +247,3 @@ app.views.DocList = class DocList extends app.View { · 164 unmodified lines
258247 }
259248 }
260249 };
261−app.views.DocList.initClass();