manager: factorize appbar between date views (#75013)
This commit is contained in:
parent
c603e2a180
commit
2fa8da2617
|
@ -0,0 +1,17 @@
|
||||||
|
{% extends "chrono/manager_agenda_view.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block appbar %}
|
||||||
|
{% block navigation %}{% endblock %}
|
||||||
|
|
||||||
|
<span class="actions">
|
||||||
|
{% block actions %}
|
||||||
|
{% if user_can_manage %}
|
||||||
|
<a href="{{ agenda.get_settings_url }}">{% trans 'Settings' %}</a>
|
||||||
|
{% endif %}
|
||||||
|
<a href="" onclick="window.print()">{% trans 'Print' %}</a>
|
||||||
|
|
||||||
|
{% include "chrono/manager_agenda_view_buttons_fragment.html" with active=kind %}
|
||||||
|
{% endblock %}
|
||||||
|
</span>
|
||||||
|
{% endblock %}
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "chrono/manager_agenda_view.html" %}
|
{% extends "chrono/manager_agenda_date_view.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block bodyargs %}class="dayview"{% endblock %}
|
{% block bodyargs %}class="dayview"{% endblock %}
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
<a>{{ day|date:"SHORT_DATE_FORMAT" }}</a>
|
<a>{{ day|date:"SHORT_DATE_FORMAT" }}</a>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block appbar %}
|
{% block navigation %}
|
||||||
<span class="buttons-group">
|
<span class="buttons-group">
|
||||||
<a class="date-prev pk-button" href="{{ view.get_previous_day_url }}"><span class="sr-only">{% trans "Previous day" %}</span></a>
|
<a class="date-prev pk-button" href="{{ view.get_previous_day_url }}"><span class="sr-only">{% trans "Previous day" %}</span></a>
|
||||||
<a class="date-next pk-button" href="{{ view.get_next_day_url }}"><span class="sr-only">{% trans "Next day" %}</span></a>
|
<a class="date-next pk-button" href="{{ view.get_next_day_url }}"><span class="sr-only">{% trans "Next day" %}</span></a>
|
||||||
|
@ -23,12 +23,4 @@
|
||||||
</div>
|
</div>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</h2>
|
</h2>
|
||||||
<span class="actions">
|
|
||||||
{% block actions %}
|
|
||||||
{% if user_can_manage %}
|
|
||||||
<a href="{% url 'chrono-manager-agenda-settings' pk=agenda.id %}">{% trans 'Settings' %}</a>
|
|
||||||
{% endif %}
|
|
||||||
<a href="" onclick="window.print()">{% trans 'Print' %}</a>
|
|
||||||
{% endblock %}
|
|
||||||
</span>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "chrono/manager_agenda_view.html" %}
|
{% extends "chrono/manager_agenda_date_view.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block bodyargs %}class="monthview"{% endblock %}
|
{% block bodyargs %}class="monthview"{% endblock %}
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
<a>{{ view.date|date:"F Y" }}</a>
|
<a>{{ view.date|date:"F Y" }}</a>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block appbar %}
|
{% block navigation %}
|
||||||
<span class="buttons-group">
|
<span class="buttons-group">
|
||||||
<a class="date-prev pk-button" href="{{ view.get_previous_month_url }}"><span class="sr-only">{% trans "Previous month" %}</span></a>
|
<a class="date-prev pk-button" href="{{ view.get_previous_month_url }}"><span class="sr-only">{% trans "Previous month" %}</span></a>
|
||||||
<a class="date-next pk-button" href="{{ view.get_next_month_url }}"><span class="sr-only">{% trans "Next month" %}</span></a>
|
<a class="date-next pk-button" href="{{ view.get_next_month_url }}"><span class="sr-only">{% trans "Next month" %}</span></a>
|
||||||
|
@ -24,12 +24,4 @@
|
||||||
</div>
|
</div>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</h2>
|
</h2>
|
||||||
<span class="actions">
|
|
||||||
{% block actions %}
|
|
||||||
{% if user_can_manage %}
|
|
||||||
<a href="{{ agenda.get_settings_url }}">{% trans 'Settings' %}</a>
|
|
||||||
{% endif %}
|
|
||||||
<a href="" onclick="window.print()">{% trans 'Print' %}</a>
|
|
||||||
{% endblock %}
|
|
||||||
</span>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "chrono/manager_agenda_view.html" %}
|
{% extends "chrono/manager_agenda_date_view.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block bodyargs %}class="weekview"{% endblock %}
|
{% block bodyargs %}class="weekview"{% endblock %}
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
<a>{{ view.first_day|date:"F Y" }}</a>
|
<a>{{ view.first_day|date:"F Y" }}</a>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block appbar %}
|
{% block navigation %}
|
||||||
<span class="buttons-group">
|
<span class="buttons-group">
|
||||||
<a class="date-prev pk-button" href="{{ view.get_previous_week_url }}"><span class="sr-only">{% trans "Previous week" %}</span></a>
|
<a class="date-prev pk-button" href="{{ view.get_previous_week_url }}"><span class="sr-only">{% trans "Previous week" %}</span></a>
|
||||||
<a class="date-next pk-button" href="{{ view.get_next_week_url }}"><span class="sr-only">{% trans "Next week" %}</span></a>
|
<a class="date-next pk-button" href="{{ view.get_next_week_url }}"><span class="sr-only">{% trans "Next week" %}</span></a>
|
||||||
|
@ -51,12 +51,4 @@
|
||||||
</div>
|
</div>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</h2>
|
</h2>
|
||||||
<span class="actions">
|
|
||||||
{% block actions %}
|
|
||||||
{% if user_can_manage %}
|
|
||||||
<a href="{{ agenda.get_settings_url }}">{% trans 'Settings' %}</a>
|
|
||||||
{% endif %}
|
|
||||||
<a href="" onclick="window.print()">{% trans 'Print' %}</a>
|
|
||||||
{% endblock %}
|
|
||||||
</span>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
{% include "chrono/manager_agenda_view_buttons_fragment.html" with active='day' %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
{% include "chrono/manager_agenda_view_buttons_fragment.html" with active='month' %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
{% include "chrono/manager_agenda_view_buttons_fragment.html" with active='week' %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
{% extends "chrono/manager_agenda_day_view.html" %}
|
{% extends "chrono/manager_agenda_day_view.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block actions %}
|
|
||||||
{{ block.super }}
|
|
||||||
{% include "chrono/manager_agenda_view_buttons_fragment.html" with active='day' %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% for period, desk_infos in view.get_timetable_infos %}
|
{% for period, desk_infos in view.get_timetable_infos %}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
{% extends "chrono/manager_agenda_month_view.html" %}
|
{% extends "chrono/manager_agenda_month_view.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block actions %}
|
|
||||||
{{ block.super }}
|
|
||||||
{% include "chrono/manager_agenda_view_buttons_fragment.html" with active='month' %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% include "chrono/manager_meetings_agenda_week_timetable_fragment.html" %}
|
{% include "chrono/manager_meetings_agenda_week_timetable_fragment.html" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
{% extends "chrono/manager_agenda_week_view.html" %}
|
{% extends "chrono/manager_agenda_week_view.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block actions %}
|
|
||||||
{{ block.super }}
|
|
||||||
{% include "chrono/manager_agenda_view_buttons_fragment.html" with active='week' %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% include "chrono/manager_meetings_agenda_week_timetable_fragment.html" %}
|
{% include "chrono/manager_meetings_agenda_week_timetable_fragment.html" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1299,6 +1299,7 @@ class AgendaDateView(DateMixin, ViewableAgendaMixin):
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context['agenda'] = self.agenda
|
context['agenda'] = self.agenda
|
||||||
|
context['kind'] = self.kind
|
||||||
if self.agenda.kind != 'events':
|
if self.agenda.kind != 'events':
|
||||||
try:
|
try:
|
||||||
context['hour_span'] = max(60 // self.agenda.get_base_meeting_duration(), 1)
|
context['hour_span'] = max(60 // self.agenda.get_base_meeting_duration(), 1)
|
||||||
|
@ -1342,6 +1343,8 @@ class AgendaDateView(DateMixin, ViewableAgendaMixin):
|
||||||
|
|
||||||
|
|
||||||
class AgendaDayView(AgendaDateView, DayArchiveView):
|
class AgendaDayView(AgendaDateView, DayArchiveView):
|
||||||
|
kind = 'day'
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
qs = super().get_queryset()
|
qs = super().get_queryset()
|
||||||
if self.agenda.kind != 'events':
|
if self.agenda.kind != 'events':
|
||||||
|
@ -1516,7 +1519,6 @@ class AgendaWeekMonthMixin:
|
||||||
).all()
|
).all()
|
||||||
else:
|
else:
|
||||||
context['single_desk'] = bool(len(self.agenda.prefetched_desks) == 1)
|
context['single_desk'] = bool(len(self.agenda.prefetched_desks) == 1)
|
||||||
context['kind'] = self.kind
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def get_timetable_infos(self):
|
def get_timetable_infos(self):
|
||||||
|
|
Loading…
Reference in New Issue