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