diff options
| author | Shyam Sunder | 2020-06-05 18:03:37 -0400 |
|---|---|---|
| committer | Shyam Sunder | 2020-06-06 08:58:23 -0400 |
| commit | 57193b57157b7a42896c887a2d5930493ac7b290 (patch) | |
| tree | 9555453a944caae64d8a00e4b073482d9e7fb244 /client/js/views/pool_view.js | |
| parent | c06aaa63af977e64ef08bfba7829214f0f0ed38e (diff) | |
client+server: implement code autoformatting using prettier and black
Diffstat (limited to 'client/js/views/pool_view.js')
| -rw-r--r-- | client/js/views/pool_view.js | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/client/js/views/pool_view.js b/client/js/views/pool_view.js index f296e90..12b7704 100644 --- a/client/js/views/pool_view.js +++ b/client/js/views/pool_view.js @@ -1,26 +1,26 @@ -'use strict'; +"use strict"; -const events = require('../events.js'); -const views = require('../util/views.js'); -const misc = require('../util/misc.js'); -const PoolSummaryView = require('./pool_summary_view.js'); -const PoolEditView = require('./pool_edit_view.js'); -const PoolMergeView = require('./pool_merge_view.js'); -const PoolDeleteView = require('./pool_delete_view.js'); -const EmptyView = require('../views/empty_view.js'); +const events = require("../events.js"); +const views = require("../util/views.js"); +const misc = require("../util/misc.js"); +const PoolSummaryView = require("./pool_summary_view.js"); +const PoolEditView = require("./pool_edit_view.js"); +const PoolMergeView = require("./pool_merge_view.js"); +const PoolDeleteView = require("./pool_delete_view.js"); +const EmptyView = require("../views/empty_view.js"); -const template = views.getTemplate('pool'); +const template = views.getTemplate("pool"); class PoolView extends events.EventTarget { constructor(ctx) { super(); this._ctx = ctx; - ctx.pool.addEventListener('change', e => this._evtChange(e)); - ctx.section = ctx.section || 'summary'; + ctx.pool.addEventListener("change", (e) => this._evtChange(e)); + ctx.section = ctx.section || "summary"; ctx.getPrettyPoolName = misc.getPrettyPoolName; - this._hostNode = document.getElementById('content-holder'); + this._hostNode = document.getElementById("content-holder"); this._install(); } @@ -28,52 +28,54 @@ class PoolView extends events.EventTarget { const ctx = this._ctx; views.replaceContent(this._hostNode, template(ctx)); - for (let item of this._hostNode.querySelectorAll('[data-name]')) { + for (let item of this._hostNode.querySelectorAll("[data-name]")) { item.classList.toggle( - 'active', item.getAttribute('data-name') === ctx.section); - if (item.getAttribute('data-name') === ctx.section) { + "active", + item.getAttribute("data-name") === ctx.section + ); + if (item.getAttribute("data-name") === ctx.section) { item.parentNode.scrollLeft = item.getBoundingClientRect().left - - item.parentNode.getBoundingClientRect().left + item.parentNode.getBoundingClientRect().left; } } - ctx.hostNode = this._hostNode.querySelector('.pool-content-holder'); - if (ctx.section === 'edit') { + ctx.hostNode = this._hostNode.querySelector(".pool-content-holder"); + if (ctx.section === "edit") { if (!this._ctx.canEditAnything) { this._view = new EmptyView(); this._view.showError( - 'You don\'t have privileges to edit pools.'); + "You don't have privileges to edit pools." + ); } else { this._view = new PoolEditView(ctx); - events.proxyEvent(this._view, this, 'submit'); + events.proxyEvent(this._view, this, "submit"); } - - } else if (ctx.section === 'merge') { + } else if (ctx.section === "merge") { if (!this._ctx.canMerge) { this._view = new EmptyView(); this._view.showError( - 'You don\'t have privileges to merge pools.'); + "You don't have privileges to merge pools." + ); } else { this._view = new PoolMergeView(ctx); - events.proxyEvent(this._view, this, 'submit', 'merge'); + events.proxyEvent(this._view, this, "submit", "merge"); } - - } else if (ctx.section === 'delete') { + } else if (ctx.section === "delete") { if (!this._ctx.canDelete) { this._view = new EmptyView(); this._view.showError( - 'You don\'t have privileges to delete pools.'); + "You don't have privileges to delete pools." + ); } else { this._view = new PoolDeleteView(ctx); - events.proxyEvent(this._view, this, 'submit', 'delete'); + events.proxyEvent(this._view, this, "submit", "delete"); } - } else { this._view = new PoolSummaryView(ctx); } - events.proxyEvent(this._view, this, 'change'); + events.proxyEvent(this._view, this, "change"); views.syncScrollPosition(); } |