mirror of
https://github.com/ansible/awx.git
synced 2026-03-08 05:01:09 -02:30
Merge pull request #1781 from mabashian/944-limit-panels
Tweaked limit-panels so that it doesn't use $transitions
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
export default ['$rootScope', '$transitions', function($rootScope, $transitions) {
|
export default [function() {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
scope: {
|
scope: {
|
||||||
@@ -7,27 +7,28 @@ export default ['$rootScope', '$transitions', function($rootScope, $transitions)
|
|||||||
},
|
},
|
||||||
link: function(scope) {
|
link: function(scope) {
|
||||||
|
|
||||||
scope.maxPanels = parseInt(scope.maxPanels);
|
const maxPanels = parseInt(scope.maxPanels);
|
||||||
|
|
||||||
$transitions.onSuccess({}, function() {
|
scope.$watch(
|
||||||
let panels = angular.element('#' + scope.panelContainer).find('.Panel');
|
() => angular.element('#' + scope.panelContainer).find('.Panel').length,
|
||||||
|
() => {
|
||||||
if(panels.length > scope.maxPanels) {
|
const panels = angular.element('#' + scope.panelContainer).find('.Panel');
|
||||||
// hide the excess panels
|
if(panels.length > maxPanels) {
|
||||||
$(panels).each(function( index ) {
|
// hide the excess panels
|
||||||
if(index+1 > scope.maxPanels) {
|
$(panels).each(function( index ) {
|
||||||
$(this).addClass('Panel-hidden');
|
if(index+1 > maxPanels) {
|
||||||
}
|
$(this).addClass('Panel-hidden');
|
||||||
else {
|
}
|
||||||
$(this).removeClass('Panel-hidden');
|
else {
|
||||||
}
|
$(this).removeClass('Panel-hidden');
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// show all the panels
|
||||||
|
$(panels).removeClass('Panel-hidden');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
);
|
||||||
// show all the panels
|
|
||||||
$(panels).removeClass('Panel-hidden');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}];
|
}];
|
||||||
|
|||||||
Reference in New Issue
Block a user