mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
ENHANCEMENT: added jquery picker to editabledatefield for date picker.
This commit is contained in:
parent
4e8abded2e
commit
50270211f2
@ -4,6 +4,9 @@
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
@ -30,7 +33,23 @@ class EditableDateField extends EditableFormField {
|
||||
* breaks on the front end.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,9 +2,6 @@
|
||||
* Javascript required to power the user defined forms.
|
||||
*
|
||||
* Rewritten and refactored from the prototype version FieldEditor.
|
||||
*
|
||||
* @todo Upgrade to jQuery 1.3 so we can use live rather
|
||||
* then live
|
||||
*/
|
||||
(function($) {
|
||||
$(document).ready(function() {
|
||||
@ -69,6 +66,7 @@
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* 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
|
||||
@ -239,6 +237,7 @@
|
||||
valueInput.addClass("hidden");
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Delete a custom rule
|
||||
*/
|
||||
@ -247,6 +246,7 @@
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* Adding a custom rule to a given form
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user