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

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Fri May 1 15:38:39 UTC 2020


 loleaflet/src/control/Control.Notebookbar.js |   22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 8b2084928bb0147b12dc3b87f3c1dec203516428
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Apr 23 13:08:49 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri May 1 17:38:22 2020 +0200

    notebookbar: load selected tab
    
    Change-Id: Ic2741f972c96342abb2916111d52d8e0c3823349
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93270
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/loleaflet/src/control/Control.Notebookbar.js b/loleaflet/src/control/Control.Notebookbar.js
index cdab92abe..70bb35edd 100644
--- a/loleaflet/src/control/Control.Notebookbar.js
+++ b/loleaflet/src/control/Control.Notebookbar.js
@@ -12,15 +12,33 @@ L.Control.Notebookbar = L.Control.extend({
 	onAdd: function (map) {
 		this.map = map;
 
-		var homeTab = JSON.parse(this.getHomeTab());
+		this.loadTab(this.getHomeTab());
+	},
+
+	clearNotebookbar: function() {
+		$('.root-container.notebookbar').remove();
+		$('.ui-tabs.notebookbar').remove();
+	},
+
+	loadTab: function(tabJSON) {
+		this.clearNotebookbar();
+		tabJSON = JSON.parse(tabJSON);
 		var builder = new L.control.notebookbarBuilder({mobileWizard: this, map: this.map, cssClass: 'notebookbar'});
-		builder.build($('#toolbar-wrapper').get(0), [homeTab]);
+		builder.build($('#toolbar-wrapper').get(0), [tabJSON]);
 	},
 
 	setTabs: function(tabs) {
 		$('nav').prepend(tabs);
 	},
 
+	selectedTab: function(tabText) {
+		switch (tabText) {
+		case 'Home':
+			this.loadTab(this.getHomeTab());
+			break;
+		}
+	},
+
 	// required, called by builder, not needed in this container
 	setCurrentScrollPosition: function() {},
 


More information about the Libreoffice-commits mailing list