Initial edit task modal work
This commit is contained in:
parent
89c12750c9
commit
bdf7393ca4
@ -29,9 +29,10 @@
|
||||
</div>
|
||||
|
||||
<div class="tasks">
|
||||
<tb-task class="task-container" *ngFor="let task of columnData.ownTask"
|
||||
<tb-task class="task-container" *ngFor="let task of columnData.tasks"
|
||||
[task]="task" [boards]="boards"
|
||||
[add-task]="getShowModalFunction(task.id)"
|
||||
[add-task]="getShowModalFunction()"
|
||||
[edit-task]="getShowModalFunction(task.id)"
|
||||
[remove-task]="getRemoveTaskFunction(task.id)"></tb-task>
|
||||
</div>
|
||||
|
||||
@ -48,7 +49,8 @@
|
||||
</div>
|
||||
</tb-modal>
|
||||
|
||||
<tb-modal *ngIf="activeBoard" modal-title="Add Task"
|
||||
<tb-modal *ngIf="activeBoard"
|
||||
modal-title="{{ modalProps.id === 0 ? 'Add' : 'Edit' }} Task"
|
||||
modal-id="{{ MODAL_ID + columnData.id }}">
|
||||
<label>
|
||||
Title
|
||||
|
@ -187,8 +187,8 @@ export class ColumnDisplay implements OnInit {
|
||||
};
|
||||
}
|
||||
|
||||
private getShowModalFunction(): Function {
|
||||
return () => { this.showModal(); };
|
||||
private getShowModalFunction(taskId: number = 0): Function {
|
||||
return () => { this.showModal(taskId); };
|
||||
}
|
||||
|
||||
private quickAddClicked() {
|
||||
@ -203,10 +203,17 @@ export class ColumnDisplay implements OnInit {
|
||||
this.quickAdd = new Task();
|
||||
}
|
||||
|
||||
private showModal() {
|
||||
this.modalProps = new Task();
|
||||
this.modalProps.column_id = this.columnData.id;
|
||||
private showModal(taskId: number = 0) {
|
||||
if (taskId === 0) {
|
||||
this.modalProps = new Task();
|
||||
this.modalProps.column_id = this.columnData.id;
|
||||
|
||||
this.modal.open(this.MODAL_ID + this.columnData.id);
|
||||
return;
|
||||
}
|
||||
|
||||
this.modalProps = this.columnData.tasks
|
||||
.filter(task => task.id === taskId)[0];
|
||||
this.modal.open(this.MODAL_ID + this.columnData.id);
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@ export class TaskDisplay implements OnInit {
|
||||
|
||||
@Input('task') taskData: Task;
|
||||
@Input('add-task') addTask: Function;
|
||||
@Input('edit-task') editTask: Function;
|
||||
@Input('remove-task') removeTask: Function;
|
||||
|
||||
@Input('boards')
|
||||
@ -93,7 +94,7 @@ export class TaskDisplay implements OnInit {
|
||||
private generateContextMenuItems() {
|
||||
this.contextMenuItems = [
|
||||
new ContextMenuItem('View Task'),
|
||||
new ContextMenuItem('Edit Task'),
|
||||
new ContextMenuItem('Edit Task', this.editTask),
|
||||
new ContextMenuItem('Remove Task', this.removeTask),
|
||||
new ContextMenuItem('', null, true),
|
||||
this.selectMenuItem,
|
||||
|
@ -25,7 +25,9 @@ export class ContextMenu {
|
||||
|
||||
let parentElement = el.nativeElement.parentElement;
|
||||
|
||||
parentElement.oncontextmenu = this.eventHandler;
|
||||
parentElement.oncontextmenu = (event: MouseEvent) => {
|
||||
this.eventHandler(event);
|
||||
};
|
||||
}
|
||||
|
||||
getText(item: ContextMenuItem): SafeHtml {
|
||||
|
Reference in New Issue
Block a user