family: fix weekly agenda & current week init (#69836)
gitea-wip/combo/pipeline/head Build started... Details
gitea/combo/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Lauréline Guérin 2022-10-04 08:46:24 +02:00
parent 84fb0e9ab0
commit dab16066fa
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
2 changed files with 6 additions and 3 deletions

View File

@ -2,7 +2,10 @@ $(function () {
function initAgendaCell($cell, prefix) {
const $weekList = $(prefix + '--week-list', $cell);
const $slider = $(prefix + '--slider', $cell);
const $currentWeek = $(prefix + '--week-title.current', $cell);
let $currentWeek = $(prefix + '--week-title.current', $cell);
if (!$currentWeek.length) {
$currentWeek = $(prefix + '--week-title:first', $cell);
}
const $nextWeekButton = $(prefix + '--next-week', $cell);
const $previousWeekButton = $(prefix + '--previous-week', $cell);
const $editAgendaBtn = $(prefix + '--edit-btn', $cell);

View File

@ -11,7 +11,7 @@
<div class="weekly-agenda-cell weekly-agenda-cell-{{ cell.pk }}" data-cell-id="{{ cell.pk }}">
{% with first_monday=json.data.0.date|date|adjust_to_week_monday last_item=json.data|last %}
{% with last_day=last_item.date|date|adjust_to_week_monday|add_days:6 %}
{% now 'Y-m-W' as current_week %}
{% now 'W' as current_week %}
{% spaceless %}
<button class="weekly-agenda-cell--previous-week"></button>
<div class="weekly-agenda-cell--week-list">
@ -19,7 +19,7 @@
{% for day in first_monday|iterate_days_until:last_day %}
{% if day.weekday == 0 %}
{% with sunday=day|add_days:6 %}
<div class="weekly-agenda-cell--week-title {% if current_week == day|date:'Y-m-W' %}current{% endif %}"
<div class="weekly-agenda-cell--week-title {% if current_week == day|date:'W' %}current{% endif %}"
{% if booking_form_url %}data-edit-url="{{ booking_form_url }}{% if '?' in booking_form_url %}&{% else %}?{% endif %}current={{ day|adjust_to_week_monday|date:'Y-m-d' }}"{% endif %}>
{% blocktrans with day_date=day|date:'d/m' sunday_date=sunday|date:'d/m' %}Week<br class="weekbreak"> of {{ day_date }} to {{ sunday_date }}{% endblocktrans %}
</div>