Fix Activities buttons

- pass module to use mod strings
- remove duplicate labels
This commit is contained in:
Jack Anderson 2023-02-22 13:49:26 +00:00 committed by Clemente Raposo
parent 3206c3f41f
commit c70fd502bd
13 changed files with 41 additions and 23 deletions

View file

@ -42,6 +42,7 @@ services:
$recordViewSidebarWidgets: '%module.recordview.sidebar_widgets%'
$recordViewBottomWidgets: '%module.recordview.bottom_widgets%'
$recordViewTopWidgets: '%module.recordview.top_widgets%'
$subpanelViewActionLimits: '%module.subpanelview.actions_limits%'
$groupedFieldsTypeMap: '%record.fields.grouped_fields_type_map%'
$currencyFieldsTypeMap: '%record.fields.currency_fields_type_map%'
$legacyToFrontEndFieldsMap: '%record.fields.legacy_to_frontend_fields_map%'

View file

@ -34,6 +34,7 @@ parameters:
listview_line_actions_limits: true
module_routing: true
recordview_actions_limits: true
subpanelview_actions_limits: true
ui: true
extensions: true
logout: true

View file

@ -0,0 +1,7 @@
parameters:
module.subpanelview.actions_limits:
XSmall: 2
Small: 2
Medium: 2
Large: 2
XLarge: 2

View file

@ -4,7 +4,6 @@ parameters:
key: select
labelKey: LBL_LINK
action: select
params:
modes:
- list
acl:
@ -13,7 +12,6 @@ parameters:
key: create
labelKey: LBL_QUICK_CREATE
action: create
params:
modes:
- list
acl:
@ -42,7 +40,6 @@ parameters:
key: create
labelKey: LNK_NEW_TASK
action: create
params:
modes:
- list
acl:
@ -52,7 +49,6 @@ parameters:
key: create
labelKey: LNK_NEW_MEETING
action: create
params:
modes:
- list
acl:
@ -62,7 +58,6 @@ parameters:
key: create
labelKey: LNK_NEW_CALL
action: create
params:
modes:
- list
acl:
@ -72,7 +67,6 @@ parameters:
key: create
labelKey: LNK_NEW_EMAIL
action: create
params:
modes:
- list
acl:
@ -84,7 +78,6 @@ parameters:
key: create
labelKey: LNK_NEW_NOTE
action: create
params:
modes:
- list
acl:
@ -94,7 +87,6 @@ parameters:
key: create
labelKey: LBL_TRACK_EMAIL_BUTTON_LABEL
action: create
params:
modes:
- list
acl:
@ -104,7 +96,6 @@ parameters:
key: create
labelKey: LBL_QUICK_CREATE
action: create
params:
modes:
- list
acl:

View file

@ -36,6 +36,7 @@ export interface ButtonInterface {
titleKey?: string;
icon?: string;
iconKlass?: string;
labelModule?: string;
}
export class Button implements ButtonInterface {
@ -46,7 +47,8 @@ export class Button implements ButtonInterface {
public label: string = null,
public icon: string = null,
public labelKey: string = null,
public titleKey: string = null
public titleKey: string = null,
public labelModule: string = null
) {
}
@ -57,7 +59,8 @@ export class Button implements ButtonInterface {
button.label,
button.icon,
button.labelKey,
button.titleKey
button.titleKey,
button.labelModule
);
}

View file

