diff --git a/Dockerfile b/Dockerfile index 307028d..399ed3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 USER appuser EXPOSE 8000 -RUN rm -rf /app/Dockerfile* \ +RUN rm -rvf /app/Dockerfile* \ /app/README.md \ /app/argocd \ /app/k8s \ @@ -31,6 +31,6 @@ RUN rm -rf /app/Dockerfile* \ /app/node_modules \ /app/*.json \ /app/test_*.py && \ - python3 manage.py collectstatic + python3 /app/manage.py collectstatic --noinput CMD ["gunicorn","--bind","0.0.0.0:8000","--workers","3","VorgabenUI.wsgi:application"] diff --git a/VorgabenUI/settings.py b/VorgabenUI/settings.py index b77e2cd..6fa33fa 100644 --- a/VorgabenUI/settings.py +++ b/VorgabenUI/settings.py @@ -127,7 +127,7 @@ USE_TZ = True STATIC_URL = '/static/' #STATIC_ROOT="/home/adebaumann/VorgabenUI/staticfiles/" -STATIC_ROOT="/app/staticfiles/" +STATIC_ROOT="staticfiles/" STATICFILES_DIRS= ( os.path.join(BASE_DIR,"static"), ) diff --git a/argocd/deployment.yaml b/argocd/deployment.yaml index 3b22128..aeed948 100644 --- a/argocd/deployment.yaml +++ b/argocd/deployment.yaml @@ -25,7 +25,7 @@ spec: mountPath: /data containers: - name: web - image: git.baumann.gr/adebaumann/vui:0.965 + image: git.baumann.gr/adebaumann/vui:0.966 imagePullPolicy: Always ports: - containerPort: 8000 diff --git a/dokumente/templates/standards/all_comments.html b/dokumente/templates/standards/all_comments.html new file mode 100644 index 0000000..561680a --- /dev/null +++ b/dokumente/templates/standards/all_comments.html @@ -0,0 +1,67 @@ +{% extends "base.html" %} + +{% block content %} +

Alle Kommentare

+ +{% if total_comments == 0 %} +
+

Es gibt noch keine Kommentare zu Vorgaben.

+

Zu den Standards

+
+{% else %} +

Insgesamt {{ total_comments }} Kommentar{{ total_comments|pluralize:"e" }}

+ + {% for dokument, comments in comments_by_document.items %} +
+
+

+ + {{ dokument.nummer }} – {{ dokument.name }} + +

+

+ {{ comments|length }} Kommentar{{ comments|length|pluralize:"e" }} +

+
+
+
+ {% for comment in comments %} +
+
+
+

+ + {{ comment.vorgabe.Vorgabennummer }} + {{ comment.vorgabe.titel }} +

+

+ Benutzer: {{ comment.user.first_name }} {{ comment.user.last_name }}
+ Erstellt: {{ comment.created_at|date:"d.m.Y H:i" }} + {% if comment.updated_at != comment.created_at %} +
+ Bearbeitet: {{ comment.updated_at|date:"d.m.Y H:i" }} + {% endif %} +

+
+
+ {% csrf_token %} + +
+
+
+ {{ comment.text }} +
+
+ {% endfor %} +
+
+
+ {% endfor %} +{% endif %} + +
+ Zu den Standards +
+{% endblock %} diff --git a/dokumente/urls.py b/dokumente/urls.py index 9947ff0..d502946 100644 --- a/dokumente/urls.py +++ b/dokumente/urls.py @@ -5,6 +5,7 @@ urlpatterns = [ path('', views.standard_list, name='standard_list'), path('unvollstaendig/', views.incomplete_vorgaben, name='incomplete_vorgaben'), path('meine-kommentare/', views.user_comments, name='user_comments'), + path('alle-kommentare/', views.all_comments, name='all_comments'), path('/', views.standard_detail, name='standard_detail'), path('/history//', views.standard_detail), path('/history/', views.standard_detail, {"check_date":"today"}, name='standard_history'), diff --git a/dokumente/views.py b/dokumente/views.py index 4a07c9f..0ff3b93 100644 --- a/dokumente/views.py +++ b/dokumente/views.py @@ -392,3 +392,31 @@ def user_comments(request): 'comments_by_document': comments_by_document, 'total_comments': user_comments.count(), }) + + +@login_required +@user_passes_test(is_staff_user) +def all_comments(request): + """ + Display all comments from all users, grouped by document. + Staff only. + """ + # Get all comments + all_comments_qs = VorgabeComment.objects.select_related( + 'vorgabe', 'vorgabe__dokument', 'user' + ).order_by( + 'vorgabe__dokument__nummer', '-created_at' + ) + + # Group comments by document + comments_by_document = {} + for comment in all_comments_qs: + dokument = comment.vorgabe.dokument + if dokument not in comments_by_document: + comments_by_document[dokument] = [] + comments_by_document[dokument].append(comment) + + return render(request, 'standards/all_comments.html', { + 'comments_by_document': comments_by_document, + 'total_comments': all_comments_qs.count(), + }) diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index 3756c3f..2814e93 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -24,8 +24,8 @@ spec: - name: data mountPath: /data containers: - - name: web - image: docker.io/adebaumann/vui:0.917 + - name: web + image: docker.io/adebaumann/vui:0.918 imagePullPolicy: Always ports: - containerPort: 8000 diff --git a/pages/templates/base.html b/pages/templates/base.html index d32decb..424c607 100644 --- a/pages/templates/base.html +++ b/pages/templates/base.html @@ -52,18 +52,21 @@ +
  • Meine Kommentare
  • + {% if user.is_staff %} +
  • Alle Kommentare
  • + {% endif %} +
  • Passwort ändern
  • +
  • +
  • +
    + {% csrf_token %} + +
    +
  • + {% else %} @@ -216,8 +219,8 @@

    -

    Version {{ version|default:"0.965" }}

    -
    +

    Version {{ version|default:"0.966" }}

    +