review comments applied

This commit is contained in:
baku 2017-01-14 22:13:51 +01:00
parent be29b1be81
commit c176b03c0c

View file

@ -8,7 +8,7 @@ const CONTAINER_HIDE_SRC = "/img/container-hide.svg";
const CONTAINER_UNHIDE_SRC = "/img/container-unhide.svg"; const CONTAINER_UNHIDE_SRC = "/img/container-unhide.svg";
// Let's set it to false before releasing!!! // Let's set it to false before releasing!!!
const DEBUG = false; const DEBUG = true;
// List of panels // List of panels
const P_ONBOARDING_1 = "onboarding1"; const P_ONBOARDING_1 = "onboarding1";
@ -61,7 +61,7 @@ let Logic = {
showPanel(panel, currentIdentity = null) { showPanel(panel, currentIdentity = null) {
// Invalid panel... ?!? // Invalid panel... ?!?
if (!(panel in this._panels)) { if (!(panel in this._panels)) {
throw("Something really bad happened. Unknown panel: " + panel + "\n"); throw new Error("Something really bad happened. Unknown panel: " + panel);
} }
this._previousPanel = this._currentPanel; this._previousPanel = this._currentPanel;
@ -80,7 +80,7 @@ let Logic = {
showPreviousPanel() { showPreviousPanel() {
if (!this._previousPanel) { if (!this._previousPanel) {
throw "Current panel not set!"; throw new Error("Current panel not set!");
} }
this.showPanel(this._previousPanel, this._currentIdentity); this.showPanel(this._previousPanel, this._currentIdentity);
@ -97,7 +97,7 @@ let Logic = {
currentIdentity() { currentIdentity() {
if (!this._currentIdentity) { if (!this._currentIdentity) {
throw("CurrentIdentity must be set before calling Logic.currentIdentity."); throw new Error("CurrentIdentity must be set before calling Logic.currentIdentity.");
} }
return this._currentIdentity; return this._currentIdentity;
}, },
@ -178,8 +178,7 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
log('identities.forEach'); log('identities.forEach');
let tr = document.createElement("tr"); let tr = document.createElement("tr");
fragment.appendChild(tr); fragment.appendChild(tr);
tr.classList.add("container-panel-row"); tr.classList.add("container-panel-row", "clickable");
tr.classList.add("clickable");
tr.innerHTML = ` tr.innerHTML = `
<td> <td>
<div class="userContext-icon open-newtab" <div class="userContext-icon open-newtab"
@ -209,8 +208,10 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
}); });
}); });
document.querySelector(".identities-list").innerHTML = ""; let list = document.querySelector(".identities-list");
document.querySelector(".identities-list").appendChild(fragment);
list.innerHTML = "";
list.appendChild(fragment);
return Promise.resolve(); return Promise.resolve();
}, },
@ -286,8 +287,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
for (let tab of tabs) { for (let tab of tabs) {
let tr = document.createElement("tr"); let tr = document.createElement("tr");
fragment.appendChild(tr); fragment.appendChild(tr);
tr.classList.add("container-info-tab"); tr.classList.add("container-info-tab", "clickable");
tr.classList.add("clickable");
tr.innerHTML = ` tr.innerHTML = `
<td><img class="icon" src="${tab.favicon}" /></td> <td><img class="icon" src="${tab.favicon}" /></td>
<td>${tab.title}</td>`; <td>${tab.title}</td>`;
@ -361,8 +361,10 @@ Logic.registerPanel(P_CONTAINERS_EDIT, {
}); });
}); });
document.querySelector("#edit-identities-list").innerHTML = ""; let list = document.querySelector("#edit-identities-list");
document.querySelector("#edit-identities-list").appendChild(fragment);
list.innerHTML = "";
list.appendChild(fragment);
return Promise.resolve(null); return Promise.resolve(null);
}, },