loleaflet/src/control/Control.JSDialogBuilder.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
New commits: commit 1037b8adb854f0fa7807e610ff2efd7c9f4f851d Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Mon Oct 14 13:27:48 2019 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Mon Oct 14 13:29:22 2019 +0200 jsdialogs: add unit translations Change-Id: I260cca656e2a08395549012f83d8607a14b0c612 diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js index 24d3fbeac..aee7a23f5 100644 --- a/loleaflet/src/control/Control.JSDialogBuilder.js +++ b/loleaflet/src/control/Control.JSDialogBuilder.js @@ -104,6 +104,13 @@ L.Control.JSDialogBuilder = L.Control.extend({ return text.replace('~', ''); }, + _cleanValueFromUnits: function(text) { + if (!text) + return ''; + return text.replace('″', '') + .replace('%', ''); + }, + _containerHandler: function(parentContainer, data) { if (data.enabled == 'false') return false; @@ -367,12 +374,19 @@ L.Control.JSDialogBuilder = L.Control.extend({ var minus = L.DomUtil.create('div', 'minus', controlsContainer); minus.innerHTML = '-'; + if (data.min) + $(spinfield).attr('min', data.min); + + if (data.max) + $(spinfield).attr('max', data.max); + if (data.enabled == 'false') $(spinfield).attr('disabled', 'disabled'); - if (data.children && data.children.length) { - $(spinfield).attr('value', data.children[0].text.replace('%', '')); - } + if (data.text) + $(spinfield).attr('value', builder._cleanValueFromUnits(data.text)); + else if (data.children && data.children.length) + $(spinfield).attr('value', builder._cleanValueFromUnits(data.children[0].text)); spinfield.addEventListener('change', function() { builder.callback('spinfield', 'change', spinfield, this.value, builder); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits