Skip to content

Commit 5f9bca1

Browse files
committed
committee history update, names in subpages
1 parent f22c77e commit 5f9bca1

File tree

11 files changed

+123
-20
lines changed

11 files changed

+123
-20
lines changed

.gitignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
*.pyc
22
migrations/
33
old
4-
posts
54
staticfiles
65
*.env
7-
import_posts.py
8-
setup_db.py
9-
stuff.txt
10-
add_committee_history.py
6+
files

db.sqlite3

0 Bytes
Binary file not shown.

mps/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
'posts': PostSitemap,
2727
'authors': AuthorSitemap,
2828
'categories': CategorySitemap,
29+
'committee_history': CommitteeHistorySitemap,
2930
}
3031

3132
urlpatterns = [

mps_site/admin.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,7 @@
1212

1313
admin.site.register(CommitteeMember)
1414
admin.site.register(CommitteePage)
15-
admin.site.register(GalleryPage)
15+
admin.site.register(GalleryPage)
16+
17+
admin.site.register(CommitteeHistory)
18+
admin.site.register(CommitteeHistoryMember)

mps_site/models.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,20 @@ class CommitteeHistoryMember(models.Model):
123123
id = models.AutoField(primary_key=True)
124124
name = models.CharField(max_length=100)
125125
position = models.CharField(max_length=100)
126+
image = models.CharField(max_length=100, null=True)
126127

127128
def __str__(self):
128129
return self.name + " - " + self.position
129130

130131
class CommitteeHistory(models.Model):
131132
id = models.AutoField(primary_key=True)
132133
year = models.CharField(max_length=100)
133-
committee_members = models.ManyToManyField(CommitteeHistoryMember)
134+
logo = models.CharField(max_length=100, null=True)
135+
title = models.CharField(max_length=100, default="Committee")
136+
members = models.ManyToManyField(CommitteeHistoryMember)
137+
138+
def get_absolute_url(self):
139+
return reverse('committee_history_detail', kwargs={'year': self.year})
134140

135141
def __str__(self):
136142
return self.year

mps_site/sitemap.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ def items(self):
3636
def lastmod(self, obj):
3737
return datetime.datetime.now()
3838

39+
class CommitteeHistorySitemap(Sitemap):
40+
changefreq = 'monthly'
41+
priority = 0.8
42+
protocol = 'https'
43+
44+
def items(self):
45+
return CommitteeHistory.objects.all().order_by("-year")
46+
47+
def lastmod(self, obj):
48+
return datetime.datetime.now()
49+
3950
class StaticViewSitemap(Sitemap):
4051
priority = 1.0
4152
changefreq = 'daily'

mps_site/templates/committee_history.html

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,68 @@
55
<div class="title-small">
66
<h1>Committee History</h1>
77
<h5><i>Meet everyone who has contributed to MPS over the years!</i></h5>
8+
<h5><i>If you were on committee previously and are not listed, please let us know at <a href="mailto:webmaster@dcumps.ie">webmaster@dcumps.ie</a></i></h5>
89
</div>
9-
{% for year in committee_history %}
10-
<h1>{{ year.year }}</h1>
10+
1111
<div class="container">
12-
<div class="row justify-content-center">
13-
<div class="col-md-8 custom-box shadow-lg bg-body">
14-
<div class="awards">
15-
<div class="center-contents shadow-lg bg-body" style="background-color: #202E4E; border-radius: 15px; padding-top: 10px; padding-bottom: 10px;">
16-
<ul style="padding-left: 10px; padding-right: 10px; list-style: none; text-align: left;">
17-
{% for member in year.committee_members.all %}
18-
<li><b>{{ member.position }}</b> - {{ member.name }}</li>
19-
{% endfor %}
20-
<ul></ul>
12+
<div class="row justify-content-center">
13+
<div class="col-md-12 custom-box shadow-lg bg-body" id="stats">
14+
<div class="row gy-4 row-cols-2 row-cols-md-4" style="color: white;">
15+
{% for year in committee_history %}
16+
<div class="col my-2 award-item {% if forloop.counter > 8 %}d-none{% endif %}">
17+
<!-- Hide awards after the first 8 initially -->
18+
<div class="hvr-grow text-center d-flex flex-column justify-content-center align-items-center py-3 shadow-lg bg-body"
19+
style="background-color: #202E4E; border-radius: 25px;">
20+
<div class="bs-icon-xl bs-icon-circle bs-icon-primary d-flex flex-shrink-0 justify-content-center align-items-center d-inline-block mb-2 bs-icon lg">
21+
<i class="fa-solid fa-users" style="font-size: 70px;"></i>
22+
</div>
23+
<div class="px-3" id="{{ year.title | lower }}">
24+
<h2 class="fw-bold tada animated mb-0">{{ year.year }}</h2>
25+
<p class="mb-0">Committee</p>
26+
</div>
27+
<a class="btn btn-primary" href="{% url 'committee_history_detail' year %}" style="margin-top: 10px; margin-bottom: 10px; color: white";>View Members</a>
28+
</div>
2129
</div>
30+
{% endfor %}
31+
</div>
32+
<div class="text-center mt-3">
33+
<button id="viewMoreButton" class="btn btn-primary" style="background-color: #202E4E; border-radius: 25px; border-width: 4px; border-color: white;">View All Committee History</button>
34+
<button id="hideButton" class="btn btn-secondary d-none" style="background-color: #202E4E; border-radius: 25px; border-width: 4px; border-color: white;">Hide Committee History</button>
2235
</div>
2336
</div>
2437
</div>
2538
</div>
26-
</div>
27-
{% endfor %}
39+
40+
<script>
41+
const viewMoreButton = document.getElementById('viewMoreButton');
42+
const hideButton = document.getElementById('hideButton');
43+
const awardItems = document.querySelectorAll('.award-item');
44+
45+
viewMoreButton.addEventListener('click', function () {
46+
// Show all hidden awards
47+
awardItems.forEach((item, index) => {
48+
if (index >= 8) {
49+
item.classList.remove('d-none');
50+
}
51+
});
52+
// Show the Hide button and hide the View More button
53+
viewMoreButton.classList.add('d-none');
54+
hideButton.classList.remove('d-none');
55+
});
56+
57+
hideButton.addEventListener('click', function () {
58+
// Hide awards after the first 8
59+
awardItems.forEach((item, index) => {
60+
if (index >= 8) {
61+
item.classList.add('d-none');
62+
}
63+
});
64+
// Show the View More button and hide the Hide button
65+
hideButton.classList.add('d-none');
66+
viewMoreButton.classList.remove('d-none');
67+
});
68+
</script>
69+
2870

2971
{% endblock %}
3072
{% block footer %}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{% extends 'base.html' %}
2+
{% load static %}
3+
{% block content %}
4+
5+
<div class="title-small">
6+
<h1>{{ committee_history.title }}</h1>
7+
<h5><i>Meet everyone who has contributed to MPS over the years!</i></h5>
8+
<h5><i>If you were on committee previously and are not listed, please let us know at <a href="mailto:webmaster@dcumps.ie">webmaster@dcumps.ie</a></i></h5>
9+
</div>
10+
<div class="container">
11+
<div class="row justify-content-center">
12+
<div class="col-md-8 custom-box shadow-lg bg-body">
13+
<div class="awards">
14+
<div class="center-contents shadow-lg bg-body" style="background-color: #202E4E; border-radius: 15px; padding-top: 10px; padding-bottom: 10px;">
15+
<ul style="padding-left: 10px; padding-right: 10px; list-style: none; text-align: left;">
16+
{% for member in committee_history.members.all %}
17+
<li><b>{{ member.position }}</b> - {{ member.name }}</li>
18+
{% endfor %}
19+
<ul></ul>
20+
</div>
21+
</div>
22+
<div class="row justify-content-center mt-3">
23+
<a class="btn btn-primary" style="background-color: #202E4E; border-radius: 25px; border-width: 4px; border-color: white;" href="/committee/history">Back to Committee History Home</a>
24+
</div>
25+
</div>
26+
</div>
27+
</div>
28+
</div>
29+
30+
{% endblock %}
31+
{% block footer %}
32+
{% endblock %}
33+
</body>
34+
</html>

mps_site/templates/components/home/about_us.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ <h1>About Us</h1>
2323
<div class="center-contents">
2424
<a class="btn btn-primary mt-4" style="background-color: #202E4E; border-radius: 25px; border-width: 4px; border-color: white;" href="https://dcuclubsandsocs.ie/society/media-production" target="_blank">What are you waiting for? Join MPS Now!</a>
2525
</div>
26+
<div class="center-contents mt-4">
27+
<a class="btn btn-primary" style="background-color: #202E4E; border-radius: 25px; border-width: 4px; border-color: white;" href="/committee/history">View Committee History</a>
28+
</div>
2629
</div>
2730

2831
</div>

mps_site/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@
4242
path("blog/category/<category>/", views.blog_category, name="blog_category"),
4343
path("blog/author/<author>/", views.blog_author, name="blog_author"),
4444
path("committee/history", views.committee_history, name="committee_history"),
45+
path("committee/<slug:year>/", views.committee_history_detail, name="committee_history_detail"),
4546
path("thecollegeview", views.tcv, name="tcv"),
4647
]

0 commit comments

Comments
 (0)