modal.alert
ModalAlert : d2/sdk/controls/modal.alert
Shows a modal alert.
Different static methods could be used to show different type of modal alerts.
Extends: Marionette.View
Example (A sample invocation to show a confirmation alert)
define([
'd2/sdk/controls/modal.alert'
], function(ModalAlert){
'use strict';
var buttonOptions = {
showYes: true,
labelYes: 'Ok',
showNo: false,
showCancel: true,
labelCancel: 'Cancel'
};
ModalAlert.confirmQuestion(function(result){
if(result) {
console.log('Clicked OK');
} else {
console.log('Clicked Cancel');
}
}, 'sample message', 'Sample Title', {
buttons: buttonOptions
});
});
- ModalAlert :
d2/sdk/controls/modal.alert
- static
- .ButtonOptions
- .showSuccess([callback], [message], [title], [options]) ⇒
PromiseReturnType
- .showInformation([callback], [message], [title], [options]) ⇒
PromiseReturnType
- .showWarning([callback], [message], [title], [options]) ⇒
PromiseReturnType
- .showError([callback], [message], [title], [options]) ⇒
PromiseReturnType
- .showMessage([callback], [message], [title], [options]) ⇒
PromiseReturnType
- .confirmSuccess([callback], [message], [title], [options]) ⇒
PromiseReturnType
- .confirmInformation([callback], [message], [title], [options]) ⇒
PromiseReturnType
- .confirmWarning([callback], [message], [title], [options]) ⇒
PromiseReturnType
- .confirmError([callback], [message], [title], [options]) ⇒
PromiseReturnType
- .confirmQuestion([callback], [message], [title], [options]) ⇒
PromiseReturnType
- .confirmMessage([callback], [message], [title], [options]) ⇒
PromiseReturnType
- inner
- ~AlertDissolveCallback ⇒
void
- ~PromiseReturnType :
jQuery.Promise
- ~OptionsType :
Object
- ~AlertDissolveCallback ⇒
- static
ModalAlert.ButtonOptions
A few pre-configured button options to ease up modal creation with preset
Kind: static property of ModalAlert
Todo
- Describe different button options
ModalAlert.showSuccess([callback], [message], [title], [options]) ⇒ PromiseReturnType
Shows a success modal alert
Kind: static method of ModalAlert
Param | Type | Description |
---|---|---|
[callback] | AlertDissolveCallback | Executed with a hint about user interaction. |
[message] | string | The message to be shown. |
[title] | string | Title of the alert. |
[options] | OptionsType | A single option hash to customize the modal title, message & button options |
ModalAlert.showInformation([callback], [message], [title], [options]) ⇒ PromiseReturnType
Shows a info modal alert
Kind: static method of ModalAlert
Param | Type | Description |
---|---|---|
[callback] | AlertDissolveCallback | Executed with a hint about user interaction. |
[message] | string | The message to be shown. |
[title] | string | Title of the alert. |
[options] | OptionsType | A single option hash to customize the modal title, message & button options |
ModalAlert.showWarning([callback], [message], [title], [options]) ⇒ PromiseReturnType
Shows a warning modal alert
Kind: static method of ModalAlert
Param | Type | Description |
---|---|---|
[callback] | AlertDissolveCallback | Executed with a hint about user interaction. |
[message] | string | The message to be shown. |
[title] | string | Title of the alert. |
[options] | OptionsType | A single option hash to customize the modal title, message & button options |
ModalAlert.showError([callback], [message], [title], [options]) ⇒ PromiseReturnType
Shows an error modal alert
Kind: static method of ModalAlert
Param | Type | Description |
---|---|---|
[callback] | AlertDissolveCallback | Executed with a hint about user interaction. |
[message] | string | The message to be shown. |
[title] | string | Title of the alert. |
[options] | OptionsType | A single option hash to customize the modal title, message & button options |
ModalAlert.showMessage([callback], [message], [title], [options]) ⇒ PromiseReturnType
Shows a generic modal alert without associating with a type
Kind: static method of ModalAlert
Param | Type | Description |
---|---|---|
[callback] | AlertDissolveCallback | Executed with a hint about user interaction. |
[message] | string | The message to be shown. |
[title] | string | Title of the alert. |
[options] | OptionsType | A single option hash to customize the modal title, message & button options |
ModalAlert.confirmSuccess([callback], [message], [title], [options]) ⇒ PromiseReturnType
Shows an interrogative modal alert representing success
Kind: static method of ModalAlert
Param | Type | Description |
---|---|---|
[callback] | AlertDissolveCallback | Executed with a hint about user interaction. |
[message] | string | The message to be shown. |
[title] | string | Title of the alert. |
[options] | OptionsType | A single option hash to customize the modal title, message & button options |
ModalAlert.confirmInformation([callback], [message], [title], [options]) ⇒ PromiseReturnType
Shows an interrogative modal alert representing information
Kind: static method of ModalAlert
Param | Type | Description |
---|---|---|
[callback] | AlertDissolveCallback | Executed with a hint about user interaction. |
[message] | string | The message to be shown. |
[title] | string | Title of the alert. |
[options] | OptionsType | A single option hash to customize the modal title, message & button options |
ModalAlert.confirmWarning([callback], [message], [title], [options]) ⇒ PromiseReturnType
Shows an interrogative modal alert representing warning
Kind: static method of ModalAlert
Param | Type | Description |
---|---|---|
[callback] | AlertDissolveCallback | Executed with a hint about user interaction. |
[message] | string | The message to be shown. |
[title] | string | Title of the alert. |
[options] | OptionsType | A single option hash to customize the modal title, message & button options |
ModalAlert.confirmError([callback], [message], [title], [options]) ⇒ PromiseReturnType
Shows an interrogative modal alert representing error
Kind: static method of ModalAlert
Param | Type | Description |
---|---|---|
[callback] | AlertDissolveCallback | Executed with a hint about user interaction. |
[message] | string | The message to be shown. |
[title] | string | Title of the alert. |
[options] | OptionsType | A single option hash to customize the modal title, message & button options |
ModalAlert.confirmQuestion([callback], [message], [title], [options]) ⇒ PromiseReturnType
Shows a generic interrogative modal alert
Kind: static method of ModalAlert
Param | Type | Description |
---|---|---|
[callback] | AlertDissolveCallback | Executed with a hint about user interaction. |
[message] | string | The message to be shown. |
[title] | string | Title of the alert. |
[options] | OptionsType | A single option hash to customize the modal title, message & button options |
ModalAlert.confirmMessage([callback], [message], [title], [options]) ⇒ PromiseReturnType
Shows a generic interrogative modal alert representing a message
Kind: static method of ModalAlert
Param | Type | Description |
---|---|---|
[callback] | AlertDissolveCallback | Executed with a hint about user interaction. |
[message] | string | The message to be shown. |
[title] | string | Title of the alert. |
[options] | OptionsType | A single option hash to customize the modal title, message & button options |
ModalAlert~AlertDissolveCallback ⇒ void
Callback type invoked, when the modal dissolves.
Kind: inner typedef of ModalAlert
Param | Type | Description |
---|---|---|
result | boolean | undefined |
|
ModalAlert~PromiseReturnType : jQuery.Promise
Return type. Associated jQuery.Promise
instance is resolve()
-ed or reject()
-ed to indicate whether user pressed 'Yes' or some other button respectively.
Kind: inner typedef of ModalAlert
ModalAlert~OptionsType : Object
Customize modal's title, message, button labels and configuration
Kind: inner typedef of ModalAlert
Todo
- Enumerate different properties