diff options
author | kimsible <kimsible@users.noreply.github.com> | 2020-08-07 18:41:05 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-08-14 15:03:38 +0200 |
commit | cb54210c192bdbedab5d3333cc2602df8e23a38a (patch) | |
tree | 28e33247f432821f9b4f11e31fd73ab7fc659aae | |
parent | c311596094d6e2bad4f6215250dfc0c819d30b15 (diff) | |
download | PeerTube-cb54210c192bdbedab5d3333cc2602df8e23a38a.tar.gz PeerTube-cb54210c192bdbedab5d3333cc2602df8e23a38a.tar.zst PeerTube-cb54210c192bdbedab5d3333cc2602df8e23a38a.zip |
Use comment as label for comments-thread add button
3 files changed, 14 insertions, 3 deletions
diff --git a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.html b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.html index 9b43d91da..c9b0a9c63 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.html +++ b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.html | |||
@@ -20,8 +20,8 @@ | |||
20 | <button *ngIf="isAddButtonDisplayed()" class="cancel-button" (click)="cancelCommentReply()" type="button" i18n> | 20 | <button *ngIf="isAddButtonDisplayed()" class="cancel-button" (click)="cancelCommentReply()" type="button" i18n> |
21 | Cancel | 21 | Cancel |
22 | </button> | 22 | </button> |
23 | <button *ngIf="isAddButtonDisplayed()" [ngClass]="{ disabled: !form.valid || addingComment }" i18n> | 23 | <button *ngIf="isAddButtonDisplayed()" [ngClass]="{ disabled: !form.valid || addingComment }"> |
24 | Reply | 24 | {{ addingCommentButtonValue }} |
25 | </button> | 25 | </button> |
26 | </div> | 26 | </div> |
27 | </form> | 27 | </form> |
diff --git a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts index c1ddc0695..c6e9c73b8 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts +++ b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts | |||
@@ -7,6 +7,7 @@ import { Video } from '@app/shared/shared-main' | |||
7 | import { VideoComment, VideoCommentService } from '@app/shared/shared-video-comment' | 7 | import { VideoComment, VideoCommentService } from '@app/shared/shared-video-comment' |
8 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 8 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
9 | import { VideoCommentCreate } from '@shared/models' | 9 | import { VideoCommentCreate } from '@shared/models' |
10 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
10 | 11 | ||
11 | @Component({ | 12 | @Component({ |
12 | selector: 'my-video-comment-add', | 13 | selector: 'my-video-comment-add', |
@@ -20,6 +21,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, | |||
20 | @Input() parentComments: VideoComment[] | 21 | @Input() parentComments: VideoComment[] |
21 | @Input() focusOnInit = false | 22 | @Input() focusOnInit = false |
22 | @Input() textValue?: string | 23 | @Input() textValue?: string |
24 | @Input() commentThread?: boolean | ||
23 | 25 | ||
24 | @Output() commentCreated = new EventEmitter<VideoComment>() | 26 | @Output() commentCreated = new EventEmitter<VideoComment>() |
25 | @Output() cancel = new EventEmitter() | 27 | @Output() cancel = new EventEmitter() |
@@ -28,6 +30,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, | |||
28 | @ViewChild('textarea', { static: true }) textareaElement: ElementRef | 30 | @ViewChild('textarea', { static: true }) textareaElement: ElementRef |
29 | 31 | ||
30 | addingComment = false | 32 | addingComment = false |
33 | addingCommentButtonValue: string | ||
31 | 34 | ||
32 | constructor ( | 35 | constructor ( |
33 | protected formValidatorService: FormValidatorService, | 36 | protected formValidatorService: FormValidatorService, |
@@ -35,7 +38,8 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, | |||
35 | private notifier: Notifier, | 38 | private notifier: Notifier, |
36 | private videoCommentService: VideoCommentService, | 39 | private videoCommentService: VideoCommentService, |
37 | private modalService: NgbModal, | 40 | private modalService: NgbModal, |
38 | private router: Router | 41 | private router: Router, |
42 | private i18n: I18n | ||
39 | ) { | 43 | ) { |
40 | super() | 44 | super() |
41 | } | 45 | } |
@@ -46,6 +50,12 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, | |||
46 | }) | 50 | }) |
47 | 51 | ||
48 | if (this.user) { | 52 | if (this.user) { |
53 | if (this.commentThread) { | ||
54 | this.addingCommentButtonValue = this.i18n('Comment') | ||
55 | } else { | ||
56 | this.addingCommentButtonValue = this.i18n('Reply') | ||
57 | } | ||
58 | |||
49 | if (this.textValue) { | 59 | if (this.textValue) { |
50 | this.patchTextValue(this.textValue, this.focusOnInit) | 60 | this.patchTextValue(this.textValue, this.focusOnInit) |
51 | return | 61 | return |
diff --git a/client/src/app/+videos/+video-watch/comment/video-comments.component.html b/client/src/app/+videos/+video-watch/comment/video-comments.component.html index 1bc0885a4..ac69f094b 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comments.component.html +++ b/client/src/app/+videos/+video-watch/comment/video-comments.component.html | |||
@@ -28,6 +28,7 @@ | |||
28 | [user]="user" | 28 | [user]="user" |
29 | (commentCreated)="onCommentThreadCreated($event)" | 29 | (commentCreated)="onCommentThreadCreated($event)" |
30 | [textValue]="commentThreadRedraftValue" | 30 | [textValue]="commentThreadRedraftValue" |
31 | [commentThread]="true" | ||
31 | ></my-video-comment-add> | 32 | ></my-video-comment-add> |
32 | 33 | ||
33 | <div *ngIf="componentPagination.totalItems === 0 && comments.length === 0" i18n>No comments.</div> | 34 | <div *ngIf="componentPagination.totalItems === 0 && comments.length === 0" i18n>No comments.</div> |