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"
|
<textarea *ngIf="comment.isEdit"
|
||||||
[(ngModel)]="commentEdit.text"
|
[(ngModel)]="commentEdit.text"
|
||||||
(keyup.enter)="$event.stopPropagation()"></textarea>
|
(keyup.control.enter)="comment.isEdit = false;editComment()"
|
||||||
|
(keyup.enter)="preventEnter($event)"></textarea>
|
||||||
|
|
||||||
<div class="byline">
|
<div class="byline">
|
||||||
{{ comment.is_edited ? strings['boards_editedBy']
|
{{ comment.is_edited ? strings['boards_editedBy']
|
||||||
@ -208,8 +209,9 @@
|
|||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
<h3>{{ strings['boards_taskAddComment'] }}</h3>
|
<h3>{{ strings['boards_taskAddComment'] }}</h3>
|
||||||
<textarea rows="5" [(ngModel)]="newComment"
|
<textarea rows="5" [(ngModel)]="newComment"
|
||||||
|
(keyup.control.enter)="addComment()"
|
||||||
(keyup.enter)="preventEnter($event)"></textarea>
|
(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>
|
<i class="icon icon-comment-empty"></i>
|
||||||
{{ strings['boards_taskAddComment'] }}
|
{{ strings['boards_taskAddComment'] }}
|
||||||
</button>
|
</button>
|
||||||
|
@ -304,8 +304,10 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
|
|||||||
attachment.task_id = this.viewModalProps.id;
|
attachment.task_id = this.viewModalProps.id;
|
||||||
|
|
||||||
this.boardService.uploadAttachment(attachment, formData)
|
this.boardService.uploadAttachment(attachment, formData)
|
||||||
.subscribe(res => {
|
.subscribe(response => {
|
||||||
console.log(res);
|
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.replaceUpdatedTask(updatedTask);
|
||||||
|
|
||||||
this.viewModalProps = this.convertToTask(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.replaceUpdatedTask(updatedTask);
|
||||||
|
|
||||||
this.viewModalProps = this.convertToTask(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];
|
const updatedTask = response.data[1][0];
|
||||||
this.replaceUpdatedTask(updatedTask);
|
this.replaceUpdatedTask(updatedTask);
|
||||||
|
this.updateTaskActivity(this.viewModalProps.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,7 +528,7 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getUserName(userId: number) {
|
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;
|
return user.username;
|
||||||
}
|
}
|
||||||
@ -535,17 +540,10 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
|
|||||||
showViewModal(taskId: number) {
|
showViewModal(taskId: number) {
|
||||||
const viewTask = this.columnData.tasks.find(task => task.id === taskId);
|
const viewTask = this.columnData.tasks.find(task => task.id === taskId);
|
||||||
|
|
||||||
this.viewTaskActivities = [];
|
this.updateTaskActivity(taskId);
|
||||||
this.boardService.getTaskActivity(viewTask.id)
|
|
||||||
.subscribe(response => {
|
|
||||||
response.data[1].forEach((item: any) => {
|
|
||||||
this.viewTaskActivities.push(
|
|
||||||
new ActivitySimple(item.text, item.timestamp));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
this.newComment = '';
|
this.newComment = '';
|
||||||
this.viewModalProps = this.convertToTask(viewTask);
|
this.viewModalProps = Object.assign({}, viewTask);
|
||||||
this.checkDueDate();
|
this.checkDueDate();
|
||||||
|
|
||||||
if (this.showActivity) {
|
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) {
|
private convertToTask(updatedTask: any) {
|
||||||
const task = new Task(updatedTask.id,
|
const task = new Task(updatedTask.id,
|
||||||
updatedTask.title,
|
updatedTask.title,
|
||||||
@ -602,6 +612,10 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
|
|||||||
private updateTaskComments(task: Task, newComments: Array<any>) {
|
private updateTaskComments(task: Task, newComments: Array<any>) {
|
||||||
task.comments = [];
|
task.comments = [];
|
||||||
|
|
||||||
|
if (!newComments) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
newComments.forEach(comment => {
|
newComments.forEach(comment => {
|
||||||
task.comments.push(
|
task.comments.push(
|
||||||
new Comment(comment.id, comment.text, comment.user_id,
|
new Comment(comment.id, comment.text, comment.user_id,
|
||||||
|
Reference in New Issue
Block a user