History

Sanity-check decaffeinate app.views.ListFold

Simon Legner committed 2 years ago

Commit a945db91 parent 5f631451 file · +9 −25Browse files

Unified · Split

assets/javascripts/views/list/list_fold.js+9−25
@@ -1,25 +1,14 @@
1−// TODO: This file was created by bulk-decaffeinate.
2−// Sanity-check the conversion and remove this comment.
3−/*
4− * decaffeinate suggestions:
5− * DS102: Remove unnecessary code created because of implicit returns
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.ListFold = class ListFold extends app.View {
11− static initClass() {
12− this.targetClass = "_list-dir";
13− this.handleClass = "_list-arrow";
14− this.activeClass = "open";
2+ static targetClass = "_list-dir";
3+ static handleClass = "_list-arrow";
4+ static activeClass = "open";
155
16− this.events = { click: "onClick" };
6+ static events = { click: "onClick" };
177
18− this.shortcuts = {
19− left: "onLeft",
20− right: "onRight",
21− };
22− }
8+ static shortcuts = {
9+ left: "onLeft",
10+ right: "onRight",
11+ };
2312
2413 open(el) {
2514 if (el && !el.classList.contains(this.constructor.activeClass)) {
@@ -59,11 +48,7 @@ app.views.ListFold = class ListFold extends app.View { · 33 unmodified lines
5948
6049 onLeft() {
6150 const cursor = this.getCursor();
62− if (
63− cursor != null
64− ? cursor.classList.contains(this.constructor.activeClass)
65− : undefined
66− ) {
51+ if (cursor?.classList?.contains(this.constructor.activeClass)) {
6752 this.close(cursor);
6853 }
6954 }
@@ -109,4 +94,3 @@ app.views.ListFold = class ListFold extends app.View { · 39 unmodified lines
10994 }
11095 }
11196 };
112−app.views.ListFold.initClass();