annotate 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
rev   line source
franck@0 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@0 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@0 11 Drupal.popups.open(
franck@0 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@0 14 {
franck@0 15 'popup_save': {
franck@0 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@0 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@0 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.
franck@0 37