Browse Source

Only display "select all" button if there are two or more items

Jeremy Stretch 8 years ago
parent
commit
c1b6da771f

+ 4 - 4
netbox/templates/dcim/device.html

@@ -335,7 +335,7 @@
                 <div class="panel-heading">
                     <strong>Device Bays</strong>
                     <div class="pull-right">
-                        {% if perms.dcim.change_devicebay %}
+                        {% if perms.dcim.change_devicebay and device_bays|length > 1 %}
                             <button class="btn btn-default btn-xs toggle">
                                 <span class="glyphicon glyphicon-unchecked" aria-hidden="true"></span> Select all
                             </button>
@@ -387,7 +387,7 @@
                 <div class="panel-heading">
                     <strong>Interfaces</strong>
                     <div class="pull-right">
-                        {% if perms.dcim.change_interface %}
+                        {% if perms.dcim.change_interface and interfaces|length > 1 %}
                             <button class="btn btn-default btn-xs toggle">
                                 <span class="glyphicon glyphicon-unchecked" aria-hidden="true"></span> Select all
                             </button>
@@ -444,7 +444,7 @@
                 <div class="panel-heading">
                     <strong>Console Server Ports</strong>
                     <div class="pull-right">
-                        {% if perms.dcim.change_consoleserverport %}
+                        {% if perms.dcim.change_consoleserverport and cs_ports|length > 1 %}
                             <button class="btn btn-default btn-xs toggle">
                                 <span class="glyphicon glyphicon-unchecked" aria-hidden="true"></span> Select all
                             </button>
@@ -496,7 +496,7 @@
                 <div class="panel-heading">
                     <strong>Power Outlets</strong>
                     <div class="pull-right">
-                        {% if perms.dcim.change_poweroutlet %}
+                        {% if perms.dcim.change_poweroutlet and cs_ports|length > 1 %}
                             <button class="btn btn-default btn-xs toggle">
                                 <span class="glyphicon glyphicon-unchecked" aria-hidden="true"></span> Select all
                             </button>

+ 1 - 1
netbox/templates/dcim/inc/devicetype_component_table.html

@@ -6,7 +6,7 @@
             <div class="panel-heading">
                 <strong>{{ title }}</strong>
                 <div class="pull-right">
-                    {% if table.rows|length > 3 %}
+                    {% if table.rows|length > 1 %}
                         <button class="btn btn-default btn-xs toggle">
                             <span class="glyphicon glyphicon-unchecked" aria-hidden="true"></span> Select all
                         </button>