bugfixes drag & drop
This commit is contained in:
parent
4dc7e9900d
commit
cf508534fa
5 changed files with 72 additions and 49 deletions
|
|
@ -44,17 +44,17 @@
|
||||||
onclick="openAddTaskPage('todo')"
|
onclick="openAddTaskPage('todo')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div id="content-todo">
|
||||||
id="content-todo"
|
<ng-container *ngIf="!isTaskRendered('todo')">
|
||||||
|
<app-task [index]="undefined"></app-task>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container
|
||||||
*ngFor="let task of firebaseService.allTasks; index as i"
|
*ngFor="let task of firebaseService.allTasks; index as i"
|
||||||
>
|
>
|
||||||
<app-task
|
<ng-container *ngIf="task.status === 'todo'">
|
||||||
*ngIf="firebaseService.allTasks[i].status === 'todo'"
|
<app-task [index]="i"></app-task>
|
||||||
[index]="i"
|
</ng-container>
|
||||||
></app-task>
|
</ng-container>
|
||||||
<ng-template [ngIf]="firebaseService.allTasks[i].status === ''">
|
|
||||||
empthy
|
|
||||||
</ng-template>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
|
@ -70,17 +70,19 @@
|
||||||
onclick="openAddTaskPage('inprogress')"
|
onclick="openAddTaskPage('inprogress')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div id="content-inprogress">
|
||||||
id="content-inprogress"
|
<ng-container *ngIf="!isTaskRendered('inprogress')">
|
||||||
|
<app-task [index]="undefined"></app-task>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container
|
||||||
*ngFor="let task of firebaseService.allTasks; index as i"
|
*ngFor="let task of firebaseService.allTasks; index as i"
|
||||||
>
|
>
|
||||||
<app-task
|
<ng-container *ngIf="task.status === 'inprogress'">
|
||||||
*ngIf="firebaseService.allTasks[i].status === 'inprogress'"
|
<app-task [index]="i"></app-task>
|
||||||
[index]="i"
|
</ng-container>
|
||||||
></app-task>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="content-column"
|
class="content-column"
|
||||||
(dragover)="dragDropService.allowDrop($event)"
|
(dragover)="dragDropService.allowDrop($event)"
|
||||||
|
|
@ -94,17 +96,19 @@
|
||||||
onclick="openAddTaskPage('awaitfeedback')"
|
onclick="openAddTaskPage('awaitfeedback')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div id="content-awaitfeedback">
|
||||||
id="content-awaitfeedback"
|
<ng-container *ngIf="!isTaskRendered('awaitfeedback')">
|
||||||
|
<app-task [index]="undefined"></app-task>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container
|
||||||
*ngFor="let task of firebaseService.allTasks; index as i"
|
*ngFor="let task of firebaseService.allTasks; index as i"
|
||||||
>
|
>
|
||||||
<app-task
|
<ng-container *ngIf="task.status === 'awaitfeedback'">
|
||||||
*ngIf="firebaseService.allTasks[i].status === 'awaitfeedback'"
|
<app-task [index]="i"></app-task>
|
||||||
[index]="i"
|
</ng-container>
|
||||||
></app-task>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="content-column"
|
class="content-column"
|
||||||
(dragover)="dragDropService.allowDrop($event)"
|
(dragover)="dragDropService.allowDrop($event)"
|
||||||
|
|
@ -118,14 +122,17 @@
|
||||||
onclick="openAddTaskPage('done')"
|
onclick="openAddTaskPage('done')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div id="content-done">
|
||||||
id="content-done"
|
<ng-container *ngIf="!isTaskRendered('done')">
|
||||||
|
<app-task [index]="undefined"></app-task>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container
|
||||||
*ngFor="let task of firebaseService.allTasks; index as i"
|
*ngFor="let task of firebaseService.allTasks; index as i"
|
||||||
>
|
>
|
||||||
<app-task
|
<ng-container *ngIf="task.status === 'done'">
|
||||||
*ngIf="firebaseService.allTasks[i].status === 'done'"
|
<app-task [index]="i"></app-task>
|
||||||
[index]="i"
|
</ng-container>
|
||||||
></app-task>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -15,17 +15,27 @@ export class BoardComponent {
|
||||||
constructor(
|
constructor(
|
||||||
public dragDropService: DragDropService,
|
public dragDropService: DragDropService,
|
||||||
public firebaseService: FirebaseService
|
public firebaseService: FirebaseService
|
||||||
) {
|
) {}
|
||||||
this.dragDropService.itemDropped.subscribe(({ index, status }) => {
|
|
||||||
this.firebaseService.allTasks[index].status = status;
|
|
||||||
this.firebaseService.updateTask(
|
|
||||||
this.firebaseService.allTasks[index].id,
|
|
||||||
index
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.firebaseService.updateAllTasks();
|
this.firebaseService.updateAllTasks();
|
||||||
|
this.dragDropService.itemDropped.subscribe(({ index, status }) => {
|
||||||
|
this.handleItemDropped(index, status);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handleItemDropped(index: number, status: string): void {
|
||||||
|
let firebaseId = this.firebaseService.allTasks[index].id;
|
||||||
|
this.firebaseService.allTasks[index].status = status;
|
||||||
|
this.firebaseService.updateTask(firebaseId, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
isTaskRendered(taskColumn: string): boolean {
|
||||||
|
for (let task of this.firebaseService.allTasks) {
|
||||||
|
if (task.status === taskColumn) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
<section>
|
<section *ngIf="index !== undefined">
|
||||||
<div
|
<div
|
||||||
class="content"
|
class="content"
|
||||||
draggable="true"
|
draggable="true"
|
||||||
*ngIf="index !== undefined"
|
|
||||||
(dragstart)="dragDropService.startDragging($event, index)"
|
(dragstart)="dragDropService.startDragging($event, index)"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|
@ -22,3 +21,5 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<div *ngIf="index === undefined" class="empty-task">No tasks</div>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
section {
|
section {
|
||||||
width: 246px;
|
width: 246px;
|
||||||
height: 100%;
|
|
||||||
margin: 15.5px 0;
|
margin: 15.5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -18,6 +17,8 @@ section {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: var(--gray);
|
color: var(--gray);
|
||||||
|
width: 246px;
|
||||||
|
margin: 15.5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,10 @@
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.d-none {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
/*------------- SCROLLBAR -------------*/
|
/*------------- SCROLLBAR -------------*/
|
||||||
|
|
||||||
*::-webkit-scrollbar {
|
*::-webkit-scrollbar {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue