[Jifty-commit] r718 - in jifty/trunk: . lib/Jifty/Web/Form/Field share/web/static/js

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Mar 20 23:56:49 EST 2006


Author: trs
Date: Mon Mar 20 23:56:49 2006
New Revision: 718

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Web/Form/Field/Date.pm
   jifty/trunk/share/web/static/css/forms.css
   jifty/trunk/share/web/static/js/bps_util.js
   jifty/trunk/share/web/static/js/jifty.js

Log:
 r9308 at wintermute:  tom | 2006-03-20 23:53:51 -0500
 * Create date selection widgets using Behaviour
 * Specify width of date fields in CSS rather than Perl
 * Fix problem of no date selection widgets in ajax updated forms


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	Mon Mar 20 23:56:49 2006
@@ -16,24 +16,4 @@
     return join(' ', 'date', ($self->SUPER::classes));
 }
 
-=head2 render_widget
-
-Output the basic edit widget and some javascript to pop up a calendar
-
-=cut
-
-sub render_widget {
-    my $self  = shift;
-    $self->length(12);
-    $self->SUPER::render_widget();
-
-    Jifty->web->out( <<"EOF");
-    <script type="text/javascript"><!--
-        onLoadHook('createCalendarLink("@{[$self->element_id]}")');
-    --></script>
-EOF
-    
-    return '';
-}
-
 1;

Modified: jifty/trunk/share/web/static/css/forms.css
==============================================================================
--- jifty/trunk/share/web/static/css/forms.css	(original)
+++ jifty/trunk/share/web/static/css/forms.css	Mon Mar 20 23:56:49 2006
@@ -52,6 +52,10 @@
     padding: 0.2em;
 }
 
+input.date {
+    width: 10em;
+}
+
 .submit_button {
     display: block;
     clear: both;
@@ -63,9 +67,7 @@
 }
 
 input.button {
-    border: 1px outset black;
-    background: white;
-    padding: 0.2em 1em;
+    padding: 0.15em 1em;
     font-weight: bold;
 }
 

Modified: jifty/trunk/share/web/static/js/bps_util.js
==============================================================================
--- jifty/trunk/share/web/static/js/bps_util.js	(original)
+++ jifty/trunk/share/web/static/js/bps_util.js	Mon Mar 20 23:56:49 2006
@@ -18,11 +18,11 @@
 }
 
 function createCalendarLink(input) {
-    var e = document.getElementById(input);
+    var e = $(input);
     if (e) {
         var link = document.createElement('a');
         link.setAttribute('href', '#');
-        link.setAttribute('onclick', "openCalWindow('"+input+"'); return false;");
+        link.setAttribute('onclick', "openCalWindow('"+e.id+"'); return false;");
         link.setAttribute('class', 'calendar-link');
         
         var text = document.createTextNode('Calendar');

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	Mon Mar 20 23:56:49 2006
@@ -230,6 +230,12 @@
         elt.onblur = function () {
             Form.Element.validate(this);
         } 
+    },
+    'input.date': function(e) {
+        if ( !Element.hasClassName( e, 'has-calendar-link' ) ) {
+            createCalendarLink(e);
+            Element.addClassName( e, 'has-calendar-link' );
+        }
     }
 });
 


More information about the Jifty-commit mailing list