From bddc8573450cc58702275f98bdc24a0eb90a7eb5 Mon Sep 17 00:00:00 2001 From: Artur Borecki Date: Thu, 12 Mar 2026 13:52:14 +0100 Subject: [PATCH] feat(course_page.html): add messages if user not logged in or doesn't have access to course --- home/templates/home/course_page.html | 32 +++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/home/templates/home/course_page.html b/home/templates/home/course_page.html index 5f7d46b..bdfc1f0 100644 --- a/home/templates/home/course_page.html +++ b/home/templates/home/course_page.html @@ -1,6 +1,5 @@ {% extends "base.html" %} -{% load static %} -{% load wagtailcore_tags %} +{% load static i18n wagtailcore_tags %} {% block title %}{{ page.title }}{% endblock %} @@ -13,7 +12,34 @@ {% block content_class %}prose{% endblock content_class %} {% block content %} +

+ {{ page.title }} +

- {{ page.body|richtext }} + {{ page.body|richtext }} + {% if user_has_access %} +

{% trans "Modules" %}

+ + {% elif not user.is_authenticated %} + {# If the user is not authenticated, we can prompt them to log in or sign up. #} +
+

{% trans "You need to be logged in to access this course. Please log in or sign up to view the modules." %}

+ {% trans "Login" %} + {% trans "Sign Up" %} +
+ {% else %} +
+

{% trans "You don't have access to this course. Please purchase it to view the modules." %}

+ {% trans "Purchase Course" %} +
+ {% endif %} {% endblock content %}