Projet

Général

Profil

0002-manager-factorize-event-template-part-44457.patch

Lauréline Guérin, 16 juillet 2020 10:56

Télécharger (7,56 ko)

Voir les différences:

Subject: [PATCH 2/5] manager: factorize event template part (#44457)

 .../chrono/manager_agenda_event_fragment.html | 38 +++++++++++++++++++
 .../manager_events_agenda_month_view.html     | 32 +---------------
 .../manager_events_agenda_settings.html       | 38 ++-----------------
 3 files changed, 43 insertions(+), 65 deletions(-)
 create mode 100644 chrono/manager/templates/chrono/manager_agenda_event_fragment.html
chrono/manager/templates/chrono/manager_agenda_event_fragment.html
1
{% load i18n %}
2
<li class="{% if event.booked_places_count > event.places %}overbooking{% endif %}
3
           {% if event.main_list_full %}full{% endif %}
4
           {% if not event.in_bookable_period %}not-{% endif %}bookable"
5
    {% if event.places %}
6
      data-total="{{ event.places }}" data-booked="{{ event.booked_places_count }}"
7
    {% elif event.waiting_list_places %}
8
      data-total="{{ event.waiting_list_places }}" data-booked="{{ event.waiting_list_count }}"
9
    {% endif %}
10
    ><a href="{% if settings_view %}{% url 'chrono-manager-event-edit' pk=agenda.pk event_pk=event.pk %}?next=settings{% else %}{% url 'chrono-manager-event-view' pk=agenda.pk event_pk=event.pk %}{% endif %}">
11
    {% if event.main_list_full %}<span class="full tag">{% trans "Full" %}</span>{% endif %}
12
    {% if settings_view %}
13
      {% if event.label %}{{ event.label }} {% endif %}[{% trans "identifier:" %} {{ event.slug }}]
14
    {% else %}
15
      {% if event.label %}{{ event.label }} / {% endif %}
16
    {% endif %}
17
    {{ event.start_datetime }}
18
    (
19
    {% if event.places %}
20
    {% blocktrans with places=event.places booked_places=event.booked_places_count %}{{ places }} places, {{ booked_places }} booked places{% endblocktrans %}
21
    {% endif %}
22
    {% if event.places and event.waiting_list_places %} / {% endif %}
23
    {% if event.waiting_list_places %}
24
    {% blocktrans with places=event.waiting_list_places waiting_places=event.waiting_list_count %}
25
    {{waiting_places}} on {{ places }} in waiting list
26
    {% endblocktrans %}
27
    {% endif %}
28
    )
29
    {% if settings_view and event.publication_date %}
30
    ({% trans "publication date:" %} {{ event.publication_date }})
31
    {% endif %}
32
    {% if not event.in_bookable_period %}
33
    ({% trans "out of bookable period" %})
34
    {% endif %}
35
        </a>
36
    {% if settings_view %}<a rel="popup" class="delete" href="{% url 'chrono-manager-event-delete' pk=agenda.pk event_pk=event.pk %}?next=settings">{% trans "remove" %}</a>{% endif %}
37
    <span class="occupation-bar"></span>
38
</li>
chrono/manager/templates/chrono/manager_events_agenda_month_view.html
8 8
{% if object_list %}
9 9
  <ul class="objects-list single-links">
10 10
  {% for event in object_list %}
11
    <li class="{% if event.booked_places_count > event.places %}overbooking{% endif %}
12
               {% if event.main_list_full %}full{% endif %}
13
               {% if not event.in_bookable_period %}not-{% endif %}bookable"
14
        {% if event.places %}
15
          data-total="{{event.places}}" data-booked="{{event.booked_places_count}}"
16
        {% elif event.waiting_list_places %}
17
          data-total="{{event.waiting_list_places}}" data-booked="{{event.waiting_list_count}}"
18
        {% endif %}
19
        ><a href="{% url 'chrono-manager-event-view' pk=agenda.id event_pk=event.id %}">
20
        {% if event.main_list_full %}<span class="full tag">{% trans "Full" %}</span>{% endif %}
21
        {% if event.label %}{{event.label}} / {% endif %}
22
        {{ event.start_datetime }}
23
        (
24
        {% if event.places %}
25
        {% blocktrans with places=event.places booked_places=event.booked_places_count %}{{ places }} places, {{ booked_places }} booked places{% endblocktrans %}
26
        {% endif %}
27
        {% if event.places and event.waiting_list_places %} / {% endif %}
28
        {% if event.waiting_list_places %}
29
        {% blocktrans with places=event.waiting_list_places waiting_places=event.waiting_list_count %}
30
        {{waiting_places}} on {{ places }} in waiting list
31
        {% endblocktrans %}
32
        {% endif %}
33
        )
34
        {% if not event.in_bookable_period %}
35
        ({% trans "out of bookable period" %})
36
        {% endif %}
37
            </a>
38
        <span class="occupation-bar"></span>
39
    </li>
40
    {% endfor %}
11
    {% include 'chrono/manager_agenda_event_fragment.html' %}
12
  {% endfor %}
41 13
  </ul>
42 14
  {% include "gadjo/pagination.html" %}
43 15
{% else %}
chrono/manager/templates/chrono/manager_events_agenda_settings.html
14 14
{% with view.get_events as events %}
15 15
{% if events %}
16 16
  <ul class="objects-list single-links">
17
    {% for event in events %}
18
    <li class="{% if event.booked_places_count > event.places %}overbooking{% endif %}
19
               {% if event.main_list_full %}full{% endif %}
20
               {% if not event.in_bookable_period %}not-{% endif %}bookable"
21
        {% if event.places %}
22
          data-total="{{event.places}}" data-booked="{{event.booked_places_count}}"
23
        {% elif event.waiting_list_places %}
24
          data-total="{{event.waiting_list_places}}" data-booked="{{event.waiting_list_count}}"
25
        {% endif %}
26
        ><a rel="popup" href="{% url 'chrono-manager-event-edit' pk=agenda.id event_pk=event.id %}?next=settings">
27
        {% if event.main_list_full %}<span class="full tag">{% trans "Full" %}</span>{% endif %}
28
        {% if event.label %}{{event.label}} {% endif %}[{% trans "identifier:" %} {{ event.slug }}]
29
        {{ event.start_datetime }}
30
        (
31
        {% if event.places %}
32
        {% blocktrans with places=event.places booked_places=event.booked_places_count %}{{ places }} places, {{ booked_places }} booked places{% endblocktrans %}
33
        {% endif %}
34
        {% if event.places and event.waiting_list_places %} / {% endif %}
35
        {% if event.waiting_list_places %}
36
        {% blocktrans with places=event.waiting_list_places waiting_places=event.waiting_list_count %}
37
        {{waiting_places}} on {{ places }} in waiting list
38
        {% endblocktrans %}
39
        {% endif %}
40
        )
41
        {% if event.publication_date %}
42
        ({% trans "publication date:" %} {{ event.publication_date }})
43
        {% endif %}
44
        {% if not event.in_bookable_period %}
45
        ({% trans "out of bookable period" %})
46
        {% endif %}
47
            </a>
48
        <a rel="popup" class="delete" href="{% url 'chrono-manager-event-delete' pk=agenda.id event_pk=event.id %}?next=settings">{% trans "remove" %}</a>
49
        <span class="occupation-bar"></span>
50
    </li>
51
    {% endfor %}
17
  {% for event in events %}
18
    {% include 'chrono/manager_agenda_event_fragment.html' with settings_view=True %}
19
  {% endfor %}
52 20
  </ul>
53 21
{% else %}
54 22
<div class="big-msg-info">
55
-