From d404d67f9b0af3dbb60d2a20a18685e1f0a6dd99 Mon Sep 17 00:00:00 2001 From: Yasa-Nataliya Date: Thu, 28 Sep 2023 17:20:01 +0530 Subject: [PATCH] [ACS-5645] Implemented changes as per review comments --- .../categories-management.component.md | 29 ------------------- .../components/tags-creator.component.md | 25 ---------------- .../categories-management.component.html | 2 +- .../categories-management.component.spec.ts | 10 +++---- .../categories-management.component.ts | 8 ++++- .../content-metadata.component.html | 12 +++++--- .../content-metadata.component.scss | 9 ++++-- .../content-metadata.component.ts | 7 ++++- .../interfaces/card-view-group.interface.ts | 4 +-- .../tags-creator/tags-creator.component.html | 2 +- .../tags-creator.component.spec.ts | 11 +++---- .../tags-creator/tags-creator.component.ts | 8 ++++- .../src/lib/styles/_components-variables.scss | 1 + .../src/lib/styles/_reference-variables.scss | 1 + 14 files changed, 51 insertions(+), 78 deletions(-) diff --git a/docs/content-services/components/categories-management.component.md b/docs/content-services/components/categories-management.component.md index b5fc334960..dc2f8c985b 100644 --- a/docs/content-services/components/categories-management.component.md +++ b/docs/content-services/components/categories-management.component.md @@ -42,32 +42,3 @@ Component allows to both assign/unassign categories to content and create multip | ---- | ---- | ----------- | | categoriesChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`Category`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/Category.md)`>` | Emitted when categories list changes. | | categoryNameControlVisibleChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when category name control visibility changes. | - -## Method: `get isNameCategoryVisible(): boolean` - -### Description -This method calculates and returns a boolean value indicating whether the category name control should be visible in the Categories Management Component. The visibility is determined by a specific condition based on the component's internal state. - -### Return Value -- Type: `boolean` -- `true` if the category name control should be visible. -- `false` if the category name control should not be visible. - -### Usage -You can access this method to determine the visibility of the category name control within the Categories Management Component. The method is used to control the display of the category name input field based on the following condition: - -```typescript -return (!this.categoryNameControlVisible && this.categories?.length > 0) || this.categoryNameControlVisible; -``` -## Method: `isCategoryEmpty(): boolean` - -### Description -The `isCategoryEmpty` method is used within the Categories Management Component to determine whether the list of categories is empty. It returns a boolean value indicating the presence or absence of categories. - -### Return Value -- Type: `boolean` -- `true` if the list of categories is not empty. -- `false` if the list of categories is empty. - -### Usage -You can use this method to check whether there are categories present in the Categories Management Component. It's particularly useful when you need to conditionally display or hide elements based on the presence of categories. diff --git a/docs/content-services/components/tags-creator.component.md b/docs/content-services/components/tags-creator.component.md index 4d3162b7ab..fd83ec7e61 100644 --- a/docs/content-services/components/tags-creator.component.md +++ b/docs/content-services/components/tags-creator.component.md @@ -38,28 +38,3 @@ Allows to create multiple tags. That component contains input and two lists. Top | tagNameControlVisibleChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when input is showing or hiding. | | tagsChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when tags in top list are changed. | -## Method: `get isNameTagsVisible(): boolean` - -### Description -The `isNameTagsVisible` method is used within the Tags Creator Component to determine whether the tag name control should be visible. It calculates a boolean value based on specific conditions that take into account the visibility of the tag name control and the presence of tags in the component. - -### Return Value -- Type: `boolean` -- `true` if the tag name control should be visible. -- `false` if the tag name control should not be visible. - -### Usage -You can use this method to control the visibility of the tag name input field within the Tags creator Component. It provides a way to dynamically show or hide the input field based on certain criteria. - -## Method: `get isTagsEmpty(): boolean` - -### Description -The `isTagsEmpty` method is a utility method used within the Tags creator Component to check whether the list of tags is empty or not. It returns a boolean value, indicating whether there are tags present in the component. - -### Return Value -- Type: `boolean` -- `true` if the list of tags is not empty. -- `false` if the list of tags is empty. - -### Usage -You can use this method to programmatically determine whether there are tags available in the Tags creator Component. It is particularly useful when you need to conditionally display messages, elements, or take specific actions based on the presence or absence of tags. diff --git a/lib/content-services/src/lib/category/categories-management/categories-management.component.html b/lib/content-services/src/lib/category/categories-management/categories-management.component.html index e3b56983f9..872e874033 100644 --- a/lib/content-services/src/lib/category/categories-management/categories-management.component.html +++ b/lib/content-services/src/lib/category/categories-management/categories-management.component.html @@ -30,7 +30,7 @@ -

+

{{ noCategoriesMsg | translate }}

diff --git a/lib/content-services/src/lib/category/categories-management/categories-management.component.spec.ts b/lib/content-services/src/lib/category/categories-management/categories-management.component.spec.ts index fee092e9c9..db9fe40833 100644 --- a/lib/content-services/src/lib/category/categories-management/categories-management.component.spec.ts +++ b/lib/content-services/src/lib/category/categories-management/categories-management.component.spec.ts @@ -240,16 +240,16 @@ describe('CategoriesManagementComponent', () => { }); }); - describe('isCategoryEmpty', () => { - it('should return true when categories is not empty', () => { + describe('hasCategory', () => { + it('should return true when has categories', () => { component.categories = [category3, category4]; - const result = component.isCategoryEmpty; + const result = component.hasCategory; expect(result).toBeTrue(); }); - it('should return false when categories is empty', () => { + it('should return false when does not have categories', () => { component.categories = []; - const result = component.isCategoryEmpty; + const result = component.hasCategory; expect(result).toBeFalse(); }); }); diff --git a/lib/content-services/src/lib/category/categories-management/categories-management.component.ts b/lib/content-services/src/lib/category/categories-management/categories-management.component.ts index a17a0aaaaf..9bb94c374b 100644 --- a/lib/content-services/src/lib/category/categories-management/categories-management.component.ts +++ b/lib/content-services/src/lib/category/categories-management/categories-management.component.ts @@ -177,6 +177,9 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy { this.cancelExistingCategoriesLoading$.complete(); } + /* + * Returns `true` if categoryNameControlVisible is true, otherwise `false` + */ get isNameCategoryVisible(): boolean { return (!this.categoryNameControlVisible && this.categories?.length > 0) || this.categoryNameControlVisible; } @@ -185,7 +188,10 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy { return this._categoryNameControl; } - get isCategoryEmpty(): boolean { + /* + * Returns `true` if has categories, otherwise `false` + */ + get hasCategory(): boolean { return this.categories?.length > 0; } diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.html b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.html index 4f079fcef1..b6b7fd2221 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.html +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.html @@ -30,7 +30,8 @@