diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-06-30 15:24:19 +0200 |
---|---|---|
committer | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-07-04 15:34:02 +0200 |
commit | 9a6981d289865b3a22c645718e0e90865ea14638 (patch) | |
tree | 5ef2e9c61d1a825c17b1c6394c16559ae06ff141 | |
parent | eb61229b295c9157772e33004587b0df030f8c40 (diff) |
Add Repositories section
In Repositories section/view, users can manage task related to
repositories. For example: list, add, delete and edit them.
-rw-r--r-- | ogcp/templates/base.html | 3 | ||||
-rw-r--r-- | ogcp/templates/repositories.html | 33 | ||||
-rw-r--r-- | ogcp/views.py | 8 |
3 files changed, 44 insertions, 0 deletions
diff --git a/ogcp/templates/base.html b/ogcp/templates/base.html index 0ec773c..dca6fda 100644 --- a/ogcp/templates/base.html +++ b/ogcp/templates/base.html @@ -36,6 +36,9 @@ <li class="nav-item {% block nav_images%}{% endblock %}"> <a class="nav-link" href="{{ url_for('images') }}">{{ _('Images') }}</a> </li> + <li class="nav-item {% block nav_repositories %}{% endblock %}"> + <a class="nav-link" href="{{ url_for('repositories') }}">{{ _('Repositories') }}</a> + </li> {% if current_user.admin %} <li class="nav-item {% block nav_users %}{% endblock %}"> <a class="nav-link" href="{{ url_for('users') }}">{{ _('Users') }}</a> diff --git a/ogcp/templates/repositories.html b/ogcp/templates/repositories.html new file mode 100644 index 0000000..3bed073 --- /dev/null +++ b/ogcp/templates/repositories.html @@ -0,0 +1,33 @@ +{% extends 'base.html' %} + +{% block nav_repositories %}active{% endblock %} + +{% block container %} + <form id="repositoriesForm"> + <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> + </form> + {{ super() }} +</form> +{% endblock %} + +{% block sidebar %} + <ul id="repositories-list" class="nav flex-column nav-pills"> + {% for repository in repositories %} + <li id="repository-{{ repository['id'] }}" class="nav-item"> + <input class="form-check-input" type="checkbox" form="repositoriesForm" + value="{{ repository['id'] }}" + name="{{ repository['name'] }}" /> + {{ repository['name'] }} + </li> + {% endfor %} + </ul> +{% endblock %} + +{% block commands %} + {% if btn_back %} + <button class="btn btn-danger ml-3" type="button" id="backButton" onclick="history.back()"> + {{ _("Back") }} + </button> + {% endif %} +{% endblock %} + diff --git a/ogcp/views.py b/ogcp/views.py index 525d23f..16ba0b6 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -1237,6 +1237,14 @@ def images(): return render_template('images.html', images=images) +@app.route('/repositories/', methods=['GET']) +@login_required +def repositories(): + r = g.server.get('/repositories') + repositories = r.json()['repositories'] + return render_template('repositories.html', repositories=repositories) + + @app.route('/users/', methods=['GET']) @login_required def users(): |