Making create screen have buttons again
This commit is contained in:
parent
4e0180d521
commit
bc847b53f5
4 changed files with 49 additions and 11 deletions
|
@ -339,7 +339,7 @@ const backgroundLogic = {
|
||||||
|
|
||||||
createOrUpdateContainer(options) {
|
createOrUpdateContainer(options) {
|
||||||
let donePromise;
|
let donePromise;
|
||||||
if (options.userContextId) {
|
if (options.userContextId !== "new") {
|
||||||
donePromise = browser.contextualIdentities.update(
|
donePromise = browser.contextualIdentities.update(
|
||||||
this.cookieStoreId(options.userContextId),
|
this.cookieStoreId(options.userContextId),
|
||||||
options.params
|
options.params
|
||||||
|
|
|
@ -91,6 +91,10 @@ table {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[hidden] {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* Effect borrowed from tabs in Firefox, ensure that the element flexes to the full width */
|
/* Effect borrowed from tabs in Firefox, ensure that the element flexes to the full width */
|
||||||
.truncate-text {
|
.truncate-text {
|
||||||
mask-image: linear-gradient(to left, transparent, black 1em);
|
mask-image: linear-gradient(to left, transparent, black 1em);
|
||||||
|
@ -803,8 +807,14 @@ span ~ .panel-header-text {
|
||||||
border: 0;
|
border: 0;
|
||||||
filter: none;
|
filter: none;
|
||||||
inline-size: 23px;
|
inline-size: 23px;
|
||||||
margin: 0;
|
margin-block-end: 0;
|
||||||
padding: 0;
|
margin-block-start: 0;
|
||||||
|
margin-inline-end: 0;
|
||||||
|
margin-inline-start: 0;
|
||||||
|
padding-block-end: 0;
|
||||||
|
padding-block-start: 0;
|
||||||
|
padding-inline-end: 0;
|
||||||
|
padding-inline-start: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.radio-choice > .radio-container > label::before {
|
.radio-choice > .radio-container > label::before {
|
||||||
|
@ -814,18 +824,18 @@ span ~ .panel-header-text {
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: 16px;
|
background-size: 16px;
|
||||||
block-size: 23px;
|
block-size: 23px;
|
||||||
fill: var(--identity-icon-color);
|
border: none;
|
||||||
filter: url('/img/filters.svg#fill');
|
|
||||||
position: relative;
|
|
||||||
content: "";
|
content: "";
|
||||||
display: block;
|
display: block;
|
||||||
border: none;
|
fill: var(--identity-icon-color);
|
||||||
|
filter: url('/img/filters.svg#fill');
|
||||||
inline-size: 23px;
|
inline-size: 23px;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.radio-choice > .radio-container > [type="radio"] {
|
.radio-choice > .radio-container > [type="radio"] {
|
||||||
display: inline;
|
|
||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
|
display: inline;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ const CONTAINER_UNHIDE_SRC = "/img/container-unhide.svg";
|
||||||
|
|
||||||
const DEFAULT_COLOR = "blue";
|
const DEFAULT_COLOR = "blue";
|
||||||
const DEFAULT_ICON = "circle";
|
const DEFAULT_ICON = "circle";
|
||||||
|
const NEW_CONTAINER_ID = "new";
|
||||||
|
|
||||||
// List of panels
|
// List of panels
|
||||||
const P_ONBOARDING_1 = "onboarding1";
|
const P_ONBOARDING_1 = "onboarding1";
|
||||||
|
@ -750,10 +751,30 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
||||||
this.initializeRadioButtons();
|
this.initializeRadioButtons();
|
||||||
|
|
||||||
Logic.addEnterHandler(document.querySelector("#edit-container-panel-back-arrow"), () => {
|
Logic.addEnterHandler(document.querySelector("#edit-container-panel-back-arrow"), () => {
|
||||||
|
const formValues = new FormData(this._editForm);
|
||||||
|
if (formValues.get("container-id") !== NEW_CONTAINER_ID) {
|
||||||
|
this._submitForm();
|
||||||
|
} else {
|
||||||
|
Logic.showPreviousPanel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Logic.addEnterHandler(document.querySelector("#edit-container-cancel-link"), () => {
|
||||||
|
Logic.showPreviousPanel();
|
||||||
|
});
|
||||||
|
|
||||||
|
this._editForm = document.getElementById("edit-container-panel-form");
|
||||||
|
const editLink = document.querySelector("#edit-container-ok-link");
|
||||||
|
Logic.addEnterHandler(editLink, () => {
|
||||||
this._submitForm();
|
this._submitForm();
|
||||||
});
|
});
|
||||||
this._editForm = document.getElementById("edit-container-panel-form");
|
editLink.addEventListener("submit", () => {
|
||||||
this._editForm.addEventListener("submit", this._submitForm.bind(this));
|
this._submitForm();
|
||||||
|
});
|
||||||
|
this._editForm.addEventListener("submit", () => {
|
||||||
|
this._submitForm();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -762,7 +783,7 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
||||||
return browser.runtime.sendMessage({
|
return browser.runtime.sendMessage({
|
||||||
method: "createOrUpdateContainer",
|
method: "createOrUpdateContainer",
|
||||||
message: {
|
message: {
|
||||||
userContextId: Logic.currentUserContextId() || false,
|
userContextId: formValues.get("container-id") || NEW_CONTAINER_ID,
|
||||||
params: {
|
params: {
|
||||||
name: document.getElementById("edit-container-panel-name-input").value || Logic.generateIdentityName(),
|
name: document.getElementById("edit-container-panel-name-input").value || Logic.generateIdentityName(),
|
||||||
icon: formValues.get("container-icon") || DEFAULT_ICON,
|
icon: formValues.get("container-icon") || DEFAULT_ICON,
|
||||||
|
@ -860,8 +881,10 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
||||||
const userContextId = Logic.currentUserContextId();
|
const userContextId = Logic.currentUserContextId();
|
||||||
const assignments = await Logic.getAssignmentObjectByContainer(userContextId);
|
const assignments = await Logic.getAssignmentObjectByContainer(userContextId);
|
||||||
this.showAssignedContainers(assignments);
|
this.showAssignedContainers(assignments);
|
||||||
|
document.querySelector("#edit-container-panel .panel-footer").hidden = !!userContextId;
|
||||||
|
|
||||||
document.querySelector("#edit-container-panel-name-input").value = identity.name || "";
|
document.querySelector("#edit-container-panel-name-input").value = identity.name || "";
|
||||||
|
document.querySelector("#edit-container-panel-usercontext-input").value = userContextId || NEW_CONTAINER_ID;
|
||||||
[...document.querySelectorAll("[name='container-color']")].forEach(colorInput => {
|
[...document.querySelectorAll("[name='container-color']")].forEach(colorInput => {
|
||||||
colorInput.checked = colorInput.value === identity.color;
|
colorInput.checked = colorInput.value === identity.color;
|
||||||
});
|
});
|
||||||
|
|
|
@ -115,6 +115,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="column-panel-content">
|
<div class="column-panel-content">
|
||||||
<form id="edit-container-panel-form">
|
<form id="edit-container-panel-form">
|
||||||
|
<input type="hidden" name="container-id" id="edit-container-panel-usercontext-input" />
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Name</legend>
|
<legend>Name</legend>
|
||||||
<input type="text" name="container-name" id="edit-container-panel-name-input" maxlength="25"/>
|
<input type="text" name="container-name" id="edit-container-panel-name-input" maxlength="25"/>
|
||||||
|
@ -131,6 +132,10 @@
|
||||||
<div class="assigned-sites-list">
|
<div class="assigned-sites-list">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="panel-footer">
|
||||||
|
<a href="#" class="button secondary expanded footer-button cancel-button" id="edit-container-cancel-link">Cancel</a>
|
||||||
|
<a class="button primary expanded footer-button" id="edit-container-ok-link">OK</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue