aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main/buttons/edit-button.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-main/buttons/edit-button.component.ts')
-rw-r--r--client/src/app/shared/shared-main/buttons/edit-button.component.ts24
1 files changed, 22 insertions, 2 deletions
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 @@
1import { Component, Input } from '@angular/core' 1import { Component, Input, OnInit } from '@angular/core'
2import { I18n } from '@ngx-translate/i18n-polyfill'
2 3
3@Component({ 4@Component({
4 selector: 'my-edit-button', 5 selector: 'my-edit-button',
@@ -6,7 +7,26 @@ import { Component, Input } from '@angular/core'
6 templateUrl: './edit-button.component.html' 7 templateUrl: './edit-button.component.html'
7}) 8})
8 9
9export class EditButtonComponent { 10export class EditButtonComponent implements OnInit {
10 @Input() label: string 11 @Input() label: string
12 @Input() title: string
11 @Input() routerLink: string[] | string = [] 13 @Input() routerLink: string[] | string = []
14
15 constructor (private i18n: I18n) { }
16
17 ngOnInit () {
18 // <my-edit-button /> No label
19 if (this.label === undefined && !this.title) {
20 this.title = this.i18n('Update')
21 }
22
23 // <my-edit-button label /> Use default label
24 if (this.label === '') {
25 this.label = this.i18n('Update')
26
27 if (!this.title) {
28 this.title = this.label
29 }
30 }
31 }
12} 32}