uv_detail.jinja 6.97 KB
Newer Older
Sli's avatar
Sli committed
1
{% extends "core/base.jinja" %}
2
{% from "core/macros.jinja" import user_profile_link %}
Sli's avatar
Sli committed
3
{% from "pedagogy/macros.jinja" import display_star %}
Sli's avatar
Sli committed
4 5 6 7 8 9

{% block title %}
{% trans %}UV Details{% endtrans %}
{% endblock %}

{% block content %}
10 11
<div class="pedagogy">
	<div id="uv_detail">
12 13 14 15 16 17 18 19 20 21
		<p id="return_noscript"><a href="{{ url('pedagogy:guide') }}">{% trans %}Back{% endtrans %}</a></p>
		<button id="return_js" onclick='(function(){
			// If comes from the guide page, go back with history
			if (document.referrer.replace(/\?(.+)/gm,"").endsWith(`{{ url("pedagogy:guide") }}`)){
				window.history.back();
				return;
			}
			// Simply goes to the guide page
			window.location.href = `{{ url("pedagogy:guide") }}`;
		})()' hidden>{% trans %}Back{% endtrans %}</button>
22

23
		<h1>{{ object.code }} - {{ object.title }}</h1>
Sli's avatar
Sli committed
24
		<br>
Sli's avatar
Sli committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
		<div class="uv-quick-info-container">
			<div class="hours-cm">
				<b>{% trans %}CM: {% endtrans %}</b>{{ object.hours_CM }}
			</div>
			<div class="hours-td">
				<b>{% trans %}TD: {% endtrans %}</b>{{ object.hours_TD }}
			</div>
			<div class="hours-tp">
				<b>{% trans %}TP: {% endtrans %}</b>{{ object.hours_TP }}
			</div>
			<div class="hours-te">
				<b>{% trans %}TE: {% endtrans %}</b>{{ object.hours_TE }}
			</div>
			<div class="hours-the">
				<b>{% trans %}THE: {% endtrans %}</b>{{ object.hours_THE }}
			</div>
41 42 43 44 45 46 47 48

			<div class="department">
				{{ object.department }}
			</div>
			<div class="credit-type">
				{{ object.credit_type }}
			</div>
			<div class="semester">
49
				{{ object.get_semester_display() }}
50
			</div>
Sli's avatar
Sli committed
51
		</div>
52

Sli's avatar
Sli committed
53 54
		<br>

Sli's avatar
Sli committed
55
		<div class="uv-details-container">
Sli's avatar
Sli committed
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
			<div class="grade">
				<p>{% trans %}global grade{% endtrans %}</p>
				<p>{% trans %}utility{% endtrans %}</p>
				<p>{% trans %}interest{% endtrans %}</p>
				<p>{% trans %}teaching{% endtrans %}</p>
				<p>{% trans %}work load{% endtrans %}</p>
			</div>
			<div class="grade-stars">
				<p>{{ display_star(object.grade_global_average) }}</p>
				<p>{{ display_star(object.grade_utility_average) }}</p>
				<p>{{ display_star(object.grade_interest_average) }}</p>
				<p>{{ display_star(object.grade_teaching_average) }}</p>
				<p>{{ display_star(object.grade_work_load_average) }}</p>
			</div>
			<div class="uv-infos">
				<p><b>{% trans %}Objectives{% endtrans %}</b></p>
				<p>{{ object.objectives|markdown }}</p>
				<p><b>{% trans %}Program{% endtrans %}</b></p>
				<p>{{ object.program|markdown }}</p>
				<p><b>{% trans %}Earned skills{% endtrans %}</b></p>
				<p>{{ object.skills|markdown }}</p>
				<p><b>{% trans %}Key concepts{% endtrans %}</b></p>
78
				<p>{{ object.key_concepts|markdown }}</p>
Sli's avatar
Sli committed
79 80 81
				<p><b>{% trans %}UV manager: {% endtrans %}</b>{{ object.manager }}</p>
			</div>
		</div>
Sli's avatar
Sli committed
82

