From f140d0369e4615cf0dd8798811f69502d4fe7e0b Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Sun, 21 Jan 2024 12:35:20 +1300 Subject: [PATCH] redirect to login form as needed --- app/static/js/scripts.js | 9 +++++++++ app/templates/base.html | 1 + app/templates/post/_comment_voting_buttons.html | 4 ++-- app/templates/post/_post_voting_buttons.html | 4 ++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/static/js/scripts.js b/app/static/js/scripts.js index e766ae94..18466f26 100644 --- a/app/static/js/scripts.js +++ b/app/static/js/scripts.js @@ -151,6 +151,15 @@ function setupConfirmFirst() { return false; }); }) + + const redirect_login = document.querySelectorAll('.redirect_login'); + redirect_login.forEach(element => { + element.addEventListener("click", function(event) { + location.href = '/auth/login'; + event.preventDefault(); + return false; + }); + }); } function setupSubmitOnInputChange() { diff --git a/app/templates/base.html b/app/templates/base.html index d6e4f72d..201dcdd5 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -210,6 +210,7 @@ {% else %}
{% endif %} + diff --git a/app/templates/post/_comment_voting_buttons.html b/app/templates/post/_comment_voting_buttons.html index d5afc7c9..373d9687 100644 --- a/app/templates/post/_comment_voting_buttons.html +++ b/app/templates/post/_comment_voting_buttons.html @@ -15,11 +15,11 @@ {% endif %} {% else %} -