Author: david
Date: Mon Dec 7 17:00:09 2009
New Revision: 4114
Log:
Start work on progressively enhanced yui dialog.
Added:
trunk/web/js/dialog.js (contents, props changed)
Added: trunk/web/js/dialog.js
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/web/js/dialog.js Mon Dec 7 17:00:09 2009 (r4114)
@@ -0,0 +1,62 @@
+// $Id$
+Drupal.behaviors.autocomplete = {
+ attach: function (context)
+ {
+ $('table.dialog').each(function()
+ {
+ var table = this;
+ var label = $(table).children('caption').remove().text();
+
+ // Create YUI container for dialog
+ var yuiDialogWrapper = $(
+ '<div class="yui-skin-sam">' +
+ '<div id="' + $(table).attr('id') + '">' +
+ '<div class="hd">' + label + '</div>' +
+ '<div class="bd">' +
+ '<form action="" method="POST" style="border: none"></form>' +
+ '</div>' +
+ '</div>' +
+ '</div>');
+
+ // Replace table with "add" link and move into dialog wrapper
+ $(table)
+ .removeClass('dialog')
+ .replaceWith('<a href="javascript:yuiDialog.show();">Add</a>')
+ .appendTo(yuiDialogWrapper.find('form'))
+
+ // append yuiDialogWrapper to document body
+ $('body').prepend(yuiDialogWrapper);
+
+ // Instantiate YUI dialog object
+ var counter = 0; // Counter
+
+ // Write data from dialog to informationobject/edit form for
submission.
+ var handleSubmit = function() {
+ //submitActorEventDialog(this.getData(), counter++); // Save the
data to the main form
+ this.hide(); // Hide dialog
+ //clearActorEventDialog(); // Clear the dialog form
+ };
+
+ var handleCancel = function() {
+ this.cancel();
+ //clearActorEventDialog();
+ };
+
+ yuiDialog = new YAHOO.widget.Dialog($(table).attr('id'),
+ {
+ width: "480px",
+ zIndex: "100",
+ fixedcenter: true,
+ visible: false,
+ modal: true,
+ constraintoviewport: true,
+ postmethod: 'none',
+ buttons: [ { text: "Submit", handler: handleSubmit, isDefault: true
},
+ { text: "Cancel", handler: handleCancel } ],
+ effect: { effect: YAHOO.widget.ContainerEffect.FADE, duration: 0.25 }
+ } );
+
+ yuiDialog.render();
+ })
+ }
+}
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.