Sidebar blacklist button on deletion

This commit is contained in:
shortcutme 2017-05-11 18:02:37 +02:00
parent 84b535767b
commit 1a3b48a60d
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
2 changed files with 29 additions and 10 deletions

View file

@ -303,10 +303,19 @@ class Sidebar extends Class
# Delete site # Delete site
@tag.find("#button-delete").off("click touchend").on "click touchend", => @tag.find("#button-delete").off("click touchend").on "click touchend", =>
wrapper.displayConfirm "Are you sure?", "Delete this site", => wrapper.displayConfirm "Are you sure?", ["Delete this site", "Blacklist"], (confirmed) =>
@tag.find("#button-delete").addClass("loading") if confirmed == 1
wrapper.ws.cmd "siteDelete", wrapper.site_info.address, -> @tag.find("#button-delete").addClass("loading")
document.location = $(".fixbutton-bg").attr("href") wrapper.ws.cmd "siteDelete", wrapper.site_info.address, ->
document.location = $(".fixbutton-bg").attr("href")
else if confirmed == 2
wrapper.displayPrompt "Blacklist this site", "text", "Delete and Blacklist", "Reason", (reason) =>
@tag.find("#button-delete").addClass("loading")
wrapper.ws.cmd "blacklistAdd", [wrapper.site_info.address, reason]
wrapper.ws.cmd "siteDelete", wrapper.site_info.address, ->
document.location = $(".fixbutton-bg").attr("href")
return false return false
# Owned checkbox # Owned checkbox

View file

@ -536,11 +536,21 @@ window.initScrollable = function () {
})(this)); })(this));
this.tag.find("#button-delete").off("click touchend").on("click touchend", (function(_this) { this.tag.find("#button-delete").off("click touchend").on("click touchend", (function(_this) {
return function() { return function() {
wrapper.displayConfirm("Are you sure?", "Delete this site", function() { wrapper.displayConfirm("Are you sure?", ["Delete this site", "Blacklist"], function(confirmed) {
_this.tag.find("#button-delete").addClass("loading"); if (confirmed === 1) {
return wrapper.ws.cmd("siteDelete", wrapper.site_info.address, function() { _this.tag.find("#button-delete").addClass("loading");
return document.location = $(".fixbutton-bg").attr("href"); return wrapper.ws.cmd("siteDelete", wrapper.site_info.address, function() {
}); return document.location = $(".fixbutton-bg").attr("href");
});
} else if (confirmed === 2) {
return wrapper.displayPrompt("Blacklist this site", "text", "Delete and Blacklist", "Reason", function(reason) {
_this.tag.find("#button-delete").addClass("loading");
wrapper.ws.cmd("blacklistAdd", [wrapper.site_info.address, reason]);
return wrapper.ws.cmd("siteDelete", wrapper.site_info.address, function() {
return document.location = $(".fixbutton-bg").attr("href");
});
});
}
}); });
return false; return false;
}; };
@ -599,7 +609,7 @@ window.initScrollable = function () {
return wrapper.notifications.add("sign", "done", inner_path + " Signed!", 5000); return wrapper.notifications.add("sign", "done", inner_path + " Signed!", 5000);
}); });
} else { } else {
wrapper.displayPrompt("Enter your private key:", "password", "Sign", function(privatekey) { wrapper.displayPrompt("Enter your private key:", "password", "Sign", "", function(privatekey) {
return wrapper.ws.cmd("siteSign", { return wrapper.ws.cmd("siteSign", {
privatekey: privatekey, privatekey: privatekey,
inner_path: inner_path, inner_path: inner_path,