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

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Mon Oct 14 10:07:14 UTC 2019


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

New commits:
commit a5d7e2e349cb56826f2c394def5c661161d8617f
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Oct 14 12:06:35 2019 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Oct 14 12:06:44 2019 +0200

    jsdialogs: add possibility to change unit presentation
    
    Change-Id: I6f3afdbd6c7a4708f3a1e17239811fd213f0ac9b

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index 032c031a3..24d3fbeac 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -4,7 +4,7 @@
  * from the JSON description provided by the server.
  */
 
-/* global $ w2ui */
+/* global $ w2ui _ */
 L.Control.JSDialogBuilder = L.Control.extend({
 
 	/* Handler is a function which takes three parameters:
@@ -338,6 +338,14 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		return false;
 	},
 
+	_unitToVisibleString: function(unit) {
+		if (unit == 'inch') {
+			return _('\"');
+		}
+
+		return unit;
+	},
+
 	_spinfieldControl: function(parentContainer, data, builder) {
 		var div = L.DomUtil.create('div', 'spinfieldcontainer', parentContainer);
 
@@ -350,7 +358,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
 
 		if (data.unit) {
 			var unit = L.DomUtil.create('span', 'spinfieldunit', div);
-			unit.innerHTML = data.unit;
+			unit.innerHTML = builder._unitToVisibleString(data.unit);
 		}
 
 		var controlsContainer = L.DomUtil.create('div', 'sinfieldcontrols', div);
@@ -363,7 +371,6 @@ L.Control.JSDialogBuilder = L.Control.extend({
 			$(spinfield).attr('disabled', 'disabled');
 
 		if (data.children && data.children.length) {
-			// TODO: units
 			$(spinfield).attr('value', data.children[0].text.replace('%', ''));
 		}
 


More information about the Libreoffice-commits mailing list