Skip to content

Commit

Permalink
Sidebar blacklist button on deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcutme committed May 11, 2017
1 parent 84b5357 commit 1a3b48a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
17 changes: 13 additions & 4 deletions plugins/Sidebar/media/Sidebar.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,19 @@ class Sidebar extends Class

# Delete site
@tag.find("#button-delete").off("click touchend").on "click touchend", =>
wrapper.displayConfirm "Are you sure?", "Delete this site", =>
@tag.find("#button-delete").addClass("loading")
wrapper.ws.cmd "siteDelete", wrapper.site_info.address, ->
document.location = $(".fixbutton-bg").attr("href")
wrapper.displayConfirm "Are you sure?", ["Delete this site", "Blacklist"], (confirmed) =>
if confirmed == 1
@tag.find("#button-delete").addClass("loading")
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

# Owned checkbox
Expand Down
22 changes: 16 additions & 6 deletions plugins/Sidebar/media/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,11 +536,21 @@ window.initScrollable = function () {
})(this));
this.tag.find("#button-delete").off("click touchend").on("click touchend", (function(_this) {
return function() {
wrapper.displayConfirm("Are you sure?", "Delete this site", function() {
_this.tag.find("#button-delete").addClass("loading");
return wrapper.ws.cmd("siteDelete", wrapper.site_info.address, function() {
return document.location = $(".fixbutton-bg").attr("href");
});
wrapper.displayConfirm("Are you sure?", ["Delete this site", "Blacklist"], function(confirmed) {
if (confirmed === 1) {
_this.tag.find("#button-delete").addClass("loading");
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;
};
Expand Down Expand Up @@ -599,7 +609,7 @@ window.initScrollable = function () {
return wrapper.notifications.add("sign", "done", inner_path + " Signed!", 5000);
});
} 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", {
privatekey: privatekey,
inner_path: inner_path,
Expand Down

0 comments on commit 1a3b48a

Please sign in to comment.