Modal Dialogs Library

This library handles jQuery UI and Bootstrap modals and it is quite useful when it comes to display plain messages. Make sure to use the "showMessage" function only in pages where Bootstrap is loaded.

Notice: Some library methods are deprecated and will be removed with JSE v1.5.

Notice: Make sure that you load the require vendor files (Bootstrap or jQuery UI) before using this module.

Examples

Display jQuery UI message.

jse.libs.modal.message({
     title: 'My Title',      // Required
     content: 'My Content'   // Required
     buttons: { ... }        // Optional
     // Other jQueryUI Dialog Widget Options
});

Display Bootstrap message.

jse.libs.modal.showMessage('Title', 'Content');
Source:
To Do:
  • Refactor modal functionality, remove Mustache dependency and split jQuery UI and Bootstrap use.

Requires

  • module:jQueryUI
  • module:Bootstrap
  • module:Mustache

Methods

(static) alert(options, title, className, defbuttons, template) → {object}

Generates the default alert layer.

Parameters:
Name Type Description
options object

Mix of jQuery UI dialog options and custom options

title string

Default title for the type of alert layer

className string

Default class for the type of alert layer

defbuttons array

Array wih the default buttons for the array type

template string

Selector for the jQuery-object used as template

Deprecated:
  • This method will be removed with JSE v1.5.
Source:
Returns:

Returns a promise object.

Type
object

(static) confirm(options) → {promise}

Returns a confirm layer.

Parameters:
Name Type Description
options object

Mix of jQuery UI dialog options and custom options.

Deprecated:
  • This method will be removed with JSE v1.5.
Source:
Returns:

Returns a promise

Type
promise

(static) error(options) → {object}

Returns an error layer.

Parameters:
Name Type Description
options object

Mix of jQuery UI dialog options and custom options.

Deprecated:
  • This method will be removed with JSE v1.5.
Source:
Returns:

Returns a promise object.

Type
object

(static) info(options) → {promise}

Returns an info layer.

Parameters:
Name Type Description
options object

Mix of jQuery UI dialog options and custom options.

Deprecated:
  • This method will be removed with JSE v1.5.
Source:
Returns:

Returns a promise object.

Type
promise

(static) message(options)

Display jQuery UI message.

This method provides an easy way to display a message to the user by using jQuery UI dialog widget.

Parameters:
Name Type Description
options Object

Modal options are the same as the jQuery dialog widget.

Source:

(static) prompt(options) → {promise}

Returns a prompt layer.

Parameters:
Name Type Description
options object

Mix of jQuery UI dialog options and custom options.

Deprecated:
  • This method will be removed with JSE v1.5.
Source:
Returns:

Returns a promise object.

Type
promise

(static) showMessage(title, content, buttonsopt) → {jQuery}

Display Bootstrap modal message.

http://getbootstrap.com/javascript/#modals

Example:

jse.libs.modal.showMessage('Title', 'Message', [ { title: 'Send', // Button title class: 'btn btn-primary send', // (optional) Add a custom button class. callback: function(event) { ... } // (optional) Provide a click callback }, { title: 'Close', closeModal: true // (optional) Modal will be closed upon click. } ]);

You can close the modal by using the Bootstrap API: $modal.modal('hide');

Parameters:
Name Type Attributes Default Description
title String

The message title.

content String

The message content.

buttons Array.<Object> <optional>
null

Provide an array with objects which define the modal buttons.

Source:
Returns:

Returns the modal selector.

Type
jQuery

(static) success(options) → {object}

Returns a success layer.

Parameters:
Name Type Description
options object

Mix of jQuery UI dialog options and custom options.

Deprecated:
  • This method will be removed with JSE v1.5.
Source:
Returns:

Returns a promise object.

Type
object

(static) warn(options) → {object}

Returns a warning layer.

Parameters:
Name Type Description
options object

Mix of jQuery UI dialog options and custom options.

Deprecated:
  • This method will be removed with JSE v1.5.
Source:
Returns:

Returns a promise object.

Type
object