mirror of
https://github.com/ae-utbm/sith.git
synced 2026-09-09 14:04:36 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35a55ff95a
|
||
|
|
00cae33a33
|
||
|
|
4bfcb6a267
|
+2
-2
@@ -50,8 +50,8 @@ class ClubAdmin(admin.ModelAdmin):
|
|||||||
@admin.register(ClubRole)
|
@admin.register(ClubRole)
|
||||||
class ClubRoleAdmin(admin.ModelAdmin):
|
class ClubRoleAdmin(admin.ModelAdmin):
|
||||||
list_display = ("name", "club", "is_board", "is_presidency")
|
list_display = ("name", "club", "is_board", "is_presidency")
|
||||||
search_fields = ("name", "club__name")
|
search_fields = ("name",)
|
||||||
autocomplete_fields = ("club", "linked_groups")
|
autocomplete_fields = ("club",)
|
||||||
list_select_related = ("club",)
|
list_select_related = ("club",)
|
||||||
list_filter = (
|
list_filter = (
|
||||||
"is_board",
|
"is_board",
|
||||||
|
|||||||
@@ -479,13 +479,6 @@ class ClubRoleCreateForm(forms.ModelForm):
|
|||||||
class ClubRoleBaseFormSet(forms.BaseInlineFormSet):
|
class ClubRoleBaseFormSet(forms.BaseInlineFormSet):
|
||||||
ordering_widget = forms.HiddenInput()
|
ordering_widget = forms.HiddenInput()
|
||||||
|
|
||||||
def __init__(self, *args, queryset=None, **kwargs):
|
|
||||||
if queryset is None:
|
|
||||||
queryset = self.model._default_manager
|
|
||||||
super().__init__(
|
|
||||||
*args, queryset=queryset.prefetch_related("linked_groups"), **kwargs
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
ClubRoleFormSet = forms.inlineformset_factory(
|
ClubRoleFormSet = forms.inlineformset_factory(
|
||||||
Club,
|
Club,
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
# Generated by Django 5.2.17 on 2026-09-01 14:36
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
dependencies = [
|
|
||||||
("club", "0017_linktype_clublink"),
|
|
||||||
("core", "0050_alter_sithfile_moderator"),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="clubrole",
|
|
||||||
name="linked_groups",
|
|
||||||
field=models.ManyToManyField(
|
|
||||||
help_text=(
|
|
||||||
"Groups that are automatically given or removed "
|
|
||||||
"to user receiving or losing this club role"
|
|
||||||
),
|
|
||||||
related_name="club_roles",
|
|
||||||
to="core.group",
|
|
||||||
verbose_name="Linked groups",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
+11
-32
@@ -23,8 +23,6 @@
|
|||||||
#
|
#
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import operator
|
|
||||||
from functools import reduce
|
|
||||||
from typing import Iterable, Self
|
from typing import Iterable, Self
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@@ -284,15 +282,6 @@ class ClubRole(OrderedModel):
|
|||||||
"If the role is inactive, people joining the club won't be able to get it."
|
"If the role is inactive, people joining the club won't be able to get it."
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
linked_groups = models.ManyToManyField(
|
|
||||||
Group,
|
|
||||||
verbose_name=_("Linked groups"),
|
|
||||||
help_text=_(
|
|
||||||
"Groups that are automatically given or removed "
|
|
||||||
"to user receiving or losing this club role"
|
|
||||||
),
|
|
||||||
related_name="linked_roles",
|
|
||||||
)
|
|
||||||
|
|
||||||
order_with_respect_to = "club"
|
order_with_respect_to = "club"
|
||||||
|
|
||||||
@@ -545,7 +534,7 @@ class Membership(models.Model):
|
|||||||
def _remove_club_groups(
|
def _remove_club_groups(
|
||||||
memberships: Iterable[Membership],
|
memberships: Iterable[Membership],
|
||||||
) -> tuple[int, dict[str, int]]:
|
) -> tuple[int, dict[str, int]]:
|
||||||
"""Remove users of those memberships from the club and club role groups.
|
"""Remove users of those memberships from the club groups.
|
||||||
|
|
||||||
For example, if a user is in the Troll club board,
|
For example, if a user is in the Troll club board,
|
||||||
he is in the board group and the members group of the Troll.
|
he is in the board group and the members group of the Troll.
|
||||||
@@ -564,19 +553,15 @@ class Membership(models.Model):
|
|||||||
clubs = {m.club_id for m in memberships}
|
clubs = {m.club_id for m in memberships}
|
||||||
users = {m.user_id for m in memberships}
|
users = {m.user_id for m in memberships}
|
||||||
groups = Group.objects.filter(Q(club__in=clubs) | Q(club_board__in=clubs))
|
groups = Group.objects.filter(Q(club__in=clubs) | Q(club_board__in=clubs))
|
||||||
role_groups = [
|
|
||||||
Q(user_id=m.user_id, group__linked_roles=m.role_id) for m in memberships
|
|
||||||
]
|
|
||||||
return User.groups.through.objects.filter(
|
return User.groups.through.objects.filter(
|
||||||
(Q(group__in=groups) & Q(user__in=users))
|
Q(group__in=groups) & Q(user__in=users)
|
||||||
| reduce(operator.or_, role_groups)
|
|
||||||
).delete()
|
).delete()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _add_club_groups(
|
def _add_club_groups(
|
||||||
memberships: Iterable[Membership],
|
memberships: Iterable[Membership],
|
||||||
) -> list[User.groups.through]:
|
) -> list[User.groups.through]:
|
||||||
"""Add users of those memberships to the club and club role groups.
|
"""Add users of those memberships to the club groups.
|
||||||
|
|
||||||
For example, if a user just joined the Troll club board,
|
For example, if a user just joined the Troll club board,
|
||||||
he will be added in both the members group and the board group
|
he will be added in both the members group and the board group
|
||||||
@@ -597,40 +582,34 @@ class Membership(models.Model):
|
|||||||
memberships = [m for m in memberships if m.end_date is None]
|
memberships = [m for m in memberships if m.end_date is None]
|
||||||
if not memberships:
|
if not memberships:
|
||||||
return []
|
return []
|
||||||
nb_prefetched = sum(
|
|
||||||
1 for m in memberships if not hasattr(m, "club") or not hasattr(m, "role")
|
if sum(1 for m in memberships if not hasattr(m, "club")) > 1:
|
||||||
)
|
|
||||||
if nb_prefetched > 1:
|
|
||||||
# if more than one membership hasn't its `club` attribute set
|
# if more than one membership hasn't its `club` attribute set
|
||||||
# it's less expensive to reload the whole query with
|
# it's less expensive to reload the whole query with
|
||||||
# a select_related than perform a distinct query
|
# a select_related than perform a distinct query
|
||||||
# to fetch each club.
|
# to fetch each club.
|
||||||
ids = {m.id for m in memberships}
|
ids = {m.id for m in memberships}
|
||||||
memberships = list(
|
memberships = list(
|
||||||
Membership.objects.filter(id__in=ids)
|
Membership.objects.filter(id__in=ids).select_related("club")
|
||||||
.select_related("club", "role")
|
|
||||||
.prefetch_related("role__linked_groups")
|
|
||||||
)
|
)
|
||||||
groups = []
|
club_groups = []
|
||||||
for membership in memberships:
|
for membership in memberships:
|
||||||
groups.append(
|
club_groups.append(
|
||||||
User.groups.through(
|
User.groups.through(
|
||||||
user_id=membership.user_id,
|
user_id=membership.user_id,
|
||||||
group_id=membership.club.members_group_id,
|
group_id=membership.club.members_group_id,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if membership.role.is_board:
|
if membership.role.is_board:
|
||||||
groups.append(
|
club_groups.append(
|
||||||
User.groups.through(
|
User.groups.through(
|
||||||
user_id=membership.user_id,
|
user_id=membership.user_id,
|
||||||
group_id=membership.club.board_group_id,
|
group_id=membership.club.board_group_id,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
groups.extend(
|
return User.groups.through.objects.bulk_create(
|
||||||
User.groups.through(user_id=membership.user_id, group_id=g.id)
|
club_groups, ignore_conflicts=True
|
||||||
for g in membership.role.linked_groups.all()
|
|
||||||
)
|
)
|
||||||
return User.groups.through.objects.bulk_create(groups, ignore_conflicts=True)
|
|
||||||
|
|
||||||
|
|
||||||
class Mailing(models.Model):
|
class Mailing(models.Model):
|
||||||
|
|||||||
@@ -15,9 +15,6 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% extends "core/base.jinja" %}
|
{% extends "core/base.jinja" %}
|
||||||
{% block additional_css %}
|
|
||||||
<link rel="stylesheet" href="{{ static("club/list.scss") }}">
|
|
||||||
{% endblock %}
|
|
||||||
{% block description -%}
|
{% block description -%}
|
||||||
{% trans %}The list of all clubs existing at UTBM.{% endtrans %}
|
{% trans %}The list of all clubs existing at UTBM.{% endtrans %}
|
||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
@@ -26,6 +23,12 @@
|
|||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% block additional_css %}
|
||||||
|
{% if not is_fragment %}
|
||||||
|
<link rel="stylesheet" href="{{ static("club/list.scss") }}">
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% from "core/macros.jinja" import paginate_htmx %}
|
{% from "core/macros.jinja" import paginate_htmx %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
@@ -33,15 +36,17 @@
|
|||||||
<h3>{% trans %}Filters{% endtrans %}</h3>
|
<h3>{% trans %}Filters{% endtrans %}</h3>
|
||||||
<form
|
<form
|
||||||
id="club-list-filters"
|
id="club-list-filters"
|
||||||
hx-get="{{ url("club:club_list") }}"
|
method="GET"
|
||||||
|
hx-action="{{ url("club:club_list") }}"
|
||||||
hx-target="#content"
|
hx-target="#content"
|
||||||
hx-swap="outerHtml"
|
hx-swap="innerHTML"
|
||||||
hx-push-url="true"
|
hx-push-url="true"
|
||||||
|
hx-disable="find input, find button"
|
||||||
>
|
>
|
||||||
<div class="row gap-4x">
|
<div class="row gap-4x">
|
||||||
{{ form }}
|
{{ form }}
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-blue margin-bottom">
|
<button class="btn btn-blue margin-bottom">
|
||||||
<i class="fa fa-magnifying-glass"></i>{% trans %}Search{% endtrans %}
|
<i class="fa fa-magnifying-glass"></i>{% trans %}Search{% endtrans %}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -49,20 +49,6 @@
|
|||||||
{{ subform.is_active.help_text }}
|
{{ subform.is_active.help_text }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{% set groups = subform.instance.linked_groups.all()|list %}
|
|
||||||
{% if groups %}
|
|
||||||
<div>
|
|
||||||
<p>
|
|
||||||
<strong>{% trans %}Linked groups : {% endtrans %}</strong>
|
|
||||||
{{ groups|map(attribute="name")|join(", ") }}
|
|
||||||
</p>
|
|
||||||
<p class="helptext">
|
|
||||||
{% trans trimmed %}
|
|
||||||
Users receiving this role will also be assigned to those groups
|
|
||||||
{% endtrans %}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from club.forms import ClubAddMemberForm, JoinClubForm
|
|||||||
from club.models import Club, ClubRole, Membership
|
from club.models import Club, ClubRole, Membership
|
||||||
from club.tests.base import TestClub
|
from club.tests.base import TestClub
|
||||||
from core.baker_recipes import subscriber_user
|
from core.baker_recipes import subscriber_user
|
||||||
from core.models import AnonymousUser, Group, User
|
from core.models import AnonymousUser, User
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
@@ -503,29 +503,6 @@ class TestMembership(TestClub):
|
|||||||
assert self.subscriber.groups.contains(self.club.members_group)
|
assert self.subscriber.groups.contains(self.club.members_group)
|
||||||
assert self.subscriber.groups.contains(self.club.board_group)
|
assert self.subscriber.groups.contains(self.club.board_group)
|
||||||
|
|
||||||
def test_add_to_club_role_group(self):
|
|
||||||
groups = baker.make(Group, _quantity=4)
|
|
||||||
self.subscriber.groups.set(groups[:1])
|
|
||||||
self.board_role.linked_groups.set(groups[1:3])
|
|
||||||
baker.make(
|
|
||||||
Membership, club=self.club, user=self.subscriber, role=self.board_role
|
|
||||||
)
|
|
||||||
assert set(self.subscriber.groups.all()) == {
|
|
||||||
*groups[:3],
|
|
||||||
self.club.board_group,
|
|
||||||
self.club.members_group,
|
|
||||||
}
|
|
||||||
|
|
||||||
def test_remove_from_club_role_group(self):
|
|
||||||
groups = baker.make(Group, _quantity=3)
|
|
||||||
baker.make(
|
|
||||||
Membership, club=self.club, user=self.subscriber, role=self.board_role
|
|
||||||
)
|
|
||||||
self.subscriber.groups.set(groups[:1])
|
|
||||||
self.board_role.linked_groups.set(groups[1:])
|
|
||||||
self.subscriber.memberships.update(end_date=localdate())
|
|
||||||
assert set(self.subscriber.groups.all()) == {groups[0]}
|
|
||||||
|
|
||||||
def test_change_position_in_club(self):
|
def test_change_position_in_club(self):
|
||||||
"""Test that when moving from board to members, club group change"""
|
"""Test that when moving from board to members, club group change"""
|
||||||
membership = baker.make(
|
membership = baker.make(
|
||||||
|
|||||||
@@ -48,27 +48,21 @@ polyfillCountryFlagEmojis();
|
|||||||
/**
|
/**
|
||||||
* HTMX
|
* HTMX
|
||||||
*/
|
*/
|
||||||
htmx.registerExtension("aria-busy", {
|
document.body.addEventListener(
|
||||||
// biome-ignore lint/style/useNamingConvention: api's name
|
"htmx:before:request" as keyof HTMLElementEventMap,
|
||||||
htmx_before_request: (
|
(event) => {
|
||||||
_: HTMLElement,
|
(event as CustomEvent).detail.ctx.target.ariaBusy = true;
|
||||||
detail: { ctx: { target: HTMLElement | undefined } },
|
|
||||||
) => {
|
|
||||||
if (detail.ctx.target !== undefined) {
|
|
||||||
(detail.ctx.target as HTMLElement).ariaBusy = "true";
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
// biome-ignore lint/style/useNamingConvention: api's name
|
);
|
||||||
htmx_after_swap: (
|
|
||||||
_: HTMLElement,
|
|
||||||
detail: { ctx: { target: HTMLElement | undefined } },
|
|
||||||
) => {
|
|
||||||
if (detail.ctx.target !== undefined) {
|
|
||||||
(detail.ctx.target as HTMLElement).ariaBusy = null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
|
document.body.addEventListener(
|
||||||
|
"htmx:before:swap" as keyof HTMLElementEventMap,
|
||||||
|
(event) => {
|
||||||
|
(event as CustomEvent).detail.ctx.target.ariaBusy = null;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
htmx.config.transitions = true;
|
||||||
Object.assign(window, { htmx });
|
Object.assign(window, { htmx });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
{% if is_fragment %}
|
{% if is_fragment %}
|
||||||
hx-post="{{ action }}"
|
hx-post="{{ action }}"
|
||||||
hx-target="#content"
|
hx-target="#content"
|
||||||
hx-swap="outerHtml"
|
hx-swap="innerHTML"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
>{% trans %}Confirm{% endtrans %}</button>
|
>{% trans %}Confirm{% endtrans %}</button>
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
{% if is_fragment %}
|
{% if is_fragment %}
|
||||||
hx-get="{{ previous }}"
|
hx-get="{{ previous }}"
|
||||||
hx-target="#content"
|
hx-target="#content"
|
||||||
hx-swap="outerHtml"
|
hx-swap="innerHTML"
|
||||||
{% else %}
|
{% else %}
|
||||||
action="window.history.back()"
|
action="window.history.back()"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -39,13 +39,13 @@
|
|||||||
<p><button
|
<p><button
|
||||||
hx-get="{{ url('core:file_moderate', file_id=f.id) }}"
|
hx-get="{{ url('core:file_moderate', file_id=f.id) }}"
|
||||||
hx-target="#content"
|
hx-target="#content"
|
||||||
hx-swap="outerHtml"
|
hx-swap="innerHTML"
|
||||||
>{% trans %}Moderate{% endtrans %}</button> -
|
>{% trans %}Moderate{% endtrans %}</button> -
|
||||||
{% set current_page = url('core:file_moderation') + "?page=" + page_obj.number | string %}
|
{% set current_page = url('core:file_moderation') + "?page=" + page_obj.number | string %}
|
||||||
<button
|
<button
|
||||||
hx-get="{{ url('core:file_delete', file_id=f.id) }}?next={{ current_page | urlencode }}&previous={{ current_page | urlencode }}"
|
hx-get="{{ url('core:file_delete', file_id=f.id) }}?next={{ current_page | urlencode }}&previous={{ current_page | urlencode }}"
|
||||||
hx-target="#file-{{ loop.index }}"
|
hx-target="#file-{{ loop.index }}"
|
||||||
hx-swap="outerHtml"
|
hx-swap="innerHTML"
|
||||||
>{% trans %}Delete{% endtrans %}</button></p>
|
>{% trans %}Delete{% endtrans %}</button></p>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2026-09-08 23:36+0200\n"
|
"POT-Creation-Date: 2026-09-04 11:24+0200\n"
|
||||||
"PO-Revision-Date: 2016-07-18\n"
|
"PO-Revision-Date: 2016-07-18\n"
|
||||||
"Last-Translator: Maréchal <thomas.girod@utbm.fr\n"
|
"Last-Translator: Maréchal <thomas.girod@utbm.fr\n"
|
||||||
"Language-Team: AE info <ae.info@utbm.fr>\n"
|
"Language-Team: AE info <ae.info@utbm.fr>\n"
|
||||||
@@ -260,18 +260,6 @@ msgstr ""
|
|||||||
"Si ce rôle est inactif, il ne pourra pas être attribué aux gens qui "
|
"Si ce rôle est inactif, il ne pourra pas être attribué aux gens qui "
|
||||||
"rejoignent le club."
|
"rejoignent le club."
|
||||||
|
|
||||||
#: club/models.py
|
|
||||||
msgid "Linked groups"
|
|
||||||
msgstr "Groupes liés"
|
|
||||||
|
|
||||||
#: club/models.py
|
|
||||||
msgid ""
|
|
||||||
"Groups that are automatically given or removed to user receiving or losing "
|
|
||||||
"this club role"
|
|
||||||
msgstr ""
|
|
||||||
"Les groupes qui sont automatiquement donnés ou retirés quand l'utilisateur "
|
|
||||||
"reçoit ou perd ce rôle de club"
|
|
||||||
|
|
||||||
#: club/models.py election/models.py
|
#: club/models.py election/models.py
|
||||||
msgid "club role"
|
msgid "club role"
|
||||||
msgstr "rôle de club"
|
msgstr "rôle de club"
|
||||||
@@ -497,14 +485,6 @@ msgstr "Du"
|
|||||||
msgid "To"
|
msgid "To"
|
||||||
msgstr "Au"
|
msgstr "Au"
|
||||||
|
|
||||||
#: club/templates/club/club_roles.jinja
|
|
||||||
msgid "Linked groups : "
|
|
||||||
msgstr "Groupes liés : "
|
|
||||||
|
|
||||||
#: club/templates/club/club_roles.jinja
|
|
||||||
msgid "Users receiving this role will also be assigned to those groups"
|
|
||||||
msgstr "Les utilisateurs recevant ce rôle seront aussi assignés à ces groupes"
|
|
||||||
|
|
||||||
#: club/templates/club/club_roles.jinja
|
#: club/templates/club/club_roles.jinja
|
||||||
msgid ""
|
msgid ""
|
||||||
"Roles give rights on the club. Higher roles grant more rights, and the "
|
"Roles give rights on the club. Higher roles grant more rights, and the "
|
||||||
@@ -5852,17 +5832,6 @@ msgstr "les groupes pouvant créer des cotisations"
|
|||||||
msgid "Timetable generator"
|
msgid "Timetable generator"
|
||||||
msgstr "Générateur d'emploi du temps"
|
msgstr "Générateur d'emploi du temps"
|
||||||
|
|
||||||
#: timetable/templates/timetable/generator.jinja
|
|
||||||
msgid ""
|
|
||||||
"Wrong timetable format. Make sure you copied if from your student folder."
|
|
||||||
msgstr ""
|
|
||||||
"Mauvais format d'emploi du temps. Assurez-vous que vous l'avez copié depuis "
|
|
||||||
"votre dossier étudiant."
|
|
||||||
|
|
||||||
#: timetable/templates/timetable/generator.jinja
|
|
||||||
msgid "Incorrect row"
|
|
||||||
msgstr "Ligne incorrecte"
|
|
||||||
|
|
||||||
#: timetable/templates/timetable/generator.jinja
|
#: timetable/templates/timetable/generator.jinja
|
||||||
msgid "Generate"
|
msgid "Generate"
|
||||||
msgstr "Générer"
|
msgstr "Générer"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2026-09-08 23:36+0200\n"
|
"POT-Creation-Date: 2026-05-17 10:03+0200\n"
|
||||||
"PO-Revision-Date: 2024-09-17 11:54+0200\n"
|
"PO-Revision-Date: 2024-09-17 11:54+0200\n"
|
||||||
"Last-Translator: Sli <antoine@bartuccio.fr>\n"
|
"Last-Translator: Sli <antoine@bartuccio.fr>\n"
|
||||||
"Language-Team: AE info <ae.info@utbm.fr>\n"
|
"Language-Team: AE info <ae.info@utbm.fr>\n"
|
||||||
@@ -22,8 +22,8 @@ msgid ""
|
|||||||
"You're going to remove your own role from the presidency. You may lock "
|
"You're going to remove your own role from the presidency. You may lock "
|
||||||
"yourself out of this page. Do you want to continue ? "
|
"yourself out of this page. Do you want to continue ? "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Vous vous apprêtez à retirer votre propre rôle de la présidence. Vous "
|
"Vous vous apprêtez à retirer votre propre rôle de la présidence. Vous risquez "
|
||||||
"risquez de perdre l'accès à cette page. Voulez-vous continuer ?"
|
"de perdre l'accès à cette page. Voulez-vous continuer ?"
|
||||||
|
|
||||||
#: com/static/bundled/com/components/ics-calendar-index.ts
|
#: com/static/bundled/com/components/ics-calendar-index.ts
|
||||||
msgid "More info"
|
msgid "More info"
|
||||||
@@ -279,3 +279,9 @@ msgstr "Il n'a pas été possible de modérer l'image"
|
|||||||
msgid "Couldn't delete picture"
|
msgid "Couldn't delete picture"
|
||||||
msgstr "Il n'a pas été possible de supprimer l'image"
|
msgstr "Il n'a pas été possible de supprimer l'image"
|
||||||
|
|
||||||
|
#: timetable/static/bundled/timetable/generator-index.ts
|
||||||
|
msgid ""
|
||||||
|
"Wrong timetable format. Make sure you copied if from your student folder."
|
||||||
|
msgstr ""
|
||||||
|
"Mauvais format d'emploi du temps. Assurez-vous que vous l'avez copié depuis "
|
||||||
|
"votre dossier étudiant."
|
||||||
|
|||||||
+3
-3
@@ -92,11 +92,11 @@ docs = [
|
|||||||
default-groups = ["dev", "tests", "docs"]
|
default-groups = ["dev", "tests", "docs"]
|
||||||
|
|
||||||
[tool.xapian]
|
[tool.xapian]
|
||||||
version = "2.1.0"
|
version = "2.0.0"
|
||||||
# Those hashes are here to protect against supply chains attacks
|
# Those hashes are here to protect against supply chains attacks
|
||||||
# See `https://ae-utbm.github.io/sith/howto/xapian/` for more information
|
# See `https://ae-utbm.github.io/sith/howto/xapian/` for more information
|
||||||
core-sha256 = "8e1259586d342e3d12b5e1f772e9185a10f2ba16e541566b5c3c239f71b8aacc"
|
core-sha256 = "6cea3f49952a47224439a40bdb3608f928d121ad8721b9921cc42802d548ecf8"
|
||||||
bindings-sha256 = "f52ec189f13b4fa66ea625a6eb94bb32dd651b9ec806be6a911dda54cbe3875c"
|
bindings-sha256 = "9a544b69c31355a92edbcd4102cf0f1ec4407fd0a4645f4870fb52300b736910"
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
output-format = "concise" # makes ruff error logs easier to read
|
output-format = "concise" # makes ruff error logs easier to read
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ function parseSlots(s: string): TimetableSlot[] {
|
|||||||
.map((row: string) => {
|
.map((row: string) => {
|
||||||
const parsed = TIMETABLE_ROW_RE.exec(row);
|
const parsed = TIMETABLE_ROW_RE.exec(row);
|
||||||
if (!parsed?.groups) {
|
if (!parsed?.groups) {
|
||||||
throw new Error(`Couldn't parse row ${row}`, { cause: { row: row } });
|
throw new Error(`Couldn't parse row ${row}`);
|
||||||
}
|
}
|
||||||
const [startHour, startMin] = parsed.groups.startHour
|
const [startHour, startMin] = parsed.groups.startHour
|
||||||
.split(":")
|
.split(":")
|
||||||
@@ -78,7 +78,7 @@ function parseSlots(s: string): TimetableSlot[] {
|
|||||||
document.addEventListener("alpine:init", () => {
|
document.addEventListener("alpine:init", () => {
|
||||||
Alpine.data("timetableGenerator", () => ({
|
Alpine.data("timetableGenerator", () => ({
|
||||||
content: DEFAULT_TIMETABLE,
|
content: DEFAULT_TIMETABLE,
|
||||||
error: null as { incorrectRow?: string },
|
error: "",
|
||||||
displayedWeekdays: [] as WeekDay[],
|
displayedWeekdays: [] as WeekDay[],
|
||||||
courses: [] as TimetableSlot[],
|
courses: [] as TimetableSlot[],
|
||||||
startSlot: 0,
|
startSlot: 0,
|
||||||
@@ -106,9 +106,10 @@ document.addEventListener("alpine:init", () => {
|
|||||||
generate() {
|
generate() {
|
||||||
try {
|
try {
|
||||||
this.courses = parseSlots(this.content);
|
this.courses = parseSlots(this.content);
|
||||||
this.error = null;
|
} catch {
|
||||||
} catch (err) {
|
this.error = gettext(
|
||||||
this.error = { incorrectRow: err?.cause?.row };
|
"Wrong timetable format. Make sure you copied if from your student folder.",
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,23 +16,9 @@
|
|||||||
<div x-data="timetableGenerator">
|
<div x-data="timetableGenerator">
|
||||||
<form @submit.prevent="generate()">
|
<form @submit.prevent="generate()">
|
||||||
<h1>Générateur d'emploi du temps</h1>
|
<h1>Générateur d'emploi du temps</h1>
|
||||||
<template x-if="error !== null" x-cloak>
|
<div class="alert alert-red" x-show="!!error" x-cloak>
|
||||||
<div class="alert alert-red">
|
<span class="alert-main" x-text="error"></span>
|
||||||
<div class="alert-main">
|
|
||||||
<p>
|
|
||||||
{% trans trimmed %}
|
|
||||||
Wrong timetable format. Make sure you copied if from your student folder.
|
|
||||||
{% endtrans %}
|
|
||||||
</p>
|
|
||||||
<template x-if="!!error.incorrectRow">
|
|
||||||
<p>
|
|
||||||
{% trans %}Incorrect row{% endtrans %} :
|
|
||||||
<code x-text="error.incorrectRow"></code>
|
|
||||||
</p>
|
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="timetable-input">Colle ton emploi du temps (sans l'entête)</label>
|
<label for="timetable-input">Colle ton emploi du temps (sans l'entête)</label>
|
||||||
<textarea id="timetable-input" cols="30" rows="15" x-model="content"></textarea>
|
<textarea id="timetable-input" cols="30" rows="15" x-model="content"></textarea>
|
||||||
|
|||||||
Reference in New Issue
Block a user