Sli's avatar
Sli committed
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
		<br>
		<div id="leave_comment">
			<h2>{% trans %}Leave comment{% endtrans %}</h2>
			<div>
				<form action="{{ url('pedagogy:uv_detail', uv_id=object.id) }}" method="post" enctype="multipart/form-data">
					{% csrf_token %}
					<div class="leave-comment-grid-container">
						<div class="form-stars">
							{{ form.author.errors }}
							{{ form.uv.errors }}

							{{ form.author }}
							{{ form.uv }}

							<div class="input-stars">
								<label for="{{ form.grade_global.id_for_label }}">{{ form.grade_global.label }} :</label>
								{{ form.grade_global.errors }}
								{{ form.grade_global }}
							</div>

							<div class="input-stars">
								<label for="{{ form.grade_utility.id_for_label }}">{{ form.grade_utility.label }} :</label>
								{{ form.grade_utility.errors }}
								{{ form.grade_utility }}
							</div>

							<div class="input-stars">
								<label for="{{ form.grade_interest.id_for_label }}">{{ form.grade_interest.label }} :</label>
								{{ form.grade_interest.errors }}
								{{ form.grade_interest }}
							</div>

							<div class="input-stars">
								<label for="{{ form.grade_teaching.id_for_label }}">{{ form.grade_teaching.label }} :</label>
								{{ form.grade_teaching.errors }}
								{{ form.grade_teaching }}
							</div>

							<div class="input-stars">
								<label for="{{ form.grade_work_load.id_for_label }}">{{ form.grade_work_load.label }} :</label>
								{{ form.grade_work_load.errors }}
								{{ form.grade_work_load }}
							</div>
						</div>
						<div class="form-comment">
							<label for="{{ form.comment.id_for_label }}">{{ form.comment.label }} :</label>
							{{ form.comment.errors }}
							{{ form.comment }}
						</div>
					</div>
					<p><input type="submit" value="{% trans %}Comment{% endtrans %}" /></p>
				</form>
			</div>
		</div>
		<br>

139 140
		{% if object.comments.exists() %}
			<h2>{% trans %}Comments{% endtrans %}</h2>
141
			{% for comment in object.comments.order_by("-publish_date").all() %}
142 143
				<div id="{{ comment.id }}" class="comment-container">

Sli's avatar
Sli committed
144
					<div class="grade-block">
145
						<div class="grade-type">
Sli's avatar
Sli committed
146
							<p>{% trans %}global grade{% endtrans %}</p>
147 148 149 150
							<p>{% trans %}utility{% endtrans %}</p>
							<p>{% trans %}interest{% endtrans %}</p>
							<p>{% trans %}teaching{% endtrans %}</p>
							<p>{% trans %}work load{% endtrans %}</p>
Sli's avatar
Sli committed
151
						</div>
152
						<div class="grade-stars">
Sli's avatar
Sli committed
153 154 155 156 157 158
							<p>{{ display_star(comment.grade_global) }}</p>
							<p>{{ display_star(comment.grade_utility) }}</p>
							<p>{{ display_star(comment.grade_interest) }}</p>
							<p>{{ display_star(comment.grade_teaching) }}</p>
							<p>{{ display_star(comment.grade_work_load) }}</p>
						</div>
159
					</div>
160

161 162 163 164 165 166
					<div class="comment">
						<div class="anchor">
							<a href="{{ url('pedagogy:uv_detail', uv_id=uv.id) }}#{{ comment.id }}"><i class="fa fa-paragraph"></i></a>
						</div>
						{{ comment.comment|markdown }}
					</div>
167

Sli's avatar
Sli committed
168
					<div class="info">
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
						{% if comment.is_reported %}
							<p class="status-reported">
								{% trans %}This comment has been reported{% endtrans %}
							</p>
						{% endif %}

						{% if user.is_owner(comment) %}
							<p class="actions">
									<a href="{{ url('pedagogy:comment_update', comment_id=comment.id) }}">{% trans %}Edit{% endtrans %}</a>
									<a href="{{ url('pedagogy:comment_delete', comment_id=comment.id) }}">{% trans %}Delete{% endtrans %}</a>
							</p>
						{% endif %}
					</div>

					<div class="comment-end-bar">
Sli's avatar
Sli committed
184
						<p class="report"><a href="{{ url('pedagogy:comment_report', comment_id=comment.id) }}">{% trans %}Report this comment{% endtrans %}</a></p>
185 186 187 188

						<p class="date">{{ comment.publish_date.strftime('%d/%m/%Y') }}</p>

						<p class="author">{{ user_profile_link(comment.author) }}</p>
Sli's avatar
Sli committed
189
					</div>
190 191 192 193 194 195

				</div>
			{% endfor %}
		{% endif %}

	</div>
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
</div>

<script type="text/javascript">
	$("#return_noscript").hide();
	$("#return_js").show();
	var icons = {
		header: "fa fa-toggle-right",
		activeHeader: "fa fa-toggle-down"
	};
	$(function(){
		$("#leave_comment").accordion({
			icons: icons,
		    heightStyle: "content",
		    active: false,
		    collapsible: true
Sli's avatar
Sli committed
211
		});
212 213 214 215 216 217
	});
	// Remove jquery-ui icons to make fontawesome work
	$(document).ready(function(){
		$(".ui-accordion-header-icon").first().removeClass("ui-icon");
	});
</script>
218
{% endblock %}