From faaa3008a8d2bc97991d125585c51d957c7250ab Mon Sep 17 00:00:00 2001
From: groovecoder
Date: Thu, 12 Jan 2017 15:52:28 -0600
Subject: [PATCH] for #55: edit-container-panel colors; delete-container-panel
---
index.js | 4 +++-
webextension/css/popup.css | 16 +++++++++----
webextension/js/popup.js | 28 ++++++++++++++++++++--
webextension/popup.html | 49 ++++++++++++++++++++++++++++++++++----
4 files changed, 86 insertions(+), 11 deletions(-)
diff --git a/index.js b/index.js
index a751559..e3181ee 100644
--- a/index.js
+++ b/index.js
@@ -12,6 +12,8 @@ const webExtension = require("sdk/webextension");
const windows = require("sdk/windows");
const windowUtils = require("sdk/window/utils");
+const IDENTITY_COLORS = ["blue", "turquoise", "green", "yellow", "orange", "red", "pink", "purple"];
+
let ContainerService = {
_identitiesState: {},
@@ -132,7 +134,7 @@ let ContainerService = {
color = "green";
} else if (identity.color === "#ee5195") {
color = "pink";
- } else if (["blue", "turquoise", "green", "yellow", "orange", "red", "pink", "purple"].indexOf(identity.color) !== -1) {
+ } else if (IDENTITY_COLORS.indexOf(identity.color) !== -1) {
color = identity.color;
} else {
color = "";
diff --git a/webextension/css/popup.css b/webextension/css/popup.css
index bc1227a..bad469d 100644
--- a/webextension/css/popup.css
+++ b/webextension/css/popup.css
@@ -76,7 +76,7 @@ table {
block-size: 16px;
}
-.container-panel > table.unstriped tbody tr {
+table.unstriped tbody tr {
border-bottom: 1px solid #f1f1f1;
background-color: #fefefe;
cursor: pointer;
@@ -226,12 +226,20 @@ table {
cursor: pointer;
}
-.edit-containers-panel-footer {
+.edit-containers-panel-footer a {
+ color: #ffffff;
+}
+
+.edit-containers-exit-text {
+ display: flex;
+ align-items: center;
background: #248aeb;
+ block-size: 100%;
color: #ffffff;
justify-content: center;
}
-.edit-containers-panel-footer a {
- color: #ffffff;
+.choose-color-icon {
+ padding-inline-start: 17px;
+ padding-inline-end: 7px;
}
diff --git a/webextension/js/popup.js b/webextension/js/popup.js
index 06b284e..51d3ed2 100644
--- a/webextension/js/popup.js
+++ b/webextension/js/popup.js
@@ -173,9 +173,9 @@ function showEditContainersPanel() {
tr.addEventListener("click", e => {
if (e.target.matches(".edit-container-icon")) {
- showPanel("#edit-container-panel");
+ showEditContainerPanel(identity);
} else if (e.target.matches(".delete-container-icon")) {
- console.log(`clicked to delete ${identity.userContextId} container`);
+ showDeleteContainerPanel(identity);
}
});
});
@@ -186,6 +186,22 @@ function showEditContainersPanel() {
showPanel("#edit-containers-panel");
}
+function showEditContainerPanel(identity) {
+ document.querySelector("#edit-container-panel-name-input").value = identity.name;
+ showPanel("#edit-container-panel");
+}
+
+function showDeleteContainerPanel(identity) {
+ // Populating the panel: name and icon
+ document.getElementById("delete-container-name").innerText = identity.name;
+
+ let icon = document.getElementById("delete-container-icon");
+ icon.setAttribute("data-identity-icon", identity.image);
+ icon.setAttribute("data-identity-color", identity.color);
+
+ showPanel("#delete-container-panel");
+}
+
document.querySelector("#add-container-link").addEventListener("click", () => {
showPanel("#edit-container-panel");
});
@@ -206,6 +222,14 @@ document.querySelector("#edit-container-cancel-link").addEventListener("click",
showEditContainersPanel();
});
+document.querySelector("#delete-container-panel-back-arrow").addEventListener("click", () => {
+ showEditContainersPanel();
+});
+
+document.querySelector("#delete-container-cancel-link").addEventListener("click", () => {
+ showEditContainersPanel();
+});
+
document.querySelector("#sort-containers-link").addEventListener("click", () => {
browser.runtime.sendMessage({
method: "sortTabs"
diff --git a/webextension/popup.html b/webextension/popup.html
index a94e88d..9316540 100644
--- a/webextension/popup.html
+++ b/webextension/popup.html
@@ -80,7 +80,14 @@
@@ -94,11 +101,20 @@
@@ -107,7 +123,7 @@
+
+
+
«
+
+
+
+
Remove This Container
+
If you remove this container now, container tabs will be closed. Are you sure you want to remove this Container?
+
+
+
+
+
+
+