Adapt empty value hiding to grouped layout

pull/2099/head
Hagen Schink 10 years ago
parent 98f6145c83
commit 184785a52e
  1. 10
      app/assets/javascripts/angular/work_packages/controllers/details-tab-overview-controller.js
  2. 11
      public/templates/work_packages/tabs/overview.html

@ -177,5 +177,15 @@ module.exports = function($scope,
hideAllAttributes: true
};
$scope.isGroupEmpty = function(group) {
return group.attributes.filter(function(element) {
return !!element.value;
}).length == 0;
};
$scope.anyEmptyWorkPackageValue = function() {
return $scope.groupedAttributes.filter(function(element) {
return $scope.isGroupEmpty(element);
}).length > 0;
};
}

@ -9,11 +9,12 @@
<div class="detail-panel-attributes">
<div ng-repeat="group in groupedAttributes" class="detail-panel-attributes-group">
<div ng-repeat="group in groupedAttributes" ng-hide="isGroupEmpty(group) && toggleStates.hideAllAttributes" class="detail-panel-attributes-group">
<h3 ng-bind="group.groupName"></h3>
<ul>
<li ng-repeat="propertyData in group.attributes">
<li ng-repeat="propertyData in group.attributes"
ng-show="propertyData.value || !toggleStates.hideAllAttributes">
<div class="work-package-attributes--label" ng-bind="propertyData.label"></div>
<div class="work-package-attributes--value-container" ng-switch="propertyData.value">
@ -42,6 +43,12 @@
</li>
</ul>
</div>
<panel-expander if="anyEmptyWorkPackageValue()"
collapsed="toggleStates.hideAllAttributes"
expand-text="{{ I18n.t('js.label_show_attributes') }}"
collapse-text="{{ I18n.t('js.label_hide_attributes') }}">
</panel-expander>
</div>
<div class="detail-panel-latest-activity">

Loading…
Cancel
Save