+
diff --git a/src/app/shared/truncatable/truncatable.component.spec.ts b/src/app/shared/truncatable/truncatable.component.spec.ts
index b539ab0d56..29100e50d2 100644
--- a/src/app/shared/truncatable/truncatable.component.spec.ts
+++ b/src/app/shared/truncatable/truncatable.component.spec.ts
@@ -70,15 +70,4 @@ describe('TruncatableComponent', () => {
});
});
- describe('When toggle is called', () => {
- beforeEach(() => {
- spyOn(truncatableService, 'toggle');
- comp.toggle();
- });
-
- it('should call toggle on the TruncatableService', () => {
- expect(truncatableService.toggle).toHaveBeenCalledWith(identifier);
- });
- });
-
});
diff --git a/src/app/shared/truncatable/truncatable.component.ts b/src/app/shared/truncatable/truncatable.component.ts
index e22ce4441e..61ec9c422a 100644
--- a/src/app/shared/truncatable/truncatable.component.ts
+++ b/src/app/shared/truncatable/truncatable.component.ts
@@ -1,6 +1,4 @@
-import {
- Component, Input
-} from '@angular/core';
+import { AfterViewChecked, Component, ElementRef, Input, OnInit } from '@angular/core';
import { TruncatableService } from './truncatable.service';
@Component({
@@ -13,7 +11,7 @@ import { TruncatableService } from './truncatable.service';
/**
* Component that represents a section with one or more truncatable parts that all listen to this state
*/
-export class TruncatableComponent {
+export class TruncatableComponent implements OnInit, AfterViewChecked {
/**
* Is true when all truncatable parts in this truncatable should be expanded on loading
*/
@@ -29,7 +27,7 @@ export class TruncatableComponent {
*/
@Input() onHover = false;
- public constructor(private service: TruncatableService) {
+ public constructor(private service: TruncatableService, private el: ElementRef,) {
}
/**
@@ -61,11 +59,14 @@ export class TruncatableComponent {
}
}
- /**
- * Expands the truncatable when it's collapsed, collapses it when it's expanded
- */
- public toggle() {
- this.service.toggle(this.id);
+ ngAfterViewChecked() {
+ const truncatedElements = this.el.nativeElement.querySelectorAll('.truncated');
+ if (truncatedElements?.length > 1) {
+ for (let i = 0; i < (truncatedElements.length - 1); i++) {
+ truncatedElements[i].classList.remove('truncated');
+ truncatedElements[i].classList.add('notruncatable');
+ }
+ }
}
}
diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5
index c3c68a6882..12de3ffdea 100644
--- a/src/assets/i18n/en.json5
+++ b/src/assets/i18n/en.json5
@@ -2056,6 +2056,10 @@
"item.search.title": "Item Search",
+ "item.truncatable-part.show-more": "Show more",
+
+ "item.truncatable-part.show-less": "Collapse",
+
"item.page.abstract": "Abstract",
From 0812377b58c88f552677d3e4868fa21382a5d680 Mon Sep 17 00:00:00 2001
From: Sufiyan Shaikh <“sufiyan.shaikh@4science.com”>
Date: Wed, 27 Apr 2022 11:50:53 +0530
Subject: [PATCH 03/30] [DSC-516] Test cases changes
---
...item-admin-search-result-grid-element.component.spec.ts | 2 ++
.../truncatable-part/truncatable-part.component.spec.ts | 7 +++++--
.../truncatable-part/truncatable-part.component.ts | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.spec.ts b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.spec.ts
index dedada5f5f..148cfb13cb 100644
--- a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.spec.ts
+++ b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.spec.ts
@@ -18,6 +18,7 @@ import { ItemAdminSearchResultGridElementComponent } from './item-admin-search-r
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils';
import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock';
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
+import { NativeWindowRef, NativeWindowService } from '../../../../../core/services/window.service';
describe('ItemAdminSearchResultGridElementComponent', () => {
let component: ItemAdminSearchResultGridElementComponent;
@@ -52,6 +53,7 @@ describe('ItemAdminSearchResultGridElementComponent', () => {
SharedModule
],
providers: [
+ { provide: NativeWindowService, useValue: new NativeWindowRef() },
{ provide: TruncatableService, useValue: mockTruncatableService },
{ provide: BitstreamDataService, useValue: mockBitstreamDataService },
{ provide: ThemeService, useValue: mockThemeService },
diff --git a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.spec.ts b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.spec.ts
index 09109ee400..09d603e6b7 100644
--- a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.spec.ts
+++ b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.spec.ts
@@ -9,6 +9,7 @@ import { getMockTranslateService } from '../../mocks/translate.service.mock';
import { TranslateLoaderMock } from '../../mocks/translate-loader.mock';
import { mockTruncatableService } from '../../mocks/mock-trucatable.service';
import { By } from '@angular/platform-browser';
+import { NativeWindowRef, NativeWindowService } from '../../../core/services/window.service';
describe('TruncatablePartComponent', () => {
let comp: TruncatablePartComponent;
@@ -29,7 +30,7 @@ describe('TruncatablePartComponent', () => {
};
beforeEach(waitForAsync(() => {
translateService = getMockTranslateService();
- TestBed.configureTestingModule({
+ void TestBed.configureTestingModule({
imports: [NoopAnimationsModule,
TranslateModule.forRoot({
loader: {
@@ -40,6 +41,7 @@ describe('TruncatablePartComponent', () => {
],
declarations: [TruncatablePartComponent],
providers: [
+ { provide: NativeWindowService, useValue: new NativeWindowRef() },
{ provide: TruncatableService, useValue: truncatableServiceStub },
],
schemas: [NO_ERRORS_SCHEMA]
@@ -110,7 +112,7 @@ describe('TruncatablePartComponent', () => {
let truncatableService;
beforeEach(waitForAsync(() => {
translateService = getMockTranslateService();
- TestBed.configureTestingModule({
+ void TestBed.configureTestingModule({
imports: [
NoopAnimationsModule,
TranslateModule.forRoot({
@@ -122,6 +124,7 @@ describe('TruncatablePartComponent', () => {
],
declarations: [TruncatablePartComponent],
providers: [
+ { provide: NativeWindowService, useValue: new NativeWindowRef() },
{ provide: TruncatableService, useValue: mockTruncatableService },
],
schemas: [NO_ERRORS_SCHEMA]
diff --git a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.ts b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.ts
index fe8279ee07..7fe36e950a 100644
--- a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.ts
+++ b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.ts
@@ -2,7 +2,7 @@ import { Component, Inject, Input, OnDestroy, OnInit, PLATFORM_ID } from '@angul
import { TruncatableService } from '../truncatable.service';
import { hasValue } from '../../empty.util';
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
-import { NativeWindowRef, NativeWindowService } from 'src/app/core/services/window.service';
+import { NativeWindowRef, NativeWindowService } from '../../../core/services/window.service';
@Component({
selector: 'ds-truncatable-part',
From aaa166593e8fb2a2f082808934a0ad95c890d639 Mon Sep 17 00:00:00 2001
From: Giuseppe Digilio
Date: Wed, 27 Apr 2022 18:59:29 +0200
Subject: [PATCH 04/30] [DSC-516] Fix accessibility issues
---
.../truncatable-part.component.html | 16 +++++++---------
.../truncatable-part.component.scss | 15 ++++++---------
.../truncatable-part.component.spec.ts | 4 ++--
.../truncatable-part.component.ts | 11 +++++------
4 files changed, 20 insertions(+), 26 deletions(-)
diff --git a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.html b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.html
index 34227e2583..cb9f529f99 100644
--- a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.html
+++ b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.html
@@ -1,11 +1,9 @@
diff --git a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.scss b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.scss
index 7a1f31f578..f67d343cd6 100644
--- a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.scss
+++ b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.scss
@@ -1,10 +1,7 @@
-#dontBreakContent:not(.truncated) ~ label{
- display: none;
- }
+.content:not(.truncated) ~ button.expandButton {
+ display: none;
+}
-a {
- color: #207698 !important;
- text-decoration: none !important;
- background-color: transparent !important;
- cursor: pointer;
-}
\ No newline at end of file
+.btn:focus {
+ box-shadow: none !important;
+}
diff --git a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.spec.ts b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.spec.ts
index 09d603e6b7..08d3e18117 100644
--- a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.spec.ts
+++ b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.spec.ts
@@ -70,7 +70,7 @@ describe('TruncatablePartComponent', () => {
});
it('collapseButton should be hidden', () => {
- const a = fixture.debugElement.query(By.css('#collapseButton'));
+ const a = fixture.debugElement.query(By.css('.collapseButton'));
expect(a).toBeNull();
});
});
@@ -98,7 +98,7 @@ describe('TruncatablePartComponent', () => {
(comp as any).setLines();
(comp as any).expandable = true;
fixture.detectChanges();
- const a = fixture.debugElement.query(By.css('#collapseButton'));
+ const a = fixture.debugElement.query(By.css('.collapseButton'));
expect(a).not.toBeNull();
});
});
diff --git a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.ts b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.ts
index 7fe36e950a..0bfcf25d39 100644
--- a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.ts
+++ b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.ts
@@ -1,4 +1,4 @@
-import { Component, Inject, Input, OnDestroy, OnInit, PLATFORM_ID } from '@angular/core';
+import { AfterContentChecked, Component, Inject, Input, OnDestroy, OnInit, PLATFORM_ID } from '@angular/core';
import { TruncatableService } from '../truncatable.service';
import { hasValue } from '../../empty.util';
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
@@ -14,7 +14,7 @@ import { NativeWindowRef, NativeWindowService } from '../../../core/services/win
* Component that truncates/clamps a piece of text
* It needs a TruncatableComponent parent to identify it's current state
*/
-export class TruncatablePartComponent implements OnInit, OnDestroy {
+export class TruncatablePartComponent implements AfterContentChecked, OnInit, OnDestroy {
/**
* Number of lines shown when the part is collapsed
*/
@@ -116,10 +116,9 @@ export class TruncatablePartComponent implements OnInit, OnDestroy {
* Function to get data to be observed
*/
toObserve() {
- this.observedContent = this.document.querySelectorAll('#dontBreakContent');
- this.observer = new (this._window.nativeWindow as any).ResizeObserver(entries => {
- // tslint:disable-next-line:prefer-const
- for (let entry of entries) {
+ this.observedContent = this.document.querySelectorAll('.content');
+ this.observer = new (this._window.nativeWindow as any).ResizeObserver((entries) => {
+ for (let entry of entries) {
if (!entry.target.classList.contains('notruncatable')) {
if (entry.target.scrollHeight > entry.contentRect.height) {
if (entry.target.children.length > 0) {
From d15277849b7ead1acb703c2da146363022e096dc Mon Sep 17 00:00:00 2001
From: Alisa Ismailati
Date: Sat, 7 May 2022 16:21:08 +0200
Subject: [PATCH 05/30] [CST-5677] Item authorization page
---
.../edit-item-page/edit-item-page.module.ts | 5 +-
.../item-authorizations.component.html | 36 +++-
.../item-authorizations.component.scss | 4 +
.../item-authorizations.component.ts | 183 +++++++++++++++---
.../resource-policies.component.html | 13 +-
.../resource-policies.component.ts | 6 +
6 files changed, 207 insertions(+), 40 deletions(-)
create mode 100644 src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.scss
diff --git a/src/app/item-page/edit-item-page/edit-item-page.module.ts b/src/app/item-page/edit-item-page/edit-item-page.module.ts
index 97901bd7c8..cf4a3de74b 100644
--- a/src/app/item-page/edit-item-page/edit-item-page.module.ts
+++ b/src/app/item-page/edit-item-page/edit-item-page.module.ts
@@ -1,7 +1,7 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
-import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
+import { NgbTooltipModule, NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { SharedModule } from '../../shared/shared.module';
import { EditItemPageRoutingModule } from './edit-item-page.routing.module';
@@ -48,7 +48,8 @@ import { ResourcePoliciesModule } from '../../shared/resource-policies/resource-
EditItemPageRoutingModule,
SearchPageModule,
DragDropModule,
- ResourcePoliciesModule
+ ResourcePoliciesModule,
+ NgbModule
],
declarations: [
EditItemPageComponent,
diff --git a/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.html b/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.html
index 71aa7b44de..d4af1b4d2b 100644
--- a/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.html
+++ b/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.html
@@ -1,13 +1,33 @@
-
-
-
-
-
+
+
+
+
+
+ 0">
+
+
+
+
-
diff --git a/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.scss b/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.scss
new file mode 100644
index 0000000000..c3694e6784
--- /dev/null
+++ b/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.scss
@@ -0,0 +1,4 @@
+.auth-bitstream-container {
+ margin-top: -1em;
+ margin-bottom: 1.5em;
+}
diff --git a/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.ts b/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.ts
index 76597a135b..f3313d4cef 100644
--- a/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.ts
+++ b/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.ts
@@ -1,3 +1,5 @@
+import { isEqual } from 'lodash';
+import { DSONameService } from './../../../core/breadcrumbs/dso-name.service';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@@ -25,7 +27,8 @@ interface BundleBitstreamsMapEntry {
@Component({
selector: 'ds-item-authorizations',
- templateUrl: './item-authorizations.component.html'
+ templateUrl: './item-authorizations.component.html',
+ styleUrls:['./item-authorizations.component.scss']
})
/**
* Component that handles the item Authorizations
@@ -36,14 +39,20 @@ export class ItemAuthorizationsComponent implements OnInit, OnDestroy {
* A map that contains all bitstream of the item's bundles
* @type {Observable