Skip to content

Commit

Permalink
remade the migration for hopefully prob the last time
Browse files Browse the repository at this point in the history
fixed the about page!
  • Loading branch information
JasonLovesDoggo committed Jan 4, 2024
1 parent 8bae7c8 commit b1fa512
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 86 deletions.
26 changes: 13 additions & 13 deletions core/migrations/0069_staffmember_alter_user_options_and_more.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ class Migration(migrations.Migration):
core.utils.fields.ArrayField(
base_field=models.CharField(
choices=[
("PM", "Project Manager"),
("frontend", "Frontend Developer"),
("backend", "Backend Developer"),
("app", "App Developer"),
("graphics", "Graphic Designer"),
("content", "Content Creator"),
("doodle", "Doodle Developer"),
("Project Manager", "Project Manager"),
("Frontend Developer", "Frontend Developer"),
("Backend Developer", "Backend Developer"),
("App Developer", "App Developer"),
("Graphic Designer", "Graphic Designer"),
("Content Creator", "Content Creator"),
("Doodle Developer", "Doodle Developer"),
]
),
help_text="The positions the user had/does hold.",
Expand All @@ -84,12 +84,12 @@ class Migration(migrations.Migration):
core.utils.fields.ArrayField(
base_field=models.CharField(
choices=[
("frontend", "Frontend Developer"),
("backend", "Backend Developer"),
("app", "App Developer"),
("graphics", "Graphic Designer"),
("content", "Content Creator"),
("doodle", "Doodle Developer"),
("Frontend Developer", "Frontend Developer"),
("Backend Developer", "Backend Developer"),
("App Developer", "App Developer"),
("Graphic Designer", "Graphic Designer"),
("Content Creator", "Content Creator"),
("Doodle Developer", "Doodle Developer"),
]
),
blank=True,
Expand Down
6 changes: 2 additions & 4 deletions core/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,11 @@ class StaffMember(models.Model):
primary_key=True,
related_name="staff")
bio = models.TextField(blank=False, null=False, help_text="The users staff bio (displayed on the staff page).")
_positions_options = tuple(settings.METROPOLIS_POSITIONS.items())
positions = ArrayField(base_field=CharField(choices=_positions_options), help_text="The positions the user had/does hold.")
positions = ArrayField(base_field=CharField(choices=settings.METROPOLIS_POSITIONS), help_text="The positions the user had/does hold.")
positions_leading = ArrayField(
blank=True,
null=True,
base_field=CharField(choices=tuple(({key: val for key,
val in _positions_options if key != 'PM'}).items())), # remove PM from the list of positions leading as all PM's are leading PM
base_field=CharField(choices=[(key, val) for key, val in settings.METROPOLIS_POSITIONS if key != 'Project Manager']),
)

years = ArrayField(base_field=CharField(choices=calculate_years(fmt="generate")), help_text="The years the user was a staff member. Used to determine if the user is an alumni.")
Expand Down
11 changes: 10 additions & 1 deletion core/static/core/css/about.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
color: var(--dark-grey);
font-size: 1.2rem;
}
.member-years {
.member-years, .member-position {
font-size: 0.7rem;
margin-left: 0.9rem;
background-color: var(--link-colour);
Expand All @@ -118,6 +118,15 @@
border-radius: 0.3em;
vertical-align: middle;
}
.member-position {
background-color: var(--dark-colour);
color: var(--contrast-colour)
}

.branch-lead {
/*border: 3px solid var(--link-colour);*/
}

.member-bio {
color: var(--dark-grey);
font-size: 1rem;
Expand Down
136 changes: 84 additions & 52 deletions core/templates/core/about/about.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends 'core/base.html' %}
{% load i18n %}
{% load link_tags %}
{% load gravatar_tags %}
{% load settings_tags %}
Expand All @@ -20,23 +21,23 @@
<li class="header" id="contact">CONTACT US</li>
</ul>
<script>
$(document).ready(function() {
$(document).ready(function () {
var urlParams = new URLSearchParams(window.location.search);
if(!urlParams.get("tab")) {
if (!urlParams.get("tab")) {
$("#history").addClass("active");
urlParams.set("tab", "history");
}
history.replaceState(null, null, "?"+urlParams.toString());
$(".header").click(function() {
history.replaceState(null, null, "?" + urlParams.toString());
$(".header").click(function () {
if (this.id === "map") {
window.open("/map", "_self")
} else {
$(".header").removeClass("active");
$(this).addClass("active");
$(".content").hide();
$("#content-"+this.id).show();
$("#content-" + this.id).show();
urlParams.set("tab", this.id);
history.replaceState(null, null, "?"+urlParams.toString());
history.replaceState(null, null, "?" + urlParams.toString());
}
});
});
Expand All @@ -48,18 +49,27 @@ <h1 class="title">Welcome to the Lyon's Den</h1>
<hr>
<h2 class="subtitle">Home and Pride of the Mackenzie Lyons circa 1960</h2>
<p class="text">
William Lyon Mackenzie C. I. is a Toronto District Secondary School opened in 1960 and located in North York.
Mackenzie was named after the historical prowess William Lyon Mackenzie, the political agitator who led the
government revolt in Toronto in 1837. In its years of establishing a home of blue and gold, William Lyon Mackenzie
Collegiate not only built an incredible student body of 1500 strong, but also a strong, tight-knit community that
prides itself on multicultural diversity, inclusion, creativity and academic innovation. And, here is where the
William Lyon Mackenzie C. I. is a Toronto District Secondary School opened in 1960 and located in
North York.
Mackenzie was named after the historical prowess William Lyon Mackenzie, the political agitator who
led the
government revolt in Toronto in 1837. In its years of establishing a home of blue and gold, William
Lyon Mackenzie
Collegiate not only built an incredible student body of 1500 strong, but also a strong, tight-knit
community that
prides itself on multicultural diversity, inclusion, creativity and academic innovation. And, here
is where the
heart and soul of the Lyon Pride resound.
</p>
<p class="text">
William Lyon Mackenzie Collegiate boasts scholastic excellence in its academic programing: the MaCS enrichment
program, the Gifted Program, the ELL program, the Advanced Placement Program, and the FIT program. Collectively,
these programs have helped nurture student voice and advocacy and inspire a variety of extracurricular
opportunities from clubs and councils to intramurals and athletics, to school-wide events and initiatives, all
William Lyon Mackenzie Collegiate boasts scholastic excellence in its academic programing: the MaCS
enrichment
program, the Gifted Program, the ELL program, the Advanced Placement Program, and the FIT program.
Collectively,
these programs have helped nurture student voice and advocacy and inspire a variety of
extracurricular
opportunities from clubs and councils to intramurals and athletics, to school-wide events and
initiatives, all
of which beautifully reflect the spirit of membership - the roar of the Lyon Pride.
</p>
</div>
Expand All @@ -69,16 +79,20 @@ <h1 class="title">Our Vision</h1>
<p class="text">
By definition, a metropolis is a significant cultural center of a country or region
and a central hub for regional connections and communications.
Likewise, it is our goal at Project Metropolis to create a centralized website at WLMAC where all students can easily
Likewise, it is our goal at Project Metropolis to create a centralized website at WLMAC where all
students can easily
access and share information with their peers, making this our own, online metropolis.
</p>
<h1 class="title">About the Site</h1>
<hr>
<p class="text">
The Mackenzie Lyon's Den (Project Metropolis) is a student-driven website that showcases the best of Mackenzie's pride;
The Mackenzie Lyon's Den (Project Metropolis) is a student-driven website that showcases the best of
Mackenzie's pride;
a central microcosm and communication hub, rich in representing the diverse facets of student life.
Welcome to the Lyon's Den, the first stop to find out more about Mackenzie, its school-wide activities, events,
initiatives, clubs and councils, Student Council offerings, creative student voice and essential resources to enrich
Welcome to the Lyon's Den, the first stop to find out more about Mackenzie, its school-wide
activities, events,
initiatives, clubs and councils, Student Council offerings, creative student voice and essential
resources to enrich
Mackenzie student life!
</p>
<p class="text">
Expand All @@ -90,37 +104,53 @@ <h1 class="title">About the Site</h1>
<h1 class="title">Our Team</h1>
<hr>
<p class="text">
A diverse group of {{ member_count }} developers, artists, and creators worked in tandem to build this site. Our applications are open to all students, so if you're interested in joining our team, please apply <a href="https://forms.gle/MLrFckYTyYJ3R5KdA">here</a>
A diverse group of {{ member_count }} developers, artists, and creators worked in tandem to build
this site. Our applications are open to all students, so if you're interested in joining our team,
please apply <a href="https://forms.gle/MLrFckYTyYJ3R5KdA">here</a>
</p>
<h1 class="title">Members</h1>
<hr>
{% for name, branch in members.items %}
<h2 class="subtitle">{{name}}{{ branch.keys|pluralize }}</h2>
{% for member in branch %}
<a href="{{ member.user.username|user_url}}">
<h2 class="subtitle">{{ name }}{{ branch.keys|pluralize }}</h2>
{% for member in branch %}
<a href="{{ member.user.username|user_url }}">
{% if name in member.positions_leading %}
<div class="member branch-lead">
{% else %}
<div class="member">
<div class="member-name">
<div class="member-image">
<img class="circle" src="{{ member.user.gravatar_url}}">
</div>
<div class="member-text">
{{member.user.first_name}} {{member.user.last_name}}
{% if member.years %}
<span class="member-years">
{{ member.years|join:", " }}
{% endif %}
<div class="member-name">
<div class="member-image">
<img class="circle" src="{{ member.user.gravatar_url }}">
</div>
<div class="member-text">
{{ member.user.first_name }} {{ member.user.last_name }}

{% if name in member.positions_leading %}
<span class="member-position">
{% translate 'Lead' %}
</span>
{% endif %}
</div>
</div>
<hr>
<div class="member-bio">
{{ member.bio}}
</div>
{% endif %}
{% if member.years %}
{% if name in member.positions_leading %}
<span class="member-years" style="margin-left: 0.5rem;">
{% else %}
<span class="member-years">
{% endif %}
{{ member.years|join:", " }}
</span>
{% endif %}
</div>
</a>
{% empty %}
No members under this position.
{% endfor %}
</div>
<hr>
<div class="member-bio">
{{ member.bio }}
</div>
</div>
</a>
{% empty %}
No members under this position.
{% endfor %}
{% endfor %}
</div>
<div class="content" id="content-contact">
Expand Down Expand Up @@ -161,7 +191,8 @@ <h1 class="title">Contact Us</h1>
</ul>
<br>
<div class="content-embed">
<iframe src="https://docs.google.com/forms/d/e/1FAIpQLSerD9wL2Sg8AIEVxc7ZPPIYcNPnCBnUuXTxOajhkvv8TMxwAw/viewform?embedded=true" frameborder="0" marginheight="0" marginwidth="0">
<iframe src="https://docs.google.com/forms/d/e/1FAIpQLSerD9wL2Sg8AIEVxc7ZPPIYcNPnCBnUuXTxOajhkvv8TMxwAw/viewform?embedded=true"
frameborder="0" marginheight="0" marginwidth="0">
Loading…
</iframe>
</div>
Expand Down Expand Up @@ -211,7 +242,8 @@ <h3 class="section-title">Principal</h3>
<i class="zmdi zmdi-email zmdi-hc-lg" aria-hidden="true"></i>
<p>Mrs. Cynthia Nguyen ([email protected])</p>
</a>
</li> <h3 class="section-title">Vice Principals</h3>
</li>
<h3 class="section-title">Vice Principals</h3>
<li>
<a class="link" href="mailto:[email protected]" target="_blank">
<i class="zmdi zmdi-email zmdi-hc-lg" aria-hidden="true"></i>
Expand All @@ -232,7 +264,7 @@ <h3 class="section-title">Principal</h3>
</li>
</div>
</ul>
{% comment %}
{% comment %}
{% if user.is_authenticated %}
<h2 class="subtitle">Staff</h2>
<hr>
Expand All @@ -257,17 +289,17 @@ <h2 class="subtitle">Staff</h2>
{% endcomment %}
</div>
<script>
$(document).ready(function() {
$(document).ready(function () {
var urlParams = new URLSearchParams(window.location.search);
$(".content").hide();
if(!$("#content-"+urlParams.get("tab")).length) {
if (!$("#content-" + urlParams.get("tab")).length) {
urlParams.set("tab", "history");
history.replaceState(null, null, "?"+urlParams.toString());
history.replaceState(null, null, "?" + urlParams.toString());
}
$("#content-"+urlParams.get("tab")).show();
$("#content-" + urlParams.get("tab")).show();
$(".header").removeClass("active");
$("#"+urlParams.get("tab")).addClass("active");
//$(".card-authors-text").find("a").addClass("link");
$("#" + urlParams.get("tab")).addClass("active");
//$(".card-authors-text").find("a").addClass("link");
});
</script>
</div>
Expand Down
10 changes: 4 additions & 6 deletions core/views/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def get_context_data(self, **kwargs) -> Dict[int, TeamData]:

# Group members based on positions and alumni status
grouped_members: TeamData = {
name: [] for name in settings.METROPOLIS_POSITIONS.values()
position: [] for _, position in settings.METROPOLIS_POSITIONS
}
grouped_members["Alumni"] = []
for member in members_data:
Expand All @@ -157,11 +157,9 @@ def get_context_data(self, **kwargs) -> Dict[int, TeamData]:
if member["is_alumni"] or positions is None:
grouped_members["Alumni"].append(member)
continue

for position in positions:
key = settings.METROPOLIS_POSITIONS[position]
grouped_members[key].append(member)


[grouped_members[position].append(member) for position in positions]

context["members"]: TeamData = dict(grouped_members)
context["member_count"]: int = len(members_data)
return context
Expand Down
19 changes: 9 additions & 10 deletions metropolis/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,16 +377,15 @@

# Metropolis settings

METROPOLIS_POSITIONS = {
"PM": "Project Manager",
"frontend": "Frontend Developer",
"backend": "Backend Developer",
"app": "App Developer",
"graphics": "Graphic Designer",
"content": "Content Creator",
"doodle": "Doodle Developer",
}

METROPOLIS_POSITIONS = (
("Project Manager", "Project Manager"),
("Frontend Developer", "Frontend Developer"),
("Backend Developer", "Backend Developer"),
("App Developer", "App Developer"),
("Graphic Designer", "Graphic Designer"),
("Content Creator", "Content Creator"),
("Doodle Developer", "Doodle Developer"),
)

# Theme Settings

Expand Down

0 comments on commit b1fa512

Please sign in to comment.