Allow Ctrl+Enter to submit comments (and comment edits). Fixes #302
This commit is contained in:
parent
a24594d791
commit
cff9be1987
@ -173,7 +173,8 @@
|
||||
|
||||
<textarea *ngIf="comment.isEdit"
|
||||
[(ngModel)]="commentEdit.text"
|
||||
(keyup.enter)="$event.stopPropagation()"></textarea>
|
||||
(keyup.control.enter)="comment.isEdit = false;editComment()"
|
||||
(keyup.enter)="preventEnter($event)"></textarea>
|
||||
|
||||
<div class="byline">
|
||||
{{ comment.is_edited ? strings['boards_editedBy']
|
||||
@ -208,8 +209,9 @@
|
||||
<div class="clearfix">
|
||||
<h3>{{ strings['boards_taskAddComment'] }}</h3>
|
||||
<textarea rows="5" [(ngModel)]="newComment"
|
||||
(keyup.control.enter)="addComment()"
|
||||
(keyup.enter)="preventEnter($event)"></textarea>
|
||||
<button class="right" (click)="addComment()">
|
||||
<button class="right" (click)="addComment()" [disabled]="newComment?.length === 0">
|
||||
<i class="icon icon-comment-empty"></i>
|
||||
{{ strings['boards_taskAddComment'] }}
|
||||
</button>
|
||||
|
@ -304,8 +304,10 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
|
||||
attachment.task_id = this.viewModalProps.id;
|
||||
|
||||
this.boardService.uploadAttachment(attachment, formData)
|
||||
.subscribe(res => {
|
||||
console.log(res);
|
||||
.subscribe(response => {
|
||||
response.alerts.forEach(note => this.notes.add(note));
|
||||
|
||||
console.log(response);
|
||||
});
|
||||
}
|
||||
|
||||
@ -330,6 +332,7 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
|
||||
this.replaceUpdatedTask(updatedTask);
|
||||
|
||||
this.viewModalProps = this.convertToTask(updatedTask);
|
||||
this.updateTaskActivity(this.viewModalProps.id);
|
||||
});
|
||||
}
|
||||
|
||||
@ -353,6 +356,7 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
|
||||
this.replaceUpdatedTask(updatedTask);
|
||||
|
||||
this.viewModalProps = this.convertToTask(updatedTask);
|
||||
this.updateTaskActivity(this.viewModalProps.id);
|
||||
});
|
||||
}
|
||||
|
||||
@ -369,6 +373,7 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
|
||||
|
||||
const updatedTask = response.data[1][0];
|
||||
this.replaceUpdatedTask(updatedTask);
|
||||
this.updateTaskActivity(this.viewModalProps.id);
|
||||
});
|
||||
}
|
||||
|
||||
@ -523,7 +528,7 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
getUserName(userId: number) {
|
||||
const user = this.activeBoard.users.find((test: User) => test.id === userId);
|
||||
const user = this.activeBoard.users.find((test: User) => test.id === +userId);
|
||||
|
||||
return user.username;
|
||||
}
|
||||
@ -535,17 +540,10 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
|
||||
showViewModal(taskId: number) {
|
||||
const viewTask = this.columnData.tasks.find(task => task.id === taskId);
|
||||
|
||||
this.viewTaskActivities = [];
|
||||
this.boardService.getTaskActivity(viewTask.id)
|
||||
.subscribe(response => {
|
||||
response.data[1].forEach((item: any) => {
|
||||
this.viewTaskActivities.push(
|
||||
new ActivitySimple(item.text, item.timestamp));
|
||||
});
|
||||
});
|
||||
this.updateTaskActivity(taskId);
|
||||
|
||||
this.newComment = '';
|
||||
this.viewModalProps = this.convertToTask(viewTask);
|
||||
this.viewModalProps = Object.assign({}, viewTask);
|
||||
this.checkDueDate();
|
||||
|
||||
if (this.showActivity) {
|
||||
@ -562,6 +560,18 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
private updateTaskActivity(id: number) {
|
||||
this.viewTaskActivities = [];
|
||||
|
||||
this.boardService.getTaskActivity(id)
|
||||
.subscribe(response => {
|
||||
response.data[1].forEach((item: any) => {
|
||||
this.viewTaskActivities.push(
|
||||
new ActivitySimple(item.text, item.timestamp));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private convertToTask(updatedTask: any) {
|
||||
const task = new Task(updatedTask.id,
|
||||
updatedTask.title,
|
||||
@ -602,6 +612,10 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
|
||||
private updateTaskComments(task: Task, newComments: Array<any>) {
|
||||
task.comments = [];
|
||||
|
||||
if (!newComments) {
|
||||
return;
|
||||
}
|
||||
|
||||
newComments.forEach(comment => {
|
||||
task.comments.push(
|
||||
new Comment(comment.id, comment.text, comment.user_id,
|
||||
|
Reference in New Issue
Block a user