You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
4.9 KiB

<html>
<!--
Every head markup will be the same. I know in twig we can do some templating, but didn't take the time to search if it was possible with django.
This head doesn't have anything, not even the title part because I didn't want to take the time for it.
I won't repeat this comment for all HTML file because it would be the same.
-->
<head>
{% load static %}
<link rel="stylesheet" href="{% static 'redis_app/style.css' %}">
</head>
<body>
<!--
The navbar is also the same for each HTML. There's all important links for the navigation.
Also for this one, I won't repeat this for each HTML.
-->
<nav>
<a href="{% url 'home' %}">Home</a>
<!-- If you're not logged in -->
{% if person == '' %}
<a href="{% url 'login_form' %}">Login</a>
<a href="{% url 'register_form' %}">Register</a>
<!-- If you're logged in -->
{% else %}
<a href="{% url 'courses' %}">Courses</a>
<a href="{% url 'profile' %}">Profile</a>
<a href="{% url 'search' %}">Search</a>
<a href="{% url 'notifications_view' %}">Notifications</a>
<!-- If you're a teacher -->
{% if person.role == 'Teacher' %}
<a href="{% url 'publish_message' %}">Publish a message</a>
{% endif %}
<a href="{% url 'logout' %}">Logout</a>
{% endif %}
</nav>
<!--
Main part of the HTML. there's 3 cascading div to help me creating a nice layout with flex display (because I love flex.
Also for this one, I won't repeat this for each HTML.
-->
<div class="body">
<div class="container">
<div class="div-container">
<!--
Errors and successes section. It helps me enhance the UX by informing the user if something bad happened.
Also for this one, I won't repeat this for each HTML.
-->
{% if error_message %}
<p class="error-message">{{ error_message }}</p>
{% endif %}
{% if success_message %}
<p class="success-message">{{ success_message }}</p>
{% endif %}
{% if person %}
{% if person.role == "Teacher" %}
<!--
This scary code is only here to display + Create with a nice style (again to use flex display). this will let the user creating a course.
It's only for teachers.
-->
<div class="create-container">
<div>
<!--
These a href redirects to url 'name' 'arguments' .
Indeed, this is a cool feature of django defining routes with names and arguments to retrieve it very fast in the code.
-->
<a href="{% url 'create_course' %}" class="create-course">
<p class="plus">
+
</p>
<p>
Create
</p>
</a>
</div>
</div>
{% endif %}
{% endif %}
<h1>Courses for {{ person.name }}</h1>
<!-- If there's courses -->
{% if courses %}
<div class="courses">
{% for course in courses %}
<!-- Displaying each course as a button with the course name redirecting to the course detail -->
<a href="{% url 'details' course.id %}" class="course-link">{{ course.title }}</a>
{% endfor %}
</div>
<!-- If there's not -->
{% else %}
<p class="no-courses">No course yet</p>
{% endif %}
<!-- Letting the user registering to a course with a link to Search feature. Also works for teacher if they want to copy other teachers' courses -->
<p class="register-link">
Register to a course by <a href="{% url 'search' %}">Searching</a>
</p>
</div>
</div>
</div>
</body>
</html>