Projet

Général

Profil

0001-agenda-do-not-close-the-popup-after-an-exception-del.patch

Lauréline Guérin, 31 janvier 2020 15:16

Télécharger (4,09 ko)

Voir les différences:

Subject: [PATCH] agenda: do not close the popup after an exception deletion
 (#37418)

 .../chrono/manager_meetings_agenda_settings.html    | 13 ++++++++++++-
 .../chrono/manager_time_period_exception_list.html  |  2 +-
 chrono/manager/views.py                             |  5 ++++-
 3 files changed, 17 insertions(+), 3 deletions(-)
chrono/manager/templates/chrono/manager_meetings_agenda_settings.html
1 1
{% extends "chrono/manager_agenda_settings.html" %}
2 2
{% load i18n %}
3 3

  
4
{% block extrascripts %}
5
  {{ block.super }}
6
  {% if 'display_exceptions' in request.GET %}
7
  <script>
8
    $(function () {
9
      $('a.timeperiod-exception-all.desk-{{ request.GET.display_exceptions }}').click();
10
    });
11
  </script>
12
  {% endif %}
13
{% endblock %}
14

  
4 15
{% block agenda-extra-management-actions %}
5 16
  <a rel="popup" href="{% url 'chrono-manager-agenda-add-meeting-type' pk=object.id %}">{% trans 'New Meeting Type' %}</a>
6 17
  <a rel="popup" href="{% url 'chrono-manager-agenda-add-desk' pk=object.id %}">{% trans 'New Desk' %}</a>
......
67 78
                        <a rel="popup" class="delete" href="{% url 'chrono-manager-time-period-exception-delete' pk=exception.id %}">{% trans "remove" %}</a>
68 79
                    {% endfor %}
69 80
                    {% if not desk.are_all_exceptions_displayed %}
70
                    <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>
81
                    <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>
71 82
                    {% endif %}
72 83
                    <li><a class="add" rel="popup" href="{{add_time_period_exception_url}}">{% trans 'Add a time period exception' %}</a></li>
73 84
                {% endif %}
chrono/manager/templates/chrono/manager_time_period_exception_list.html
21 21
    {% for exception in object_list %}
22 22
     <li>
23 23
         <a {% if user_can_manage %}href="{% url 'chrono-manager-time-period-exception-edit' pk=exception.id %}"{% endif %}>{{ exception }}</a>
24
        {% if user_can_manage %}<a rel="popup" class="delete" href="{% url 'chrono-manager-time-period-exception-delete' pk=exception.id %}">{% trans "remove" %}</a>{% endif %}
24
         {% 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 %}
25 25
    </li>
26 26
    {% endfor %}
27 27
   </ul>
chrono/manager/views.py
926 926
        if success_url in referer:
927 927
            return success_url
928 928

  
929
        return super(TimePeriodExceptionDeleteView, self).get_success_url()
929
        success_url = super(TimePeriodExceptionDeleteView, self).get_success_url()
930
        if 'from_popup' in self.request.GET:
931
            success_url = '{}?display_exceptions={}'.format(success_url, self.desk.pk)
932
        return success_url
930 933

  
931 934

  
932 935
time_period_exception_delete = TimePeriodExceptionDeleteView.as_view()
933
-