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.

63 lines
2.8 KiB

<html>
<head>
{% load static %}
<link rel="stylesheet" href="{% static 'redis_app/style.css' %}">
</head>
<body>
<nav>
<a href="{% url 'home' %}">Home</a>
{% if person.name == '' %}
<a href="{% url 'login_form' %}">Login</a>
<a href="{% url 'register_form' %}">Register</a>
{% 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 person.role == 'Teacher' %}
<a href="{% url 'publish_message' %}">Publish a message</a>
{% endif %}
<a href="{% url 'logout' %}">Logout</a>
{% endif %}
</nav>
<div class="body">
<div class="container">
<form action="{% url 'search_form' %}" method="POST">
{% csrf_token %}
<fieldset>
<legend><h1>Search</h1></legend>
{% if error_message %}
<p class="error-message">{{ error_message }}</p>
{% endif %}
{% if success_message %}
<p class="success-message">{{ success_message }}</p>
{% endif %}
<!--
Asking for keywords my project will search with to title, description and level attributes of every courses.
You have to type the exact word to match.
You can search for multiples courses by typing multiple keywords separated with spaces.
This displays the search for each keyword. It won't try to match for the specific search of two keywords. It will handle one keyword at once.
-->
<label for="keywords">Keywords</label>
<input name="keywords" id="keywords" placeholder="Keywords separated by spaces" class="input">
</fieldset>
<div class="submit-container">
<input type="submit" value="Search" class="submit">
</div>
</form>
<!-- Displaying all courses found. -->
{% if courses %}
{% for course in courses %}
<a href="{% url 'details' course.id %}">{{ course.title }}</a>
{% endfor %}
<!-- When no course is found :( -->
{% else %}
<p class="no-courses">No course found.</p>
{% endif %}
</div>
</div>
</body>
</html>