mirror of
				https://github.com/ae-utbm/sith.git
				synced 2025-10-31 09:03:06 +00:00 
			
		
		
		
	Finished election details.
This commit is contained in:
		| @@ -12,7 +12,7 @@ time { | |||||||
| } | } | ||||||
|  |  | ||||||
| th { | th { | ||||||
|   padding: 4px; | 	padding: 5px; | ||||||
| 	margin: 5px; | 	margin: 5px; | ||||||
| 	border: solid 1px darkgrey; | 	border: solid 1px darkgrey; | ||||||
| 	border-collapse: collapse; | 	border-collapse: collapse; | ||||||
| @@ -21,33 +21,159 @@ th { | |||||||
| 	text-overflow: ellipsis; | 	text-overflow: ellipsis; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | .election__title { | ||||||
|  | 	margin: 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .election__description { | ||||||
|  | 	margin: 0; | ||||||
|  | 	margin-top: 5px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .election__details { | ||||||
|  | 	margin: 0; | ||||||
|  | 	margin-bottom: 5px; | ||||||
|  | } | ||||||
|  |  | ||||||
| .role { | .role { | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | .role .role__title { | ||||||
|  | 	background: lightgrey; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .role__multiple-choices { | ||||||
|  | 	color: darkgreen; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .role .role_candidates { | ||||||
|  | 	background: white; | ||||||
|  | } | ||||||
|  |  | ||||||
| .list-per-role { | .list-per-role { | ||||||
|  | 	padding: 5px; | ||||||
|  | 	max-width: 310px; | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
| .list-per-role__candidates { | .list-per-role__candidates { | ||||||
| 	list-style: none; | 	list-style: none; | ||||||
| 	margin-left: 0; | 	margin: 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .list-per-role__candidate:not(:last-child) { | ||||||
|  | 	margin-bottom: 5px; | ||||||
| } | } | ||||||
|  |  | ||||||
| .candidate { | .candidate { | ||||||
|  | 	display: flex; | ||||||
|  | 	flex-flow: row nowrap; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .candidate__picture-wrapper { | ||||||
|  | 	display: flex; | ||||||
|  | 	justify-content: center; | ||||||
|  | 	align-items: center; | ||||||
|  |  | ||||||
|  | 	width: 150px; | ||||||
|  | 	height: 150px; | ||||||
|  |  | ||||||
|  | 	background-color: lightgrey; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .candidate__picture { | ||||||
|  | 	max-width: 150px; | ||||||
|  | 	max-height: 150px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .candidate__infos { | ||||||
|  | 	margin-left: 5px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .candidate__full-name { | ||||||
|  | 	display: block; | ||||||
|  |  | ||||||
|  | 	font-weight: bolder; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .candidate__nick-name { | ||||||
|  | 	font-style: italic; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .candidate__program { | ||||||
|  | 	display: block; | ||||||
|  | 	margin-top: 5px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .candidate__vote-input { | ||||||
|  | 	position: absolute; | ||||||
|  | 	border: 0; | ||||||
|  | 	height: 1px; | ||||||
|  | 	width: 1px; | ||||||
|  | 	padding: 0; | ||||||
|  | 	overflow: hidden; | ||||||
|  | 	clip: rect(0, 0, 0, 0); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .candidate__vote-choice { | ||||||
|  | 		margin-top: 5px; | ||||||
|  | 		padding: 15px; | ||||||
|  |  | ||||||
|  | 		border: solid 1px darkgrey; | ||||||
|  |  | ||||||
|  | 		text-align: center; | ||||||
|  | 		cursor: pointer; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .candidate__vote-choice:hover, .candidate__vote-choice:focus { | ||||||
|  | 	background: lightgrey; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .candidate__vote-input:checked + .candidate__vote-choice { | ||||||
|  | 	border-width: 2px; | ||||||
|  | 	border-color: darkgreen; | ||||||
|  | 	color: darkgreen; | ||||||
|  | 	font-weight: bolder; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .candidate__vote-input:checked + .candidate__vote-choice:hover, | ||||||
|  | .candidate__vote-input:checked + .candidate__vote-choice:focus { | ||||||
|  | 	background: palegreen; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .election__sumbit-section { | ||||||
|  | 	margin-top: 5px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .election__sumbit-button { | ||||||
|  | 	display: block; | ||||||
|  | 	width: 100%; | ||||||
|  | 	padding: 20px; | ||||||
|  | 	background: white; | ||||||
|  | 	border: solid 15px orange; | ||||||
|  | 	text-align: center; | ||||||
|  | 	font-size: 200%; | ||||||
|  | 	font-weight: bolder; | ||||||
|  | 	cursor: pointer; | ||||||
| } | } | ||||||
| </style> | </style> | ||||||
| {%- endblock %} | {%- endblock %} | ||||||
|  |  | ||||||
| {% block content %} | {% block content %} | ||||||
| 	<h3>{{ object.title }}</h3> | 	<h3 class="election__title">{{ object.title }}</h3> | ||||||
|  | 	<p class="election__description">{{ object.description }}</p> | ||||||
| 	<hr> | 	<hr> | ||||||
| 	<section> | 	<section> | ||||||
|     <p> | 		<p class="election__details"> | ||||||
| 			{% trans %}Polls close {% endtrans %} | 			{% trans %}Polls close {% endtrans %} | ||||||
| 			<time datetime="{{ election.end_date }}">{{ election.end_date|date("l d F Y") }}</time> at <time>{{ election.end_date|time("G:i") }}</time> | 			<time datetime="{{ election.end_date }}">{{ election.end_date|date("l d F Y") }}</time> at <time>{{ election.end_date|time("G:i") }}</time> | ||||||
| 		</p> | 		</p> | ||||||
|  | 		{%- if object.has_voted(request.user) %} | ||||||
|  | 		<p class="election__elector-infos"> | ||||||
|  | 			<span>{% trans %}You already have submitted your vote.{% endtrans %}</span> | ||||||
|  | 		</p> | ||||||
|  | 		{%- endif %} | ||||||
| 	</section> | 	</section> | ||||||
| 	<section> | 	<section> | ||||||
| 		<table> | 		<table> | ||||||
| @@ -57,89 +183,63 @@ th { | |||||||
| 				{%- for election_list in election_lists %} | 				{%- for election_list in election_lists %} | ||||||
| 				<th>{{election_list.title}}</th> | 				<th>{{election_list.title}}</th> | ||||||
| 				{%- endfor %} | 				{%- endfor %} | ||||||
|  | 				<th>{% trans %}Blank vote{% endtrans %}</th> | ||||||
| 			</thead> | 			</thead> | ||||||
| 			{%- for role in object.role.all() %} | 			{%- for role in object.role.all() %} | ||||||
| 			<tbody class="role"> | 			<tbody class="role"> | ||||||
| 				<tr><td colspan="{{election_lists.count()}}">{{role.title}}</td></tr> | 				<tr class="role__title"> | ||||||
| 				<tr> | 					<td colspan="{{election_lists.count() + 1}}"> | ||||||
|  | 						<span>{{role.title}}</span> | ||||||
|  | 						{%- if role.max_choice > 1 %} | ||||||
|  | 						<strong class="role__multiple-choices">{% trans %}You may choose up to{% endtrans %} {{ role.max_choice }} {% trans %}people.{% endtrans %}</strong> | ||||||
|  | 						{%- endif %} | ||||||
|  | 					</td> | ||||||
|  | 				</tr> | ||||||
|  | 				<tr class="role_candidates"> | ||||||
| 					{%- for election_list in election_lists %} | 					{%- for election_list in election_lists %} | ||||||
| 					<td class="list-per-role"> | 					<td class="list-per-role"> | ||||||
| 						<ul class="list-per-role__candidates"> | 						<ul class="list-per-role__candidates"> | ||||||
| 						{%- for candidature in election_list.candidature.filter(role=role) %} | 						{%- for candidature in election_list.candidature.filter(role=role) %} | ||||||
| 							<li> | 							<li class="list-per-role__candidate"> | ||||||
| 								<figure class="candidate"> | 								<figure class="candidate"> | ||||||
|  | 									<div class="candidate__picture-wrapper"> | ||||||
| 										{%- if candidature.user.profile_pict %} | 										{%- if candidature.user.profile_pict %} | ||||||
| 									<img src="{{candidature.user.profile_pict.get_download_url()}}" alt="{% trans %}Profile{% endtrans %}"> | 										<img class="candidate__picture" src="{{candidature.user.profile_pict.get_download_url()}}" alt="{% trans %}Profile{% endtrans %}"> | ||||||
| 										{%- endif %} | 										{%- endif %} | ||||||
| 									<figcaption> | 									</div> | ||||||
| 										<cite>{{ candidature.user.first_name }} <em>{{candidature.user.nick_name or ''}} </em>{{ candidature.user.last_name }}</cite> | 									<figcaption class="candidate__infos"> | ||||||
| 										<q>{{ candidature.program or '' }}</q> | 										<cite class="candidate__full-name">{{ candidature.user.first_name }} <em class="candidate__nick-name">{{candidature.user.nick_name or ''}} </em>{{ candidature.user.last_name }}</cite> | ||||||
|  | 										<q class="candidate__program">{{ candidature.program or '' }}</q> | ||||||
| 									</figcaption> | 									</figcaption> | ||||||
| 								</figure> | 								</figure> | ||||||
|  | 								{%- if object.is_active %} | ||||||
|  | 								<input id="id" class="candidate__vote-input" type="radio" name="vote"> | ||||||
|  | 								<label for="id" class="candidate__vote-choice"> | ||||||
|  | 									<span>{% trans %}Choose{% endtrans %} {{ candidature.user.nick_name or candidature.user.first_name }}</span> | ||||||
|  | 								</label> | ||||||
|  | 								{% endif %} | ||||||
| 							</li> | 							</li> | ||||||
| 						{%- endfor %} | 						{%- endfor %} | ||||||
| 						</ul> | 						</ul> | ||||||
| 					</td> | 					</td> | ||||||
| 					{%- endfor %} | 					{%- endfor %} | ||||||
|  | 					<td class="list-per-role"> | ||||||
|  | 						{%- if object.is_active %} | ||||||
|  | 						<input id="id" class="candidate__vote-input" type="radio" name="vote"> | ||||||
|  | 						<label for="id" class="candidate__vote-choice"> | ||||||
|  | 							<span>{% trans %}Choose blank vote{% endtrans %}</span> | ||||||
|  | 						</label> | ||||||
|  | 						{% endif %} | ||||||
|  | 					</td> | ||||||
| 				</tr> | 				</tr> | ||||||
| 			</tbody> | 			</tbody> | ||||||
| 			{%- endfor %} | 			{%- endfor %} | ||||||
| 		</table> | 		</table> | ||||||
| 	</section> | 	</section> | ||||||
|  | 	<section class="election__sumbit-section"> | ||||||
| 	{% if object.has_voted(request.user) %} | 		<button class="election__sumbit-button">{% trans %}Submit the vote !{% endtrans %}</button> | ||||||
| 		A voté | 	</section> | ||||||
| 	{% endif %} |  | ||||||
| 	<h1>{{object.title}}</h1> |  | ||||||
| 	<p>{{object.description}}</p> |  | ||||||
| 	<p>{% trans %}End :{% endtrans %} {{object.end_date}}</p> |  | ||||||
| 	{% if object.election_list.exists() %} |  | ||||||
| 	<table> |  | ||||||
| 		<tr> |  | ||||||
| 		{% set nb_list = object.election_list.all().count() + 1 -%} |  | ||||||
| 		{% for liste in object.election_list.all() %} |  | ||||||
| 			<td>{{liste.title}}</td> |  | ||||||
| 			{% if object.is_candidature_active -%} |  | ||||||
| 			{% set nb_list = nb_list -%} |  | ||||||
| 			{% else -%} |  | ||||||
| 			{% set nb_list = nb_list + 1 -%} |  | ||||||
| 			{% endif -%} |  | ||||||
| 		{% endfor %} |  | ||||||
| 		{% if not object.is_candidature_active -%} |  | ||||||
| 		<td>{% trans %}Blank vote{% endtrans %}</td> |  | ||||||
| 		{% endif %} |  | ||||||
| 		</tr> |  | ||||||
| 	{% for role in object.role.all() %} |  | ||||||
| 		<tr><td colspan={{nb_list}}>{{role.title}}</td></tr> |  | ||||||
| 		<tr> |  | ||||||
| 			{% for liste in object.election_list.all() %} |  | ||||||
| 			<td> |  | ||||||
| 				<ul> |  | ||||||
| 				{% for candidature in role.candidature.filter(election_list=liste) %} |  | ||||||
| 				<li> |  | ||||||
| 					{{candidature.user.first_name}} {{candidature.user.last_name}} {{candidature.user.nick_name or ''}} |  | ||||||
| 					{% if candidature.user.profile_pict %} |  | ||||||
| 					<br> |  | ||||||
| 						<img src="{{candidature.user.profile_pict.get_download_url()}}" alt="{% trans %}Profile{% endtrans %}"> |  | ||||||
| 					{% endif %} |  | ||||||
| 					<br> |  | ||||||
| 					{{candidature.program or ''}} |  | ||||||
| 				</li> |  | ||||||
| 				{% endfor %} |  | ||||||
| 				</ul> |  | ||||||
| 			</td> |  | ||||||
| 			{% endfor %} |  | ||||||
| 			{% if not object.is_candidature_active -%} |  | ||||||
| 			<td></td> |  | ||||||
| 			{% endif %} |  | ||||||
| 		</tr> |  | ||||||
| 	{% endfor %} |  | ||||||
| 	</table> |  | ||||||
| 	{% endif %} |  | ||||||
| 	<form action="{{url('election:candidate', election_id=object.id)}}" method="post">{{candidate_form}} | 	<form action="{{url('election:candidate', election_id=object.id)}}" method="post">{{candidate_form}} | ||||||
| 	{% csrf_token %} | 	{% csrf_token %} | ||||||
| 	</form> | 	</form> | ||||||
| 	{% if object.is_candidature_active -%} |  | ||||||
| 		candidature |  | ||||||
| 	{% endif -%} |  | ||||||
| {% endblock %} | {% endblock %} | ||||||
		Reference in New Issue
	
	Block a user