Create repo page stub

This commit is contained in:
George Lacey 2021-05-19 20:04:33 +01:00
parent 5759839415
commit 36a3974393
4 changed files with 39 additions and 5 deletions

View File

@ -29,7 +29,7 @@
<div style="width: 600px;" class="repo-container shadow rounded overflow-hidden <div style="width: 600px;" class="repo-container shadow rounded overflow-hidden
{% if repo.error %}bg-danger{% elif repo.warning %}bg-warning{% else %}bg-primary{% endif %}"> {% if repo.error %}bg-danger{% elif repo.warning %}bg-warning{% else %}bg-primary{% endif %}">
<div class="row me-1 overflow-hidden text-truncate"> <div class="row me-1 overflow-hidden text-truncate">
<h2 class="h2">{{ repo.label }} <h2 class="h2"><a href="/repo/{{ repo.label }}">{{ repo.label }}</a>
<small class="text-muted"> {{ repo.location }}</small> <small class="text-muted"> {{ repo.location }}</small>
</h2> </h2>
</div> </div>

View File

@ -0,0 +1,28 @@
{% extends "borg/base.html" %}
{% block title %}Repo: {{ repo.label }}{% endblock %}
{% load static %}
{% block script %}
{{block.super}}
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
{{ hour_list|json_script:"hour_list" }}
{# <script src="{% static 'js/index.js' %}"></script>#}
{% endblock %}
{% block style %}
{# .repo-container {#}
{# padding: 8px;#}
{# margin: 8px;#}
{# }#}
{##}
{# .att-label {#}
{# margin-top: 4px;#}
{# margin-bottom: 4px;#}
{# }#}
{% endblock %}
{% block body %}
<h1>Repo: {{ repo.label }}</h1>
{% endblock %}

View File

@ -5,8 +5,9 @@ from . import views
urlpatterns = [ urlpatterns = [
path('', cache_page(60)(views.index), name='index'), path('', cache_page(60)(views.index), name='index'),
path('post/repo', views.post_repo, name='repo'), path('repo/<str:repo_label>', views.repo, name='repo'),
path('post/archive', views.post_archive, name='archive'), path('post/repo', views.post_repo, name='post repo'),
path('post/error', views.post_error, name='error'), path('post/archive', views.post_archive, name='post archive'),
path('post/location', views.post_location, name='location'), path('post/error', views.post_error, name='post error'),
path('post/location', views.post_location, name='post location'),
] ]

View File

@ -38,6 +38,11 @@ def repo_daily_dict(repo_list, n_days=14):
} }
def repo(request, repo_label: str):
s_repo = get_object_or_404(Repo, label__label=repo_label)
return render(request, 'borg/repo.html', {'repo': s_repo})
@permission_required("borg.add_repo") @permission_required("borg.add_repo")
def post_repo(request): def post_repo(request):
if request.method == 'POST': if request.method == 'POST':