make dialogue close itself if callback is missing
This commit is contained in:
parent
687d49a958
commit
68c3fcb909
10 changed files with 7 additions and 61 deletions
|
@ -68,7 +68,13 @@ namespace Sakura
|
|||
DOM.Append(button, DOM.Text(btnText));
|
||||
button.setAttribute('data-type', btnType.toString());
|
||||
button.addEventListener("click", (ev: any) => {
|
||||
(this.Callbacks.Get(+ev.target.attributes['data-type'].value)).Value.call(this);
|
||||
var callback: KeyValuePair<DialogueButton, Function> = this.Callbacks.Get(+ev.target.attributes['data-type'].value);
|
||||
|
||||
if (callback) {
|
||||
callback.Value.call(this);
|
||||
} else {
|
||||
this.Close();
|
||||
}
|
||||
});
|
||||
|
||||
DOM.Append(buttonCont, button);
|
||||
|
|
|
@ -46,9 +46,6 @@
|
|||
var error = new Sakura.Dialogue;
|
||||
error.Title = "Error";
|
||||
error.Text = text;
|
||||
error.AddCallback(Sakura.DialogueButton.Ok, function () {
|
||||
this.Close();
|
||||
});
|
||||
error.Display();
|
||||
}
|
||||
|
||||
|
|
|
@ -150,11 +150,6 @@
|
|||
error.Title = "Error";
|
||||
error.Text = result.error;
|
||||
error.SetType(Sakura.DialogueType.Info);
|
||||
|
||||
error.AddCallback(Sakura.DialogueButton.Ok, function () {
|
||||
this.Close();
|
||||
});
|
||||
|
||||
error.Display();
|
||||
} else {
|
||||
stopEdit();
|
||||
|
@ -198,11 +193,6 @@
|
|||
error.Title = "Error";
|
||||
error.Text = result.error;
|
||||
error.SetType(Sakura.DialogueType.Info);
|
||||
|
||||
error.AddCallback(Sakura.DialogueButton.Ok, function () {
|
||||
this.Close();
|
||||
});
|
||||
|
||||
error.Display();
|
||||
} else if (result.go) {
|
||||
window.location.assign(result.go)
|
||||
|
|
|
@ -66,17 +66,11 @@
|
|||
var error = new Sakura.Dialogue;
|
||||
error.Title = "Error";
|
||||
error.Text = "Deletion failed!";
|
||||
error.AddCallback(Sakura.DialogueButton.Ok, function () {
|
||||
this.Close();
|
||||
});
|
||||
error.Display();
|
||||
});
|
||||
deleter.Start(Sakura.HTTPMethod.DELETE);
|
||||
this.Close();
|
||||
});
|
||||
confirm.AddCallback(Sakura.DialogueButton.No, function () {
|
||||
this.Close();
|
||||
});
|
||||
confirm.Display();
|
||||
}
|
||||
|
||||
|
|
|
@ -99,9 +99,6 @@
|
|||
var diag = new Sakura.Dialogue;
|
||||
diag.Title = "Login Error";
|
||||
diag.Text = result.error;
|
||||
diag.AddCallback(Sakura.DialogueButton.Ok, function () {
|
||||
this.Close();
|
||||
});
|
||||
diag.Display();
|
||||
} else if (result.go) {
|
||||
window.location.assign(result.go);
|
||||
|
@ -121,10 +118,6 @@
|
|||
confirm.Title = "Logout";
|
||||
confirm.Text = "Are you sure?";
|
||||
|
||||
confirm.AddCallback(Sakura.DialogueButton.No, function () {
|
||||
this.Close();
|
||||
});
|
||||
|
||||
confirm.AddCallback(Sakura.DialogueButton.Yes, function () {
|
||||
var ajax = new Sakura.AJAX;
|
||||
ajax.SetUrl("{{ route('auth.logout') }}?session=" + Sakura.Config.SessionId);
|
||||
|
@ -138,11 +131,6 @@
|
|||
var error = new Sakura.Dialogue;
|
||||
error.Title = "Logout Error";
|
||||
error.Text = "Logout failed.";
|
||||
|
||||
error.AddCallback(Sakura.DialogueButton.Ok, function () {
|
||||
this.Close();
|
||||
});
|
||||
|
||||
error.Display();
|
||||
});
|
||||
|
||||
|
|
|
@ -10,14 +10,8 @@
|
|||
<script>
|
||||
function yuunoRankProtected() {
|
||||
var confirm = new Sakura.Dialogue;
|
||||
|
||||
confirm.Title = "Ranks";
|
||||
confirm.Text = "You aren't allowed to remove this rank from your account!";
|
||||
|
||||
confirm.AddCallback(Sakura.DialogueButton.Ok, function () {
|
||||
this.Close();
|
||||
});
|
||||
|
||||
confirm.Display();
|
||||
}
|
||||
|
||||
|
@ -33,10 +27,6 @@
|
|||
confirm.Title = "Ranks";
|
||||
confirm.Text = "You are about to remove the rank '" + name + "' from your account. Are you sure about this?";
|
||||
|
||||
confirm.AddCallback(Sakura.DialogueButton.No, function () {
|
||||
this.Close();
|
||||
});
|
||||
|
||||
confirm.AddCallback(Sakura.DialogueButton.Yes, function () {
|
||||
this.Close();
|
||||
yuunoRankDo(id, csrf, 'remove');
|
||||
|
@ -64,11 +54,6 @@
|
|||
error.Title = "Ranks";
|
||||
error.Text = result.error;
|
||||
error.SetType(Sakura.DialogueType.Info);
|
||||
|
||||
error.AddCallback(Sakura.DialogueButton.Ok, function () {
|
||||
this.Close();
|
||||
});
|
||||
|
||||
error.Display();
|
||||
} else if (mode === 'remove') {
|
||||
Sakura.DOM.Remove(Sakura.DOM.ID('rank-' + id));
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
confirm.Title = "Account Deactivation";
|
||||
confirm.Text = "Are you really sure? You can reactivate your account within 30 days of deactivated, after that it'll be permanently deleted!";
|
||||
|
||||
confirm.AddCallback(Sakura.DialogueButton.No, function () {
|
||||
this.Close();
|
||||
});
|
||||
|
||||
confirm.AddCallback(Sakura.DialogueButton.Yes, function () {
|
||||
var ajax = new Sakura.AJAX;
|
||||
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
confirm.Title = "Session Manager";
|
||||
confirm.Text = !id ? "You are about to end every active login to your account. Are you sure?" : "Are you sure you want to end this session?";
|
||||
|
||||
confirm.AddCallback(Sakura.DialogueButton.No, function () {
|
||||
this.Close();
|
||||
});
|
||||
|
||||
confirm.AddCallback(Sakura.DialogueButton.Yes, function () {
|
||||
var ajax = new Sakura.AJAX,
|
||||
formData = new FormData;
|
||||
|
|
|
@ -33,9 +33,6 @@
|
|||
dialogue.Title = "Confirmation";
|
||||
dialogue.Text = "Are you sure?";
|
||||
dialogue.SetType(Sakura.DialogueType.Confirm);
|
||||
dialogue.AddCallback(Sakura.DialogueButton.No, function () {
|
||||
this.Close();
|
||||
});
|
||||
dialogue.AddCallback(Sakura.DialogueButton.Yes, function () {
|
||||
updateSettings(form, action);
|
||||
this.Close();
|
||||
|
|
|
@ -155,9 +155,6 @@
|
|||
var diag = new Sakura.Dialogue;
|
||||
diag.Title = "Error";
|
||||
diag.Text = result.error;
|
||||
diag.AddCallback(Sakura.DialogueButton.Ok, function () {
|
||||
this.Close();
|
||||
});
|
||||
diag.Display();
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue