Просмотр исходного кода

Fix toggle-all checkbox consistency

Robert Zollner 6 лет назад
Родитель
Сommit
01e0bd7b24
1 измененных файлов с 5 добавлено и 6 удалено
  1. 5 6
      web/js/app.js

+ 5 - 6
web/js/app.js

@@ -1045,15 +1045,14 @@ hover_menu = function() {
 
 
 function checkedAll(frmname) {
-    if ($('.l-unit.selected:not(.header)').length > 0 || !$('.l-unit').length ) {
-        $('.l-unit:not(.header)').removeClass("selected");
-        $('.ch-toggle').prop("checked", false);
-        $('.toggle-all').removeClass('clicked-on');
-    }
-    else {
+    if($('input#toggle-all').prop('checked')){
         $('.l-unit:not(.header)').addClass("selected");
         $('.ch-toggle').prop("checked", true);
         $('.toggle-all').addClass('clicked-on');
+    } else {
+        $('.l-unit:not(.header)').removeClass("selected");
+        $('.ch-toggle').prop("checked", false);
+        $('.toggle-all').removeClass('clicked-on');
     }
 }