From 2fa0461803bdea12ee063c251fc3e70d19738ca7 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Wed, 25 Jan 2023 20:46:24 +0100 Subject: [PATCH] Fix sliders --- core/admin/assets/assets/app.js | 7 +++++-- core/admin/mailu/ui/templates/domain/create.html | 2 +- core/admin/mailu/ui/templates/user/create.html | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/admin/assets/assets/app.js b/core/admin/assets/assets/app.js index 661e0242..a5338878 100644 --- a/core/admin/assets/assets/app.js +++ b/core/admin/assets/assets/app.js @@ -86,9 +86,12 @@ $('document').ready(function() { if (value_element.length) { value_element = $(value_element[0]); var infinity = $(this).data('infinity'); - var step = $(this).attr('step'); + var unit = $(this).attr('unit'); + if (typeof unit === 'undefined' && unit === false) { + unit=1; + } $(this).on('input', function() { - var num = (infinity && this.value == 0) ? '∞' : (this.value/step).toFixed(2); + var num = (infinity && this.value == 0) ? '∞' : (this.value/unit).toFixed(2); if (num.endsWith('.00')) num = num.substr(0, num.length - 3); value_element.text(num); }).trigger('input'); diff --git a/core/admin/mailu/ui/templates/domain/create.html b/core/admin/mailu/ui/templates/domain/create.html index f0d5308d..5674e52b 100644 --- a/core/admin/mailu/ui/templates/domain/create.html +++ b/core/admin/mailu/ui/templates/domain/create.html @@ -10,7 +10,7 @@ {{ form.hidden_tag() }} {{ macros.form_field(form.name) }} {{ macros.form_fields((form.max_users, form.max_aliases)) }} - {{ macros.form_field(form.max_quota_bytes, step=50*10**6, max=50*10**9, data_infinity="true", + {{ macros.form_field(form.max_quota_bytes, unit=10**9, step=50*10**6, max=50*10**9, data_infinity="true", prepend=' GB') }} {{ macros.form_field(form.signup_enabled) }} {{ macros.form_field(form.comment) }} diff --git a/core/admin/mailu/ui/templates/user/create.html b/core/admin/mailu/ui/templates/user/create.html index 495e788b..ba8904f6 100644 --- a/core/admin/mailu/ui/templates/user/create.html +++ b/core/admin/mailu/ui/templates/user/create.html @@ -21,7 +21,7 @@ {%- endcall %} {%- call macros.card(_("Features and quotas"), theme="success") %} - {{ macros.form_field(form.quota_bytes, step=50*10**6, max=(max_quota_bytes or domain.max_quota_bytes or 50*10**9), data_infinity="true", + {{ macros.form_field(form.quota_bytes, unit=10**9, step=50*10**6, max=(max_quota_bytes or domain.max_quota_bytes or 50*10**9), data_infinity="true", prepend=' GB') }} {{ macros.form_field(form.enable_imap) }} {{ macros.form_field(form.enable_pop) }}