Skip to content

Commit

Permalink
Fix layout on small screens (Group Mgmt tables) (pi-hole#2078)
Browse files Browse the repository at this point in the history
Signed-off-by: rdwebdesign <[email protected]>
  • Loading branch information
rdwebdesign authored Jan 14, 2022
1 parent 1f0ed95 commit 035d8f9
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 8 deletions.
2 changes: 1 addition & 1 deletion groups-adlists.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<th>Status</th>
<th>Comment</th>
<th>Group assignment</th>
<th>Action</th>
<th>&nbsp;</th>
</tr>
</thead>
</table>
Expand Down
2 changes: 1 addition & 1 deletion groups-clients.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<th title="Acceptable values are: IP address, subnet (CIDR notation), MAC address (AA:BB:CC:DD:EE:FF format) or host names.">Client</th>
<th>Comment</th>
<th>Group assignment</th>
<th>Action</th>
<th>&nbsp;</th>
</tr>
</thead>
</table>
Expand Down
2 changes: 1 addition & 1 deletion groups-domains.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<th>Status</th>
<th>Comment</th>
<th>Group assignment</th>
<th>Action</th>
<th>&nbsp;</th>
</tr>
</thead>
</table>
Expand Down
2 changes: 1 addition & 1 deletion groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<th>Name</th>
<th>Status</th>
<th>Description</th>
<th>Action</th>
<th>&nbsp;</th>
</tr>
</thead>
</table>
Expand Down
2 changes: 1 addition & 1 deletion scripts/pi-hole/js/groups-adlists.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function initTable() {
{ data: "enabled", searchable: false },
{ data: "comment" },
{ data: "groups", searchable: false },
{ data: null, width: "80px", orderable: false },
{ data: null, width: "22px", orderable: false },
],
columnDefs: [
{
Expand Down
2 changes: 1 addition & 1 deletion scripts/pi-hole/js/groups-clients.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function initTable() {
{ data: "ip", type: "ip-address" },
{ data: "comment" },
{ data: "groups", searchable: false },
{ data: "name", width: "80px", orderable: false },
{ data: "name", width: "22px", orderable: false },
],
columnDefs: [
{
Expand Down
2 changes: 1 addition & 1 deletion scripts/pi-hole/js/groups-domains.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function initTable() {
{ data: "enabled", searchable: false },
{ data: "comment" },
{ data: "groups", searchable: false, visible: showtype === "all" },
{ data: null, width: "80px", orderable: false },
{ data: null, width: "22px", orderable: false },
],
columnDefs: [
{
Expand Down
2 changes: 1 addition & 1 deletion scripts/pi-hole/js/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $(function () {
{ data: "name" },
{ data: "enabled", searchable: false },
{ data: "description" },
{ data: null, width: "60px", orderable: false },
{ data: null, width: "22px", orderable: false },
],
columnDefs: [
{
Expand Down
79 changes: 79 additions & 0 deletions style/pi-hole.css
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,85 @@ td.details-control {
animation: icon-bounce 1.5s 2 linear;
}

/* Fix some datatables layout on small screens */
@media screen and (max-width: 660px), screen and (min-width: 767px) and (max-width: 960px) {
#domainsTable_wrapper .table-responsive {
border: none;
overflow: unset;
}
#domainsTable {
border: 0;
box-sizing: border-box;
}
#domainsTable thead {
display: none;
}
#domainsTable tr {
display: flex;
padding: 15px 0;
flex-wrap: wrap;
box-sizing: border-box;
align-items: end;
border: 1px solid rgba(127, 127, 127, 0.4);
margin: 10px 0;
border-radius: 6px;
}
#domainsTable td {
flex: 1 1 auto;
width: 100px;
display: block;
border: none;
box-sizing: border-box;
order: 2;
text-align: right;
padding: 4px 8px;
}
#domainsTable td:nth-child(2n) {
width: calc(100% - 120px);
}
#domainsTable td:first-child {
width: calc(100% - 40px);
order: 1;
text-align: left;
padding-bottom: 10px;
border-bottom: 1px solid rgba(127, 127, 127, 0.25);
margin-bottom: 5px;
}
#domainsTable td:last-child {
width: 40px;
order: 1;
padding-bottom: 10px;
border-bottom: 1px solid rgba(127, 127, 127, 0.25);
margin-bottom: 5px;
}
#domainsTable td:nth-child(2),
#domainsTable td:nth-child(4) {
text-align: left;
}
#domainsTable td::before {
display: block;
font-weight: bold;
font-size: smaller;
}
#domainsTable td:nth-child(2)::before {
content: "Type:";
}
#domainsTable td:nth-child(4)::before {
content: "Comment:";
}
}
@media screen and (min-width: 767px) {
#domainsTable select.form-control {
padding: 0 0 0 5px;
width: auto;
}
}
@media screen and (max-width: 767px) {
#domainsTable th {
white-space: normal;
}
}

@keyframes icon-bounce {
0%,
20%,
Expand Down
10 changes: 10 additions & 0 deletions style/themes/lcars.css
Original file line number Diff line number Diff line change
Expand Up @@ -1670,6 +1670,16 @@ table.dataTable {
}
}

/*** Fix some datatables layout on small screens ***/
@media screen and (max-width: 660px), screen and (min-width: 767px) and (max-width: 960px) {
#domainsTable td::before {
margin: 0 5px 2px;
}
#domainsTable td:nth-child(2n) {
width: calc(100% - 160px);
}
}

/*** Used by the long-term pages ***/
.daterangepicker {
background-color: #345;
Expand Down

0 comments on commit 035d8f9

Please sign in to comment.