manager: split agenda settings template (#38680)
This commit is contained in:
parent
ded2a305e2
commit
1940044b7a
|
@ -21,155 +21,18 @@
|
|||
{% if user_can_manage %}
|
||||
<a download href="{% url 'chrono-manager-agenda-export' pk=object.id %}">{% trans 'Export' %}</a>
|
||||
<a rel="popup" href="{% url 'chrono-manager-agenda-edit' pk=object.id %}">{% trans 'Options' %}</a>
|
||||
{% if object.kind == "events" %}
|
||||
<a rel="popup" href="{% url 'chrono-manager-agenda-import-events' pk=object.id %}">{% trans 'Import Events' %}</a>
|
||||
<a rel="popup" href="{% url 'chrono-manager-agenda-add-event' pk=object.id %}">{% trans 'New Event' %}</a>
|
||||
{% else %}
|
||||
<a rel="popup" href="{% url 'chrono-manager-agenda-add-meeting-type' pk=object.id %}">{% trans 'New Meeting Type' %}</a>
|
||||
<a rel="popup" href="{% url 'chrono-manager-agenda-add-desk' pk=object.id %}">{% trans 'New Desk' %}</a>
|
||||
{% endif %}
|
||||
{% block agenda-extra-management-actions %}
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
</span>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if object.kind == "events" %}
|
||||
<div class="section">
|
||||
<h3>{% trans "Events" %}</h3>
|
||||
<div>
|
||||
{% if object.event_set.count %}
|
||||
<ul class="objects-list single-links">
|
||||
{% for event in object.event_set.all %}
|
||||
<li class="{% if event.booked_places > event.places %}overbooking{% endif %}
|
||||
{% if event.full %}full{% endif %}
|
||||
{% if not event.in_bookable_period %}not-{% endif %}bookable"
|
||||
{% if event.places %}
|
||||
data-total="{{event.places}}" data-booked="{{event.booked_places}}"
|
||||
{% elif event.waiting_list_places %}
|
||||
data-total="{{event.waiting_list_places}}" data-booked="{{event.waiting_list}}"
|
||||
{% endif %}
|
||||
><a rel="popup" href="{% if user_can_manage %}{% url 'chrono-manager-event-edit' pk=event.id %}{% else %}#{% endif %}">
|
||||
{% if event.label %}{{event.label}} / {% endif %}
|
||||
{{ event.start_datetime }}
|
||||
{% if event.full %}/ <span class="full">{% trans "full" %}</span>{% endif %}
|
||||
(
|
||||
{% if event.places %}
|
||||
{% blocktrans with places=event.places booked_places=event.booked_places %}{{ places }} places, {{ booked_places }} booked places{% endblocktrans %}
|
||||
{% endif %}
|
||||
{% if event.places and event.waiting_list_places %} / {% endif %}
|
||||
{% if event.waiting_list_places %}
|
||||
{% blocktrans with places=event.waiting_list_places waiting_places=event.waiting_list %}
|
||||
{{waiting_places}} on {{ places }} in waiting list
|
||||
{% endblocktrans %}
|
||||
{% endif %}
|
||||
)
|
||||
{% if not event.in_bookable_period %}
|
||||
({% trans "out of bookable period" %})
|
||||
{% endif %}
|
||||
</a>
|
||||
{% if user_can_manage %}<a rel="popup" class="delete" href="{% url 'chrono-manager-event-delete' pk=event.id %}">{% trans "remove" %}</a>{% endif %}
|
||||
<span class="occupation-bar"></span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<div class="big-msg-info">
|
||||
{% blocktrans %}
|
||||
This agenda doesn't have any event yet. Click on the "New Event" button in
|
||||
the top right of the page to add a first one.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if object.kind == "meetings" %}
|
||||
|
||||
<div class="section">
|
||||
<h3>{% trans 'Meeting Types' %}</h3>
|
||||
<div>
|
||||
{% if object.meetingtype_set.count %}
|
||||
<ul class="objects-list single-links">
|
||||
{% for meeting_type in object.meetingtype_set.all %}
|
||||
<li><a rel="popup" href="{% if user_can_manage %}{% url 'chrono-manager-meeting-type-edit' pk=meeting_type.id %}{% else %}#{% endif %}">
|
||||
{{meeting_type.label}}
|
||||
<span class="duration">({{meeting_type.duration}} {% trans "minutes" %})</span>
|
||||
<span class="identifier">[{% trans "identifier:" %} {{meeting_type.slug}}]</span>
|
||||
</a>
|
||||
{% if user_can_manage %}<a rel="popup" class="delete" href="{% url 'chrono-manager-meeting-type-delete' pk=meeting_type.id %}">{% trans "remove" %}</a>{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<div class="big-msg-info">
|
||||
{% blocktrans %}
|
||||
This agenda doesn't have any meeting type yet. Click on the "New Meeting Type" button in
|
||||
the top right of the page to add a first one.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h3>{% trans 'Time Periods' %}</h3>
|
||||
<div>
|
||||
{% if object.desk_set.count %}
|
||||
<div class="timeperiods">
|
||||
{% for desk in object.desk_set.all %}
|
||||
<div class="timeperiod">
|
||||
{% url 'chrono-manager-agenda-add-time-period' agenda_pk=object.pk pk=desk.pk as add_time_period_url %}
|
||||
<ul class="objects-list single-links">
|
||||
{% if forloop.counter != 1 or forloop.revcounter != 1 %}
|
||||
<li><a rel="popup" href="{% if user_can_manage %}{% url 'chrono-manager-desk-edit' pk=desk.id %}{% else %}#{% endif %}">
|
||||
<strong>{{ desk.label }}</strong>
|
||||
</a>
|
||||
{% if user_can_manage %}<a rel="popup" class="delete" href="{% url 'chrono-manager-desk-delete' pk=desk.id %}">{% trans "remove" %}</a>{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% for time_period in desk.timeperiod_set.all %}
|
||||
<li><a rel="popup" href="{% if user_can_manage %}{% url 'chrono-manager-time-period-edit' pk=time_period.id %}{% else %}#{% endif %}">
|
||||
{{time_period.weekday_str}} / {{time_period.start_time}} → {{time_period.end_time}} </a>
|
||||
{% if user_can_manage %}<a rel="popup" class="delete" href="{% url 'chrono-manager-time-period-delete' pk=time_period.id %}">{% trans "remove" %}</a>{% endif %}
|
||||
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% if user_can_manage %}
|
||||
<li><a class="add" rel="popup" href="{{add_time_period_url}}">{% trans 'Add a time period' %}</a></li>
|
||||
{% endif %}
|
||||
{% if desk.timeperiod_set.count %}
|
||||
{% url 'chrono-manager-agenda-add-time-period-exception' agenda_pk=object.pk pk=desk.pk as add_time_period_exception_url %}
|
||||
<li><a href="#"><strong>{% trans 'Exceptions' %}</strong></a><a class="link-action-icon upload" rel="popup" href="{% url 'chrono-manager-desk-add-import-time-period-exceptions' pk=desk.pk %}" title="{% trans 'Import exceptions from .ics' %}">{% trans 'upload' %}</a></li>
|
||||
{% for exception in desk.get_exceptions_within_two_weeks %}
|
||||
<li><a rel="popup" href="{% if user_can_manage %}{% url 'chrono-manager-time-period-exception-edit' pk=exception.pk %}{% else %}#{% endif %}">
|
||||
{{ exception }}
|
||||
{% if user_can_manage %}<a rel="popup" class="delete" href="{% url 'chrono-manager-time-period-exception-delete' pk=exception.id %}">{% trans "remove" %}</a>{% endif %}
|
||||
{% endfor %}
|
||||
{% if not desk.are_all_exceptions_displayed %}
|
||||
<li><a class="timeperiod-exception-all" rel="popup" data-selector="div.timeperiod" href="{% url 'chrono-manager-time-period-exception-extract-list' pk=desk.id %}">({% trans 'see all exceptions' %})</a></li>
|
||||
{% endif %}
|
||||
<li><a class="add" rel="popup" href="{{add_time_period_exception_url}}">{% trans 'Add a time period exception' %}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="big-msg-info">
|
||||
{% blocktrans %}
|
||||
This agenda doesn't have any desk yet. Click on the "New Desk" button in
|
||||
the top right of the page to add a first one.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% block agenda-settings %}
|
||||
{% endblock %}
|
||||
|
||||
{% block agenda-permissions %}
|
||||
<div class="section">
|
||||
<h3>{% trans "Permissions" %}</h3>
|
||||
<div>
|
||||
|
@ -179,7 +42,9 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block agenda-booking-delays %}
|
||||
<div class="section">
|
||||
<h3>{% trans "Booking Delays" %}</h3>
|
||||
<div>
|
||||
|
@ -189,5 +54,6 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
{% extends "chrono/manager_agenda_settings.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block agenda-extra-management-actions %}
|
||||
<a rel="popup" href="{% url 'chrono-manager-agenda-import-events' pk=object.id %}">{% trans 'Import Events' %}</a>
|
||||
<a rel="popup" href="{% url 'chrono-manager-agenda-add-event' pk=object.id %}">{% trans 'New Event' %}</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block agenda-settings %}
|
||||
|
||||
<div class="section">
|
||||
<h3>{% trans "Events" %}</h3>
|
||||
<div>
|
||||
{% if object.event_set.count %}
|
||||
<ul class="objects-list single-links">
|
||||
{% for event in object.event_set.all %}
|
||||
<li class="{% if event.booked_places > event.places %}overbooking{% endif %}
|
||||
{% if event.full %}full{% endif %}
|
||||
{% if not event.in_bookable_period %}not-{% endif %}bookable"
|
||||
{% if event.places %}
|
||||
data-total="{{event.places}}" data-booked="{{event.booked_places}}"
|
||||
{% elif event.waiting_list_places %}
|
||||
data-total="{{event.waiting_list_places}}" data-booked="{{event.waiting_list}}"
|
||||
{% endif %}
|
||||
><a rel="popup" href="{% if user_can_manage %}{% url 'chrono-manager-event-edit' pk=event.id %}{% else %}#{% endif %}">
|
||||
{% if event.label %}{{event.label}} / {% endif %}
|
||||
{{ event.start_datetime }}
|
||||
{% if event.full %}/ <span class="full">{% trans "full" %}</span>{% endif %}
|
||||
(
|
||||
{% if event.places %}
|
||||
{% blocktrans with places=event.places booked_places=event.booked_places %}{{ places }} places, {{ booked_places }} booked places{% endblocktrans %}
|
||||
{% endif %}
|
||||
{% if event.places and event.waiting_list_places %} / {% endif %}
|
||||
{% if event.waiting_list_places %}
|
||||
{% blocktrans with places=event.waiting_list_places waiting_places=event.waiting_list %}
|
||||
{{waiting_places}} on {{ places }} in waiting list
|
||||
{% endblocktrans %}
|
||||
{% endif %}
|
||||
)
|
||||
{% if not event.in_bookable_period %}
|
||||
({% trans "out of bookable period" %})
|
||||
{% endif %}
|
||||
</a>
|
||||
{% if user_can_manage %}<a rel="popup" class="delete" href="{% url 'chrono-manager-event-delete' pk=event.id %}">{% trans "remove" %}</a>{% endif %}
|
||||
<span class="occupation-bar"></span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<div class="big-msg-info">
|
||||
{% blocktrans %}
|
||||
This agenda doesn't have any event yet. Click on the "New Event" button in
|
||||
the top right of the page to add a first one.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,91 @@
|
|||
{% extends "chrono/manager_agenda_settings.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block agenda-extra-management-actions %}
|
||||
<a rel="popup" href="{% url 'chrono-manager-agenda-add-meeting-type' pk=object.id %}">{% trans 'New Meeting Type' %}</a>
|
||||
<a rel="popup" href="{% url 'chrono-manager-agenda-add-desk' pk=object.id %}">{% trans 'New Desk' %}</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block agenda-settings %}
|
||||
|
||||
<div class="section">
|
||||
<h3>{% trans 'Meeting Types' %}</h3>
|
||||
<div>
|
||||
{% if object.meetingtype_set.count %}
|
||||
<ul class="objects-list single-links">
|
||||
{% for meeting_type in object.meetingtype_set.all %}
|
||||
<li><a rel="popup" href="{% if user_can_manage %}{% url 'chrono-manager-meeting-type-edit' pk=meeting_type.id %}{% else %}#{% endif %}">
|
||||
{{meeting_type.label}}
|
||||
<span class="duration">({{meeting_type.duration}} {% trans "minutes" %})</span>
|
||||
<span class="identifier">[{% trans "identifier:" %} {{meeting_type.slug}}]</span>
|
||||
</a>
|
||||
{% if user_can_manage %}<a rel="popup" class="delete" href="{% url 'chrono-manager-meeting-type-delete' pk=meeting_type.id %}">{% trans "remove" %}</a>{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<div class="big-msg-info">
|
||||
{% blocktrans %}
|
||||
This agenda doesn't have any meeting type yet. Click on the "New Meeting Type" button in
|
||||
the top right of the page to add a first one.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h3>{% trans 'Time Periods' %}</h3>
|
||||
<div>
|
||||
{% if object.desk_set.count %}
|
||||
<div class="timeperiods">
|
||||
{% for desk in object.desk_set.all %}
|
||||
<div class="timeperiod">
|
||||
{% url 'chrono-manager-agenda-add-time-period' agenda_pk=object.pk pk=desk.pk as add_time_period_url %}
|
||||
<ul class="objects-list single-links">
|
||||
{% if forloop.counter != 1 or forloop.revcounter != 1 %}
|
||||
<li><a rel="popup" href="{% if user_can_manage %}{% url 'chrono-manager-desk-edit' pk=desk.id %}{% else %}#{% endif %}">
|
||||
<strong>{{ desk.label }}</strong>
|
||||
</a>
|
||||
{% if user_can_manage %}<a rel="popup" class="delete" href="{% url 'chrono-manager-desk-delete' pk=desk.id %}">{% trans "remove" %}</a>{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% for time_period in desk.timeperiod_set.all %}
|
||||
<li><a rel="popup" href="{% if user_can_manage %}{% url 'chrono-manager-time-period-edit' pk=time_period.id %}{% else %}#{% endif %}">
|
||||
{{time_period.weekday_str}} / {{time_period.start_time}} → {{time_period.end_time}} </a>
|
||||
{% if user_can_manage %}<a rel="popup" class="delete" href="{% url 'chrono-manager-time-period-delete' pk=time_period.id %}">{% trans "remove" %}</a>{% endif %}
|
||||
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% if user_can_manage %}
|
||||
<li><a class="add" rel="popup" href="{{add_time_period_url}}">{% trans 'Add a time period' %}</a></li>
|
||||
{% endif %}
|
||||
{% if desk.timeperiod_set.count %}
|
||||
{% url 'chrono-manager-agenda-add-time-period-exception' agenda_pk=object.pk pk=desk.pk as add_time_period_exception_url %}
|
||||
<li><a href="#"><strong>{% trans 'Exceptions' %}</strong></a><a class="link-action-icon upload" rel="popup" href="{% url 'chrono-manager-desk-add-import-time-period-exceptions' pk=desk.pk %}" title="{% trans 'Import exceptions from .ics' %}">{% trans 'upload' %}</a></li>
|
||||
{% for exception in desk.get_exceptions_within_two_weeks %}
|
||||
<li><a rel="popup" href="{% if user_can_manage %}{% url 'chrono-manager-time-period-exception-edit' pk=exception.pk %}{% else %}#{% endif %}">
|
||||
{{ exception }}
|
||||
{% if user_can_manage %}<a rel="popup" class="delete" href="{% url 'chrono-manager-time-period-exception-delete' pk=exception.id %}">{% trans "remove" %}</a>{% endif %}
|
||||
{% endfor %}
|
||||
{% if not desk.are_all_exceptions_displayed %}
|
||||
<li><a class="timeperiod-exception-all" rel="popup" data-selector="div.timeperiod" href="{% url 'chrono-manager-time-period-exception-extract-list' pk=desk.id %}">({% trans 'see all exceptions' %})</a></li>
|
||||
{% endif %}
|
||||
<li><a class="add" rel="popup" href="{{add_time_period_exception_url}}">{% trans 'Add a time period exception' %}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="big-msg-info">
|
||||
{% blocktrans %}
|
||||
This agenda doesn't have any desk yet. Click on the "New Desk" button in
|
||||
the top right of the page to add a first one.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -598,7 +598,6 @@ class ManagedDeskSubobjectMixin(object):
|
|||
|
||||
|
||||
class AgendaSettings(ManagedAgendaMixin, DetailView):
|
||||
template_name = 'chrono/manager_agenda_settings.html'
|
||||
model = Agenda
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
|
@ -619,6 +618,9 @@ class AgendaSettings(ManagedAgendaMixin, DetailView):
|
|||
context['user_can_manage'] = self.get_object().can_be_managed(self.request.user)
|
||||
return context
|
||||
|
||||
def get_template_names(self):
|
||||
return ['chrono/manager_%s_agenda_settings.html' % self.agenda.kind]
|
||||
|
||||
|
||||
agenda_settings = AgendaSettings.as_view()
|
||||
|
||||
|
|
Loading…
Reference in New Issue