]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/app/shared/shared-main/buttons/delete-button.component.ts
Improve (accessibility title) and move action-buttons on left in tables (#2980)
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / buttons / delete-button.component.ts
... / ...
CommitLineData
1import { Component, Input, OnInit } from '@angular/core'
2import { I18n } from '@ngx-translate/i18n-polyfill'
3
4@Component({
5 selector: 'my-delete-button',
6 styleUrls: [ './button.component.scss' ],
7 templateUrl: './delete-button.component.html'
8})
9
10export class DeleteButtonComponent implements OnInit {
11 @Input() label: string
12 @Input() title: string
13
14 constructor (private i18n: I18n) { }
15
16 ngOnInit () {
17 // <my-delete-button /> No label
18 if (this.label === undefined && !this.title) {
19 this.title = this.i18n('Delete')
20 }
21
22 // <my-delete-button label /> Use default label
23 if (this.label === '') {
24 this.label = this.i18n('Delete')
25
26 if (!this.title) {
27 this.title = this.label
28 }
29 }
30 }
31}