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

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


 loleaflet/src/control/Control.JSDialogBuilder.js |   21 +++------
 loleaflet/src/control/Control.MobileWizard.js    |   49 +++++++++++++++++------
 2 files changed, 45 insertions(+), 25 deletions(-)

New commits:
commit be6d05586d05db74990c3f07dc1f23fd98c01f07
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Sep 26 17:34:20 2019 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Sep 27 17:06:02 2019 +0200

    jsdialogs: refactor mobile wizard
    
    Change-Id: Id6ab9a0265e8d80bce4c446ec3b9526af6f95cf8
    Reviewed-on: https://gerrit.libreoffice.org/79742
    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 6f19136f5..3d19a5430 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -138,22 +138,14 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		sectionTitle.innerHTML = title;
 
 		var contentDiv = L.DomUtil.create('div', 'ui-content level-' + builder._currentDepth + ' mobile-wizard', parentContainer);
+		contentDiv.title = title;
 
 		builder._currentDepth++;
 		builder.build(contentDiv, [contentNode]);
 		builder._currentDepth--;
 
 		$(contentDiv).hide();
-		$(sectionTitle).click(function() {
-			var titles = '.ui-header.level-' + builder.wizard._currentDepth + '.mobile-wizard';
-
-			$(titles).hide('slide', { direction: 'left' }, 'fast', function() {});
-			$(contentDiv).show('slide', { direction: 'right' }, 'fast');
-
-			builder.wizard._currentDepth++;
-			builder.wizard._setTitle(title);
-			builder.wizard._inMainMenu = false;
-		});
+		$(sectionTitle).click(function() { builder.wizard.goLevelDown(contentDiv); });
 	},
 
 	_frameHandler: function(parentContainer, data, builder) {
diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js
index 90f567e27..c1e8a2b14 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -21,18 +21,7 @@ L.Control.MobileWizard = L.Control.extend({
 	_setupBackButton: function() {
 		var that = this;
 		var backButton = $('#mobile-wizard-back');
-		backButton.click(function() {
-			if (that._inMainMenu) {
-				that._hideWizard();
-				that._currentDepth = 0;
-			} else {
-				that._currentDepth--;
-				$('.ui-content.level-' + that._currentDepth + '.mobile-wizard').hide('slide', { direction: 'right' }, 'fast', function() {});
-				$('.ui-header.level-' + that._currentDepth + '.mobile-wizard').show('slide', { direction: 'left' }, 'fast');
-				if (that._currentDepth == 0)
-					that._inMainMenu = true;
-			}
-		});
+		backButton.click(function() { that.goLevelUp(); });
 	},
 
 	_showWizard: function() {
@@ -49,6 +38,42 @@ L.Control.MobileWizard = L.Control.extend({
 		document.activeElement.blur();
 	},
 
+	getCurrentLevel: function() {
+		return this._currentDepth;
+	},
+
+	goLevelDown: function(contentToShow) {
+		var titles = '.ui-header.level-' + this.getCurrentLevel() + '.mobile-wizard';
+
+		$(titles).hide('slide', { direction: 'left' }, 'fast');
+		$(contentToShow).show('slide', { direction: 'right' }, 'fast');
+
+		this._currentDepth++;
+		this._setTitle(contentToShow.title);
+		this._inMainMenu = false;
+	},
+
+	goLevelUp: function() {
+		if (this._inMainMenu) {
+			this._hideWizard();
+			this._currentDepth = 0;
+		} else {
+			this._currentDepth--;
+
+			var parent = $('.ui-content.mobile-wizard:visible');
+			if (this._currentDepth > 0 && parent)
+				this._setTitle(parent.get(0).title);
+			else
+				this._setTitle('');
+
+			$('.ui-content.level-' + this._currentDepth + '.mobile-wizard').hide('slide', { direction: 'right' }, 'fast');
+			$('.ui-header.level-' + this._currentDepth + '.mobile-wizard').show('slide', { direction: 'left' }, 'fast');
+
+			if (this._currentDepth == 0)
+				this._inMainMenu = true;
+		}
+	},
+
 	_setTitle: function(title) {
 		var right = $('#mobile-wizard-title');
 		right.text(title);
commit 9c84adedbe7f4cf8cd603c6135bd802caed41c95
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Sep 26 15:50:05 2019 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Sep 27 17:05:53 2019 +0200

    jsdialogs: correctly create radiobutton
    
    Change-Id: I677c8ac094d10c4a3de4fe5d1f491140796f33ac
    Reviewed-on: https://gerrit.libreoffice.org/79741
    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 b2e656847..6f19136f5 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -175,9 +175,12 @@ L.Control.JSDialogBuilder = L.Control.extend({
 	},
 
 	_radiobuttonControl: function(parentContainer, data, builder) {
-		var radiobutton = L.DomUtil.create('input', '', parentContainer);
-		radiobutton.type = 'radiobutton';
-		radiobutton.value = builder._cleanText(data.text);
+		var radiobutton = L.DomUtil.createWithId('input', data.id, parentContainer);
+		radiobutton.type = 'radio';
+
+		var radiobuttonLabel = L.DomUtil.create('label', '', parentContainer);
+		radiobuttonLabel.innerHTML = builder._cleanText(data.text);
+		radiobuttonLabel.for = data.id;
 
 		if (data.enabled == 'false')
 			$(radiobutton).attr('disabled', 'disabled');


More information about the Libreoffice-commits mailing list