loleaflet/src/control/Control.MobileWizard.js |   26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

New commits:
commit 167deafa8440e3745b39aec05d14ae22ae7344b3
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Wed Oct 2 12:18:35 2019 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Wed Oct 2 12:20:21 2019 +0200

    jsdialogs: refactor wizard
    
    Remember content and back button objects,
    created reset method
    
    Change-Id: Ib9084c37c7ded76f265f9f3d2a3340bc71455be0
    Reviewed-on: https://gerrit.libreoffice.org/80019
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Tested-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/loleaflet/src/control/Control.MobileWizard.js 
b/loleaflet/src/control/Control.MobileWizard.js
index dd6cfb7e0..d5df7e8c8 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -18,11 +18,19 @@ L.Control.MobileWizard = L.Control.extend({
                this._setupBackButton();
        },
 
+       _reset: function() {
+               this._currentDepth = 0;
+               this._inMainMenu = true;
+               this.content.empty();
+               this.backButton.addClass('close-button');
+       },
+
        _setupBackButton: function() {
                var that = this;
-               var backButton = $('#mobile-wizard-back');
-               backButton.click(function() { that.goLevelUp(); });
-               $(backButton).addClass('close-button');
+               this.content = $('#mobile-wizard-content');
+               this.backButton = $('#mobile-wizard-back');
+               this.backButton.click(function() { that.goLevelUp(); });
+               $(this.backButton).addClass('close-button');
        },
 
        _showWizard: function() {
@@ -44,7 +52,7 @@ L.Control.MobileWizard = L.Control.extend({
        },
 
        goLevelDown: function(contentToShow) {
-               $('#mobile-wizard-back').removeClass('close-button');
+               this.backButton.removeClass('close-button');
 
                var titles = '.ui-header.level-' + this.getCurrentLevel() + 
'.mobile-wizard';
 
@@ -74,7 +82,7 @@ L.Control.MobileWizard = L.Control.extend({
 
                        if (this._currentDepth == 0) {
                                this._inMainMenu = true;
-                               
$('#mobile-wizard-back').addClass('close-button');
+                               this.backButton.addClass('close-button');
                        }
                }
        },
@@ -87,15 +95,12 @@ L.Control.MobileWizard = L.Control.extend({
        _onMobileWizard: function(data) {
                if (data) {
                        this._isActive = true;
-                       this._currentDepth = 0;
+                       this._reset();
 
                        this._showWizard();
                        this._hideKeyboard();
 
-                       var content = $('#mobile-wizard-content');
-                       content.empty();
-
-                       L.control.jsDialogBuilder({mobileWizard: this, map: 
this.map}).build(content.get(0), [data]);
+                       L.control.jsDialogBuilder({mobileWizard: this, map: 
this.map}).build(this.content.get(0), [data]);
                }
        }
 });
commit 69e77af393b8d252429b215c477de479d426003a
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Wed Oct 2 11:59:02 2019 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Wed Oct 2 12:20:03 2019 +0200

    jsdialogs: differentiate close and back button in wizard
    
    Change-Id: I2c00e40606576a43b36ebf39c8ea090540c79fdc
    Reviewed-on: https://gerrit.libreoffice.org/80018
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Tested-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/loleaflet/src/control/Control.MobileWizard.js 
b/loleaflet/src/control/Control.MobileWizard.js
index c1e8a2b14..dd6cfb7e0 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -22,6 +22,7 @@ L.Control.MobileWizard = L.Control.extend({
                var that = this;
                var backButton = $('#mobile-wizard-back');
                backButton.click(function() { that.goLevelUp(); });
+               $(backButton).addClass('close-button');
        },
 
        _showWizard: function() {
@@ -43,6 +44,8 @@ L.Control.MobileWizard = L.Control.extend({
        },
 
        goLevelDown: function(contentToShow) {
+               $('#mobile-wizard-back').removeClass('close-button');
+
                var titles = '.ui-header.level-' + this.getCurrentLevel() + 
'.mobile-wizard';
 
                $(titles).hide('slide', { direction: 'left' }, 'fast');
@@ -69,8 +72,10 @@ L.Control.MobileWizard = L.Control.extend({
                        $('.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)
+                       if (this._currentDepth == 0) {
                                this._inMainMenu = true;
+                               
$('#mobile-wizard-back').addClass('close-button');
+                       }
                }
        },
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to