Hide calendar shortcuts when input is disabled
authorJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Sat, 16 Apr 2011 10:45:37 +0000 (10:45 +0000)
committerJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Sat, 16 Apr 2011 10:45:37 +0000 (10:45 +0000)
www/DateTimeShortcuts.js
www_templates/fragment_vessel_history.html

index c12dde28aa83150f3f9cd8299e7a68c5a1133e0b..a3c63c0cc0aab1857401170f6e1f587687cf6b6e 100644 (file)
@@ -130,6 +130,12 @@ var DateTimeShortcuts = {
 
         // Shortcut links (calendar icon and "Today" link)
         var shortcuts_span = document.createElement('span');
+       // Nirgal HACK starts
+       shortcuts_span.setAttribute('id', 'spancalshort_'+num);
+       //alert(''+inp.getAttribute('disabled'));
+       if (inp.getAttribute('disabled') != null)
+               shortcuts_span.style.display = 'none';
+       // Nirgal HACK ends
         inp.parentNode.insertBefore(shortcuts_span, inp.nextSibling);
         var today_link = document.createElement('a');
         today_link.setAttribute('href', 'javascript:DateTimeShortcuts.handleCalendarQuickLink(' + num + ', 0);');
index 54c53e170cf7eabf7df12a7e69b3b085b5b3d577..9d8d634455626b48c3bacd9f7aecee021c29b421 100644 (file)
@@ -4,24 +4,32 @@
 function show_hide_start_end_time(value) {
     if (value=='duration') {
         $('#id_start_date').attr('disabled', 'disabled');
+        $('#spancalshort_0').hide();
         $('#id_duration_0').removeAttr('disabled');
         $('#id_duration_1').removeAttr('disabled');
         $('#id_end_date').attr('disabled', 'disabled');
+        $('#spancalshort_1').hide();
     } else if (value=='date_date') {
         $('#id_start_date').removeAttr('disabled');
+        $('#spancalshort_0').show();
         $('#id_duration_0').attr('disabled', 'disabled');
         $('#id_duration_1').attr('disabled', 'disabled');
         $('#id_end_date').removeAttr('disabled');
+        $('#spancalshort_1').show();
     } else if (value=='start_duration') {
         $('#id_start_date').removeAttr('disabled');
+        $('#spancalshort_0').show();
         $('#id_duration_0').removeAttr('disabled');
         $('#id_duration_1').removeAttr('disabled');
         $('#id_end_date').attr('disabled', 'disabled');
+        $('#spancalshort_1').hide();
     } else {
         $('#id_start_date').attr('disabled', 'disabled');
+        $('#spancalshort_0').hide(); /* usually not ready yet */
         $('#id_duration_0').attr('disabled', 'disabled');
         $('#id_duration_1').attr('disabled', 'disabled');
         $('#id_end_date').attr('disabled', 'disabled');
+        $('#spancalshort_1').hide(); /* usually not ready yet */
     }
 }
 $(document).ready(function () {