Make colors configurable for navbar and badges

This commit is contained in:
ruan 2018-07-08 11:18:29 +02:00
parent d7c3b8ae83
commit 21b774a33a
No known key found for this signature in database
GPG Key ID: 0D2EC1C52E469C0B
4 changed files with 18 additions and 8 deletions

View File

@ -169,6 +169,7 @@ try {
$all = $trim;
}
usort($all, array("History", "cmp_row_date_desc"));
$bc = $page->settings->info_badge_classes;
if (!empty($all)) {
$page->table_begin();
@ -193,7 +194,7 @@ try {
$label_type = $page->type;
$label_name = Info::create($row, $page, $label_type)->name(); //ucfirst($label_type);
$label = "<span class='badge litebans-label-history litebans-label-$label_type'>$label_name</span>";
$label = "<span class='$bc litebans-label-history litebans-label-$label_type'>$label_name</span>";
$page->print_table_rows($row, array(
"type" => $label,

View File

@ -43,7 +43,7 @@ function navbar($links) {
$li .= " class=\"$class\"";
if ($this->page->settings->header_show_totals && isset($this->count[$page])) {
$title .= " <span class=\"badge-pill badge-secondary\">";
$title .= ' <span class="' . $this->page->settings->badge_classes . '">';
$title .= $this->count[$page];
$title .= "</span>";
}
@ -79,7 +79,7 @@ $settings = $this->page->settings;
<header role="banner">
<div class="navbar navbar-expand-lg fixed-top navbar-dark bg-primary">
<div class="navbar navbar-expand-lg fixed-top <?php echo $settings->navbar_classes; ?>">
<div class="container">
<a class="navbar-brand" href="<?php echo $settings->name_link; ?>">
<?php echo $settings->name; ?>

View File

@ -29,6 +29,14 @@ final class Settings {
// $this->name_link = 'https://example.com';
$this->name_link = 'index.php';
// Here you can customize colors for the Bootstrap 4 theme that you are using.
// Bootstrap 4 themes have four sets of colors: primary, secondary, light and dark.
// Navbar classes: navbar-light, navbar-dark, bg-primary, bg-secondary, bg-light, bg-dark
// Badge (label) classes: badge, badge-pill, badge-primary, badge-secondary, badge-light, badge-dark
$this->navbar_classes = 'navbar-dark bg-primary';
$this->badge_classes = 'badge-pill badge-secondary';
$this->info_badge_classes = 'badge';
// Show server scope column?
$this->show_server_scope = true;

View File

@ -151,6 +151,7 @@ if ($st->execute(array($id))) {
$header = $page->name;
$badges = "";
$bc = $page->settings->info_badge_classes;
if (!($info instanceof KickInfo)) {
$active = $page->active($row);
@ -163,19 +164,19 @@ if ($st->execute(array($id))) {
$idx = "generic.ipmute";
}
if ($idx !== null) {
$badges .= "<span class='badge litebans-label-info litebans-label-ipban'>" . $page->t($idx) . "</span>";
$badges .= "<span class='$bc litebans-label-info litebans-label-ipban'>" . $page->t($idx) . "</span>";
}
}
if ($active === true) {
$badges .= "<span class='badge litebans-label-info litebans-label-active'>" . $page->t("generic.active") . "</span>";
$badges .= "<span class='$bc litebans-label-info litebans-label-active'>" . $page->t("generic.active") . "</span>";
if ($permanent) {
$badges .= "<span class='badge litebans-label-info litebans-label-permanent'>" . $page->t("generic.permanent") . "</span>";
$badges .= "<span class='$bc litebans-label-info litebans-label-permanent'>" . $page->t("generic.permanent") . "</span>";
}
} else {
if ($page->is_expired($row)) {
$badges .= "<span class='badge litebans-label-info litebans-label-expired'>" . $page->t("generic.expired") . "</span>";
$badges .= "<span class='$bc litebans-label-info litebans-label-expired'>" . $page->t("generic.expired") . "</span>";
} else {
$badges .= "<span class='badge litebans-label-info litebans-label-inactive'>" . $page->t("generic.inactive") . "</span>";
$badges .= "<span class='$bc litebans-label-info litebans-label-inactive'>" . $page->t("generic.inactive") . "</span>";
}
}
}