X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-main%2Fbuttons%2Fedit-button.component.ts;h=d8ae39b84c58c290a206aa7a97bb54bd9a60c6bb;hb=8c360747995e17eb5520e22fc3d7bd4c3d26eeee;hp=9cfe1a3bbd062ae2665b9ed8a6d675589e6c3794;hpb=67ed6552b831df66713bac9e672738796128d33f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-main/buttons/edit-button.component.ts b/client/src/app/shared/shared-main/buttons/edit-button.component.ts index 9cfe1a3bb..d8ae39b84 100644 --- a/client/src/app/shared/shared-main/buttons/edit-button.component.ts +++ b/client/src/app/shared/shared-main/buttons/edit-button.component.ts @@ -1,4 +1,5 @@ -import { Component, Input } from '@angular/core' +import { Component, Input, OnInit } from '@angular/core' +import { I18n } from '@ngx-translate/i18n-polyfill' @Component({ selector: 'my-edit-button', @@ -6,7 +7,26 @@ import { Component, Input } from '@angular/core' templateUrl: './edit-button.component.html' }) -export class EditButtonComponent { +export class EditButtonComponent implements OnInit { @Input() label: string + @Input() title: string @Input() routerLink: string[] | string = [] + + constructor (private i18n: I18n) { } + + ngOnInit () { + // No label + if (this.label === undefined && !this.title) { + this.title = this.i18n('Update') + } + + // Use default label + if (this.label === '') { + this.label = this.i18n('Update') + + if (!this.title) { + this.title = this.label + } + } + } }