nested collections

This commit is contained in:
Kyle Spearrin 2018-10-25 12:19:35 -04:00
parent 1390d7eb1d
commit 8252512784
4 changed files with 20 additions and 9 deletions

2
jslib

@ -1 +1 @@
Subproject commit 6aba4550a4b1e643528392d6305df00977046232 Subproject commit b0eea9d7cefdc5453750f49985689fefa1fa53a5

View File

@ -50,5 +50,9 @@ export class GroupingsComponent extends BaseGroupingsComponent {
unassignedCollection.organizationId = this.organization.id; unassignedCollection.organizationId = this.organization.id;
unassignedCollection.readOnly = true; unassignedCollection.readOnly = true;
this.collections.push(unassignedCollection); this.collections.push(unassignedCollection);
if (this.loadNestedCollections) {
this.nestedCollections = await this.collectionService.getAllNested(this.collections);
}
} }
} }

View File

@ -52,7 +52,7 @@
</a> </a>
</h3> </h3>
<ul class="fa-ul card-ul carets"> <ul class="fa-ul card-ul carets">
<ng-template #recursiveList let-folders> <ng-template #recursiveFolders let-folders>
<li *ngFor="let f of folders" [ngClass]="{active: selectedFolder && f.node.id === selectedFolderId}"> <li *ngFor="let f of folders" [ngClass]="{active: selectedFolder && f.node.id === selectedFolderId}">
<div class="d-flex"> <div class="d-flex">
<a href="#" appStopClick (click)="selectFolder(f.node)"> <a href="#" appStopClick (click)="selectFolder(f.node)">
@ -63,20 +63,26 @@
</a> </a>
</div> </div>
<ul class="fa-ul card-ul carets" *ngIf="f.children.length"> <ul class="fa-ul card-ul carets" *ngIf="f.children.length">
<ng-container *ngTemplateOutlet="recursiveList; context:{ $implicit: f.children }"></ng-container> <ng-container *ngTemplateOutlet="recursiveFolders; context:{ $implicit: f.children }"></ng-container>
</ul> </ul>
</li> </li>
</ng-template> </ng-template>
<ng-container *ngTemplateOutlet="recursiveList; context:{ $implicit: nestedFolders }"></ng-container> <ng-container *ngTemplateOutlet="recursiveFolders; context:{ $implicit: nestedFolders }"></ng-container>
</ul> </ul>
</ng-container> </ng-container>
<ng-container *ngIf="showCollections && collections && collections.length"> <ng-container *ngIf="showCollections && collections && collections.length">
<h3>{{'collections' | i18n}}</h3> <h3>{{'collections' | i18n}}</h3>
<ul class="fa-ul card-ul carets"> <ul class="fa-ul card-ul carets">
<li *ngFor="let c of collections" [ngClass]="{active: c.id === selectedCollectionId}"> <ng-template #recursiveCollections let-collections>
<a href="#" appStopClick (click)="selectCollection(c)"> <li *ngFor="let c of collections" [ngClass]="{active: c.node.id === selectedCollectionId}">
<i class="fa-li fa fa-caret-right"></i> {{c.name}}</a> <a href="#" appStopClick (click)="selectCollection(c.node)">
<i class="fa-li fa fa-caret-right"></i> {{c.node.name}}</a>
<ul class="fa-ul card-ul carets" *ngIf="c.children.length">
<ng-container *ngTemplateOutlet="recursiveCollections; context:{ $implicit: c.children }"></ng-container>
</ul>
</li> </li>
</ng-template>
<ng-container *ngTemplateOutlet="recursiveCollections; context:{ $implicit: nestedCollections }"></ng-container>
</ul> </ul>
</ng-container> </ng-container>
</ng-container> </ng-container>

View File

@ -21,7 +21,8 @@ export class GroupingsComponent extends BaseGroupingsComponent {
constructor(collectionService: CollectionService, folderService: FolderService) { constructor(collectionService: CollectionService, folderService: FolderService) {
super(collectionService, folderService); super(collectionService, folderService);
this.loadNestedFolder = true; this.loadNestedFolders = true;
this.loadNestedCollections = true;
} }
searchTextChanged() { searchTextChanged() {