com: add birthdays block

Signed-off-by: Skia <skia@libskia.so>
This commit is contained in:
Skia 2017-09-26 13:45:14 +02:00
parent 7b48156259
commit b87990e3db
4 changed files with 79 additions and 22 deletions

View File

@ -36,6 +36,24 @@
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
<div id="birthdays">
<div id="birthdays_title">{% trans %}Birthdays{% endtrans %}</div>
<div id="birthdays_content">
<ul class="birthdays_year">
{% for d in birthdays.dates('date_of_birth', 'year', 'DESC') %}
<li>
{% trans age=timezone.now().year - d.year %}{{ age }} year old{% endtrans %}
<ul>
{% for u in birthdays.filter(date_of_birth__year=d.year) %}
<li><a href="{{ u.get_absolute_url() }}">{{ u.get_short_name() }}</a></li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
</div>
</div>
</div> </div>

View File

@ -283,6 +283,10 @@ class NewsListView(CanViewMixin, ListView):
kwargs = super(NewsListView, self).get_context_data(**kwargs) kwargs = super(NewsListView, self).get_context_data(**kwargs)
kwargs['NewsDate'] = NewsDate kwargs['NewsDate'] = NewsDate
kwargs['timedelta'] = timedelta kwargs['timedelta'] = timedelta
kwargs['birthdays'] = User.objects\
.filter(date_of_birth__month=timezone.now().month, date_of_birth__day=timezone.now().day)\
.filter(role__in=['STUDENT', 'FORMER_STUDENT'])\
.order_by('-date_of_birth')
return kwargs return kwargs

View File

