]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Use comment as label for comments-thread add button
authorkimsible <kimsible@users.noreply.github.com>
Fri, 7 Aug 2020 16:41:05 +0000 (18:41 +0200)
committerChocobozzz <chocobozzz@cpy.re>
Fri, 14 Aug 2020 13:03:38 +0000 (15:03 +0200)
client/src/app/+videos/+video-watch/comment/video-comment-add.component.html
client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts
client/src/app/+videos/+video-watch/comment/video-comments.component.html

index 9b43d91dad8bb1010dd3000e46bcf6b66957403e..c9b0a9c63afdc607ec8043d23bec79aef6549f5a 100644 (file)
@@ -20,8 +20,8 @@
     <button *ngIf="isAddButtonDisplayed()" class="cancel-button" (click)="cancelCommentReply()" type="button" i18n>
       Cancel
     </button>
-    <button *ngIf="isAddButtonDisplayed()" [ngClass]="{ disabled: !form.valid || addingComment }" i18n>
-      Reply
+    <button *ngIf="isAddButtonDisplayed()" [ngClass]="{ disabled: !form.valid || addingComment }">
+      {{ addingCommentButtonValue }}
     </button>
   </div>
 </form>
index c1ddc069535ab753dc0cc68dcda1e67c0dcabf19..c6e9c73b8f2357c1cbe357dfb05521e55e4c806e 100644 (file)
@@ -7,6 +7,7 @@ import { Video } from '@app/shared/shared-main'
 import { VideoComment, VideoCommentService } from '@app/shared/shared-video-comment'
 import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
 import { VideoCommentCreate } from '@shared/models'
+import { I18n } from '@ngx-translate/i18n-polyfill'
 
 @Component({
   selector: 'my-video-comment-add',
@@ -20,6 +21,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges,
   @Input() parentComments: VideoComment[]
   @Input() focusOnInit = false
   @Input() textValue?: string
+  @Input() commentThread?: boolean
 
   @Output() commentCreated = new EventEmitter<VideoComment>()
   @Output() cancel = new EventEmitter()
@@ -28,6 +30,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges,
   @ViewChild('textarea', { static: true }) textareaElement: ElementRef
 
   addingComment = false
+  addingCommentButtonValue: string
 
   constructor (
     protected formValidatorService: FormValidatorService,
@@ -35,7 +38,8 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges,
     private notifier: Notifier,
     private videoCommentService: VideoCommentService,
     private modalService: NgbModal,
-    private router: Router
+    private router: Router,
+    private i18n: I18n
   ) {
     super()
   }
@@ -46,6 +50,12 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges,
     })
 
     if (this.user) {
+      if (this.commentThread) {
+        this.addingCommentButtonValue = this.i18n('Comment')
+      } else {
+        this.addingCommentButtonValue = this.i18n('Reply')
+      }
+
       if (this.textValue) {
         this.patchTextValue(this.textValue, this.focusOnInit)
         return
index 1bc0885a4d0c584cb46ea377058c7fc7b17d48e7..ac69f094b1277df8df7b6264f3a2462c29c4e5d1 100644 (file)
@@ -28,6 +28,7 @@
       [user]="user"
       (commentCreated)="onCommentThreadCreated($event)"
       [textValue]="commentThreadRedraftValue"
+      [commentThread]="true"
     ></my-video-comment-add>
 
     <div *ngIf="componentPagination.totalItems === 0 && comments.length === 0" i18n>No comments.</div>