aceberg/git-confed

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

Summary

Maintainability
Test Coverage
{{ define "config" }}

<body>
    <div class="container mt-5">
    <div class="row">
        <div class="col">
        <table class="table">
            <form action="/config_save/" method="post">
                <tr>
                    <td>Host</td>
                    <td><input name="host" type="text" class="form-control" value="{{ .Config.Host }}"></td>
                </tr>
                <tr>
                    <td>Port</td>
                    <td><input name="port" type="text" class="form-control" value="{{ .Config.Port }}"></td>
                </tr>
                <tr>
                    <td>Theme</td>
                    <td><select name="theme" class="form-select">
                        <option selected>{{ .Config.Theme }}</option>
                        {{ range .Themes }}
                            <option value="{{ . }}">{{ . }}</option>
                        {{ end }}
                    </select></td>
                </tr>
                <tr>
                    <td>Color mode</td>
                    <td><select name="color" class="form-select">
                        <option selected>{{ .Config.Color }}</option>
                        <option value="light">light</option>
                        <option value="dark">dark</option>
                    </select></td>
                </tr>
                <tr>
                    <td>Node path</td>
                    <td><input name="node" type="text" class="form-control" value="{{ .Config.NodePath }}"></td>
                </tr>
                <tr>
                    <td>URLs</td>
                    <td><textarea name="urls" rows="2" class="form-control">{{ range .Config.ListURL }}{{ . }} {{ end }}</textarea></td>
                </tr>
                <tr>
                    <td>Other</td>
                    <td><textarea name="other" rows="2" class="form-control">{{ range .Config.Other }}{{ . }} {{ end }}</textarea></td>
                </tr>
                <tr>
                    <td><button type="submit" class="btn btn-primary">Save</button></td>
                    <td></td>
                </tr>
            </form>
        </table>
        </div>
        <div class="col">
            <div class="alert alert-info" role="alert">
                <p>● After changing <b>Host</b> or <b>Port</b> you need to restart the app</p>
                <p>● <b>URLs</b> should be space separated</p>
                <p>● <b>Other</b> - search for other keywords in .git/config (space separated)</p>
            </div>
        </div>
    </div>
    <br>
    <h5>Where to search for git repos:</h5>
    <div class="row">
        <form action="/folder_add/" method="post" class="input-group">
            <input name="path" type="text" class="form-control" placeholder="Path to folder with git repos">
            <button type="submit" class="btn btn-primary">Add</button>
        </form>
    </div>
    <br>
    <div class="row">
        <table class="table table-striped">
            <tr>
                <th style="width: 5%;">Del</th>
                <th>Path</th>
            </tr>
            {{ range .Config.Folders }}
            <tr>
                <td>
                    <a href="/folder_del?path={{ . }}">
                        <i class="bi bi-x-square"></i>
                    </a>
                </td>
                <td>
                    <a href="/filter?tag=folder&name={{ . }}">{{ . }}</a>
                </td>
            </tr>
            {{ end }}
        </table>
    </div>
    </div>
        

{{ template "footer" }}
{{ end }}