-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduced confirm and confirmDelete functions in the Angular overlay service #6526
Introduced confirm and confirmDelete functions in the Angular overlay service #6526
Conversation
I wonder if it would be better just with a single E.g.:
It would then just use the same function, but adjust the layout of the confirm like the existing properties like |
Thanks @abjerner - we'll have a look soon! |
I've now updated the PR according to Bjarne's suggestions. This means that the Usage is as following: Default confirm dialog (no explicit type): $scope.default = function () {
overlayService.confirm({
title: "Hest",
content: "Please confirm me.",
confirmMessage: "Click the green \"Confirm\" button below to confirm this dialog.",
//confirmMessageStyle: "danger",
close: function () {
overlayService.close();
},
submit: function () {
overlayService.close();
}
});
}; Delete dialog: $scope.danger = function () {
overlayService.confirm({
title: "Hest",
content: "Please delete me.",
confirmType: "delete",
confirmMessage: "This will delete the account.",
//confirmMessageStyle: "danger",
close: function () {
overlayService.close();
},
submit: function () {
overlayService.close();
}
});
}; As also suggested by Bjarne, when switch (overlay.confirmType) {
case "delete":
if (!overlay.confirmMessageStyle) overlay.confirmMessageStyle = "danger";
if (!overlay.submitButtonStyle) overlay.submitButtonStyle = "danger";
if (!overlay.submitButtonLabelKey) overlay.submitButtonLabelKey = "contentTypeEditor_yesDelete";
break;
default:
if (!overlay.submitButtonLabelKey) overlay.submitButtonLabelKey = "general_confirm";
} |
Wonderful, thanks @abjerner ! |
@nul800sebastiaan I can have a look at it tomorrow 😉 |
Implementing #6507
Based on Bjarne's PR for a confirm overlay, this PR adds the
confirm
andconfirmDelete
methods to the Angular overlay service.The
confirm
function has some default settings:closeButtonLabelKey
togeneral_cancel
submitButtonLabelKey
togeneral_confirm
close
callback which just closes the overlayIt looks like this:
The
confirmDelete
functions does whatconfirm
does, but then also:submitButtonStyle
todanger
submitButtonLabelKey
tocontentTypeEditor_yesDelete
It looks like this:
I haven't updated the code in Bjarne's PR, but:
could now be shortened to: