Skip to content

Commit

Permalink
feat: added previous_roles attribute to Member model
Browse files Browse the repository at this point in the history
  • Loading branch information
JStoresund committed Oct 17, 2024
1 parent a4de522 commit abca2f9
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 5.0.2 on 2024-10-17 16:48

import web.modelfields
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('internal', '0026_add_secret_permissions'),
]

operations = [
migrations.AddField(
model_name='historicalmember',
name='previous_roles',
field=web.modelfields.UnlimitedCharField(blank=True, verbose_name='previous roles'),
),
migrations.AddField(
model_name='member',
name='previous_roles',
field=web.modelfields.UnlimitedCharField(blank=True, verbose_name='previous roles'),
),
]
1 change: 1 addition & 0 deletions src/internal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Member(models.Model):
verbose_name=_("committees"),
)
role = UnlimitedCharField(blank=True, verbose_name=_("role"))
previous_roles = UnlimitedCharField(blank=True, verbose_name=_("previous roles"))
contact_email = models.EmailField(blank=True, verbose_name=_("contact email"))
# The email address of a Google user can potentially belong to any host, not just "gmail.com"
google_email = models.EmailField(blank=True, verbose_name=_("Google email"))
Expand Down
6 changes: 4 additions & 2 deletions src/internal/static/internal/js/member_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ function showDetailedMemberInformation(member) {
dateQuitOrRetired: `${member.data.semesterQuitOrRetired} (${member.data.dateQuitOrRetired})`,
reasonQuit: member.data.reasonQuit,
role: member.data.role,
previous_roles: member.data.previous_roles,
guidanceExemption: member.data.guidanceExemption,
comment: member.data.comment,
};
Expand Down Expand Up @@ -311,7 +312,7 @@ function setup() {
state.searchValue = $searchInput.val();

// Package member information
$("#member-table tbody tr").each((index, row) => {
$("#member-table tbody tr").each((_index, row) => {
const $row = $(row);

const searchableData = {
Expand All @@ -332,6 +333,7 @@ function setup() {
semesterJoined: $row.data("semester-joined"),
reasonQuit: $.trim($row.data("reason-quit")),
role: $.trim($row.data("role")),
previous_roles: $.trim($row.data("previous_roles")),
comment: $.trim($row.data("comment")),
};

Expand Down Expand Up @@ -391,7 +393,7 @@ function setup() {
state.allMembers.push(member);
});

for (const sortAttribute of ["name", "committees", "status", "dateJoinedSortable", "contactEmail", "role", "phone"]) {
for (const sortAttribute of ["name", "committees", "status", "dateJoinedSortable", "contactEmail", "role", "previous_roles", "phone"]) {
$(`#member-sort-${sortAttribute}`).closest("th").click((e) => setSort(
sortAttribute, $(e.target).find(".icon"),
));
Expand Down
4 changes: 4 additions & 0 deletions src/internal/templates/internal/member_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ <h1 class="title-with-buttons">
<th>
{% translate "role"|capfirst %}<i id="member-sort-role" class="sort icon"></i>
</th>
<th class="mobile hidden">
Previous roles<i id="member-sort-previous_roles" class="sort icon"></i>
</th>
<th class="mobile hidden">
{% translate "status"|capfirst %}<i id="member-sort-status" class="sort icon"></i>
</th>
Expand Down Expand Up @@ -216,6 +219,7 @@ <h1 class="title-with-buttons">
{% endfor %}
</td>
<td>{{ member.role }}</td>
<td class="mobile hidden">{{ member.previous_roles }}</td>
<td class="label-cell mobile hidden">
{% for status_name, color in membership_status %}
<div class="ui {{ color }} label">{{ status_name }}</div>
Expand Down

0 comments on commit abca2f9

Please sign in to comment.