toodego: calendar widget compatibility with calendar cell (#55586)

This commit is contained in:
Lauréline Guérin 2021-07-13 19:30:18 +02:00
parent 3d30aa6db2
commit 56da827268
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
1 changed files with 13 additions and 4 deletions

View File

@ -4,15 +4,17 @@
{% with options=widget.get_options|list %}
{% with first_monday=options.0.options.details.JOURDATE|adjust_to_week_monday last_option=options|last %}
{% with last_day=last_option.options.details.JOURDATE|adjust_to_week_monday|add_days:6 %}
{% now 'Y-m-d' as now %}
{% spaceless %}
<button class="previous-week"></button>
<ul>
{% for day in first_monday|iterate_days_until:last_day %}
{% if day.weekday == 0 %}
{% if not forloop.first %}</ul></li>{% endif %}
<li {% if forloop.first %}class="shown"{% endif %}><span class="week-title">Semaine<br class="weekbreak"> du {{day|date:"d/m"}} au {{day|add_days:6|date:"d/m"}}</span><ul>
<li><span class="week-title">Semaine<br class="weekbreak"> du {{day|date:"d/m"}} au {{day|add_days:6|date:"d/m"}}</span><ul>
{% endif %}
<li class="day-title" data-weekday="{{day.weekday}}"><strong>{{day|date:"l d/m"}}</strong></li>
<li class="day-title {% if form.var.current_day == day|date:"Y-m-d" or not form.var.current_day and now == day|date:"Y-m-d" %}current{% endif %}" data-weekday="{{day.weekday}}"><strong>{{day|date:"l d/m"}}</strong></li>
{% with day_str=day|date:"Y-m-d" %}
{% for option in options %}
{% if option.options.details.JOURDATE == day_str %}
@ -47,6 +49,7 @@
{% endfor %}
</ul>
<button class="next-week"></button>
{% endspaceless %}
{% endwith %}
{% endwith %}
{% endwith %}
@ -104,8 +107,6 @@
left: 0;
border: 1px solid black;
border-radius: 2px;
}
.template-caluire-reservations-enfant .content input[disabled] + span::before {
border: 1px solid #aaa;
}
.template-caluire-reservations-enfant .content input[disabled] + span::after {
@ -196,6 +197,14 @@ $('.template-caluire-reservations-enfant li.day-title').each(function(idx, elem)
$(elem).hide();
}
});
/* init first week shown */
var $cell = $('.template-caluire-reservations-enfant');
$('li', $cell).removeClass('shown');
if ($('li.day-title.current', $cell).length) {
$('li.day-title.current', $cell).parent().parent().addClass('shown');
} else {
$('li', $cell).first().addClass('shown');
}
$('.template-caluire-reservations-enfant input').on('change', function() {
if ($(this).is(':checked')) {
var $current_li = $(this).parents('li').first();