From 30814423ae98b6ac5f7407fc53cffe32aae57124 Mon Sep 17 00:00:00 2001 From: Kim <1877318+kimsible@users.noreply.github.com> Date: Fri, 31 Jul 2020 11:30:57 +0200 Subject: Improve (accessibility title) and move action-buttons on left in tables (#2980) * Improve and move action-buttons on left in tables * Focus on my-delete and my-button * Correct spaces syntax * Move user-action dropdown on the left Co-authored-by: kimsible --- .../shared-main/buttons/button.component.html | 4 ++-- .../shared-main/buttons/button.component.scss | 4 ++++ .../buttons/delete-button.component.html | 3 +-- .../shared-main/buttons/delete-button.component.ts | 17 ++++++++++++--- .../shared-main/buttons/edit-button.component.html | 3 +-- .../shared-main/buttons/edit-button.component.ts | 24 ++++++++++++++++++++-- 6 files changed, 44 insertions(+), 11 deletions(-) (limited to 'client/src/app/shared/shared-main') diff --git a/client/src/app/shared/shared-main/buttons/button.component.html b/client/src/app/shared/shared-main/buttons/button.component.html index 8eccd5c3c..65e06f7a4 100644 --- a/client/src/app/shared/shared-main/buttons/button.component.html +++ b/client/src/app/shared/shared-main/buttons/button.component.html @@ -1,8 +1,8 @@ - + - {{ label }} + {{ label }} diff --git a/client/src/app/shared/shared-main/buttons/button.component.scss b/client/src/app/shared/shared-main/buttons/button.component.scss index 06fde9f1d..f73b7b808 100644 --- a/client/src/app/shared/shared-main/buttons/button.component.scss +++ b/client/src/app/shared/shared-main/buttons/button.component.scss @@ -1,6 +1,10 @@ @import '_variables'; @import '_mixins'; +:host { + outline: none; +} + my-small-loader ::ng-deep .root { display: inline-block; margin: 0 3px 0 0; diff --git a/client/src/app/shared/shared-main/buttons/delete-button.component.html b/client/src/app/shared/shared-main/buttons/delete-button.component.html index 6643e6013..c94d8d0c9 100644 --- a/client/src/app/shared/shared-main/buttons/delete-button.component.html +++ b/client/src/app/shared/shared-main/buttons/delete-button.component.html @@ -1,6 +1,5 @@ - + {{ label }} - Delete diff --git a/client/src/app/shared/shared-main/buttons/delete-button.component.ts b/client/src/app/shared/shared-main/buttons/delete-button.component.ts index 39e31900f..aced0f881 100644 --- a/client/src/app/shared/shared-main/buttons/delete-button.component.ts +++ b/client/src/app/shared/shared-main/buttons/delete-button.component.ts @@ -9,12 +9,23 @@ import { I18n } from '@ngx-translate/i18n-polyfill' export class DeleteButtonComponent implements OnInit { @Input() label: string - - title: string + @Input() title: string constructor (private i18n: I18n) { } ngOnInit () { - this.title = this.label || this.i18n('Delete') + // No label + if (this.label === undefined && !this.title) { + this.title = this.i18n('Delete') + } + + // Use default label + if (this.label === '') { + this.label = this.i18n('Delete') + + if (!this.title) { + this.title = this.label + } + } } } diff --git a/client/src/app/shared/shared-main/buttons/edit-button.component.html b/client/src/app/shared/shared-main/buttons/edit-button.component.html index 4ffc563d9..ecb709be1 100644 --- a/client/src/app/shared/shared-main/buttons/edit-button.component.html +++ b/client/src/app/shared/shared-main/buttons/edit-button.component.html @@ -1,6 +1,5 @@ - + {{ label }} - Update 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 + } + } + } } -- cgit v1.2.3