Skip to content

Commit

Permalink
Merge pull request mozilla#1 from CSCD01/issue-1670-ui
Browse files Browse the repository at this point in the history
Issue 1670 ui
  • Loading branch information
sherry13131 committed Mar 7, 2020
2 parents ae1f80b + f2b4262 commit ace5f50
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/css/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,20 @@ span ~ .panel-header-text {
padding-block-start: 5px;
padding-inline-end: 5px;
padding-inline-start: 5px;

}

.edit-container-panel input[type="text"]#edit-container-panel-site-input {
inline-size: 80%;
}

#edit-container-site-link {
block-size: 36px;
background: #ebebeb;
}

#edit-container-site-link:hover {
background: #e3e3e3;
}

.edit-container-panel legend {
Expand Down
13 changes: 13 additions & 0 deletions src/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,11 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
this._submitForm();
});

// Add new site to current container
const siteLink = document.querySelector("#edit-container-site-link");
Logic.addEnterHandler(siteLink, () => {
this._addSite();
});

},

Expand All @@ -1078,6 +1083,12 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
}
},

async _addSite() {
const formValues = new FormData(this._editForm);
console.log(formValues.get("container-id"));
console.log(formValues.get("site-name"));
},

showAssignedContainers(assignments) {
const assignmentPanel = document.getElementById("edit-sites-assigned");
const assignmentKeys = Object.keys(assignments);
Expand Down Expand Up @@ -1161,6 +1172,8 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
const assignments = await Logic.getAssignmentObjectByContainer(userContextId);
this.showAssignedContainers(assignments);
document.querySelector("#edit-container-panel .panel-footer").hidden = !!userContextId;
// Only show ability to add site if it's an existing container
document.querySelector("#edit-container-panel-add-site").hidden = !userContextId;

document.querySelector("#edit-container-panel-name-input").value = identity.name || "";
document.querySelector("#edit-container-panel-usercontext-input").value = userContextId || NEW_CONTAINER_ID;
Expand Down
5 changes: 5 additions & 0 deletions src/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ <h3 class="panel-header-text">Edit Containers</h3>
<fieldset id="edit-container-panel-choose-icon" class="radio-choice">
<legend>Choose an icon</legend>
</fieldset>
<fieldset id="edit-container-panel-add-site" hidden>
<legend>Assign site</legend>
<input type="text" name="site-name" id="edit-container-panel-site-input"/>
<a class="button secondary" id="edit-container-site-link">Add</a>
</fieldset>
</form>
<div id="edit-sites-assigned" class="scrollable" hidden>
<h3>Sites assigned to this container</h3>
Expand Down

0 comments on commit ace5f50

Please sign in to comment.