diff --git a/assets/javascripts/views/list/paginated_list.js b/assets/javascripts/views/list/paginated_list.js index 43553ef1..0b888806 100644 --- a/assets/javascripts/views/list/paginated_list.js +++ b/assets/javascripts/views/list/paginated_list.js @@ -19,11 +19,10 @@ constructor(data) { super(); - this.onClick = this.onClick.bind(this); - let base = this.constructor.events || (this.constructor.events = {}); this.data = data; - if (base.click == null) { - base.click = "onClick"; + this.constructor.events = this.constructor.events || {}; + if (this.constructor.events.click == null) { + this.constructor.events.click = "onClick"; } } diff --git a/assets/javascripts/views/misc/notice.js b/assets/javascripts/views/misc/notice.js index d357018c..251e25d0 100644 --- a/assets/javascripts/views/misc/notice.js +++ b/assets/javascripts/views/misc/notice.js @@ -3,7 +3,6 @@ /* * decaffeinate suggestions: * DS002: Fix invalid constructor - * DS101: Remove unnecessary use of Array.from * DS206: Consider reworking classes to avoid initClass * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ @@ -13,13 +12,15 @@ app.views.Notice = class Notice extends app.View { this.attributes = { role: "alert" }; } - constructor(type, ...rest) { + constructor(type, ...args) { super(); this.type = type; - [...this.args] = Array.from(rest); + this.args = args || []; + this.init0(); // needs this.args + this.refreshElements(); } - init() { + init0() { this.activate(); } @@ -36,7 +37,7 @@ app.views.Notice = class Notice extends app.View { } show() { - this.html(this.tmpl(`${this.type}Notice`, ...Array.from(this.args))); + this.html(this.tmpl(`${this.type}Notice`, ...this.args)); this.prependTo(app.el); } diff --git a/assets/javascripts/views/sidebar/entry_list.js b/assets/javascripts/views/sidebar/entry_list.js index 854946b5..535c86b6 100644 --- a/assets/javascripts/views/sidebar/entry_list.js +++ b/assets/javascripts/views/sidebar/entry_list.js @@ -18,9 +18,11 @@ app.views.EntryList = class EntryList extends app.views.PaginatedList { constructor(entries) { super(...arguments); this.entries = entries; + this.init0(); // needs this.data from PaginatedList + this.refreshElements(); } - init() { + init0() { this.renderPaginated(); this.activate(); } diff --git a/assets/javascripts/views/sidebar/results.js b/assets/javascripts/views/sidebar/results.js index 7ebd9e43..b60b2440 100644 --- a/assets/javascripts/views/sidebar/results.js +++ b/assets/javascripts/views/sidebar/results.js @@ -21,7 +21,7 @@ app.views.Results = class Results extends app.View { super(); this.sidebar = sidebar; this.search = search; - this.init0(); + this.init0(); // needs this.search this.refreshElements(); } diff --git a/assets/javascripts/views/sidebar/type_list.js b/assets/javascripts/views/sidebar/type_list.js index 8eba7404..4e774301 100644 --- a/assets/javascripts/views/sidebar/type_list.js +++ b/assets/javascripts/views/sidebar/type_list.js @@ -23,9 +23,11 @@ app.views.TypeList = class TypeList extends app.View { constructor(doc) { super(); this.doc = doc; + this.init0(); // needs this.doc + this.refreshElements(); } - init() { + init0() { this.lists = {}; this.render(); this.activate();