annotate API.txt @ 7:85e281a44a62
tip
Refuse to add popups.js to an ajax request that's not already a popup
In some case, if you enable the "Always scan for popups links" options,
Popups Ajax processing will break the original module request.
author |
Franck Deroche <franck@defr.org> |
date |
Fri, 31 Dec 2010 14:13:37 +0100 |
parents |
4215c43e74eb |
children |
|
rev |
line source |
franck@1
|
1 As well as attaching popup behavior to links,
|
franck@0
|
2 Popups API provides javascript function for creating in-window popup messages.
|
franck@0
|
3
|
franck@0
|
4 Popups.message(title, message)
|
franck@0
|
5 Produces a simple modal box with the title, message and "OK", "Cancel" buttons.
|
franck@1
|
6
|
franck@0
|
7 Popups.open(title, body, buttons, width)
|
franck@0
|
8 More powerful, allows you to specify what the buttons are and what they do.
|
franck@0
|
9 buttons is a hash of hash, with button title and function.
|
franck@0
|
10 * Example:
|
franck@1
|
11 Drupal.popups.open(
|
franck@1
|
12 Drupal.t('Warning: Please Confirm'),
|
franck@0
|
13 Drupal.t("There are unsaved changes on this page, which you will lose if you continue."),
|
franck@1
|
14 {
|
franck@0
|
15 'popup_save': {
|
franck@1
|
16 title: Drupal.t('Save Changes'),
|
franck@0
|
17 func: function(){Drupal.popups.savePage(element, options);}
|
franck@0
|
18 },
|
franck@0
|
19 'popup_submit': {
|
franck@1
|
20 title: Drupal.t('Continue'),
|
franck@0
|
21 func: function(){Drupal.popups.removePopup(); Drupal.popups.openPath(element, options);}
|
franck@0
|
22 },
|
franck@0
|
23 'popup_cancel': {
|
franck@0
|
24 title: Drupal.t('Cancel'), func: Drupal.popups.close;
|
franck@1
|
25 }
|
franck@0
|
26 }
|
franck@0
|
27 );
|
franck@0
|
28
|
franck@0
|
29 // TODO - make a more useful api function for opening a path.
|
franck@0
|
30 Popups.openPath = function(element, options, parent)
|
franck@0
|
31 * @param element
|
franck@0
|
32 * Element that was clicked to open the popups.
|
franck@0
|
33 * @param options
|
franck@0
|
34 * Hash of options controlling how the popups interacts with the underlying page.
|
franck@0
|
35 * @param parent
|
franck@0
|
36 * If path is being opened from inside another popup, that popup is the parent.
|