Browse Source

Returned outlines, added master checkbox for lists

Rafał Pitoń 11 years ago
parent
commit
ac150b3401

+ 0 - 1
misago/static/misago/admin/css/misago/buttons.less

@@ -22,7 +22,6 @@
     background: darken(@btn-bg, 15%);
     background: darken(@btn-bg, 15%);
     border-color: darken(@btn-bg, 15%);
     border-color: darken(@btn-bg, 15%);
     box-shadow: none;
     box-shadow: none;
-    outline: none;
     position: relative;
     position: relative;
     top: 2px;
     top: 2px;
 
 

+ 19 - 0
misago/static/misago/admin/css/misago/tables.less

@@ -18,6 +18,25 @@
   &>.pull-right {
   &>.pull-right {
     margin-left: @line-height-computed / 2;
     margin-left: @line-height-computed / 2;
 
 
+    &.master-checkbox {
+      background: none;
+      border-color: transparent;
+      .box-shadow(none);
+      padding: 0px 6px;
+
+      color: @gray-light;
+      font-size: 24px;
+      line-height: 32px;
+
+      &.active, &:active {
+        top: 0px;
+      }
+
+      &.active {
+        color: @brand-success;
+      }
+    }
+
     .dropdown-menu {
     .dropdown-menu {
       left: auto;
       left: auto;
       right: 0px;
       right: 0px;

+ 17 - 6
misago/static/misago/admin/css/style.css

@@ -5817,7 +5817,6 @@ body {
   background: #c7c7c7;
   background: #c7c7c7;
   border-color: #c7c7c7;
   border-color: #c7c7c7;
   box-shadow: none;
   box-shadow: none;
-  outline: none;
   position: relative;
   position: relative;
   top: 2px;
   top: 2px;
   color: #5e5e5e;
   color: #5e5e5e;
@@ -5844,7 +5843,6 @@ body {
   background: #1d6fa5;
   background: #1d6fa5;
   border-color: #1d6fa5;
   border-color: #1d6fa5;
   box-shadow: none;
   box-shadow: none;
-  outline: none;
   position: relative;
   position: relative;
   top: 2px;
   top: 2px;
   color: #e6e6e6;
   color: #e6e6e6;
@@ -5871,7 +5869,6 @@ body {
   background: #28a1c5;
   background: #28a1c5;
   border-color: #28a1c5;
   border-color: #28a1c5;
   box-shadow: none;
   box-shadow: none;
-  outline: none;
   position: relative;
   position: relative;
   top: 2px;
   top: 2px;
   color: #e6e6e6;
   color: #e6e6e6;
@@ -5898,7 +5895,6 @@ body {
   background: #208e4e;
   background: #208e4e;
   border-color: #208e4e;
   border-color: #208e4e;
   box-shadow: none;
   box-shadow: none;
-  outline: none;
   position: relative;
   position: relative;
   top: 2px;
   top: 2px;
   color: #e6e6e6;
   color: #e6e6e6;
@@ -5925,7 +5921,6 @@ body {
   background: #df8a13;
   background: #df8a13;
   border-color: #df8a13;
   border-color: #df8a13;
   box-shadow: none;
   box-shadow: none;
-  outline: none;
   position: relative;
   position: relative;
   top: 2px;
   top: 2px;
   color: #e6e6e6;
   color: #e6e6e6;
@@ -5952,7 +5947,6 @@ body {
   background: #bf2718;
   background: #bf2718;
   border-color: #bf2718;
   border-color: #bf2718;
   box-shadow: none;
   box-shadow: none;
-  outline: none;
   position: relative;
   position: relative;
   top: 2px;
   top: 2px;
   color: #e6e6e6;
   color: #e6e6e6;
@@ -6172,6 +6166,23 @@ body {
 .table-actions > .pull-right {
 .table-actions > .pull-right {
   margin-left: 10px;
   margin-left: 10px;
 }
 }
+.table-actions > .pull-right.master-checkbox {
+  background: none;
+  border-color: transparent;
+  -webkit-box-shadow: none;
+  box-shadow: none;
+  padding: 0px 6px;
+  color: #999999;
+  font-size: 24px;
+  line-height: 32px;
+}
+.table-actions > .pull-right.master-checkbox.active,
+.table-actions > .pull-right.master-checkbox:active {
+  top: 0px;
+}
+.table-actions > .pull-right.master-checkbox.active {
+  color: #2ecc71;
+}
 .table-actions > .pull-right .dropdown-menu {
 .table-actions > .pull-right .dropdown-menu {
   left: auto;
   left: auto;
   right: 0px;
   right: 0px;

+ 57 - 6
misago/static/misago/admin/js/misago-tables.js

@@ -1,8 +1,14 @@
 // Mass-action tables
 // Mass-action tables
 function tableMassActions(label_none, label_selected) {
 function tableMassActions(label_none, label_selected) {
   var $controller = $('.mass-controller');
   var $controller = $('.mass-controller');
+  var $master = $('.master-checkbox');
   var $form = $controller.parents('form');
   var $form = $controller.parents('form');
 
 
+  var items_num = $('.table tr input[type=checkbox]').length;
+  if (items_num == 0) {
+    $master.prop("disabled", true);
+  }
+
   $form.find('.dropdown-menu button').click(function() {
   $form.find('.dropdown-menu button').click(function() {
     if ($(this).data('confirmation')) {
     if ($(this).data('confirmation')) {
       var confirmation = confirm($(this).data('confirmation'));
       var confirmation = confirm($(this).data('confirmation'));
@@ -52,21 +58,66 @@ function tableMassActions(label_none, label_selected) {
         $row.removeClass('active');
         $row.removeClass('active');
       }
       }
 
 
-      var selected_no = $('.table tr.active').length
+      var selected_no = $('.table tr.active').length;
       if (selected_no > 0) {
       if (selected_no > 0) {
         enableController(selected_no);
         enableController(selected_no);
       } else {
       } else {
         disableController();
         disableController();
       }
       }
+
+      if (items_num == selected_no) {
+        $master.addClass('active');
+      } else {
+        $master.removeClass('active');
+      }
+
       return false;
       return false;
     });
     });
+  });
+
+  var selected_no = $('.table tr.active').length;
+  if (selected_no > 0) {
+    enableController(selected_no);
+  } else {
+    $controller.html('<span class="fa fa-exclamation-circle"></span> ' + label_none);
+    $controller.prop("disabled", true);
+  }
 
 
-    var selected_no = $('.table tr.active').length
-    if (selected_no > 0) {
-      enableController(selected_no);
+  if (items_num == selected_no) {
+    $master.addClass('active');
+  } else {
+    $master.removeClass('active');
+  }
+
+  $master.click(function() {
+    if ($master.hasClass('active')) {
+      $master.removeClass('active');
+      if (items_num > 0) {
+        disableController();
+        $('.table tr input[type=checkbox]').each(function() {
+          var $row = $(this).parents('tr');
+          var $checkbox = $row.find('input[type=checkbox]');
+          var $check = $checkbox.parent().parent().find('a');
+
+          $checkbox.prop("checked", false);
+          $row.removeClass('active');
+          $check.removeClass('active');
+        });
+      }
     } else {
     } else {
-      $controller.html('<span class="fa fa-exclamation-circle"></span> ' + label_none);
-      $controller.prop("disabled", true);
+      $master.addClass('active');
+      if (items_num > 0) {
+        enableController(items_num);
+        $('.table tr input[type=checkbox]').each(function() {
+          var $row = $(this).parents('tr');
+          var $checkbox = $row.find('input[type=checkbox]');
+          var $check = $checkbox.parent().parent().find('a');
+
+          $checkbox.prop("checked", true);
+          $row.addClass('active');
+          $check.addClass('active');
+        });
+      }
     }
     }
   });
   });
 }
 }

+ 0 - 1
misago/static/misago/css/misago/buttons.less

@@ -21,7 +21,6 @@
     background: darken(@btn-bg, 15%);
     background: darken(@btn-bg, 15%);
     border-color: darken(@btn-bg, 15%);
     border-color: darken(@btn-bg, 15%);
     box-shadow: none;
     box-shadow: none;
-    outline: none;
     position: relative;
     position: relative;
     top: 2px;
     top: 2px;
 
 

+ 12 - 9
misago/templates/misago/admin/generic/list.html

@@ -44,15 +44,15 @@
   {% endif %}
   {% endif %}
 
 
   {% if search_form %}
   {% if search_form %}
-  <button class="btn btn-{% if active_filters %}success{% else %}default{% endif %} pull-left" data-toggle="modal" data-target="#filter-modal">
-    {% if active_filters %}
-    <span class="fa fa-check"></span>
-    {% trans "Change search" %}
-    {% else %}
-    <span class="fa fa-search"></span>
-    {% trans "Search list" %}
-    {% endif %}
-  </button>
+    <button class="btn btn-{% if active_filters %}success{% else %}default{% endif %} pull-left" data-toggle="modal" data-target="#filter-modal">
+      {% if active_filters %}
+      <span class="fa fa-check"></span>
+      {% trans "Change search" %}
+      {% else %}
+      <span class="fa fa-search"></span>
+      {% trans "Search list" %}
+      {% endif %}
+    </button>
 
 
     {% if active_filters %}
     {% if active_filters %}
     <form method="get" class="pull-left">
     <form method="get" class="pull-left">
@@ -69,6 +69,9 @@
   {% endif %}
   {% endif %}
 
 
   {% if mass_actions %}
   {% if mass_actions %}
+  <button type="button" class="btn btn-default pull-right master-checkbox">
+    <span class="fa fa-check"></span>
+  </button>
   <div class="btn-group pull-right">
   <div class="btn-group pull-right">
     <form id="mass-action" action="{{ querystring }}" method="post">
     <form id="mass-action" action="{{ querystring }}" method="post">
       <button type="button" class="btn btn-default dropdown-toggle mass-controller" data-toggle="dropdown">
       <button type="button" class="btn btn-default dropdown-toggle mass-controller" data-toggle="dropdown">