Sanity-check decaffeinate app.views.Settings

pull/1441/head
Simon Legner 1 year ago
parent 329da39c08
commit 1995d8a3bb

@ -1,37 +1,22 @@
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS205: Consider reworking code to avoid use of IIFEs
* DS206: Consider reworking classes to avoid initClass
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
(function () {
let SIDEBAR_HIDDEN_LAYOUT = undefined;
app.views.Settings = class Settings extends app.View { app.views.Settings = class Settings extends app.View {
static initClass() { static SIDEBAR_HIDDEN_LAYOUT = "_sidebar-hidden";
SIDEBAR_HIDDEN_LAYOUT = "_sidebar-hidden";
this.el = "._settings"; static el = "._settings";
this.elements = { static elements = {
sidebar: "._sidebar", sidebar: "._sidebar",
saveBtn: 'button[type="submit"]', saveBtn: 'button[type="submit"]',
backBtn: "button[data-back]", backBtn: "button[data-back]",
}; };
this.events = { static events = {
import: "onImport", import: "onImport",
change: "onChange", change: "onChange",
submit: "onSubmit", submit: "onSubmit",
click: "onClick", click: "onClick",
}; };
this.shortcuts = { enter: "onEnter" }; static shortcuts = { enter: "onEnter" };
}
init() { init() {
this.addSubview((this.docPicker = new app.views.DocPicker())); this.addSubview((this.docPicker = new app.views.DocPicker()));
@ -40,7 +25,7 @@
activate() { activate() {
if (super.activate(...arguments)) { if (super.activate(...arguments)) {
this.render(); this.render();
document.body.classList.remove(SIDEBAR_HIDDEN_LAYOUT); document.body.classList.remove(Settings.SIDEBAR_HIDDEN_LAYOUT);
} }
} }
@ -48,8 +33,8 @@
if (super.deactivate(...arguments)) { if (super.deactivate(...arguments)) {
this.resetClass(); this.resetClass();
this.docPicker.detach(); this.docPicker.detach();
if (app.settings.hasLayout(SIDEBAR_HIDDEN_LAYOUT)) { if (app.settings.hasLayout(Settings.SIDEBAR_HIDDEN_LAYOUT)) {
document.body.classList.add(SIDEBAR_HIDDEN_LAYOUT); document.body.classList.add(Settings.SIDEBAR_HIDDEN_LAYOUT);
} }
} }
} }
@ -79,7 +64,7 @@
const disabledDocs = new app.collections.Docs( const disabledDocs = new app.collections.Docs(
(() => { (() => {
const result = []; const result = [];
for (var doc of Array.from(app.docs.all())) { for (var doc of app.docs.all()) {
if (docs.indexOf(doc.slug) === -1) { if (docs.indexOf(doc.slug) === -1) {
result.push(doc); result.push(doc);
} }
@ -122,6 +107,3 @@
} }
} }
}; };
app.views.Settings.initClass();
return app.views.Settings;
})();

Loading…
Cancel
Save