summaryrefslogtreecommitdiffstats
path: root/ogcp/templates/repos.html
blob: 881057b1c116db7e2a3b77499095557e37030054 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{% extends 'base.html' %}

{% block nav_repos %}active{% endblock %}

{% block container %}
    <form id="reposForm">
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
    </form>
    {{ super() }}
</form>
{% endblock %}

{% block sidebar %}
    <ul id="repos-list" class="nav ogcp-nav flex-column nav-pills">
        {% for repos in repos_resp %}
        {% set server_name = repos["server"].name %}
        {% set server_ip_port = repos["server"].ip ~ ":" ~ repos["server"].port %}
        {% set repos_list = repos["json"]["repositories"] %}
        <li class="nav-item">
            <input class="form-check-input" type="checkbox" form="reposForm"
                value="{{ server_ip_port }}" name="selected-server" />
            <a class="nav-link {% if not repos_list %}disabled{% endif %}" href="#server{{loop.index}}"
                       {% if repos_list %}data-toggle="collapse"{% endif %}>
                {{ server_name }}
            </a>
            <ul class="nav flex-column collapse" id="server{{loop.index}}">
                {% for r in repos_list %}
                <li class="nav-item">
                    <input class="form-check-input" type="checkbox" form="reposForm"
                           value="{{ r["id"] }}"
                           name="selected-repo" />
                    {{ r["name"] }}
                </li>
                {% endfor %}
            </ul>
        </li>
        {% endfor %}
    </ul>
    <script>
        // Launch the javascript on document ready, so all the global functions exists
        // in the scope
        document.addEventListener('readystatechange', () => {
            if (document.readyState === 'complete') {
                keepReposTreeState()
            }
        });
    </script>
{% endblock %}

{% block commands %}
  <input class="btn btn-light {% block nav_repo_add %}{% endblock %}" type="submit" value="{{ _('Add repo') }}"
         form="reposForm" formaction="{{ url_for('repo_add_get') }}" formmethod="get">

  {% if btn_back %}
    <button class="btn btn-danger ml-3" type="button" id="backButton" onclick="history.back()">
      {{ _("Back") }}
    </button>
  {% endif %}
{% endblock %}