NDOJ/templates/course/course.html
2024-10-02 15:06:33 -05:00

124 lines
No EOL
4.2 KiB
HTML

{% extends "course/base.html" %}
{% block two_col_media %}
<style type="text/css">
.contest-name {
font-weight: bold;
font-size: 1.1em;
}
.contest-details {
font-size: 0.9em;
}
</style>
{% endblock %}
{% block js_media %}
<script type="text/javascript">
$(document).ready(function () {
$('.time-remaining').each(function () {
count_down($(this));
});
});
</script>
{% endblock %}
{% block middle_content %}
<center><h2>{{title}}</h2></center>
<h3 class="course-content-title">{{_("About")}}</h3>
<div>
{{ course.about|markdown|reference|str|safe }}
</div>
{% if lessons %}
<br>
<h3 class="course-content-title">{{_("Lessons")}}</h3>
<ul class="lesson-list">
{% for lesson in lessons %}
<a href="{{url('course_lesson_detail', course.slug, lesson.id)}}">
{% set progress = lesson_progress[lesson.id] %}
<li>
<div class="lesson-title">
{{ lesson.title }}
<div class="lesson-points">
{% if progress['total_points'] %}
{{(progress['achieved_points'] / progress['total_points'] * lesson.points) | floatformat(1)}} / {{lesson.points}}
{% else %}
0 / {{lesson.points}}
{% endif %}
</div>
</div>
<div class="progress-container">
<div class="progress-bar" style="width: {{progress['percentage']}}%;">{{progress['percentage']|floatformat(0)}}%</div>
</div>
</li>
</a>
{% endfor %}
</ul>
{% endif %}
{% if course_contests %}
<br>
<h3 class="course-content-title">{{_("Contests")}}</h3>
<br>
<table class="table striped">
<thead>
<tr>
<th>{{_("Name")}}</th>
<th>{{_("Start")}}</th>
<th>{{_("End")}}</th>
<th>{{_("Length")}}</th>
<th>{{_("Score")}}</th>
</tr>
</thead>
<tbody>
{% for course_contest in course_contests %}
{% set contest = course_contest.contest %}
{% set progress = contest_progress[course_contest.id] %}
<tr>
<td>
<a href="{{ url('contest_view', contest.key) }}" class="contest-name">{{ contest.name }}</a>
</td>
<td>
{{ contest.start_time|date(_("H:i d/m/Y")) }}
<div class="contest-details">
{% if contest.time_before_start %}
<span class="time">{{ _('Starting in %(countdown)s.', countdown=contest.start_time|as_countdown) }}</span>
{% endif %}
</div>
</td>
<td>
{{ contest.end_time|date(_("H:i d/m/Y"))}}
<div class="contest-details">
{% if contest.time_before_end %}
<span class="time">{% trans countdown=contest.end_time|as_countdown %}Ends in {{ countdown }}{% endtrans %}</span>
{% endif %}
</div>
</td>
<td>
{% if contest.time_limit %}
{% trans time_limit=contest.time_limit|timedelta('localized-no-seconds') %}{{ time_limit }}{% endtrans %}
{% else %}
{% trans duration=contest.contest_window_length|timedelta('localized-no-seconds') %}{{ duration }}{% endtrans %}
{% endif %}
</td>
<td>
{% if progress['total_points'] %}
{{ (progress['achieved_points'] / progress['total_points'] * course_contest.points) | floatformat(1) }} / {{ course_contest.points }}
{% else %}
0 / {{ course_contest.points }}
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<br>
<h3 class="course-content-title">
{% set achieved_points = total_progress['achieved_points'] %}
{% set total_points = total_progress['total_points'] %}
{% set percentage = total_progress['percentage'] %}
{{_("Total achieved points")}}:
<span style="float: right; font-weight: normal;">
{{ achieved_points | floatformat(2) }} / {{ total_points }} ({{percentage|floatformat(1)}}%)
</span>
</h3>
{% endblock %}