chore(web): HTML::navListGroup

This commit is contained in:
Baoshuo Ren 2022-10-21 11:38:19 +08:00
parent aeab23cc9a
commit 92626c1193
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
3 changed files with 11 additions and 20 deletions

View File

@ -610,16 +610,7 @@ EOD);
<!-- left col --> <!-- left col -->
<div class="col-md-3"> <div class="col-md-3">
<div class="list-group"> <?= HTML::navListGroup($tabs_info, $cur_tab) ?>
<?php foreach ($tabs_info as $id => $tab): ?>
<a
role="button"
class="list-group-item list-group-item-action <?= $cur_tab == $id ? 'active' : '' ?>"
href="<?= $tab['url'] ?>">
<?= $tab['name'] ?>
</a>
<?php endforeach ?>
</div>
</div> </div>
<!-- end left col --> <!-- end left col -->

View File

@ -277,16 +277,7 @@ EOD);
<!-- left col --> <!-- left col -->
<div class="col-md-3"> <div class="col-md-3">
<div class="list-group"> <?= HTML::navListGroup($tabs_info, $cur_tab) ?>
<?php foreach ($tabs_info as $id => $tab): ?>
<a
role="button"
class="list-group-item list-group-item-action <?= $cur_tab == $id ? 'active' : '' ?>"
href="<?= $tab['url'] ?>">
<?= $tab['name'] ?>
</a>
<?php endforeach ?>
</div>
<a <a
class="btn btn-light d-block mt-2 w-100 text-start text-primary" class="btn btn-light d-block mt-2 w-100 text-start text-primary"

View File

@ -33,6 +33,15 @@ class HTML {
$html .= '</ul>'; $html .= '</ul>';
return $html; return $html;
} }
public static function navListGroup($tabs_info, $cur) {
$html = '<div class="list-group">';
foreach ($tabs_info as $id => $tab) {
$html .= '<a role="button" class="list-group-item list-group-item-action'.($cur == $id ? ' active' : '').'" href="'.$tab['url'].'">'.$tab['name'].'</a>';
}
$html .= '</div>';
return $html;
}
public static function hiddenToken() { public static function hiddenToken() {
return '<input type="hidden" name="_token" value="'.crsf_token().'" />'; return '<input type="hidden" name="_token" value="'.crsf_token().'" />';