@ -52,6 +52,7 @@ export class ActionGroupMenuComponent implements OnInit {
@Input() buttonGroupClass = '';
@Input() actionContext: ActionContext;
@Input() config: ActionDataSource;
@Input() actionLimitConfig: string = 'recordview_actions_limits';
configState = new BehaviorSubject<ButtonGroupInterface>({buttons: []});
config$ = this.configState.asObservable();
@ -71,8 +72,6 @@ export class ActionGroupMenuComponent implements OnInit {
protected defaultBreakpoint = 3;
protected breakpoint: number;
constructor(
protected languages: LanguageStore,
protected screenSize: ScreenSizeObserverService,
@ -138,7 +137,7 @@ export class ActionGroupMenuComponent implements OnInit {
getBreakpoint(): number {
const breakpointMap = this.systemConfigStore.getConfigValue('recordview_actions_limits');
const breakpointMap = this.systemConfigStore.getConfigValue(this.actionLimitConfig);
if (this.screen && breakpointMap && breakpointMap[this.screen]) {
this.breakpoint = breakpointMap[this.screen];
@ -155,6 +154,7 @@ export class ActionGroupMenuComponent implements OnInit {
protected buildButton(action: Action): ButtonInterface {
const button = {
label: action.label || '',
labelModule: this?.actionContext?.module ?? '',
labelKey: action.labelKey || '',
klass: this.buttonClass,
titleKey: action.titleKey || '',
@ -175,6 +175,10 @@ export class ActionGroupMenuComponent implements OnInit {
}
} as ButtonInterface;
if (!button.label){
button.labelKey = action.labelKey ?? '';
}
const debounceClick = action?.params?.debounceClick ?? null;
button.debounceClick = true;

View file

@ -25,9 +25,7 @@
*/
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
import {Button, ButtonInterface} from 'common';
import {DropdownButtonInterface} from 'common';
import {ButtonGroupInterface} from 'common';
import {Button, ButtonGroupInterface, ButtonInterface, DropdownButtonInterface} from 'common';
import {Observable, Subscription} from 'rxjs';
interface SplitButtons {
@ -116,11 +114,13 @@ export class ButtonGroupComponent implements OnInit, OnDestroy {
protected getBreakpoint(): number {
if (!this.internalConfig.breakpoint) {
const breakpoint = this.internalConfig?.breakpoint ?? null;
if (breakpoint === null) {
return 4;
}
return this.internalConfig.breakpoint;
return breakpoint;
}
protected splitButtons(): void {

View file

@ -34,6 +34,6 @@
[klass]="config.iconKlass || ''"
[title]="language.getFieldLabel(config.titleKey || '')"></scrm-image>
<ng-container *ngIf="!config.labelKey">{{ config.label || '' }}</ng-container>
<scrm-label *ngIf="config.labelKey" [labelKey]="config.labelKey"></scrm-label>
<scrm-label *ngIf="config.labelKey" [labelKey]="config.labelKey" [module]="config.labelModule ?? ''"></scrm-label>
<ng-content></ng-content>
</button>

View file

@ -64,7 +64,7 @@
<scrm-image [image]="item.icon" [klass]="item.iconKlass || ''"></scrm-image>
</div>
<div class="flex-grow-1">
{{item && item.label}}
<scrm-label *ngIf="item && item.labelKey" [labelKey]="item.labelKey" [module]="item.labelModule ?? ''"></scrm-label>
</div>
</div>
</a>

View file

@ -32,6 +32,8 @@
</span>
<span panel-header-button>
<scrm-action-group-menu [config]="actionsAdapter"
[actionContext]="getActionContext()"
[actionLimitConfig]="'subpanelview_actions_limits'"
buttonClass="btn btn-sm btn-outline-light"
></scrm-action-group-menu>
</span>

View file

@ -25,7 +25,7 @@
*/
import {Component, Input, OnInit} from '@angular/core';
import {ButtonGroupInterface, ButtonInterface} from 'common';
import {ActionContext, ButtonGroupInterface, ButtonInterface} from 'common';
import {Observable} from 'rxjs';
import {TableConfig} from '../../../../components/table/table.model';
import {SubpanelTableAdapter} from '../../adapters/table.adapter';
@ -107,6 +107,11 @@ export class SubpanelComponent implements OnInit {
} as ButtonInterface;
}
getActionContext(): ActionContext {
const module = this.store?.metadata?.module ?? '';
return {module} as ActionContext;
}
buildAdapters(): void {
this.adapter = this.tableAdapterFactory.create(this.store);
this.tableConfig = this.adapter.getTable();

View file

@ -44,7 +44,8 @@ class ModStringsHandler extends LegacyHandler
protected static $extraModules = [
'SecurityGroups',
'Bugs'
'Bugs',
'History'
];
/**

View file

@ -97,6 +97,7 @@ class SystemConfigHandler extends LegacyHandler implements SystemConfigProviderI
* @param array $listViewSettingsLimits
* @param array $listViewActionsLimits
* @param array $recordViewActionLimits
* @param array $subpanelViewActionLimits
* @param array $listViewLineActionsLimits
* @param array $uiConfigs
* @param array $notificationsConfigs
@ -127,6 +128,7 @@ class SystemConfigHandler extends LegacyHandler implements SystemConfigProviderI
array $listViewSettingsLimits,
array $listViewActionsLimits,
array $recordViewActionLimits,
array $subpanelViewActionLimits,
array $listViewLineActionsLimits,
array $uiConfigs,
array $notificationsConfigs,
@ -157,6 +159,7 @@ class SystemConfigHandler extends LegacyHandler implements SystemConfigProviderI
$this->injectedSystemConfigs['listview_settings_limits'] = $listViewSettingsLimits;
$this->injectedSystemConfigs['listview_actions_limits'] = $listViewActionsLimits;
$this->injectedSystemConfigs['recordview_actions_limits'] = $recordViewActionLimits;
$this->injectedSystemConfigs['subpanelview_actions_limits'] = $subpanelViewActionLimits;
$this->injectedSystemConfigs['listview_line_actions_limits'] = $listViewLineActionsLimits;
$this->injectedSystemConfigs['ui'] = $uiConfigs ?? [];
$this->injectedSystemConfigs['ui']['notifications'] = $notificationsConfigs ?? [];