Ignore expansion state of root if there's a subproject in timelines

pull/913/head
Till Breuer 11 years ago
parent 0f725dc0cc
commit b4dc3df071
  1. 1
      app/assets/javascripts/angular/directives/timeline-table-row-directive.js
  2. 11
      app/assets/javascripts/angular/filters/ancestors_expanded_filter.js
  3. 9
      public/templates/timelines/timeline_table.html

@ -7,6 +7,7 @@ openprojectApp.directive('timelineTableRow', [function() {
var rowObject = scope.row.payload;
scope.rowObject = rowObject;
scope.rowObjectType = rowObject.objectType;
scope.changeDetected = rowObject.objectType === 'PlanningElement' && (rowObject.hasAlternateDates() || rowObject.isNewlyAdded() || rowObject.isDeleted());
scope.indent = scope.hideTreeRoot ? scope.row.level-1 : scope.row.level;

@ -3,7 +3,16 @@ openprojectApp
return function(ancestors) {
if(!ancestors) return true;
return ancestors.map(function(ancestor){
var directAncestors;
if(ancestors.length > 1 && ancestors[0].payload.objectType === 'Project' && ancestors[1].payload.objectType === 'Project') {
// discard expansion state of root if there's another project ancestor
directAncestors = ancestors.slice(1);
} else {
directAncestors = ancestors;
}
return directAncestors.map(function(ancestor){
return ancestor.expanded;
}).reduce(function(a,b){
return a && b;

@ -21,11 +21,10 @@
ng-class="{
'tl-first-row': $first,
'tl-last-row': $last,
'tl-project-row': rowObject.objectType === 'Project'
'tl-project-row': rowObjectType === 'Project'
}"
ng-show="row.ancestors | ancestorsExpanded"
ng-if="!(hideTreeRoot && $first)"
ng-hide="rowObject.objectType === 'Project' && excludeEmpty && !row.childNodes">
ng-if="!(hideTreeRoot && $first || rowObjectType === 'Project' && excludeEmpty && !row.childNodes)"
ng-show="rowObjectType === 'Project' && row.level === 1 || (row.ancestors | ancestorsExpanded)">
<td ng-class="[
'tl-first-column',
@ -45,7 +44,7 @@
</span>
<span>
<a modal title="{{row.text}}" target="row.url" ng-class="{'tl-discreet-link': true, 'tl-project': rowObject.objectType === 'Project'}">{{row.text}}</a>
<a modal title="{{row.text}}" target="row.url" ng-class="{'tl-discreet-link': true, 'tl-project': rowObjectType === 'Project'}">{{row.text}}</a>
</span>
</span>
</td>

Loading…
Cancel
Save