Revision: 2670
          https://sourceforge.net/p/mrbs/code/2670/
Author:   cimorrison
Date:     2013-02-01 18:20:25 +0000 (Fri, 01 Feb 2013)
Log Message:
-----------
Fixed bug causing time selectors not to work properly after the area has been 
changed.   See SF bugs #258

Modified Paths:
--------------
    mrbs/trunk/web/js/edit_entry.js.php

Modified: mrbs/trunk/web/js/edit_entry.js.php
===================================================================
--- mrbs/trunk/web/js/edit_entry.js.php 2013-01-31 20:23:08 UTC (rev 2669)
+++ mrbs/trunk/web/js/edit_entry.js.php 2013-02-01 18:20:25 UTC (rev 2670)
@@ -781,13 +781,24 @@
   
   
 var reloadSlotSelector = function reloadSlotSelector(select, area) {
-    select.data('previous', select.data('current'));
-    select.data('current', select.val());
     select.html($('#' + select.attr('id') + area).html())
           .val(select.data('current'));
   };
   
   
+var updateSelectorData = function updateSelectorData(){
+    var selectors = ['area', 'start_seconds', 'end_seconds'];
+    var i, select;
+    
+    for (i=0; i<selectors.length; i++)
+    {
+      select = $('#' + selectors[i]);
+      select.data('previous', select.data('current'));
+      select.data('current', select.val());
+    }
+  };
+  
+
 function adjustSlotSelectors()
 {
   <?php
@@ -827,7 +838,6 @@
   {
     return;
   }
-
   <?php 
   // If All Day is checked then just set the start and end values to the first
   // and last possible options.
@@ -969,6 +979,7 @@
   <?php // Destroy and rebuild the start select ?>
   startSelect.html($('#start_seconds' + currentArea).html());
   startSelect.val(startValue);
+  startSelect.data('current', startValue);
 
   <?php // Destroy and rebuild the end select ?>
   endSelect.empty();
@@ -1054,6 +1065,7 @@
     });
     
   endSelect.val(endValue);
+  endSelect.data('current', endValue);
   
   adjustWidth(startSelect, endSelect);
     
@@ -1083,9 +1095,10 @@
           $(this).data('current', $(this).val());
           $(this).data('previous', $(this).val());
         })
-      .change(function() { 
+      .change(function() {
+          updateSelectorData();
           reloadSlotSelector($(this), $('#area').val());
-          adjustSlotSelectors(); 
+          adjustSlotSelectors();
         });
     
   
@@ -1094,12 +1107,8 @@
       .data('previous', areaSelect.val())
       .change(function() {
           var newArea = $(this).val();
-          <?php 
-          // Update the current and previous values for
-          // the area selector
-          ?>
-          $(this).data('previous', $(this).data('current'));
-          $(this).data('current', newArea);
+
+          updateSelectorData();
           
           <?php // Switch room selects ?>
           var roomSelect = $('#rooms');
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to