@ -364,21 +364,22 @@ header {
text-transform: uppercase; text-transform: uppercase;
font-size: 1.1em; font-size: 1.1em;
border: solid 1px black; border: solid 1px black;
&:last-of-type { &:not(:first-of-type) {
margin: 2em 0em 1em 0em; margin: 2em 0em 1em 0em;
} }
} }
} }
/* AGENDA */ /* AGENDA/BIRTHDAYS */
#agenda { #agenda,#birthdays {
box-shadow: grey 2px 2px 2px;
display: block; display: block;
width: 100%; width: 100%;
background: white; background: white;
box-shadow: grey 2px 2px 2px;
font-size: 70%; font-size: 70%;
border: solid 1px $black-color; border: solid 1px $black-color;
#agenda_title { margin-bottom: 1em;
#agenda_title,#birthdays_title {
margin: 0em; margin: 0em;
padding: 0.5em; padding: 0.5em;
font-weight: bold; font-weight: bold;
@ -391,6 +392,8 @@ header {
#agenda_content { #agenda_content {
overflow: auto; overflow: auto;
height: 20em; height: 20em;
}
#agenda_content,#birthdays_content {
.agenda_item { .agenda_item {
padding: 0.5em; padding: 0.5em;
margin-bottom: 0.5em; margin-bottom: 0.5em;
@ -407,9 +410,27 @@ header {
} }
} }
} }
ul.birthdays_year {
margin: 0em;
list-style-type: none;
font-weight: bold;
>li {
padding: 0.5em;
&:nth-child(even) {
background: $secondary-neutral-light-color;
} }
} }
/* END AGENDA */ ul {
margin: 0em;
margin-left: 1em;
list-style-type: square;
list-style-position: inside;
font-weight: normal;
}
}
}
}
/* END AGENDA/BIRTHDAYS */
/* EVENTS TODAY AND NEXT FEW DAYS */ /* EVENTS TODAY AND NEXT FEW DAYS */
.news_events_group { .news_events_group {

View File

@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-09-25 18:37+0200\n" "POT-Creation-Date: 2017-09-26 13:32+0200\n"
"PO-Revision-Date: 2016-07-18\n" "PO-Revision-Date: 2016-07-18\n"
"Last-Translator: Skia <skia@libskia.so>\n" "Last-Translator: Skia <skia@libskia.so>\n"
"Language-Team: AE info <ae.info@utbm.fr>\n" "Language-Team: AE info <ae.info@utbm.fr>\n"
@ -367,11 +367,12 @@ msgstr "Compte en banque : "
#: election/templates/election/election_detail.jinja:280 #: election/templates/election/election_detail.jinja:280
#: election/templates/election/election_detail.jinja:330 #: election/templates/election/election_detail.jinja:330
#: election/templates/election/election_detail.jinja:378 #: election/templates/election/election_detail.jinja:378
#: forum/templates/forum/macros.jinja:21 forum/templates/forum/macros.jinja:123 #: forum/templates/forum/macros.jinja:21
#: forum/templates/forum/macros.jinja:123
#: launderette/templates/launderette/launderette_admin.jinja:16 #: launderette/templates/launderette/launderette_admin.jinja:16
#: launderette/views.py:182 sas/templates/sas/album.jinja:26 #: launderette/views.py:182 sas/templates/sas/album.jinja:26
#: sas/templates/sas/moderation.jinja:18 sas/templates/sas/picture.jinja:74 #: sas/templates/sas/moderation.jinja:18 sas/templates/sas/picture.jinja:74
#: sas/templates/sas/picture.jinja.py:124 #: sas/templates/sas/picture.jinja:124
#: stock/templates/stock/stock_shopping_list.jinja:43 #: stock/templates/stock/stock_shopping_list.jinja:43
#: stock/templates/stock/stock_shopping_list.jinja:69 #: stock/templates/stock/stock_shopping_list.jinja:69
#: trombi/templates/trombi/detail.jinja:35 #: trombi/templates/trombi/detail.jinja:35
@ -966,7 +967,8 @@ msgstr "Cet email est déjà abonné à cette mailing"
msgid "Unregistered user" msgid "Unregistered user"
msgstr "Désabonner un utilisateur" msgstr "Désabonner un utilisateur"
#: club/templates/club/club_list.jinja:4 club/templates/club/club_list.jinja:24 #: club/templates/club/club_list.jinja:4
#: club/templates/club/club_list.jinja:24
msgid "Club list" msgid "Club list"
msgstr "Liste des clubs" msgstr "Liste des clubs"
@ -1037,7 +1039,8 @@ msgstr "Au"
msgid "Sellings" msgid "Sellings"
msgstr "Ventes" msgstr "Ventes"
#: club/templates/club/club_sellings.jinja:9 club/templates/club/stats.jinja:19 #: club/templates/club/club_sellings.jinja:9
#: club/templates/club/stats.jinja:19
#: counter/templates/counter/cash_summary_list.jinja:15 #: counter/templates/counter/cash_summary_list.jinja:15
msgid "Show" msgid "Show"
msgstr "Montrer" msgstr "Montrer"
@ -1372,8 +1375,8 @@ msgid "News admin"
msgstr "Administration des nouvelles" msgstr "Administration des nouvelles"
#: com/templates/com/news_admin_list.jinja:9 #: com/templates/com/news_admin_list.jinja:9
#: com/templates/com/news_detail.jinja:5 com/templates/com/news_detail.jinja:11 #: com/templates/com/news_detail.jinja:5
#: com/templates/com/news_list.jinja:4 #: com/templates/com/news_detail.jinja:11 com/templates/com/news_list.jinja:4
msgid "News" msgid "News"
msgstr "Nouvelles" msgstr "Nouvelles"
@ -1560,15 +1563,24 @@ msgstr "Administrer les news"
msgid "Agenda" msgid "Agenda"
msgstr "Agenda" msgstr "Agenda"
#: com/templates/com/news_list.jinja:63 #: com/templates/com/news_list.jinja:41
msgid "Birthdays"
msgstr "Anniversaires"
#: com/templates/com/news_list.jinja:46
#, python-format
msgid "%(age)s year old"
msgstr "%(age)s ans"
#: com/templates/com/news_list.jinja:85
msgid "Events today and the next few days" msgid "Events today and the next few days"
msgstr "Événements aujourd'hui et dans les prochains jours" msgstr "Événements aujourd'hui et dans les prochains jours"
#: com/templates/com/news_list.jinja:96 #: com/templates/com/news_list.jinja:123
msgid "Nothing to come..." msgid "Nothing to come..."
msgstr "Rien à venir..." msgstr "Rien à venir..."
#: com/templates/com/news_list.jinja:102 #: com/templates/com/news_list.jinja:130
msgid "Coming soon... don't miss!" msgid "Coming soon... don't miss!"
msgstr "Prochainement... à ne pas rater!" msgstr "Prochainement... à ne pas rater!"
@ -1700,15 +1712,15 @@ msgstr "Ce champ est obligatoire."
msgid "You crazy? You can not finish an event before starting it." msgid "You crazy? You can not finish an event before starting it."
msgstr "T'es fou? Un événement ne peut pas finir avant même de commencer." msgstr "T'es fou? Un événement ne peut pas finir avant même de commencer."
#: com/views.py:326 #: com/views.py:329
msgid "Delete and save to regenerate" msgid "Delete and save to regenerate"
msgstr "Supprimer et sauver pour regénérer" msgstr "Supprimer et sauver pour regénérer"
#: com/views.py:334 #: com/views.py:337
msgid "Weekmail of the " msgid "Weekmail of the "
msgstr "Weekmail du " msgstr "Weekmail du "
#: com/views.py:414 #: com/views.py:417
msgid "" msgid ""
"You must be a board member of the selected club to post in the Weekmail." "You must be a board member of the selected club to post in the Weekmail."
msgstr "" msgstr ""
@ -2184,7 +2196,7 @@ msgstr "SAS"
#: core/templates/core/base.jinja:149 forum/templates/forum/forum.jinja:10 #: core/templates/core/base.jinja:149 forum/templates/forum/forum.jinja:10
#: forum/templates/forum/last_unread.jinja:13 #: forum/templates/forum/last_unread.jinja:13
#: forum/templates/forum/main.jinja:6 forum/templates/forum/main.jinja.py:11 #: forum/templates/forum/main.jinja:6 forum/templates/forum/main.jinja:11
#: forum/templates/forum/main.jinja:14 forum/templates/forum/reply.jinja:15 #: forum/templates/forum/main.jinja:14 forum/templates/forum/reply.jinja:15
#: forum/templates/forum/topic.jinja:30 #: forum/templates/forum/topic.jinja:30
msgid "Forum" msgid "Forum"
@ -2446,11 +2458,13 @@ msgstr "Partager sur Facebook"
msgid "Tweet" msgid "Tweet"
msgstr "Tweeter" msgstr "Tweeter"
#: core/templates/core/macros.jinja:39 core/templates/core/user_detail.jinja:27 #: core/templates/core/macros.jinja:39
#: core/templates/core/user_detail.jinja:27
msgid "Born: " msgid "Born: "
msgstr "Né le : " msgstr "Né le : "
#: core/templates/core/macros.jinja:43 core/templates/core/user_detail.jinja:48 #: core/templates/core/macros.jinja:43
#: core/templates/core/user_detail.jinja:48
msgid "Promo: " msgid "Promo: "
msgstr "Promo : " msgstr "Promo : "