mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-5088] Replaced function calls in templates with variable references (#3227)
* [ACS-5088] Replaced method calls in templates with variables * [ACS-5088] Replaced method calls in templates with variables * [ACS-5088] Replaced method calls for *ngIf and *ngFor with variables - Batch 1 (WIP) * [ACS-5088] Replaced method calls for *ngIf and *ngFor with variables - Batch 2 (WIP) * [ACS-5088] Replaced instances of $any with cast pipe. Replaced other instances of method calls in templates with variables * [ACS-5088] Resolved test cases * [ACS-5088] Resolved test cases in aca-content library * [ACS-5088] Resolved test cases in aca-shared library * [ACS-5088] Resolved test cases in aca-folder-rules library * [ACS-5088] Reverted usage of cast pipe to $any() * [ACS-5088] Fixed incorrect revert * [ACS-5088] Resolved code review findings - shortened expressions and made onDestroy subjects use void instead of boolean * [ACS-5088] Resolved code review findings - changed parameter name in sort function * [ACS-5088] Resolved code review findings - added 'void' type to onDestroy subjects * [ACS-5088] Upgraded eslint version to 8.41.0. Added "@angular-eslint/template/no-call-expression" rule to prevent function calls in templates unless needed (reports warnings) * [ACS-5088] Resolved typo in ToggleFavoriteComponent
This commit is contained in:
@@ -36,7 +36,7 @@ describe('LockedByComponent', () => {
|
||||
}
|
||||
} as any
|
||||
};
|
||||
|
||||
component.ngOnInit();
|
||||
expect(component.text).toBe('owner-name');
|
||||
});
|
||||
});
|
||||
|
@@ -22,7 +22,7 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, Input, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, Input, ChangeDetectionStrategy, ViewEncapsulation, OnInit } from '@angular/core';
|
||||
import { NodeEntry } from '@alfresco/js-api';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
@@ -43,11 +43,13 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
class: 'aca-locked-by'
|
||||
}
|
||||
})
|
||||
export class LockedByComponent {
|
||||
export class LockedByComponent implements OnInit {
|
||||
@Input()
|
||||
node: NodeEntry;
|
||||
|
||||
get text(): string {
|
||||
return this.node?.entry?.properties?.['cm:lockOwner']?.displayName;
|
||||
public text: string;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.text = this.node?.entry?.properties?.['cm:lockOwner']?.displayName;
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, Input, ViewEncapsulation, HostListener, ViewChild, ViewChildren, QueryList, AfterViewInit } from '@angular/core';
|
||||
import { Component, Input, ViewEncapsulation, HostListener, ViewChild, ViewChildren, QueryList, AfterViewInit, OnInit } from '@angular/core';
|
||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||
import { MatMenu, MatMenuItem, MatMenuTrigger } from '@angular/material/menu';
|
||||
import { ThemePalette } from '@angular/material/core';
|
||||
@@ -34,7 +34,7 @@ import { ToolbarMenuItemComponent } from '../toolbar-menu-item/toolbar-menu-item
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
host: { class: 'app-toolbar-menu' }
|
||||
})
|
||||
export class ToolbarMenuComponent implements AfterViewInit {
|
||||
export class ToolbarMenuComponent implements OnInit, AfterViewInit {
|
||||
@Input()
|
||||
actionRef: ContentActionRef;
|
||||
|
||||
@@ -56,15 +56,17 @@ export class ToolbarMenuComponent implements AfterViewInit {
|
||||
color?: string;
|
||||
};
|
||||
|
||||
get type(): string {
|
||||
return this.data?.menuType || 'default';
|
||||
}
|
||||
type = 'default';
|
||||
|
||||
@HostListener('document:keydown.Escape')
|
||||
handleKeydownEscape() {
|
||||
this.matTrigger.closeMenu();
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.type = this.data?.menuType || 'default';
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
const menuItems: MatMenuItem[] = [];
|
||||
this.toolbarMenuItems.forEach((toolbarMenuItem: ToolbarMenuItemComponent) => {
|
||||
|
Reference in New Issue
Block a user