aceberg/miniboard

View on GitHub
internal/web/templates/header.html

Summary

Maintainability
Test Coverage
{{ define "header"}}

<!DOCTYPE html>
<html lang="en" data-bs-theme="{{ .Config.Color }}">
<head>
    <title>MiniBoard - {{ .CurrentTab }}</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!--Favicon-->
    <link href="data:image/x-icon;base64, {{ .Config.Icon }}" rel="icon" type="image/x-icon" />
    {{ if eq .Config.NodePath "" }}
    <!-- Font for icons -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
    <!-- Bootstrap and theme -->
    <link href="https://cdn.jsdelivr.net/npm/bootswatch@5.3.0/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
    <!-- JavaScript Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js"></script>
    {{ else }} <!-- Local node_modules -->
    <link rel="stylesheet" href="{{ .Config.NodePath }}/node_modules/bootstrap-icons/font/bootstrap-icons.css">
    <link href="{{ .Config.NodePath }}/node_modules/bootswatch/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
    <script src="{{ .Config.NodePath }}/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    {{ end }}
</head>
<style>
  .my-btn-width {
      width: {{ .Config.BtnWidth }} !important;
  }
  .my-col-on {
      color:{{ .Config.ColorOn }};
  }
  .my-col-off {
      color:{{ .Config.ColorOff }};
  }
  .monospace-font {
      font-family: monospace;
  }
</style>
<body>
    <nav class="navbar navbar-expand-sm navbar-dark bg-primary">
    <div class="container">
        <ul class="navbar-nav">
            &nbsp;&nbsp;
            <li class="nav-item">
                <a class="nav-link active" href="/">
                    <img src="data:image/png;base64, {{ .Config.Icon }}" width="30"/>
                </a>
            </li>
            &nbsp;&nbsp;
            <li class="nav-item dropdown">
                <a class="nav-link active dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                    <i class="bi bi-list"></i>
                </a>
                <ul class="dropdown-menu">
                    {{ if .Config.LoggedIn }}
                    <li><a class="dropdown-item" href="/login/?logout=yes">Log Out</a></li>
                    <li><hr class="dropdown-divider"></li>
                    {{ end }}
                    <li><a class="dropdown-item" href="/config/">Config</a></li>
                    <li><hr class="dropdown-divider"></li>
                    <li><a class="dropdown-item" href="/auth_conf/">Edit auth</a></li>
                    <li><a class="dropdown-item" href="/panels/">Edit panels</a></li>
                    <li><a class="dropdown-item" href="/tabs/">Edit tabs</a></li>
                    <li><a class="dropdown-item" href="/uptime_edit/">Edit uptime</a></li>
                    <li><hr class="dropdown-divider"></li>
                    <li><a class="dropdown-item" href="/file/">Edit board file</a></li>
                    <li><a class="dropdown-item" href="/reload/">Reload</a></li>
                    <li><hr class="dropdown-divider"></li>
                    <li><a class="dropdown-item" target="_blank" href="https://github.com/aceberg/miniboard">About</a></li>
                </ul>
            </li>
            {{ range $key, $value := .Links.Tabs }}
            <li class="nav-item">
                <a class="nav-link active" href="/?tab={{ $key }}">{{ .Name }}</a>
            </li>
            {{ end }}
        </ul>
        {{ if .Links.Uptime.Enabled }}
        <ul class="nav navbar-nav navbar-right">
            <li class="nav-item">
                <a class="nav-link active" href="/uptime/">Uptime</a>
            </li>
        </ul>
        {{ end }}
    </div>
    </nav>
{{ end }}