Skip to content

Commit fe985ed

Browse files
authored
Refactoring (hestiacp#3158)
1 parent a17d853 commit fe985ed

23 files changed

+138
-156
lines changed

.editorconfig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ max_line_length = 100
1515
[*.md]
1616
trim_trailing_whitespace = false
1717

18-
# YAML forbids using tabs.
18+
# YAML forbids using tabs
1919
# See https://yaml.org/faq.html
2020
[*.{yml,yaml}]
2121
indent_size = 2
2222
indent_style = space
23+
24+
# Views have longer line length for now
25+
[web/templates/**/*.php]
26+
max_line_length = 200

web/css/src/themes/dark.css

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515

1616
/* Alerts */
1717
--alert-danger-color: #d13535;
18+
19+
/* Icons */
20+
--icon-color-purple: #c364ff;
21+
--icon-color-maroon: #ff3478;
22+
--icon-color-green: #37cf39;
23+
--icon-color-blue: #0092f4;
1824
}
1925

2026
b,
@@ -753,38 +759,6 @@ form#vstobjects.suspended {
753759
/* Icon component
754760
========================================================================== */
755761

756-
.icon-purple {
757-
color: #c364ff;
758-
759-
&:hover {
760-
color: #c364ff;
761-
}
762-
}
763-
764-
.icon-maroon {
765-
color: #ff3478;
766-
767-
&:hover {
768-
color: #ff3478;
769-
}
770-
}
771-
772-
.icon-green {
773-
color: #37cf39;
774-
775-
&:hover {
776-
color: #37cf39;
777-
}
778-
}
779-
780-
.icon-blue {
781-
color: #0092f4;
782-
783-
&:hover {
784-
color: #0092f4;
785-
}
786-
}
787-
788762
.icon-highlight {
789763
color: #dadada;
790764

@@ -800,7 +774,6 @@ form#vstobjects.suspended {
800774

801775
.l-unit--suspended .icon-dim {
802776
color: #808080;
803-
text-shadow: 0;
804777
}
805778

806779
/* Modals

web/css/src/themes/default.css

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@
2525
--alert-info-color: #618ecc;
2626
--alert-danger-color: #ec6c6c;
2727
--alert-success-color: #5ea64c;
28+
29+
/* Icons */
30+
--icon-color-teal: #3cc;
31+
--icon-color-purple: #8e2fca;
32+
--icon-color-maroon: #c36;
33+
--icon-color-red: #f33;
34+
--icon-color-green: #53ba55;
35+
--icon-color-orange: #ffc043;
36+
--icon-color-blue: #326b9b;
37+
--icon-color-lightblue: #6eb6f0;
2838
}
2939

3040
.check-label {
@@ -1202,10 +1212,6 @@
12021212
}
12031213

12041214
.body-stats .l-unit__stat-col--left {
1205-
width: 130px;
1206-
}
1207-
1208-
.l-unit__stat-col.l-unit__stat-col--left.icon-pad-right {
12091215
width: 180px;
12101216
}
12111217

@@ -1376,10 +1382,6 @@
13761382
display: inline-block;
13771383
}
13781384

1379-
.icon-pad-right {
1380-
margin-right: 6px;
1381-
}
1382-
13831385
.l-unit__stat-cols {
13841386
padding-right: 10px;
13851387
}
@@ -2349,66 +2351,66 @@ form#vstobjects.suspended {
23492351
}
23502352

23512353
.icon-teal {
2352-
color: #3cc;
2354+
color: var(--icon-color-teal);
23532355

23542356
&:hover {
2355-
color: #3cc;
2357+
color: var(--icon-color-teal);
23562358
}
23572359
}
23582360

23592361
.icon-purple {
2360-
color: #8e2fca;
2362+
color: var(--icon-color-purple);
23612363

23622364
&:hover {
2363-
color: #8e2fca;
2365+
color: var(--icon-color-purple);
23642366
}
23652367
}
23662368

23672369
.icon-maroon {
2368-
color: #c36;
2370+
color: var(--icon-color-maroon);
23692371

23702372
&:hover {
2371-
color: #c36;
2373+
color: var(--icon-color-maroon);
23722374
}
23732375
}
23742376

23752377
.icon-red {
2376-
color: #f33;
2378+
color: var(--icon-color-red);
23772379

23782380
&:hover {
2379-
color: #f33;
2381+
color: var(--icon-color-red);
23802382
}
23812383
}
23822384

23832385
.icon-green {
2384-
color: #53ba55;
2386+
color: var(--icon-color-green);
23852387

23862388
&:hover {
2387-
color: #53ba55;
2389+
color: var(--icon-color-green);
23882390
}
23892391
}
23902392

23912393
.icon-orange {
2392-
color: #ffc043;
2394+
color: var(--icon-color-orange);
23932395

23942396
&:hover {
2395-
color: #ffc043;
2397+
color: var(--icon-color-orange);
23962398
}
23972399
}
23982400

