[Libreoffice-commits] online.git: loleaflet/src

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Mon Oct 14 11:30:09 UTC 2019


 loleaflet/src/control/Control.JSDialogBuilder.js |   20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

New commits:
commit 1037b8adb854f0fa7807e610ff2efd7c9f4f851d
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Oct 14 13:27:48 2019 +0200
Commit:     Szymon Kłos <szymon.klos at 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);


More information about the Libreoffice-commits mailing list