ENHANCEMENT: added jquery picker to editabledatefield for date picker.

This commit is contained in:
Will Rossiter 2010-05-31 07:57:00 +00:00
parent 4e8abded2e
commit 50270211f2
2 changed files with 23 additions and 4 deletions

View File

@ -4,6 +4,9 @@
* *
* Allows a user to add a date field to the Field Editor * Allows a user to add a date field to the Field Editor
* *
* @todo Localization, Time Field / Date time field combinations. Set ranges of dates,
* set default date
*
* @package userforms * @package userforms
*/ */
@ -30,7 +33,23 @@ class EditableDateField extends EditableFormField {
* breaks on the front end. * breaks on the front end.
*/ */
public function getFormField() { public function getFormField() {
return new TextField( $this->Name, $this->Title, $this->Default); // scripts for jquery date picker
Requirements::javascript(THIRDPARTY_DIR .'/jquery-ui/jquery.ui.core.js');
Requirements::javascript(THIRDPARTY_DIR .'/jquery-ui/jquery.ui.datepicker.js');
Requirements::customScript(<<<JS
(function(jQuery) {
$(document).ready(function() {
$('input[name^=EditableDateField]').datepicker();
});
})(jQuery);
JS
, 'UserFormsDate');
// css for jquery date picker
Requirements::css(THIRDPARTY_DIR .'/jquery-ui-themes/smoothness/jquery-ui-1.8rc3.custom.css');
return new DateField( $this->Name, $this->Title, $this->Default);
} }
/** /**

View File

@ -2,9 +2,6 @@
* Javascript required to power the user defined forms. * Javascript required to power the user defined forms.
* *
* Rewritten and refactored from the prototype version FieldEditor. * Rewritten and refactored from the prototype version FieldEditor.
*
* @todo Upgrade to jQuery 1.3 so we can use live rather
* then live
*/ */
(function($) { (function($) {
$(document).ready(function() { $(document).ready(function() {
@ -69,6 +66,7 @@
}); });
return false; return false;
}); });
/** /**
* Upon renaming a field we should go through and rename all the * Upon renaming a field we should go through and rename all the
* fields in the select fields to use this new field title. We can * fields in the select fields to use this new field title. We can
@ -239,6 +237,7 @@
valueInput.addClass("hidden"); valueInput.addClass("hidden");
} }
}); });
/** /**
* Delete a custom rule * Delete a custom rule
*/ */
@ -247,6 +246,7 @@
return false; return false;
}); });
/** /**
* Adding a custom rule to a given form * Adding a custom rule to a given form
*/ */