From e9a1d70196dd9d9f0a3c4f98a44a7125dbfefd9a Mon Sep 17 00:00:00 2001 From: Jorran de Wit <jorrandewit@outlook.com> Date: Mon, 28 Aug 2017 21:12:21 +0200 Subject: [PATCH] Add "login" links to submission page --- comments/templates/comments/new_comment.html | 4 ++++ comments/views.py | 1 + submissions/templates/submissions/submission_detail.html | 2 ++ 3 files changed, 7 insertions(+) diff --git a/comments/templates/comments/new_comment.html b/comments/templates/comments/new_comment.html index 55d670be8..8a59f3240 100644 --- a/comments/templates/comments/new_comment.html +++ b/comments/templates/comments/new_comment.html @@ -9,4 +9,8 @@ {% url 'comments:new_comment' object_id=object_id type_of_object=type_of_object as url %} {% include 'comments/_add_comment_form.html' with form=form url=url %} +{% elif not user.is_authenticated %} + +<h3 class="text-center"><a href="{% url 'scipost:login' %}?next={{request.path}}" class="btns btxn-info mt-3 px-4">Login to comment</a></h3> + {% endif %} diff --git a/comments/views.py b/comments/views.py index 1948eba50..021b7f730 100644 --- a/comments/views.py +++ b/comments/views.py @@ -20,6 +20,7 @@ from submissions.models import Submission, Report from commentaries.models import Commentary +@login_required @permission_required('scipost.can_submit_comments', raise_exception=True) def new_comment(request, **kwargs): form = CommentForm(request.POST or None, request.FILES or None) diff --git a/submissions/templates/submissions/submission_detail.html b/submissions/templates/submissions/submission_detail.html index 16ff9ea98..ede9cef6d 100644 --- a/submissions/templates/submissions/submission_detail.html +++ b/submissions/templates/submissions/submission_detail.html @@ -148,6 +148,8 @@ {% endif %} </div> </div> +{% elif not user.is_authenticated %} + <div class="text-center"><a class="btn btn-primary btn-sm px-3" href="{% url 'scipost:login' %}?next={{request.path}}">Login to report</a></div> {% endif %} {% if invited_reports %} -- GitLab