Skip to content

Commit 83289a4

Browse files
authored
More table refactoring (hestiacp#3602)
* Rename .table-header to .units-header * Tidy table class names
1 parent 750e36f commit 83289a4

34 files changed

+95
-95
lines changed

web/css/src/themes/dark.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ strong {
351351
color: #fff;
352352
}
353353

354-
.table-header {
354+
.units-header {
355355
background: #404040;
356356
border-left: 1px solid #212121;
357357
border-right: 1px solid #212121;

web/css/src/themes/default.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@
903903
}
904904
}
905905

906-
.table-header {
906+
.units-header {
907907
font-size: 0.8rem;
908908
background: linear-gradient(to bottom, rgb(247 247 247 / 100%) 0%, rgb(255 255 255 / 100%) 100%);
909909
background-color: #fff;

web/css/src/themes/flat.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ strong {
5757
background-color: #fff;
5858
}
5959

60-
.table-header {
60+
.units-header {
6161
box-shadow: none;
6262
background: #fafafa;
6363
}

web/css/src/themes/vestia.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ strong {
205205
}
206206
}
207207

208-
.table-header {
208+
.units-header {
209209
box-shadow: none;
210210
background: #fafafa;
211211
line-height: 1.2rem;

web/js/src/alpineInit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default function alpineInit() {
55
/** @param {SubmitEvent} evt */
66
'@submit'(evt) {
77
evt.preventDefault();
8-
document.querySelectorAll('.ch-toggle').forEach((el) => {
8+
document.querySelectorAll('.js-unit-checkbox').forEach((el) => {
99
if (el.checked) {
1010
const input = document.createElement('input');
1111
input.type = 'hidden';

web/js/src/listSelectAll.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Select all checkbox on list view pages
22
export default function handleListSelectAll() {
3-
const selectAllCheckbox = document.querySelector('.js-toggle-all');
3+
const selectAllCheckbox = document.querySelector('.js-toggle-all-checkbox');
44
if (selectAllCheckbox) {
55
selectAllCheckbox.addEventListener('change', toggleAll);
66
}
@@ -9,11 +9,11 @@ export default function handleListSelectAll() {
99
function toggleAll(evt) {
1010
const isChecked = evt.target.checked;
1111

12-
document.querySelectorAll('.ch-toggle').forEach((el) => {
12+
document.querySelectorAll('.js-unit-checkbox').forEach((el) => {
1313
el.checked = isChecked;
1414
});
1515

16-
document.querySelectorAll('.l-unit').forEach((el) => {
16+
document.querySelectorAll('.js-unit').forEach((el) => {
1717
el.classList.toggle('selected', isChecked);
1818
});
1919
}

web/js/src/listSorting.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default function handleListSorting() {
5656
faIcon.classList.add(span.classList.contains('up') ? 'fa-arrow-up-a-z' : 'fa-arrow-down-a-z');
5757

5858
// Sort units and reattach them to the DOM
59-
const units = Array.from(document.querySelectorAll('.js-sortable-unit')).sort((a, b) => {
59+
const units = Array.from(document.querySelectorAll('.js-unit')).sort((a, b) => {
6060
const aAttr = a.getAttribute(`data-${state.sort_par}`);
6161
const bAttr = b.getAttribute(`data-${state.sort_par}`);
6262

web/js/src/shortcuts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ export default function handleShortcuts() {
128128
.register(
129129
{ key: 'A', ctrlKey: true, shiftKey: true },
130130
(_evt) => {
131-
const checked = document.querySelector('.l-unit .ch-toggle:eq(0)').checked;
131+
const checked = document.querySelector('.js-unit-checkbox:eq(0)').checked;
132132
document
133133
.querySelectorAll('.l-unit')
134134
.forEach((el) => el.classList.toggle('selected'), !checked);
135-
document.querySelectorAll('.l-unit .ch-toggle').forEach((el) => (el.checked = !checked));
135+
document.querySelectorAll('.js-unit-checkbox').forEach((el) => (el.checked = !checked));
136136
},
137137
{ disabledInInput: true }
138138
)

web/templates/pages/list_access_keys.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343

4444

4545
<div class="container units">
46-
<div class="header table-header">
46+
<div class="header units-header">
4747
<div class="l-unit__col l-unit__col--right">
4848
<div>
4949
<div class="clearfix l-unit__stat-col--left super-compact">
50-
<input type="checkbox" class="js-toggle-all" title="<?= _("Select all") ?>">
50+
<input type="checkbox" class="js-toggle-all-checkbox" title="<?= _("Select all") ?>">
5151
</div>
5252
<div class="clearfix l-unit__stat-col--left wide-6"><b><?= _("Access Key") ?></b></div>
5353
<div class="clearfix l-unit__stat-col--left compact u-text-right"><b>&nbsp;</b></div>
@@ -69,14 +69,14 @@
6969
$key_date = !empty($value['DATE']) ? $value['DATE'] : '-';
7070
$key_time = !empty($value['TIME']) ? $value['TIME'] : '-';
7171
?>
72-
<div class="l-unit animate__animated animate__fadeIn js-sortable-unit"
72+
<div class="l-unit animate__animated animate__fadeIn js-unit"
7373
data-sort-key="<?=strtolower($key)?>"
7474
data-sort-comment="<?=strtolower($key_comment)?>"
7575
data-sort-date="<?=strtotime($data[$key]['DATE'] .' '. $data[$key]['TIME'] )?>">
7676

7777
<div class="l-unit__col l-unit__col--right">
7878
<div class="clearfix l-unit__stat-col--left super-compact">
79-
<input id="check<?= $i ?>" class="ch-toggle" type="checkbox" title="<?= _("Select") ?>" name="key[]" value="<?= $key ?>">
79+
<input id="check<?= $i ?>" class="js-unit-checkbox" type="checkbox" title="<?= _("Select") ?>" name="key[]" value="<?= $key ?>">
8080
</div>
8181
<div class="clearfix l-unit__stat-col--left wide-6">
8282
<b><a href="/list/access-key/?key=<?= htmlentities($key) ?>&token=<?= $_SESSION["token"] ?>" title="<?= _("Access Key") ?>: <?= $key ?>"><?= $key ?></a></b>

web/templates/pages/list_backup.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
<!-- End toolbar -->
3636

3737
<div class="container units">
38-
<div class="header table-header">
38+
<div class="header units-header">
3939
<div class="l-unit__col l-unit__col--right">
4040
<div>
4141
<div class="clearfix l-unit__stat-col--left super-compact">
42-
<input type="checkbox" class="js-toggle-all" title="<?= _("Select all") ?>" <?= $display_mode ?>>
42+
<input type="checkbox" class="js-toggle-all-checkbox" title="<?= _("Select all") ?>" <?= $display_mode ?>>
4343
</div>
4444
<div class="clearfix l-unit__stat-col--left wide-4"><b><?= _("File Name") ?></b></div>
4545
<div class="clearfix l-unit__stat-col--left compact-4 u-text-right"><b>&nbsp;</b></div>
@@ -73,7 +73,7 @@
7373
<div class="l-unit__col l-unit__col--right">
7474
<div>
7575
<div class="clearfix l-unit__stat-col--left super-compact">
76-
<input id="check<?= $i ?>" class="ch-toggle" type="checkbox" title="<?= _("Select") ?>" name="backup[]" value="<?= $key ?>" <?= $display_mode ?>>
76+
<input id="check<?= $i ?>" class="js-unit-checkbox" type="checkbox" title="<?= _("Select") ?>" name="backup[]" value="<?= $key ?>" <?= $display_mode ?>>
7777
</div>
7878
<div class="clearfix l-unit__stat-col--left wide-4 truncate">
7979
<b>

0 commit comments

Comments
 (0)