aboutsummaryrefslogtreecommitdiffhomepage
path: root/ui/static/js
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-08-25 12:21:54 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-08-25 12:21:54 -0700
commit551b73acfb6ed4620387c7345b117d32697deb77 (patch)
tree4c46ec045da34d03a3e8230e25e48e0237f0685c /ui/static/js
parentfebce4f2e3a86da4171783fcc593b25a807c3da8 (diff)
Add remove button in feed edit page
Diffstat (limited to 'ui/static/js')
-rw-r--r--ui/static/js/bootstrap.js1
-rw-r--r--ui/static/js/confirm_handler.js14
2 files changed, 12 insertions, 3 deletions
diff --git a/ui/static/js/bootstrap.js b/ui/static/js/bootstrap.js
index bd3b09e..3e9004f 100644
--- a/ui/static/js/bootstrap.js
+++ b/ui/static/js/bootstrap.js
@@ -58,6 +58,7 @@ document.addEventListener("DOMContentLoaded", function() {
});
mouseHandler.onClick("a[data-on-click=markPageAsRead]", () => navHandler.markPageAsRead());
+
mouseHandler.onClick("a[data-confirm]", (event) => {
(new ConfirmHandler()).handle(event);
});
diff --git a/ui/static/js/confirm_handler.js b/ui/static/js/confirm_handler.js
index 9fe9133..c0147cd 100644
--- a/ui/static/js/confirm_handler.js
+++ b/ui/static/js/confirm_handler.js
@@ -1,7 +1,15 @@
class ConfirmHandler {
- remove(url) {
+ executeRequest(url, redirectURL) {
let request = new RequestBuilder(url);
- request.withCallback(() => window.location.reload());
+
+ request.withCallback(() => {
+ if (redirectURL) {
+ window.location.href = redirectURL;
+ } else {
+ window.location.reload();
+ }
+ });
+
request.execute();
}
@@ -24,7 +32,7 @@ class ConfirmHandler {
questionElement.remove();
containerElement.appendChild(loadingElement);
- this.remove(linkElement.dataset.url);
+ this.executeRequest(linkElement.dataset.url, linkElement.dataset.redirectUrl);
};
let noElement = document.createElement("a");