agenda: do not close the popup after an exception deletion (#37418)

This commit is contained in:
Lauréline Guérin 2020-01-31 15:15:21 +01:00
parent baf109b11a
commit d38f62ed1b
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
3 changed files with 17 additions and 3 deletions

View File

@ -1,6 +1,17 @@
{% extends "chrono/manager_agenda_settings.html" %}
{% load i18n %}
{% block extrascripts %}
{{ block.super }}
{% if 'display_exceptions' in request.GET %}
<script>
$(function () {
$('a.timeperiod-exception-all.desk-{{ request.GET.display_exceptions }}').click();
});
</script>
{% endif %}
{% endblock %}
{% 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>
@ -67,7 +78,7 @@
<a rel="popup" class="delete" href="{% url 'chrono-manager-time-period-exception-delete' pk=exception.id %}">{% trans "remove" %}</a>
{% 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>
<li><a class="timeperiod-exception-all desk-{{ desk.pk }}" 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 %}

View File

@ -21,7 +21,7 @@
{% for exception in object_list %}
<li>
<a {% if user_can_manage %}href="{% url 'chrono-manager-time-period-exception-edit' pk=exception.id %}"{% endif %}>{{ exception }}</a>
{% if user_can_manage %}<a rel="popup" class="delete" href="{% url 'chrono-manager-time-period-exception-delete' pk=exception.id %}">{% trans "remove" %}</a>{% endif %}
{% if user_can_manage %}<a rel="popup" class="delete" href="{% url 'chrono-manager-time-period-exception-delete' pk=exception.id %}{% if not page_obj %}?from_popup{% endif %}">{% trans "remove" %}</a>{% endif %}
</li>
{% endfor %}
</ul>

View File

@ -926,7 +926,10 @@ class TimePeriodExceptionDeleteView(ManagedDeskSubobjectMixin, DeleteView):
if success_url in referer:
return success_url
return super(TimePeriodExceptionDeleteView, self).get_success_url()
success_url = super(TimePeriodExceptionDeleteView, self).get_success_url()
if 'from_popup' in self.request.GET:
success_url = '{}?display_exceptions={}'.format(success_url, self.desk.pk)
return success_url
time_period_exception_delete = TimePeriodExceptionDeleteView.as_view()