feat: added a page to list cohorts of a course

- added a page /courses/<course>/manage that lists the active cohorts
- only accessible to mentors and staff
- also added a "manage the course" button on course page for mentors/staff

Issue #271
This commit is contained in:
Anand Chitipothu
2021-11-29 17:33:45 +05:30
parent 7cd57cadb2
commit 102fa9c0a8
7 changed files with 141 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
{% extends "www/cohorts/base.html" %}
{% block title %}Manage {{ course.title }}{% endblock %}
{% block page_content %}
<div class="common-page-style">
<div class="container">
{% if cohorts %}
<h2>Cohorts</h2>
<div class="row">
{% for cohort in cohorts %}
<div class="col-md-4">
{{ render_cohort(course, cohort) }}
</div>
{% endfor %}
{% else %}
<h2>Permission Denied</h2>
<p>You don't have permission to manage this course.</p>
{% endif %}
</div>
</div>
</div>
{% endblock %}
{% macro render_cohort(course, cohort) %}
<div class="card">
<div class="card-body">
<h5 class="card-title">{{cohort.title}}</h5>
<h6 class="card-subtitle mb-2 text-muted">{{cohort.begin_date}} - {{cohort.end_date}}</h6>
<a href="/courses/{{course.name}}/cohorts/{{cohort.slug}}" class="card-link">Manage</a>
</div>
</div>
{% endmacro %}