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