[Jifty-commit] r5675 - in jifty/trunk: lib/Jifty/Web/Form/Field share/web/static/js
Jifty commits
jifty-commit at lists.jifty.org
Fri Aug 8 12:06:49 EDT 2008
Author: trs
Date: Fri Aug 8 12:06:48 2008
New Revision: 5675
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Web/Form/Field/Date.pm
jifty/trunk/share/web/static/js/calendar.js
jifty/trunk/share/web/static/js/jifty.js
Log:
r38821 at zot: tom | 2008-08-08 12:05:20 -0400
* The default allowed handlers for form elements are sane for Date elements
* When a date field is updated via the calendar, an onchange event should be triggered
* Move the form field focusing behaviour rule with the rest (and last) so that other rules can register onfocus events that will get triggered by the autofocus
Modified: jifty/trunk/lib/Jifty/Web/Form/Field/Date.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field/Date.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field/Date.pm Fri Aug 8 12:06:48 2008
@@ -22,18 +22,6 @@
return join(' ', 'date', ($self->SUPER::classes));
}
-
-=head2 handler_allowed HANDLER_NAME
-
-Returns 1 if the handler (e.g. onclick) is allowed. Undef otherwise.
-
-=cut
-
-sub handler_allowed {
- undef;
-}
-
-
=head2 canonicalize_value
If the value is a DateTime, return just the ymd portion of it.
Modified: jifty/trunk/share/web/static/js/calendar.js
==============================================================================
--- jifty/trunk/share/web/static/js/calendar.js (original)
+++ jifty/trunk/share/web/static/js/calendar.js Fri Aug 8 12:06:48 2008
@@ -23,7 +23,7 @@
Jifty.Calendar.hideOpenCalendar();
return;
}
-
+
Jifty.Calendar.hideOpenCalendar();
/* We need to delay Jifty's canonicalization until after we've
@@ -80,7 +80,9 @@
if (day < 10)
day = "0" + day;
- obj.input.value = year + "-" + month + "-" + day;
+ jQuery(obj.input).val(year + "-" + month + "-" + day);
+ // Trigger an onchange event for any listeners
+ jQuery(obj.input).change();
Jifty.Calendar.hideOpenCalendar();
},
Modified: jifty/trunk/share/web/static/js/jifty.js
==============================================================================
--- jifty/trunk/share/web/static/js/jifty.js (original)
+++ jifty/trunk/share/web/static/js/jifty.js Fri Aug 8 12:06:48 2008
@@ -727,17 +727,6 @@
});
-// Form elements should focus if the CSS says so.
-Behaviour.register({
- ".focus": function(e) {
- /* Check to see if the element is already focused */
- if (!jQuery(e).hasClass("focused")) {
- jQuery(e).addClass("focused").focus();
- }
- }
-});
-
-
// Form elements should AJAX validate if the CSS says so
Behaviour.register({
'input.ajaxvalidation, textarea.ajaxvalidation, input.ajaxcanonicalization, textarea.ajaxcanonicalization': function(elt) {
@@ -777,6 +766,14 @@
},
'.form_field .error, .form_field .warning, .form_field .canonicalization_note': function(e) {
if ( e.innerHTML == "" ) jQuery(e).hide();
+ },
+ // Form elements should focus if the CSS says so.
+ ".focus": function(e) {
+ /* Check to see if the element is already focused */
+ if (!jQuery(e).hasClass("focused")) {
+ console.log("here");
+ jQuery(e).addClass("focused").focus();
+ }
}
});
More information about the Jifty-commit
mailing list