From 3b3f992b50645a3db0f914e844d4d27519920d95 Mon Sep 17 00:00:00 2001 From: Zarlex Date: Fri, 24 Nov 2017 14:28:14 +0100 Subject: [PATCH 1/3] Fix typo --- src/mw-ui-components/directives/mw_tab_bar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mw-ui-components/directives/mw_tab_bar.js b/src/mw-ui-components/directives/mw_tab_bar.js index 1cfe3bbd..098b0970 100644 --- a/src/mw-ui-components/directives/mw_tab_bar.js +++ b/src/mw-ui-components/directives/mw_tab_bar.js @@ -82,8 +82,8 @@ angular.module('mwUI.UiComponents') }; $scope.selectTabByNumber = function (number) { - if (number > 0 && number <= $scope.tabs.length) { - $scope.select(panes[number - 1]); + if (number > 0 && number <= $scope.panes.length) { + $scope.select($scope.panes[number - 1]); } }; From 09ea52b46ba76eb5853ab4affa534cfc7e8f0952 Mon Sep 17 00:00:00 2001 From: Zarlex Date: Fri, 24 Nov 2017 14:28:42 +0100 Subject: [PATCH 2/3] Use $scope.panes everywhere instead of having two vars --- src/mw-ui-components/directives/mw_tab_bar.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mw-ui-components/directives/mw_tab_bar.js b/src/mw-ui-components/directives/mw_tab_bar.js index 098b0970..de227549 100644 --- a/src/mw-ui-components/directives/mw_tab_bar.js +++ b/src/mw-ui-components/directives/mw_tab_bar.js @@ -26,15 +26,16 @@ angular.module('mwUI.UiComponents') controller: function ($scope) { // The panes are populated by the mw-tabs-pane directive that is calling `registerPane`of this controller // It is defined as a scope attribute so it is available in this html template - var panes = $scope.panes = [], - activePaneIndex; + var activePaneIndex; + + $scope.panes = []; var setInitialSelection = function () { activePaneIndex = null; // In case that no active pane is defined by setting activePaneNumber or Id the first pane will be selected - if (angular.isUndefined($scope.activePaneNumber) && angular.isUndefined($scope.activePaneId) && panes.length>0) { - $scope.select(panes[0]); + if (angular.isUndefined($scope.activePaneNumber) && angular.isUndefined($scope.activePaneId) && $scope.panes.length>0) { + $scope.select($scope.panes[0]); // When a pane number is defined the pane with the index of activePaneNumber + 1 will be selected // So when the second tab shall be selected set activePaneNumber to 2 @@ -111,13 +112,13 @@ angular.module('mwUI.UiComponents') }); this.registerPane = function (pane) { - panes.push(pane); + $scope.panes.push(pane); throttledSetInitialSelection(); }; this.unRegisterPane = function (pane) { if (pane) { - var indexOfExistingPane = _.indexOf(panes, pane); + var indexOfExistingPane = _.indexOf($scope.panes, pane); if (indexOfExistingPane !== -1) { $scope.panes.splice(indexOfExistingPane, 1); } From 0ac82ae6694e833266a375a69efa6fbd472028f5 Mon Sep 17 00:00:00 2001 From: Zarlex Date: Fri, 24 Nov 2017 14:30:22 +0100 Subject: [PATCH 3/3] Release new version --- CHANGELOG.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bdc19aa2..18147d95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# v1.21.1 +## Bug Fixes +### Ui components module +- Fix bug that tab pane could not be selected by number anymore + # v1.21.0 ## Features ### Backbone module diff --git a/package.json b/package.json index 818bfec3..e6a0d8ef 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "mw-uikit", "description": "A toolbox to build portals with AngularJS 1.5.x that have a lot of forms and list views for example admin portals to manage data.", "author": "Alexander Zarges (http://relution.io)", - "version": "1.21.0", + "version": "1.21.1", "license": "Apache-2.0", "devDependencies": { "angular": "1.5.7",