11< article class ="card shadow ">
2- < div class ="card-body ">
3- < h5 class ="p-orange card-title "> {{ hackathon.display_name }}</ h5 >
4- < h6 class ="card-subtitle mb-2 text-muted "> {{ hackathon.start_date }} - {{ hackathon.end_date }}</ h6 >
5- < p class ="card-text "> {{ hackathon.description }}</ p >
6- {% if hackathon.organiser %}
7- < p > Organiser: < a href ="# " class ="p-blue card-link "> {{ hackathon.organiser }}</ a > </ p >
2+ < div class ="card-body ">
3+ < h5 class ="p-orange card-title "> {{ hackathon.display_name }}</ h5 >
4+ < h6 class ="card-subtitle mb-2 text-muted "> {{ hackathon.start_date }} - {{ hackathon.end_date }}</ h6 >
5+ < p class ="card-text "> {{ hackathon.description }}</ p >
6+ {% if hackathon.organiser %}
7+ < p > Organiser: < a href ="# " class ="p-blue card-link "> {{ hackathon.organiser }}</ a > </ p >
8+ {% endif %}
9+ < a href ="# " class ="btn btn-ci mr-3 "> Read More</ a >
10+
11+ <!-- Delete button, only visible for admin users -->
12+ {% if user.is_authenticated and user.is_superuser %}
13+ < button class ="btn btn-ci " type ="button " data-toggle ="modal " data-target ="#delete-modal-{{ hackathon.id }} ">
14+ Delete Event
15+ </ button >
16+ {% endif %}
17+ </ div >
18+ </ article >
19+
20+ <!-- Modal - pass in hackathon id to modal id to enable rendering details and deleting correct hackathon event -->
21+ < div class ="modal fade " id ="delete-modal-{{ hackathon.id }} " tabindex ="-1 " aria-labelledby ="delete-modal "
22+ aria-hidden ="true ">
23+ < div class ="modal-dialog ">
24+ < div class ="modal-content ">
25+ < div class ="modal-header ">
26+ < h4 class ="modal-title "> Delete Hackathon</ h4 >
27+ < button type ="button " class ="close " data-dismiss ="modal " aria-label ="Close ">
28+ < span aria-hidden ="true "> ×</ span >
29+ </ button >
30+ </ div >
31+ < div class ="modal-body ">
32+ <!-- Warn user if hackathon has started and is in progress - dates need to be formatted to work correctly -->
33+ {% if hackathon.start_date|date:"jS F Y H:i" < = today|date:"jS F Y H:i" and hackathon.end_date|date:"jS F Y H:i" > = today|date:"jS F Y H:i" %}
34+ {{ hackathon.display_name }} is currently ongoing, do you really want to delete it?
35+ {% else %}
36+ Do you really want to delete {{ hackathon.display_name }}?
837 {% endif %}
9- < a href ="# " class ="btn btn-ci "> Read More</ a >
10- </ div >
11- </ article >
38+ </ div >
39+ < div class ="modal-footer ">
40+ < button type ="button " class ="btn btn-ci mr-3 " data-dismiss ="modal "> No</ button >
41+ < a href ="{% url 'hackathon:delete_hackathon' hackathon.id %} " type ="button " class ="btn btn-ci "> Yes</ a >
42+ </ div >
43+ </ div >
44+ </ div >
45+ </ div >
0 commit comments