]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-main/buttons/edit-button.component.ts
Use bootstrap loader
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / buttons / edit-button.component.ts
index 9cfe1a3bbd062ae2665b9ed8a6d675589e6c3794..0049dfa640230de23ab612bc807823e87a8aa4ce 100644 (file)
@@ -1,12 +1,34 @@
-import { Component, Input } from '@angular/core'
+import { Component, Input, OnInit } from '@angular/core'
 
 @Component({
   selector: 'my-edit-button',
-  styleUrls: [ './button.component.scss' ],
-  templateUrl: './edit-button.component.html'
+  template: `
+    <my-button
+      icon="edit" className="grey-button-link"
+      [label]="label" [title]="title" [responsiveLabel]="responsiveLabel"
+      [routerLink]="routerLink"
+    ></my-button>
+  `
 })
-
-export class EditButtonComponent {
+export class EditButtonComponent implements OnInit {
   @Input() label: string
+  @Input() title: string
   @Input() routerLink: string[] | string = []
+  @Input() responsiveLabel = false
+
+  ngOnInit () {
+    // <my-edit-button /> No label
+    if (this.label === undefined && !this.title) {
+      this.title = $localize`Update`
+    }
+
+    // <my-edit-button label /> Use default label
+    if (this.label === '') {
+      this.label = $localize`Update`
+
+      if (!this.title) {
+        this.title = this.label
+      }
+    }
+  }
 }