From e271ea375e32ce79a03154c16b2387483912cdf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laur=C3=A9line=20Gu=C3=A9rin?= Date: Tue, 24 May 2022 16:53:02 +0200 Subject: [PATCH] manager: use sidetabs to navigate between agenda settings (#65653) --- chrono/manager/static/css/style.scss | 11 +- .../chrono/manager_agenda_settings.html | 134 ++++----- .../manager_events_agenda_settings.html | 269 +++++++++--------- .../manager_meetings_agenda_settings.html | 254 +++++++++-------- .../manager_virtual_agenda_settings.html | 146 +++++----- tests/manager/test_all.py | 4 +- tests/manager/test_exception.py | 2 +- 7 files changed, 420 insertions(+), 400 deletions(-) diff --git a/chrono/manager/static/css/style.scss b/chrono/manager/static/css/style.scss index 0624a44c..46f207f0 100644 --- a/chrono/manager/static/css/style.scss +++ b/chrono/manager/static/css/style.scss @@ -58,8 +58,6 @@ h2 span.identifier { .timeperiods { display: flex; flex-wrap: wrap; - margin-right: -10px; - margin-bottom: -10px; } .timeperiods .timeperiod { @@ -522,3 +520,12 @@ table.timesheet { .page_break { height: 20px; } + +div.agenda-settings .pk-tabs--container { + & > div { + padding: 1ex; + .panel--buttons a.button { + line-height: inherit; + } + } +} diff --git a/chrono/manager/templates/chrono/manager_agenda_settings.html b/chrono/manager/templates/chrono/manager_agenda_settings.html index 781e3ad8..c4d3d5e9 100644 --- a/chrono/manager/templates/chrono/manager_agenda_settings.html +++ b/chrono/manager/templates/chrono/manager_agenda_settings.html @@ -35,73 +35,77 @@ {% block content %} -{% block agenda-settings %} -{% endblock %} +
+
+
+ {% block agenda-settings-extra-tab-buttons %}{% endblock %} + {% if object.kind != 'virtual' %} + + {% endif %} + + +
+
-{% block agenda-reminder %} -
-

{% trans "Booking reminders" %} -{% trans "Configure" %} -

-
-{% for info in agenda.reminder_settings.display_info %} -

{{ info }}

-{% empty %} -

{% trans "Reminders are disabled for this agenda." %}

-{% endfor %} -

-{% if agenda.reminder_settings.days_before_email %} -{% trans "Preview email" %} -{% endif %} -{% if agenda.reminder_settings.days_before_sms %} -{% trans "Preview SMS" %} -{% endif %} -

-{% if agenda.reminder_settings.days_before_email or agenda.reminder_settings.days_before_sms %} -

-{% trans "Test reminder sending" %} -

-{% endif %} -
-
-{% endblock %} + {% block agenda-settings-extra-tab-list %}{% endblock %} -{% block agenda-permissions %} -
-

{% trans "Permissions" %} -{% trans 'Configure' %} -

-
-
    -
  • {% trans "Edit Role:" %} {% if agenda.edit_role %}{{ agenda.edit_role }}{% else %}{% trans "undefined" %}{% endif %}
  • -
  • {% trans "View Role:" %} {% if agenda.view_role %}{{ agenda.view_role }}{% else %}{% trans "undefined" %}{% endif %}
  • -
-
-
-{% endblock %} - -{% block agenda-booking-delays %} -
-

{% trans "Booking Delays" %} -{% trans 'Configure' %} -

-
-
    -
  • {% trans "Minimal booking delay:" %} - {% if agenda.minimal_booking_delay is not None %} - {% if agenda.minimal_booking_delay_in_working_days %} - {% blocktrans count count=agenda.minimal_booking_delay %}{{ count }} working day{% plural %}{{ count }} working days{% endblocktrans %} - {% else %} - {% blocktrans count count=agenda.minimal_booking_delay %}{{ count }} day{% plural %}{{ count }} days{% endblocktrans %} + {% if object.kind != 'virtual' %} +
  • -
  • {% trans "Maximal booking delay:" %} - {% if agenda.maximal_booking_delay is not None %} - {% blocktrans count count=agenda.maximal_booking_delay %}{{ count }} day{% plural %}{{ count }} days{% endblocktrans %} - {% else %}{% trans "undefined" %}{% endif %}
  • -
-
-
-{% endblock %} + {% if agenda.reminder_settings.days_before_sms %} + {% trans "Preview SMS" %} + {% endif %} +

+ {% if agenda.reminder_settings.days_before_email or agenda.reminder_settings.days_before_sms %} +

+ {% trans "Test reminder sending" %} +

+ {% endif %} + +
+ {% endif %} + + + + +
+
+ {% endblock %} diff --git a/chrono/manager/templates/chrono/manager_events_agenda_settings.html b/chrono/manager/templates/chrono/manager_events_agenda_settings.html index 4c82948e..274b56a5 100644 --- a/chrono/manager/templates/chrono/manager_events_agenda_settings.html +++ b/chrono/manager/templates/chrono/manager_events_agenda_settings.html @@ -12,158 +12,157 @@ {% endif %}{% endwith %} {% endblock %} -{% block agenda-settings %} +{% block agenda-settings-extra-tab-buttons %} + + {% if has_recurring_events %} + + {% endif %} + + + +{% endblock %} -
-

{% trans "Events" %}

-
-{% with view.get_events as events %} -{% if events %} - -{% else %} -
- {% 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 %} -
-{% endif %} -{% endwith %} -
-
+{% block agenda-settings-extra-tab-list %} -
-

{% trans "Display options" %} - {% trans 'Configure' %} -

-
-
    +
    + {% with view.get_events as events %} + {% if events %} + + {% else %} +
    + {% 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 %} +
    + {% endif %} + {% endwith %} +
    + + {% if has_recurring_events %} + + {% endif %} + + -
+ + +
-
-

{% trans "Booking check options" %} - {% trans 'Configure' %} -

-
-
    - {% if has_check_types %} + -
+ + +
-
-

{% trans "Notifications" %} -{% trans 'Configure' %} -

-
-{% for notification_type in object.notifications_settings.get_notification_types %} -{% if forloop.first %}
    {% endif %} -
  • - {% blocktrans trimmed with display_value=notification_type.display_value label=notification_type.label %} - {{ label }}: {{ display_value }} will be notified. - {% endblocktrans %} -
  • -{% if forloop.last %}
{% endif %} -{% empty %} -

{% trans "Notifications are disabled for this agenda." %}

-{% endfor %} -
-
- -{% if has_recurring_events %} -
-

{% trans "Recurrence exceptions" %} -{% trans 'Configure' %} -

-
-{% if object.recurrence_exceptions_report.events.exists %} -
-

{% trans "The following events exist despite exceptions because they have active bookings:" %}

- -

{% trans "You can cancel them manually for this warning to go away, or wait until they are passed." %}

-
-{% endif %} - -
-
-{% endif %} + {% endblock %} diff --git a/chrono/manager/templates/chrono/manager_meetings_agenda_settings.html b/chrono/manager/templates/chrono/manager_meetings_agenda_settings.html index d0bf1a77..d9eb9399 100644 --- a/chrono/manager/templates/chrono/manager_meetings_agenda_settings.html +++ b/chrono/manager/templates/chrono/manager_meetings_agenda_settings.html @@ -26,145 +26,149 @@ {% endif %} {% endblock %} -{% block agenda-settings %} +{% block agenda-settings-extra-tab-buttons %} + + {% if object.desk_simple_management %} + + {% endif %} + + {% if has_resources %} + + {% endif %} + +{% endblock %} -
-

{% trans 'Meeting Types' %}

-
-{% if meeting_types %} - -{% else %} -
- {% 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 %} -
-{% endif %} -
-
+{% block agenda-settings-extra-tab-list %} -{% if object.desk_simple_management %} -
-

{% trans 'Desks' %}

-
-
-{% endif %} + + {% else %} +
+ {% 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 %} +
+ {% endif %} +
-
-

{% trans 'Time Periods' %}

-
- {% if object.prefetched_desks %} -
+ {% if object.desk_simple_management %} + + {% endif %} + + - {% else %} -
- {% 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 %} -
- {% endif %} -
-
-{% with object.resources.all as agenda_resources %} -{% if has_resources %} -
-

{% trans 'Resources' %}

-
-{% if agenda_resources %} -
-{% endif %} -{% endwith %} - -
-

{% trans "Display options" %} - {% trans 'Configure' %} -

-
-
    -
  • - {% trans "Booking display template:" %} -
    {{ agenda.get_booking_user_block_template }}
    + + {% trans "remove" %}
  • -
-
-
+ {% endfor %} + + {% else %} +
+ {% blocktrans %} + This agenda doesn't have any resource yet. Click on the "Add resource" button in + the top right of the page to add a first one. + {% endblocktrans %} +
+ {% endif %} + {% endwith %} +
+ {% endif %} + + {% endblock %} diff --git a/chrono/manager/templates/chrono/manager_virtual_agenda_settings.html b/chrono/manager/templates/chrono/manager_virtual_agenda_settings.html index 006c981c..ae903c6a 100644 --- a/chrono/manager/templates/chrono/manager_virtual_agenda_settings.html +++ b/chrono/manager/templates/chrono/manager_virtual_agenda_settings.html @@ -6,75 +6,81 @@ {% trans 'Include Agenda' %} {% endblock %} -{% block agenda-settings %} - -
-

{% trans 'Included Agendas' %}

-
-{% if virtual_members %} - -{% else %} -
- {% blocktrans %} - This virtual agenda doesn't include any agenda yet. Click on the "Include Agenda" button in - the top right of the page to include a first one. - {% endblocktrans %} -
-{% endif %} -
-
- -{% if virtual_members %} -
-

{% trans 'Meeting Types' %}

-
-{% if meeting_types %} - -{% else %} -
- {% blocktrans %} - This virtual agenda doesn't have any meeting type. - It is probably because its included agendas have incompatible meeting types - and it makes this virtual agenda unusable. - {% endblocktrans %} -
-{% endif %} -
-
-{% endif %} - -{% if agenda.excluded_timeperiods.count %} -
-

{% trans 'Excluded Periods' %}

-
- -
-
-{% endif %} - -{% block agenda-reminder %} +{% block agenda-settings-extra-tab-buttons %} + + {% if virtual_members %} + + {% endif %} + {% endblock %} + +{% block agenda-settings-extra-tab-list %} + +
+ {% if virtual_members %} + + {% else %} +
+ {% blocktrans %} + This virtual agenda doesn't include any agenda yet. Click on the "Include Agenda" button in + the top right of the page to include a first one. + {% endblocktrans %} +
+ {% endif %} +
+ + {% if virtual_members %} + + {% endif %} + + + {% endblock %} diff --git a/tests/manager/test_all.py b/tests/manager/test_all.py index 69f2b9c2..5d1ee271 100644 --- a/tests/manager/test_all.py +++ b/tests/manager/test_all.py @@ -2134,11 +2134,11 @@ def test_virtual_agenda_settings_empty(app, admin_user): assert 'Delete' in resp.text assert 'Included Agendas' in resp.text assert 'Add Excluded Period' in resp.text + assert 'Excluded Periods' in resp.text + assert "This virtual agenda doesn't have any excluded period yet" in resp.text assert "This virtual agenda doesn't include any agenda yet" in resp.text # No meeting types yet assert 'Meeting Types' not in resp.text - # No absence yet - assert 'Excluded Periods' not in resp.text def test_virtual_agenda_settings(app, admin_user): diff --git a/tests/manager/test_exception.py b/tests/manager/test_exception.py index 321a3e86..639aed65 100644 --- a/tests/manager/test_exception.py +++ b/tests/manager/test_exception.py @@ -94,7 +94,7 @@ def test_meetings_agenda_add_time_period_exception(app, admin_user): hour=16 ).strftime(dt_format) # add an exception beyond 2 weeks and make sure it isn't listed - resp = resp.click('Add a time period exception', index=1) + resp = resp.click('Add a time period exception', index=0) future = tomorrow + datetime.timedelta(days=15) resp.form['label'] = 'Exception 2' resp.form['start_datetime_0'] = future.strftime('%Y-%m-%d')