2399-
.icon-lightblue {
2400-
color: #6eb6f0;
2401+
.icon-blue {
2402+
color: var(--icon-color-blue);
24012403

24022404
&:hover {
2403-
color: #6eb6f0;
2405+
color: var(--icon-color-blue);
24042406
}
24052407
}
24062408

2407-
.icon-blue {
2408-
color: #326b9b;
2409+
.icon-lightblue {
2410+
color: var(--icon-color-lightblue);
24092411

24102412
&:hover {
2411-
color: #326b9b;
2413+
color: var(--icon-color-lightblue);
24122414
}
24132415
}
24142416

@@ -2427,7 +2429,6 @@ form#vstobjects.suspended {
24272429

24282430
.l-unit--suspended .icon-dim {
24292431
color: #c0c0c0;
2430-
text-shadow: 0;
24312432
}
24322433

24332434
.cron-helper-container {

web/css/src/utilities.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@
6969
margin-left: 10px !important;
7070
}
7171

72+
.u-mr5 {
73+
margin-right: 5px !important;
74+
}
75+
7276
.u-mr10 {
7377
margin-right: 10px !important;
7478
}

web/css/themes/dark.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/css/themes/default.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/templates/includes/js.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,14 @@
4141
})
4242
</script>
4343

44-
<?php foreach (new DirectoryIterator($_SERVER["HESTIA"] . "/web/js/custom_scripts") as $customScript) {
45-
if ($customScript->getExtension() === "js") {
46-
echo '<script defer src="/js/custom_scripts/' . rawurlencode($customScript->getBasename()) . '"></script>';
47-
} elseif ($customScript->getExtension() === "php") {
44+
<?php
45+
$customScriptDirectory = new DirectoryIterator($_SERVER["HESTIA"] . "/web/js/custom_scripts");
46+
foreach ($customScriptDirectory as $customScript) {
47+
$extension = $customScript->getExtension();
48+
if ($extension === "js") {
49+
$customScriptPath = "/js/custom_scripts/" . rawurlencode($customScript->getBasename());
50+
echo '<script defer src="' . $customScriptPath . '"></script>';
51+
} elseif ($extension === "php") {
4852
require_once $customScript->getPathname();
4953
}
5054
} ?>

web/templates/pages/add_package.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,15 @@ class="fas icon-dim icon-maroon js-section-toggle-icon"
295295
<div class="u-mb10">
296296
<label for="v_shell" class="form-label"><?= _("SSH Access") ?></label>
297297
<select class="form-select" name="v_shell" id="v_shell">
298-
<?php
299-
foreach ($shells as $key => $value) {
300-
echo "\t\t\t\t<option value=\"".htmlentities($value)."\"";
301-
if ((!empty($v_shell)) && ( $value == trim($v_shell,"''"))){
302-
echo ' selected' ;
303-
}
304-
echo ">".htmlentities($value)."</option>\n";
305-
}
306-
?>
298+
<?php foreach ($shells as $key => $value): ?>
299+
<option value="<?= htmlentities($value) ?>"
300+
<?php if ((!empty($v_shell)) && ($value == trim($v_shell,"''"))): ?>
301+
selected
302+
<?php endif; ?>
303+
>
304+
<?= htmlentities($value) ?>
305+
</option>
306+
<?php endforeach; ?>
307307
</select>
308308
</div>
309309
</div>

web/templates/pages/edit_package.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,15 @@ class="fas icon-dim icon-maroon js-section-toggle-icon"
299299
<div class="u-mb10">
300300
<label for="v_shell" class="form-label"><?= _("SSH Access") ?></label>
301301
<select class="form-select" name="v_shell" id="v_shell">
302-
<?php
303-
foreach ($shells as $key => $value) {
304-
echo "\t\t\t\t<option value=\"".htmlentities($value)."\"";
305-
if ((!empty($v_shell)) && ( $value == trim($v_shell, "'"))){
306-
echo ' selected' ;
307-
}
308-
echo ">".htmlentities($value)."</option>\n";
309-
}
310-
?>
302+
<?php foreach ($shells as $key => $value): ?>
303+
<option value="<?= htmlentities($value) ?>"
304+
<?php if ((!empty($v_shell)) && ($value == trim($v_shell,"''"))): ?>
305+
selected
306+
<?php endif; ?>
307+
>
308+
<?= htmlentities($value) ?>
309+
</option>
310+
<?php endforeach; ?>
311311
</select>
312312
</div>
313313
</div>

web/templates/pages/list_backup_detail.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<div class="actions-panel clearfix">
6868
<div class="actions-panel__col actions-panel__list shortcut-enter" key-action="href">
6969
<a href="/schedule/restore/?backup=<?=$backup?>&type=web&object=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?= _("Restore") ?>">
70-
<i class="fas fa-arrow-rotate-left icon-green icon-dim icon-pad-right"></i>
70+
<i class="fas fa-arrow-rotate-left icon-green icon-dim u-mr5"></i>
7171
</a>
7272
</div>
7373
</div>

0 commit comments

Comments
 (0)