History

Sanity-check decaffeinate app.views.ListFold

Simon Legner committed 2 years ago

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

Showing the changes to assets/javascripts (1 of 1 file). Show all

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 */
10app.views.ListFold = class ListFold extends app.View {1app.views.ListFold = class ListFold extends app.View {
11 static initClass() {2 static targetClass = "_list-dir";
12 this.targetClass = "_list-dir";3 static handleClass = "_list-arrow";
13 this.handleClass = "_list-arrow";4 static activeClass = "open";
14 this.activeClass = "open";
15 5
16 this.events = { click: "onClick" };6 static events = { click: "onClick" };
17 7
18 this.shortcuts = {8 static shortcuts = {
19 left: "onLeft",9 left: "onLeft",
20 right: "onRight",10 right: "onRight",
21 };11 };
22 }
23 12
24 open(el) {13 open(el) {
25 if (el && !el.classList.contains(this.constructor.activeClass)) {14 if (el && !el.classList.contains(this.constructor.activeClass)) {
@@ -59,11 +48,7 @@ app.views.ListFold = class ListFold extends app.View { · 33 unmodified lines
59 48
60 onLeft() {49 onLeft() {
61 const cursor = this.getCursor();50 const cursor = this.getCursor();
62 if (51 if (cursor?.classList?.contains(this.constructor.activeClass)) {
63 cursor != null
64 ? cursor.classList.contains(this.constructor.activeClass)
65 : undefined
66 ) {
67 this.close(cursor);52 this.close(cursor);
68 }53 }
69 }54 }
@@ -109,4 +94,3 @@ app.views.ListFold = class ListFold extends app.View { · 39 unmodified lines
109 }94 }
110 }95 }
111};96};
112app.views.ListFold.initClass();