Merge "Fix bug that prevent saving layout"
This commit is contained in:
commit
bc982cabde
@ -8,18 +8,16 @@
|
||||
{
|
||||
"type": "tabpanel",
|
||||
"attributes": {
|
||||
"navigation": [
|
||||
{
|
||||
"navigation": {
|
||||
"openProblems" : {
|
||||
"title": "Open problems",
|
||||
"panelId": "openProblems",
|
||||
"provider": "nbServicesHostsOpenProblems"
|
||||
},
|
||||
{
|
||||
"allProblems": {
|
||||
"title": "All problems",
|
||||
"panelId": "allProblems",
|
||||
"provider": "nbServicesHostsProblems"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"components": [
|
||||
{
|
||||
@ -74,18 +72,16 @@
|
||||
{
|
||||
"type": "tabpanel",
|
||||
"attributes": {
|
||||
"navigation": [
|
||||
{
|
||||
"navigation": {
|
||||
"openProblems": {
|
||||
"title": "Open Problems",
|
||||
"panelId": "openProblems",
|
||||
"provider": "nbServicesHostsOpenProblems"
|
||||
},
|
||||
{
|
||||
"allProblems": {
|
||||
"title": "All Problems",
|
||||
"panelId": "allProblems",
|
||||
"provider": "nbServicesHostsOpenProblemsDoubleCount"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"components": [
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div role="tabpanel" class="tab-pane" data-ng-class="{active: parent.currentPanel === index }"
|
||||
id="{{options.attributes.panelId}}" data-ng-show="parent.currentPanel === index">
|
||||
<div role="tabpanel" class="tab-pane" data-ng-class="{active: parent.currentPanel === options.attributes.panelId }"
|
||||
id="{{options.attributes.panelId}}" data-ng-show="parent.currentPanel === options.attributes.panelId">
|
||||
<section class="main__content tabpanel">
|
||||
<bansho-components components="options.components"></bansho-components>
|
||||
</section>
|
||||
|
@ -1,9 +1,9 @@
|
||||
<section class="main__content tabpanel">
|
||||
<nav>
|
||||
<ul class="tablist clearfix">
|
||||
<li role="presentation" class="tablist__item" data-ng-repeat="(index, panel) in navigation"
|
||||
ng-class="{active: currentPanel === index }">
|
||||
<a ng-click="setIsShown(index)"
|
||||
<li role="presentation" class="tablist__item" data-ng-repeat="(key, panel) in options.attributes.navigation"
|
||||
ng-class="{active: currentPanel === key}">
|
||||
<a ng-click="setIsShown(key)"
|
||||
class="tabpanel__tab"
|
||||
aria-expanded="true"
|
||||
role="tab"
|
||||
|
@ -11,16 +11,12 @@ angular.module('bansho.tabpanel', [])
|
||||
link: function (scope) {
|
||||
scope.navigation = scope.options.attributes.navigation;
|
||||
|
||||
scope.currentPanel = 0;
|
||||
scope.setIsShown = function (index) {
|
||||
scope.currentPanel = index;
|
||||
scope.currentPanel = Object.keys(scope.navigation)[0];
|
||||
scope.setIsShown = function (panelId) {
|
||||
scope.currentPanel = panelId;
|
||||
};
|
||||
|
||||
angular.forEach(scope.options.components, function (panel, index) {
|
||||
panel.attributes.index = index;
|
||||
});
|
||||
|
||||
angular.forEach(scope.options.attributes.navigation, function (panel, index) {
|
||||
angular.forEach(scope.navigation, function (panel) {
|
||||
panel.right = sharedData.getData(panel.provider, function (data) {
|
||||
panel.right = data;
|
||||
});
|
||||
@ -39,11 +35,14 @@ angular.module('bansho.tabpanel', [])
|
||||
link: function (scope) {
|
||||
if (scope.$parent.$parent.currentPanel !== undefined) {
|
||||
scope.parent = scope.$parent.$parent;
|
||||
scope.index = scope.options.attributes.index;
|
||||
} else {
|
||||
scope.parent = {};
|
||||
scope.parent.currentPanel = 0;
|
||||
scope.index = 0;
|
||||
|
||||
if (!scope.options.attributes) {
|
||||
scope.options.attributes = {};
|
||||
}
|
||||
scope.options.attributes.panelId = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user