Verified Commit 6e7b0da9 authored by Alex ORLUC's avatar Alex ORLUC

fix right update / delete / create folder + fix css

parent caaf0b0b
......@@ -21,7 +21,7 @@
</span>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item [disabled]="createItemNode" (click)="addNewItem(node)">{{lang.addSubFolder}}</button>
<button mat-menu-item [disabled]="createItemNode || !node.canAdd" (click)="addNewItem(node)">{{lang.addSubFolder}}</button>
<button mat-menu-item (click)="deleteNode(node)" [disabled]="!node.edition">{{lang.delete}}</button>
<button mat-menu-item (click)="openFolderAdmin(node)" [disabled]="!node.edition">{{lang.update}}</button>
</mat-menu>
......@@ -60,7 +60,7 @@
</span>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item [disabled]="createItemNode" (click)="addNewItem(node)">{{lang.addSubFolder}}</button>
<button mat-menu-item [disabled]="createItemNode || !node.canAdd" (click)="addNewItem(node)">{{lang.addSubFolder}}</button>
<button mat-menu-item (click)="deleteNode(node)" [disabled]="!node.edition">{{lang.delete}}</button>
<button mat-menu-item (click)="openFolderAdmin(node)" [disabled]="!node.edition">{{lang.update}}</button>
</mat-menu>
......@@ -74,7 +74,7 @@
</mat-list-item>
</mat-nav-list>
<mat-list *ngIf="createRootNode">
<mat-list-item role="listitem">
<mat-list-item role="listitem" class="rootFolder">
<form>
<mat-form-field floatLabel="never" style="width: 100%;">
<input matInput id="itemValue" #itemValue placeholder="{{lang.addRootFolder}}">
......
......@@ -81,12 +81,17 @@ form {
.more {
width: 100%;
opacity: 0.6;
::ng-deep.mat-list-item-content {
justify-content: center;
}
}
.rootFolder {
width: 100%;
}
.private {
margin-left: 5px;
color: $secondary;
......
......@@ -243,7 +243,7 @@ export class FolderTreeComponent implements OnInit {
if (currentNode.children === undefined) {
currentNode['children'] = [];
}
currentNode.children.push({ label: '', parent_id: currentNode.id } as ItemNode);
currentNode.children.push({ label: '', parent_id: currentNode.id, public : currentNode.public } as ItemNode);
this.dataChange.next(this.data);
this.treeControl.expand(node);
......@@ -425,6 +425,8 @@ export class FolderTreeComponent implements OnInit {
exhaustMap(() => this.http.get("../../rest/folders/" + node.id)),
tap((data: any) => {
let canAdmin = false;
let canAdd = true;
const compare = data.folder.sharing.entities.filter((item: any) => userEntities.indexOf(item) > -1);
......@@ -435,7 +437,10 @@ export class FolderTreeComponent implements OnInit {
canAdmin = true;
}
});
if (data.folder.user_id !== currentUserId && node.public) {
canAdd = false;
}
node.canAdd = canAdd;
node.edition = (canAdmin || data.folder.user_id === currentUserId) ? true : false;
}),
).subscribe();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment