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

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 27 15:03:46 UTC 2019


 loleaflet/css/toolbar.css                        |   14 +++++
 loleaflet/src/control/Control.JSDialogBuilder.js |   58 ++++++++++++++++++++---
 loleaflet/src/control/Control.MobileWizard.js    |    2 
 3 files changed, 66 insertions(+), 8 deletions(-)

New commits:
commit 65c990dd2c6669627331b48370eb9bda367f6469
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Sep 23 22:46:44 2019 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Sep 27 17:03:36 2019 +0200

    jsdialogs: implement frame control
    
    * fix vertical containers
    * add frame support
    * connect with MobileWizard
    
    Change-Id: I27b59193c597e5af012d5b904e8516bf38c54c00
    Reviewed-on: https://gerrit.libreoffice.org/79726
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Tested-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/loleaflet/css/toolbar.css b/loleaflet/css/toolbar.css
index 9c6866718..fcf000081 100644
--- a/loleaflet/css/toolbar.css
+++ b/loleaflet/css/toolbar.css
@@ -766,3 +766,17 @@ tr.useritem > td > img {
     background-color: #F6F6F6;
     height: 30px;
 }
+
+.ui-content.mobile-wizard {
+	background-color: white !important;
+	border: none !important;
+	padding: 10px;
+}
+
+.ui-header.mobile-wizard {
+	height: 20px !important;
+	font-size: 11pt !important;
+	margin: 5px;
+	padding: 5px;
+	border: solid 1px lightgrey;
+}
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index ac5af0a71..ebd3e6843 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -7,6 +7,12 @@
 /* global $ */
 L.Control.JSDialogBuilder = L.Control.extend({
 
+	/* Handler is a function which takes two parameters:
+	 * parentContainer - place where insert the content
+	 * data - data of a control under process
+	 * returns boolean: true if children should be processed
+	 * and false otherwise
+	 */
 	_controlHandlers: {},
 
 	_setup: function() {
@@ -18,6 +24,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		this._controlHandlers['combobox'] = this._comboboxControl;
 		this._controlHandlers['listbox'] = this._comboboxControl;
 		this._controlHandlers['fixedtext'] = this._fixedtextControl;
+		this._controlHandlers['frame'] = this._frameHandler;
 		this._controlHandlers['container'] = this._containerHandler;
 		this._controlHandlers['window'] = this._containerHandler;
 		this._controlHandlers['borderwindow'] = this._containerHandler;
@@ -34,6 +41,28 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		return false;
 	},
 
+	_frameHandler: function(parentContainer, data, builder) {
+		var titleNode = data.children[0];
+		var sectionTitle = L.DomUtil.create('div', 'ui-header mobile-wizard ui-widget', parentContainer);
+		sectionTitle.innerHTML = titleNode.text;
+
+		var contentNode = data.children[1];
+		var contentDiv = L.DomUtil.create('div', 'ui-content mobile-wizard', parentContainer);
+		builder.build(contentDiv, [contentNode]);
+
+		$(contentDiv).hide();
+		$(sectionTitle).click(function() {
+			$('.ui-header.mobile-wizard').hide('slide', { direction: 'left' }, 'fast', function() {
+				$(contentDiv).show('slide', { direction: 'right' }, 'fast');
+			});
+			builder.wizard._setTitle(titleNode.text);
+			builder.wizard._inMainMenu = false;
+		});
+
+
+		return false;
+	},
+
 	_radiobuttonControl: function(parentContainer, data) {
 		var radiobutton = L.DomUtil.create('input', '', parentContainer);
 		radiobutton.type = 'radiobutton';
@@ -128,8 +157,8 @@ L.Control.JSDialogBuilder = L.Control.extend({
 					currentInsertPlace = L.DomUtil.create('td', '', currentHorizontalRow);
 			}
 
-			var childIsContainer = (childType == 'container' || childType == 'borderwindow');
-			var childIsVertical = childData.vertical === true;
+			var childIsContainer = (childType == 'container' || childType == 'borderwindow') && childData.children.length > 1;
+			var childIsVertical = childData.vertical == 'true';
 			var childColumns = childData.cols;
 
 			var childObject = null;
@@ -145,7 +174,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
 			var handler = this._controlHandlers[childType];
 
 			if (handler)
-				processChildren = handler(childObject, childData);
+				processChildren = handler(childObject, childData, this);
 			else
 				console.warn('Unsupported control type: \"' + childType + '\"');
 
@@ -158,5 +187,6 @@ L.Control.JSDialogBuilder = L.Control.extend({
 L.control.jsDialogBuilder = function (options) {
 	var builder = new L.Control.JSDialogBuilder(options);
 	builder._setup();
+	builder.wizard = options.mobileWizard;
 	return builder;
 };
diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js
index 93bf2bea6..4f6b672eb 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -60,7 +60,7 @@ L.Control.MobileWizard = L.Control.extend({
 			var content = $('#mobile-wizard-content');
 			content.empty();
 
-			L.control.jsDialogBuilder().build(content.get(0), [data]);
+			L.control.jsDialogBuilder({'mobileWizard': this}).build(content.get(0), [data]);
 		}
 	}
 });
commit 4997b4705baf1b1512a72b5857c4931e64140db1
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Sep 23 18:20:51 2019 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Sep 27 17:03:28 2019 +0200

    jsdialogs: Add disabled state for controls
    
    Change-Id: If637025bbb3e7931ace791bdbd7821715058b931
    Reviewed-on: https://gerrit.libreoffice.org/79725
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Tested-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index 078eba3a6..ac5af0a71 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -39,6 +39,9 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		radiobutton.type = 'radiobutton';
 		radiobutton.value = data.text;
 
+		if (data.enabled == 'false')
+			$(radiobutton).attr('disabled', 'disabled');
+
 		return false;
 	},
 
@@ -49,6 +52,9 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		checkboxLabel.innerHTML = data.text;
 		checkboxLabel.for = data.id;
 
+		if (data.enabled == 'false')
+			$(checkbox).attr('disabled', 'disabled');
+
 		return false;
 	},
 
@@ -57,6 +63,9 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		spinfield.type = 'number';
 		spinfield.value = data.text;
 
+		if (data.enabled == 'false')
+			$(spinfield).attr('disabled', 'disabled');
+
 		return false;
 	},
 
@@ -64,6 +73,9 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		var edit = L.DomUtil.create('input', '', parentContainer);
 		edit.value = data.text;
 
+		if (data.enabled == 'false')
+			$(edit).attr('disabled', 'disabled');
+
 		return false;
 	},
 
@@ -71,6 +83,9 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		var pushbutton = L.DomUtil.create('button', '', parentContainer);
 		pushbutton.innerHTML = data.text;
 
+		if (data.enabled == 'false')
+			$(pushbutton).attr('disabled', 'disabled');
+
 		return false;
 	},
 
@@ -78,6 +93,9 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		var listbox = L.DomUtil.create('select', '', parentContainer);
 		listbox.value = data.text;
 
+		if (data.enabled == 'false')
+			$(listbox).attr('disabled', 'disabled');
+
 		return false;
 	},
 
@@ -98,12 +116,8 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		for (var childIndex in data) {
 			var childData = data[childIndex];
 			var childType = childData.type;
-			var childIsEnabled = childData.enabled;
 			var processChildren = true;
 
-			if (childIsEnabled === false)
-				continue;
-
 			if (currentIsContainer) {
 				var horizontalOverflow = (childIndex > 0 && columns && (childIndex % columns == 0));
 				var newRow = currentIsVertival || horizontalOverflow;


More information about the Libreoffice-commits mailing list