Projet

Général

Profil

0001-misc-current-week-on-famille-reservations-par-semain.patch

Lauréline Guérin, 29 octobre 2021 16:30

Télécharger (2,31 ko)

Voir les différences:

Subject: [PATCH] misc: current week on famille-reservations-par-semaine widget
 (#57239)

 .../widgets/famille-reservations-par-semaine.html   | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
templates/qommon/forms/widgets/famille-reservations-par-semaine.html
5 5

  
6 6
{% with first_monday=options.0.options.date|date|adjust_to_week_monday last_option=options|last %}
7 7
{% with last_day=last_option.options.date|date|adjust_to_week_monday|add_days:6 %}
8
{% now 'Y-m-d' as now %}
8 9

  
9 10
<button class="previous-week">←</button>
10 11
<ul>
11 12
{% for day in first_monday|iterate_days_until:last_day %}
12 13
{% if day.weekday == 0 %}
13 14
{% if not forloop.first %}</ul></li>{% endif %}
14
<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>
15
<li class="week{% if forloop.first %} 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>
15 16
{% endif %}
16
<li class="day-title" data-weekday="{{day.weekday}}"><strong>{{day|date:"l d/m"}}</strong></li>
17
<li class="day-title {% if now == day|date:"Y-m-d" %}current{% endif %}" data-weekday="{{day.weekday}}"><strong>{{day|date:"l d/m"}}</strong></li>
17 18
  {% with day_str=day|date:"Y-m-d" %}
18 19
    {% for option in options %}
19 20
      {% if option.options.date == day_str %}
......
175 176
    $(elem).hide();
176 177
  }
177 178
});
179
/* init first week shown */
180
var $cell = $('.template-famille-reservations-par-semaine');
181
$cell.find('li').removeClass('shown');
182
if ($('li.day-title.current', $cell).length) {
183
  $('li.day-title.current', $cell).parents('li.week').addClass('shown');
184
} else {
185
  $('li', $cell).first().addClass('shown');
186
}
178 187
</script>
179 188
{% endblock %}
180
-