1. Matthew Schinckel
  2. django-weekday-field

Commits

Matthew Schinckel  committed 3641eb0

Oh fuck me.
You have no idea how long I have been trying to hunt down the fact
that this fucking static file would not load. I've been moving it
around, but could not see that I had transposed g and d.

  • Participants
  • Parent commits 6a09b5a
  • Branches default

Comments (0)

Files changed (3)

File setup.py

View file
  • Ignore whitespace
         "weekday_field",
     ],
     package_data = {
-        '': ['static/weekday_field/js/*.js'],
+        '': ['static/*/*/*'],
     },
     classifiers = [
         'Programming Language :: Python',

File weekday_field/static/weekday_field/js/checkbox-widget.js

View file
  • Ignore whitespace
+function changeHandler(evt) {
+  var $target = $(evt.target);
+  var targetValue = evt.target.value;
+  var targetChecked = !!$target.attr('checked');
+  
+  var $others = $('[name=' + $target.attr('name') + ']');
+  var $anyAll = $('[value="None"]');
+  
+  if (targetValue === 'None') {
+    $others.attr('checked', true);
+    $target.attr('disabled', true);
+    return;
+  }
+  
+  // Otherwise, whenever we deselect any, deselect the "All" item.
+  if (!targetChecked) {
+    $others.filter('[value="None"]').attr('checked', false);
+  }
+  if (targetValue.match(',')) {
+    // This was a multiple box.
+    $others.filter(function(i, el) {
+      return targetValue.match(el.value);
+    }).attr('checked', targetChecked);
+  } else {
+    // This was a single choice.
+    if (!targetChecked) {
+      // And it was a deselection.
+      $others.filter(function(i, el) {
+        return el.value.match(targetValue);
+      }).attr('checked', false);
+    } else {
+      // Only check multiple ones if they all match.
+      var value_ = $others.filter(function(i, el) {
+        return !el.value.match(',');
+      }).filter(':checked');
+      var value = [];
+      
+      $.each(value_, function(i, el){
+        value.push(el.value);
+      });
+      value = value.sort().join();
+      
+      $others.filter(function(i, el) {
+        return value.match(el.value);
+      }).attr('checked', true);
+    }  
+  }
+  
+  // If we deselected everything, select everything.
+  if ($others.filter(':checked').length === 0) {
+    $others.attr('checked', true);
+  } else {
+    // Now check for all to be selected.
+    if ($others.filter(':not(:checked)').length === 1) {
+      if ($others.filter(':not(:checked)')[0].value === 'None') {
+        $others.attr('checked', true);
+      }  
+    }
+  }
+  
+  $anyAll.attr('disabled', !!$anyAll.attr('checked'));
+}

File weekday_field/static/weekday_field/js/checkbox-wigdet.js

  • Ignore whitespace
-function changeHandler(evt) {
-  var $target = $(evt.target);
-  var targetValue = evt.target.value;
-  var targetChecked = !!$target.attr('checked');
-  
-  var $others = $('[name=' + $target.attr('name') + ']');
-  var $anyAll = $('[value="None"]');
-  
-  if (targetValue === 'None') {
-    $others.attr('checked', true);
-    $target.attr('disabled', true);
-    return;
-  }
-  
-  // Otherwise, whenever we deselect any, deselect the "All" item.
-  if (!targetChecked) {
-    $others.filter('[value="None"]').attr('checked', false);
-  }
-  if (targetValue.match(',')) {
-    // This was a multiple box.
-    $others.filter(function(i, el) {
-      return targetValue.match(el.value);
-    }).attr('checked', targetChecked);
-  } else {
-    // This was a single choice.
-    if (!targetChecked) {
-      // And it was a deselection.
-      $others.filter(function(i, el) {
-        return el.value.match(targetValue);
-      }).attr('checked', false);
-    } else {
-      // Only check multiple ones if they all match.
-      var value_ = $others.filter(function(i, el) {
-        return !el.value.match(',');
-      }).filter(':checked');
-      var value = [];
-      
-      $.each(value_, function(i, el){
-        value.push(el.value);
-      });
-      value = value.sort().join();
-      
-      $others.filter(function(i, el) {
-        return value.match(el.value);
-      }).attr('checked', true);
-    }  
-  }
-  
-  // If we deselected everything, select everything.
-  if ($others.filter(':checked').length === 0) {
-    $others.attr('checked', true);
-  } else {
-    // Now check for all to be selected.
-    if ($others.filter(':not(:checked)').length === 1) {
-      if ($others.filter(':not(:checked)')[0].value === 'None') {
-        $others.attr('checked', true);
-      }  
-    }
-  }
-  
-  $anyAll.attr('disabled', !!$anyAll.attr('checked'));
-}