Documentation

Dialog

The Dialog module provides a mechanism for launching an add-on's modules as modal dialogs from within an add-on's iframe. A modal dialog displays information without requiring the user to leave the current page. The dialog is opened over the entire window, rather than within the iframe itself.

###Styling your dialog to look like a standard Atlassian dialog By default the dialog iframe is undecorated. It's up to the developer to style the dialog.

In order to maintain a consistent look and feel between the host application and the add-on, we encourage add-on developers to style their dialogs to match Atlassian's Design Guidelines for modal dialogs. To do that, you'll need to add the AUI styles to your dialog.

For more information, read about the Atlassian User Interface dialog component.

Classes

Dialog
DialogButton
DialogOptions

Methods

close(data)

Closes the currently open dialog. Optionally pass data to listeners of the dialog.close event. This will only close a dialog that has been opened by your add-on. You can register for close events using the dialog.close event and the events module

Parameters:
NameTypeDescription
dataObject

An object to be emitted on dialog close.

Example
AP.require('dialog', function(dialog){ dialog.close({foo: 'bar'}); });

getButton() → {DialogButton}

Returns the button that was requested (either cancel or submit)

Returns:
DialogButton
Example
AP.require('dialog', function(dialog){ dialog.getButton('submit'); });

onDialogMessage(String, Function)

register callbacks responding to messages from the host dialog, such as "submit" or "cancel"

Parameters:
NameTypeDescription
String

button either "cancel" or "submit"

Function

callback function

This functionality is deprecated and may be removed in the future.