Commit 13a84818 authored by Nicolas Pernoud's avatar Nicolas Pernoud
Browse files

fix : disable buttons on davs rename, edit and delete

parent 4e153345
Pipeline #5692 passed with stages
in 2 minutes and 34 seconds
......@@ -41,7 +41,7 @@ After, for every access to a proxied application or a webdav service (say myapp.
Applications and davs can be opened to everyone as well (no authentication).
Vestibule creates a subdomain for every services (apps and davs) and provide Let's encrypt certificate automatically.
Vestibule creates a subdomain for every services (apps and davs) and provide Let's encrypt certificates automatically.
## Installation
......@@ -84,7 +84,7 @@ printf "1\n${LOGIN}\n${TOKEN}\n" | gio mount $DAV_URL
### Override branding
Every branding asset is in `web/assets/brand` directory. It can be altered according to your needs.
Every branding asset is in `web/assets/brand` directory. They can be altered according to your needs.
## Development
......
......@@ -166,7 +166,7 @@ function davTemplate(dav) {
<hr class="dropdown-divider" />
<p><strong>${dav.host}</strong></p>
<p>Serves ${dav.root} directory, with ${dav.writable ? "read/write" : "read only"} access</p>
<p>${dav.secured ? "Restricted access to user with roles <strong>" + dav.roles + "</strong>" : "Unrestricted access"}</p>
<p>${dav.secured ? "Restricted access to users with roles <strong>" + dav.roles + "</strong>" : "Unrestricted access"}</p>
<p class="has-text-centered"><strong>-${dav.id}-</strong></p>
</div>
</div>
......
......@@ -78,7 +78,14 @@ export class Edit {
}
async save() {
const toggleButtons = () => {
this.gid("edit-save").classList.toggle("is-loading");
this.gid("edit-save").disabled = !this.gid("edit-save").disabled;
this.gid("edit-close").disabled = !this.gid("edit-close").disabled;
this.gid("edit-share").disabled = !this.gid("edit-share").disabled;
};
try {
toggleButtons();
const response = await fetch(this.url, {
method: "put",
headers: new Headers({
......@@ -93,5 +100,6 @@ export class Edit {
} catch (e) {
HandleError(e);
}
toggleButtons();
}
}
......@@ -284,8 +284,16 @@ export class Explorer {
`;
const field = renameModal.getElementsByTagName("input")[0];
field.setSelectionRange(0, file.name.lastIndexOf("."));
renameModal.querySelector("#" + "explorer-rename-ok").addEventListener("click", async () => {
const renameOK = renameModal.querySelector("#explorer-rename-ok");
const renameCancel = renameModal.querySelector("#explorer-rename-cancel");
const toggleButtons = () => {
renameOK.classList.toggle("is-loading");
renameOK.disabled = !renameOK.disabled;
renameCancel.disabled = !renameCancel.disabled;
};
renameOK.addEventListener("click", async () => {
try {
toggleButtons();
const response = await fetch(this.fullHostname + file.path, {
method: "MOVE",
headers: new Headers({
......@@ -307,7 +315,7 @@ export class Explorer {
renameModal.parentNode.removeChild(renameModal);
});
});
renameModal.querySelector("#" + "explorer-rename-cancel").addEventListener("click", () => {
renameCancel.addEventListener("click", () => {
AnimateCSS(renameModal, "animate__fadeOut", function () {
renameModal.parentNode.removeChild(renameModal);
});
......
......@@ -70,7 +70,7 @@
</div>
<div class="navbar-menu">
<div class="navbar-end">
<div class="navbar-item"><p>v4.3.17</p></div>
<div class="navbar-item"><p>v4.3.18</p></div>
</div>
</div>
</nav>
......
......@@ -27,13 +27,22 @@ export class Delete {
</div>
</div>
`;
deleteModal.querySelector("#" + "delete-ok").addEventListener("click", async () => {
const deleteOK = deleteModal.querySelector("#delete-ok");
const deleteCancel = deleteModal.querySelector("#delete-cancel");
const toggleButtons = () => {
deleteOK.classList.toggle("is-loading");
deleteOK.disabled = !deleteOK.disabled;
deleteCancel.disabled = !deleteCancel.disabled;
};
deleteOK.addEventListener("click", async () => {
toggleButtons();
await okFunction();
toggleButtons();
AnimateCSS(deleteModal, "animate__fadeOut", function () {
deleteModal.parentNode.removeChild(deleteModal);
});
});
deleteModal.querySelector("#" + "delete-cancel").addEventListener("click", () => {
deleteCancel.addEventListener("click", () => {
AnimateCSS(deleteModal, "animate__fadeOut", function () {
deleteModal.parentNode.removeChild(deleteModal);
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment