From 55affdebced2046e45988e727254bfd662e94842 Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Tue, 25 May 2021 09:28:02 +0200 Subject: [PATCH 01/44] 79597: Add alt text to ds-thumbnail --- src/app/thumbnail/thumbnail.component.html | 2 +- src/app/thumbnail/thumbnail.component.scss | 28 ++++++++++++++++++++++ src/app/thumbnail/thumbnail.component.ts | 6 ++++- src/assets/i18n/en.json5 | 4 ++++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/app/thumbnail/thumbnail.component.html b/src/app/thumbnail/thumbnail.component.html index dbf8f6732c..ec11ba6c0f 100644 --- a/src/app/thumbnail/thumbnail.component.html +++ b/src/app/thumbnail/thumbnail.component.html @@ -1,4 +1,4 @@
- +
diff --git a/src/app/thumbnail/thumbnail.component.scss b/src/app/thumbnail/thumbnail.component.scss index e2718bac06..9feac243db 100644 --- a/src/app/thumbnail/thumbnail.component.scss +++ b/src/app/thumbnail/thumbnail.component.scss @@ -1,3 +1,31 @@ img { max-width: 100%; } + +.outer { // .outer/.inner generated ~ https://ratiobuddy.com/ + position: relative; + &:before { + display: block; + content: ""; + width: 100%; + padding-top: (210 / 297) * 100%; // A4 ratio + } + > .inner { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + + > .thumbnail-placeholder { + background: var(--bs-gray-100); + border: var(--bs-gray-200) 1px; + color: var(--bs-gray-600); + font-weight: bold; + display: flex; + justify-content: center; + align-items: center; + text-align: center; + } + } +} diff --git a/src/app/thumbnail/thumbnail.component.ts b/src/app/thumbnail/thumbnail.component.ts index 7e981d5fe6..8d5e780f27 100644 --- a/src/app/thumbnail/thumbnail.component.ts +++ b/src/app/thumbnail/thumbnail.component.ts @@ -18,7 +18,6 @@ export const THUMBNAIL_PLACEHOLDER = 'data:image/svg+xml;charset=UTF-8,%3Csvg%20 templateUrl: './thumbnail.component.html' }) export class ThumbnailComponent implements OnInit { - /** * The thumbnail Bitstream */ @@ -34,6 +33,11 @@ export class ThumbnailComponent implements OnInit { */ src: string; + /** + * i18n key of thumbnail alt text + */ + @Input() alt? = 'thumbnail.default.alt'; + /** * Initialize the thumbnail. * Use a default image if no actual image is available. diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 4c3317a0c0..ac37eba016 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -3539,6 +3539,10 @@ "submission.workflow.tasks.pool.show-detail": "Show detail", + "thumbnail.default.alt": "Thumbnail Image", + + "thumbnail.default.placeholder": "No Thumbnail Available", + "title": "DSpace", From d80da3bbfe2cd6185e9f90538425897336475651 Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Tue, 25 May 2021 09:28:46 +0200 Subject: [PATCH 02/44] 79597: Add HTML placeholder for missing thumbnails --- src/app/thumbnail/thumbnail.component.html | 9 ++++++++- src/app/thumbnail/thumbnail.component.scss | 2 +- src/app/thumbnail/thumbnail.component.ts | 23 ++++++++++++---------- src/assets/i18n/en.json5 | 14 +++++++++++++ 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/app/thumbnail/thumbnail.component.html b/src/app/thumbnail/thumbnail.component.html index ec11ba6c0f..4789917f1c 100644 --- a/src/app/thumbnail/thumbnail.component.html +++ b/src/app/thumbnail/thumbnail.component.html @@ -1,4 +1,11 @@
- + +
+
+
+ {{ placeholder | translate }} +
+
+
diff --git a/src/app/thumbnail/thumbnail.component.scss b/src/app/thumbnail/thumbnail.component.scss index 9feac243db..4c8c7d90ad 100644 --- a/src/app/thumbnail/thumbnail.component.scss +++ b/src/app/thumbnail/thumbnail.component.scss @@ -19,7 +19,7 @@ img { > .thumbnail-placeholder { background: var(--bs-gray-100); - border: var(--bs-gray-200) 1px; + border: 1px solid var(--bs-gray-200); color: var(--bs-gray-600); font-weight: bold; display: flex; diff --git a/src/app/thumbnail/thumbnail.component.ts b/src/app/thumbnail/thumbnail.component.ts index 8d5e780f27..21a5da3567 100644 --- a/src/app/thumbnail/thumbnail.component.ts +++ b/src/app/thumbnail/thumbnail.component.ts @@ -2,11 +2,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { Bitstream } from '../core/shared/bitstream.model'; import { hasValue } from '../shared/empty.util'; -/** - * A fallback placeholder image as a base64 string - */ -export const THUMBNAIL_PLACEHOLDER = 'data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2293%22%20height%3D%22120%22%20viewBox%3D%220%200%2093%20120%22%20preserveAspectRatio%3D%22none%22%3E%3C!--%0ASource%20URL%3A%20holder.js%2F93x120%3Ftext%3DNo%20Thumbnail%0ACreated%20with%20Holder.js%202.8.2.%0ALearn%20more%20at%20http%3A%2F%2Fholderjs.com%0A(c)%202012-2015%20Ivan%20Malopinsky%20-%20http%3A%2F%2Fimsky.co%0A--%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%3C!%5BCDATA%5B%23holder_1543e460b05%20text%20%7B%20fill%3A%23AAAAAA%3Bfont-weight%3Abold%3Bfont-family%3AArial%2C%20Helvetica%2C%20Open%20Sans%2C%20sans-serif%2C%20monospace%3Bfont-size%3A10pt%20%7D%20%5D%5D%3E%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_1543e460b05%22%3E%3Crect%20width%3D%2293%22%20height%3D%22120%22%20fill%3D%22%23FFFFFF%22%2F%3E%3Cg%3E%3Ctext%20x%3D%2235.6171875%22%20y%3D%2257%22%3ENo%3C%2Ftext%3E%3Ctext%20x%3D%2210.8125%22%20y%3D%2272%22%3EThumbnail%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E'; - /** * This component renders a given Bitstream as a thumbnail. * One input parameter of type Bitstream is expected. @@ -24,9 +19,10 @@ export class ThumbnailComponent implements OnInit { @Input() thumbnail: Bitstream; /** - * The default image, used if the thumbnail isn't set or can't be downloaded + * The default image, used if the thumbnail isn't set or can't be downloaded. + * If defaultImage is null, a HTML placeholder is used instead. */ - @Input() defaultImage? = THUMBNAIL_PLACEHOLDER; + @Input() defaultImage? = null; /** * The src attribute used in the template to render the image. @@ -38,12 +34,19 @@ export class ThumbnailComponent implements OnInit { */ @Input() alt? = 'thumbnail.default.alt'; + /** + * i18n key of HTML placeholder text + */ + @Input() placeholder? = 'thumbnail.default.placeholder'; + /** * Initialize the thumbnail. * Use a default image if no actual image is available. */ ngOnInit(): void { - if (hasValue(this.thumbnail) && hasValue(this.thumbnail._links) && hasValue(this.thumbnail._links.content) && this.thumbnail._links.content.href) { + if (hasValue(this.thumbnail) && hasValue(this.thumbnail._links) + && hasValue(this.thumbnail._links.content) + && this.thumbnail._links.content.href) { this.src = this.thumbnail._links.content.href; } else { this.src = this.defaultImage; @@ -53,13 +56,13 @@ export class ThumbnailComponent implements OnInit { /** * Handle image download errors. * If the image can't be found, use the defaultImage instead. - * If that also can't be found, use the base64 placeholder. + * If that also can't be found, use null to fall back to the HTML placeholder. */ errorHandler() { if (this.src !== this.defaultImage) { this.src = this.defaultImage; } else { - this.src = THUMBNAIL_PLACEHOLDER; + this.src = null; } } } diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index ac37eba016..2235eda34d 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -3539,10 +3539,24 @@ "submission.workflow.tasks.pool.show-detail": "Show detail", + "thumbnail.default.alt": "Thumbnail Image", "thumbnail.default.placeholder": "No Thumbnail Available", + "thumbnail.project.alt": "Project Logo", + + "thumbnail.project.placeholder": "Project Placeholder Image", + + "thumbnail.orgunit.alt": "OrgUnit Logo", + + "thumbnail.orgunit.placeholder": "OrgUnit Placeholder Image", + + "thumbnail.person.alt": "Profile Picture", + + "thumbnail.person.placeholder": "No Profile Picture Available", + + "title": "DSpace", From 7a69a23f0c50e28801d04045e905e80f5929ebd1 Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Tue, 25 May 2021 09:46:54 +0200 Subject: [PATCH 03/44] 79597: Improve placeholder contrast --- src/app/thumbnail/thumbnail.component.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/thumbnail/thumbnail.component.scss b/src/app/thumbnail/thumbnail.component.scss index 4c8c7d90ad..290b395212 100644 --- a/src/app/thumbnail/thumbnail.component.scss +++ b/src/app/thumbnail/thumbnail.component.scss @@ -19,8 +19,8 @@ img { > .thumbnail-placeholder { background: var(--bs-gray-100); - border: 1px solid var(--bs-gray-200); - color: var(--bs-gray-600); + border: 1px solid var(--bs-gray-300); + color: var(--bs-gray-800); font-weight: bold; display: flex; justify-content: center; From 4b6e02f773b27897fe0ce178a516d2a12a969bed Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Tue, 25 May 2021 09:55:19 +0200 Subject: [PATCH 04/44] 79597: Specify i18n text for person, project & orgunit --- .../item-pages/org-unit/org-unit.component.html | 7 ++++++- .../item-pages/person/person.component.html | 6 +++++- .../item-pages/project/project.component.html | 7 ++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/app/entity-groups/research-entities/item-pages/org-unit/org-unit.component.html b/src/app/entity-groups/research-entities/item-pages/org-unit/org-unit.component.html index 822d4858ce..14d56d4104 100644 --- a/src/app/entity-groups/research-entities/item-pages/org-unit/org-unit.component.html +++ b/src/app/entity-groups/research-entities/item-pages/org-unit/org-unit.component.html @@ -9,7 +9,12 @@
- + +
- + +
- + + From c9ff89a143d178f24728c353ede4cb8e21e12d41 Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Tue, 25 May 2021 10:03:18 +0200 Subject: [PATCH 05/44] 79597: Thumbnail placeholder style ~ CSS variables --- src/app/thumbnail/thumbnail.component.scss | 6 +++--- src/styles/_custom_variables.scss | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/thumbnail/thumbnail.component.scss b/src/app/thumbnail/thumbnail.component.scss index 290b395212..e2374c96db 100644 --- a/src/app/thumbnail/thumbnail.component.scss +++ b/src/app/thumbnail/thumbnail.component.scss @@ -18,9 +18,9 @@ img { left: 0; > .thumbnail-placeholder { - background: var(--bs-gray-100); - border: 1px solid var(--bs-gray-300); - color: var(--bs-gray-800); + background: var(--ds-thumbnail-placeholder-background); + border: var(--ds-thumbnail-placeholder-border); + color: var(--ds-thumbnail-placeholder-color); font-weight: bold; display: flex; justify-content: center; diff --git a/src/styles/_custom_variables.scss b/src/styles/_custom_variables.scss index 298be09f67..d0e1564281 100644 --- a/src/styles/_custom_variables.scss +++ b/src/styles/_custom_variables.scss @@ -46,6 +46,9 @@ --ds-edit-item-language-field-width: 43px; --ds-thumbnail-max-width: 175px; + --ds-thumbnail-placeholder-background: #{$gray-100}; + --ds-thumbnail-placeholder-border: 1px solid #{$gray-300}; + --ds-thumbnail-placeholder-color: #{lighten($gray-800, 7%)}; --ds-dso-selector-list-max-height: 475px; --ds-dso-selector-current-background-color: #eeeeee; From 4567f8cc2cfb880e414ead44c7f76326b546517b Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Tue, 25 May 2021 10:20:46 +0200 Subject: [PATCH 06/44] 79597: Limit thumbnail width & set to portrait --- src/app/thumbnail/thumbnail.component.scss | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/thumbnail/thumbnail.component.scss b/src/app/thumbnail/thumbnail.component.scss index e2374c96db..a96147468c 100644 --- a/src/app/thumbnail/thumbnail.component.scss +++ b/src/app/thumbnail/thumbnail.component.scss @@ -1,3 +1,7 @@ +.thumbnail { + max-width: var(--ds-thumbnail-max-width); +} + img { max-width: 100%; } @@ -8,7 +12,7 @@ img { display: block; content: ""; width: 100%; - padding-top: (210 / 297) * 100%; // A4 ratio + padding-top: (297 / 210) * 100%; // A4 ratio } > .inner { position: absolute; From 363d1d74dff0d82291cef6893f6989ea20f7cda8 Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Tue, 25 May 2021 11:03:51 +0200 Subject: [PATCH 07/44] 79597: Update unit tests --- .../shared/mocks/translate.service.mock.ts | 1 + src/app/thumbnail/thumbnail.component.html | 6 +-- src/app/thumbnail/thumbnail.component.spec.ts | 42 ++++++++++++++++--- 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/src/app/shared/mocks/translate.service.mock.ts b/src/app/shared/mocks/translate.service.mock.ts index 0bc172b408..38b088e50f 100644 --- a/src/app/shared/mocks/translate.service.mock.ts +++ b/src/app/shared/mocks/translate.service.mock.ts @@ -3,6 +3,7 @@ import { TranslateService } from '@ngx-translate/core'; export function getMockTranslateService(): TranslateService { return jasmine.createSpyObj('translateService', { get: jasmine.createSpy('get'), + use: jasmine.createSpy('use'), instant: jasmine.createSpy('instant'), setDefaultLang: jasmine.createSpy('setDefaultLang') }); diff --git a/src/app/thumbnail/thumbnail.component.html b/src/app/thumbnail/thumbnail.component.html index 4789917f1c..cef88e0192 100644 --- a/src/app/thumbnail/thumbnail.component.html +++ b/src/app/thumbnail/thumbnail.component.html @@ -1,10 +1,8 @@
- +
-
- {{ placeholder | translate }} -
+
{{ placeholder | translate }}
diff --git a/src/app/thumbnail/thumbnail.component.spec.ts b/src/app/thumbnail/thumbnail.component.spec.ts index 21678c9162..687282a373 100644 --- a/src/app/thumbnail/thumbnail.component.spec.ts +++ b/src/app/thumbnail/thumbnail.component.spec.ts @@ -1,10 +1,18 @@ -import { DebugElement } from '@angular/core'; +import { DebugElement, Pipe, PipeTransform } from '@angular/core'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { Bitstream } from '../core/shared/bitstream.model'; import { SafeUrlPipe } from '../shared/utils/safe-url-pipe'; -import { THUMBNAIL_PLACEHOLDER, ThumbnailComponent } from './thumbnail.component'; +import { ThumbnailComponent } from './thumbnail.component'; +import { TranslateService } from '@ngx-translate/core'; + +@Pipe({ name: 'translate' }) +class MockTranslatePipe implements PipeTransform { + transform(key: string): string { + return 'TRANSLATED ' + key; + } +} describe('ThumbnailComponent', () => { let comp: ThumbnailComponent; @@ -14,7 +22,7 @@ describe('ThumbnailComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ThumbnailComponent, SafeUrlPipe] + declarations: [ThumbnailComponent, SafeUrlPipe, MockTranslatePipe], }).compileComponents(); })); @@ -39,6 +47,19 @@ describe('ThumbnailComponent', () => { const image: HTMLElement = de.query(By.css('img')).nativeElement; expect(image.getAttribute('src')).toBe(comp.thumbnail._links.content.href); }); + it('should include the alt text', () => { + const thumbnail = new Bitstream(); + thumbnail._links = { + self: { href: 'self.url' }, + bundle: { href: 'bundle.url' }, + format: { href: 'format.url' }, + content: { href: 'content.url' }, + }; + comp.thumbnail = thumbnail; + fixture.detectChanges(); + const image: HTMLElement = de.query(By.css('img')).nativeElement; + expect(image.getAttribute('alt')).toBe('TRANSLATED ' + comp.alt); + }); }); describe(`when the thumbnail doesn't exist`, () => { describe('and there is a default image', () => { @@ -48,13 +69,24 @@ describe('ThumbnailComponent', () => { comp.errorHandler(); expect(comp.src).toBe(comp.defaultImage); }); + it('should include the alt text', () => { + comp.src = 'http://bit.stream'; + comp.defaultImage = 'http://default.img'; + comp.errorHandler(); + fixture.detectChanges(); + const image: HTMLElement = de.query(By.css('img')).nativeElement; + expect(image.getAttribute('alt')).toBe('TRANSLATED ' + comp.alt); + }); }); describe('and there is no default image', () => { it('should display the placeholder', () => { comp.src = 'http://default.img'; - comp.defaultImage = 'http://default.img'; comp.errorHandler(); - expect(comp.src).toBe(THUMBNAIL_PLACEHOLDER); + expect(comp.src).toBe(null); + + fixture.detectChanges(); + const placeholder = fixture.debugElement.query(By.css('div.thumbnail-placeholder')).nativeElement; + expect(placeholder.innerHTML).toBe('TRANSLATED ' + comp.placeholder); }); }); }); From ca7d45ff0c0fa2b221bb27587a7ce67e5905cb7d Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Tue, 25 May 2021 11:18:08 +0200 Subject: [PATCH 08/44] 79597: Fix tslint issue --- src/app/thumbnail/thumbnail.component.spec.ts | 2 +- src/app/thumbnail/thumbnail.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/thumbnail/thumbnail.component.spec.ts b/src/app/thumbnail/thumbnail.component.spec.ts index 687282a373..82eadc04de 100644 --- a/src/app/thumbnail/thumbnail.component.spec.ts +++ b/src/app/thumbnail/thumbnail.component.spec.ts @@ -5,8 +5,8 @@ import { Bitstream } from '../core/shared/bitstream.model'; import { SafeUrlPipe } from '../shared/utils/safe-url-pipe'; import { ThumbnailComponent } from './thumbnail.component'; -import { TranslateService } from '@ngx-translate/core'; +// tslint:disable-next-line:pipe-prefix @Pipe({ name: 'translate' }) class MockTranslatePipe implements PipeTransform { transform(key: string): string { diff --git a/src/app/thumbnail/thumbnail.component.ts b/src/app/thumbnail/thumbnail.component.ts index 21a5da3567..11dee37037 100644 --- a/src/app/thumbnail/thumbnail.component.ts +++ b/src/app/thumbnail/thumbnail.component.ts @@ -10,7 +10,7 @@ import { hasValue } from '../shared/empty.util'; @Component({ selector: 'ds-thumbnail', styleUrls: ['./thumbnail.component.scss'], - templateUrl: './thumbnail.component.html' + templateUrl: './thumbnail.component.html', }) export class ThumbnailComponent implements OnInit { /** From 060d0dd556ad9bbee790018fbb48f8815198093e Mon Sep 17 00:00:00 2001 From: Alessandro Martelli Date: Thu, 27 May 2021 09:43:29 +0200 Subject: [PATCH 09/44] [CST-4223] Creating a new submission should redirect to workspaceitem edit page --- .../submit/submission-submit.component.html | 10 ------- .../submission-submit.component.spec.ts | 27 ++++++++----------- .../submit/submission-submit.component.ts | 8 +----- 3 files changed, 12 insertions(+), 33 deletions(-) diff --git a/src/app/submission/submit/submission-submit.component.html b/src/app/submission/submit/submission-submit.component.html index a7680f07c2..e69de29bb2 100644 --- a/src/app/submission/submit/submission-submit.component.html +++ b/src/app/submission/submit/submission-submit.component.html @@ -1,10 +0,0 @@ -
-
- -
-
diff --git a/src/app/submission/submit/submission-submit.component.spec.ts b/src/app/submission/submit/submission-submit.component.spec.ts index 16e26e3b33..1b76082d1b 100644 --- a/src/app/submission/submit/submission-submit.component.spec.ts +++ b/src/app/submission/submit/submission-submit.component.spec.ts @@ -26,7 +26,6 @@ describe('SubmissionSubmitComponent Component', () => { let itemDataService: ItemDataService; let router: RouterStub; - const submissionId = '826'; const submissionObject: any = mockSubmissionObject; beforeEach(waitForAsync(() => { @@ -67,27 +66,23 @@ describe('SubmissionSubmitComponent Component', () => { router = null; }); - it('should init properly when a valid SubmissionObject has been retrieved',() => { - - submissionServiceStub.createSubmission.and.returnValue(observableOf(submissionObject)); - - fixture.detectChanges(); - - expect(comp.submissionId.toString()).toEqual(submissionId); - expect(comp.collectionId).toBe(submissionObject.collection.id); - expect(comp.selfUrl).toBe(submissionObject._links.self.href); - expect(comp.sections).toBe(submissionObject.sections); - expect(comp.submissionDefinition).toBe(submissionObject.submissionDefinition); - - }); - it('should redirect to mydspace when an empty SubmissionObject has been retrieved',() => { submissionServiceStub.createSubmission.and.returnValue(observableOf({})); fixture.detectChanges(); - expect(router.navigate).toHaveBeenCalled(); + expect(router.navigate).toHaveBeenCalledWith(['/mydspace']); + + }); + + it('should redirect to workspaceitem edit when a not empty SubmissionObject has been retrieved',() => { + + submissionServiceStub.createSubmission.and.returnValue(observableOf({ id: '1234'})); + + fixture.detectChanges(); + + expect(router.navigate).toHaveBeenCalledWith(['/workspaceitems', '1234', 'edit'], { replaceUrl: true}); }); diff --git a/src/app/submission/submit/submission-submit.component.ts b/src/app/submission/submit/submission-submit.component.ts index 0c2172368a..af1bf38539 100644 --- a/src/app/submission/submit/submission-submit.component.ts +++ b/src/app/submission/submit/submission-submit.component.ts @@ -122,13 +122,7 @@ export class SubmissionSubmitComponent implements OnDestroy, OnInit { this.notificationsService.info(null, this.translate.get('submission.general.cannot_submit')); this.router.navigate(['/mydspace']); } else { - this.collectionId = (submissionObject.collection as Collection).id; - this.sections = submissionObject.sections; - this.selfUrl = submissionObject._links.self.href; - this.submissionDefinition = (submissionObject.submissionDefinition as SubmissionDefinitionsModel); - this.submissionId = submissionObject.id; - this.itemLink$.next(submissionObject._links.item.href); - this.item = submissionObject.item as Item; + this.router.navigate(['/workspaceitems', submissionObject.id, 'edit'], { replaceUrl: true}); } } }), From 41c07e74ca5c3ad3a6a69492c40873c8b7fb7089 Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Thu, 27 May 2021 08:59:32 +0200 Subject: [PATCH 10/44] 79597: Add input to toggle thumbnail max-width --- src/app/thumbnail/thumbnail.component.html | 9 +++++---- src/app/thumbnail/thumbnail.component.scss | 2 +- src/app/thumbnail/thumbnail.component.ts | 7 ++++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/app/thumbnail/thumbnail.component.html b/src/app/thumbnail/thumbnail.component.html index cef88e0192..645bce9b80 100644 --- a/src/app/thumbnail/thumbnail.component.html +++ b/src/app/thumbnail/thumbnail.component.html @@ -1,8 +1,9 @@ -
- -
+
+ +
-
{{ placeholder | translate }}
+
{{ placeholder | translate }}
diff --git a/src/app/thumbnail/thumbnail.component.scss b/src/app/thumbnail/thumbnail.component.scss index a96147468c..b15238afac 100644 --- a/src/app/thumbnail/thumbnail.component.scss +++ b/src/app/thumbnail/thumbnail.component.scss @@ -1,4 +1,4 @@ -.thumbnail { +.limit-width { max-width: var(--ds-thumbnail-max-width); } diff --git a/src/app/thumbnail/thumbnail.component.ts b/src/app/thumbnail/thumbnail.component.ts index 11dee37037..30911644f7 100644 --- a/src/app/thumbnail/thumbnail.component.ts +++ b/src/app/thumbnail/thumbnail.component.ts @@ -5,7 +5,7 @@ import { hasValue } from '../shared/empty.util'; /** * This component renders a given Bitstream as a thumbnail. * One input parameter of type Bitstream is expected. - * If no Bitstream is provided, a holderjs image will be rendered instead. + * If no Bitstream is provided, a HTML placeholder will be rendered instead. */ @Component({ selector: 'ds-thumbnail', @@ -39,6 +39,11 @@ export class ThumbnailComponent implements OnInit { */ @Input() placeholder? = 'thumbnail.default.placeholder'; + /** + * Limit thumbnail width to --ds-thumbnail-max-width + */ + @Input() limitWidth? = true; + /** * Initialize the thumbnail. * Use a default image if no actual image is available. From 4f38821bb3ff269d890ebf381beb5f0ff701152a Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Thu, 27 May 2021 09:10:31 +0200 Subject: [PATCH 11/44] 79597: Replace ds-grid-thumbnail with ds-thumbnail --- ...ournal-issue-search-result-grid-element.component.html | 8 ++++---- ...urnal-volume-search-result-grid-element.component.html | 8 ++++---- .../journal-search-result-grid-element.component.html | 8 ++++---- .../org-unit-search-result-grid-element.component.html | 8 ++++---- .../person-search-result-grid-element.component.html | 8 ++++---- .../project-search-result-grid-element.component.html | 8 ++++---- .../collection-grid-element.component.html | 8 ++++---- .../community-grid-element.component.html | 8 ++++---- src/app/shared/object-grid/object-grid.component.scss | 2 +- .../collection-search-result-grid-element.component.html | 8 ++++---- .../community-search-result-grid-element.component.html | 8 ++++---- .../item/item-search-result-grid-element.component.html | 8 ++++---- 12 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-issue/journal-issue-search-result-grid-element.component.html b/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-issue/journal-issue-search-result-grid-element.component.html index df6c9e60c0..feb282d3a7 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-issue/journal-issue-search-result-grid-element.component.html +++ b/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-issue/journal-issue-search-result-grid-element.component.html @@ -8,14 +8,14 @@ rel="noopener noreferrer" [routerLink]="[itemPageRoute]" class="card-img-top full-width">
- - + +
- - + +
diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-volume/journal-volume-search-result-grid-element.component.html b/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-volume/journal-volume-search-result-grid-element.component.html index cdc19b7f14..aa2352b284 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-volume/journal-volume-search-result-grid-element.component.html +++ b/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-volume/journal-volume-search-result-grid-element.component.html @@ -8,14 +8,14 @@ rel="noopener noreferrer" [routerLink]="[itemPageRoute]" class="card-img-top full-width">
- - + +
- - + +
diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal/journal-search-result-grid-element.component.html b/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal/journal-search-result-grid-element.component.html index bacd657663..8fdad59827 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal/journal-search-result-grid-element.component.html +++ b/src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal/journal-search-result-grid-element.component.html @@ -8,14 +8,14 @@ rel="noopener noreferrer" [routerLink]="[itemPageRoute]" class="card-img-top full-width">
- - + +
- - + +
diff --git a/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/org-unit/org-unit-search-result-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/org-unit/org-unit-search-result-grid-element.component.html index 2c3087d701..b8be58a603 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/org-unit/org-unit-search-result-grid-element.component.html +++ b/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/org-unit/org-unit-search-result-grid-element.component.html @@ -8,14 +8,14 @@ rel="noopener noreferrer" [routerLink]="[itemPageRoute]" class="card-img-top full-width">
- - + +
- - + +
diff --git a/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/person/person-search-result-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/person/person-search-result-grid-element.component.html index 005fa9cc83..8281eb0e04 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/person/person-search-result-grid-element.component.html +++ b/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/person/person-search-result-grid-element.component.html @@ -8,14 +8,14 @@ rel="noopener noreferrer" [routerLink]="[itemPageRoute]" class="card-img-top full-width">
- - + +
- - + +
diff --git a/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/project/project-search-result-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/project/project-search-result-grid-element.component.html index e84e8c49d0..88498a4d67 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/project/project-search-result-grid-element.component.html +++ b/src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/project/project-search-result-grid-element.component.html @@ -8,14 +8,14 @@ rel="noopener noreferrer" [routerLink]="[itemPageRoute]" class="card-img-top full-width">
- - + +
- - + +
diff --git a/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.html b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.html index 9b9d174704..d47e897edc 100644 --- a/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.html +++ b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.html @@ -1,11 +1,11 @@
- - + + - - + +

{{object.name}}

diff --git a/src/app/shared/object-grid/community-grid-element/community-grid-element.component.html b/src/app/shared/object-grid/community-grid-element/community-grid-element.component.html index f676ba303b..63097c4f57 100644 --- a/src/app/shared/object-grid/community-grid-element/community-grid-element.component.html +++ b/src/app/shared/object-grid/community-grid-element/community-grid-element.component.html @@ -1,11 +1,11 @@
- - + + - - + +

{{object.name}}

diff --git a/src/app/shared/object-grid/object-grid.component.scss b/src/app/shared/object-grid/object-grid.component.scss index 46675615f0..68a7f2f991 100644 --- a/src/app/shared/object-grid/object-grid.component.scss +++ b/src/app/shared/object-grid/object-grid.component.scss @@ -1,7 +1,7 @@ :host ::ng-deep { --ds-wrapper-grid-spacing: calc(var(--bs-spacer) / 2); - div.thumbnail > img { + div.thumbnail > .thumbnail-content { height: var(--ds-card-thumbnail-height); width: 100%; display: block; diff --git a/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.html b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.html index f8c75fc0d4..739fa6c7a8 100644 --- a/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.html +++ b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.html @@ -1,11 +1,11 @@
- - + + - - + +
diff --git a/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.html b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.html index 8025213b3b..d8c253c8a9 100644 --- a/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.html +++ b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.html @@ -1,11 +1,11 @@
- - + + - - + +
diff --git a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item/item-search-result-grid-element.component.html b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item/item-search-result-grid-element.component.html index 85aeb63a6b..bc16853721 100644 --- a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item/item-search-result-grid-element.component.html +++ b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item/item-search-result-grid-element.component.html @@ -6,14 +6,14 @@
- - + +
- - + +
From 6cbd9dc920c7937e4f5217ee40bd4b2242ecf328 Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Thu, 27 May 2021 09:21:00 +0200 Subject: [PATCH 12/44] 79597: Remove GridThumbnailComponent --- .../grid-thumbnail.component.html | 3 - .../grid-thumbnail.component.scss | 0 .../grid-thumbnail.component.spec.ts | 50 ------------- .../grid-thumbnail.component.ts | 72 ------------------- src/app/shared/shared.module.ts | 5 +- 5 files changed, 1 insertion(+), 129 deletions(-) delete mode 100644 src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.html delete mode 100644 src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.scss delete mode 100644 src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.spec.ts delete mode 100644 src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.ts diff --git a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.html b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.html deleted file mode 100644 index 1df4026f83..0000000000 --- a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.html +++ /dev/null @@ -1,3 +0,0 @@ -
- -
diff --git a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.scss b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.spec.ts b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.spec.ts deleted file mode 100644 index 825a4d5c60..0000000000 --- a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.spec.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { DebugElement } from '@angular/core'; -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Bitstream } from '../../../core/shared/bitstream.model'; -import { SafeUrlPipe } from '../../utils/safe-url-pipe'; - -import { GridThumbnailComponent } from './grid-thumbnail.component'; - -describe('GridThumbnailComponent', () => { - let comp: GridThumbnailComponent; - let fixture: ComponentFixture; - let de: DebugElement; - let el: HTMLElement; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [GridThumbnailComponent, SafeUrlPipe] - }).compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(GridThumbnailComponent); - comp = fixture.componentInstance; // BannerComponent test instance - de = fixture.debugElement.query(By.css('div.thumbnail')); - el = de.nativeElement; - }); - - it('should display image', () => { - const thumbnail = new Bitstream(); - thumbnail._links = { - self: { href: 'self.url' }, - bundle: { href: 'bundle.url' }, - format: { href: 'format.url' }, - content: { href: 'content.url' }, - }; - comp.thumbnail = thumbnail; - fixture.detectChanges(); - const image: HTMLElement = de.query(By.css('img')).nativeElement; - expect(image.getAttribute('src')).toBe(comp.thumbnail._links.content.href); - }); - - it('should display placeholder', () => { - const thumbnail = new Bitstream(); - comp.thumbnail = thumbnail; - fixture.detectChanges(); - const image: HTMLElement = de.query(By.css('img')).nativeElement; - expect(image.getAttribute('src')).toBe(comp.defaultImage); - }); - -}); diff --git a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.ts b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.ts deleted file mode 100644 index 92d93686dc..0000000000 --- a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { - Component, - Input, - OnChanges, - OnInit, - SimpleChanges, -} from '@angular/core'; -import { Bitstream } from '../../../core/shared/bitstream.model'; -import { hasValue } from '../../empty.util'; - -/** - * This component renders a given Bitstream as a thumbnail. - * One input parameter of type Bitstream is expected. - * If no Bitstream is provided, a holderjs image will be rendered instead. - */ - -@Component({ - selector: 'ds-grid-thumbnail', - styleUrls: ['./grid-thumbnail.component.scss'], - templateUrl: './grid-thumbnail.component.html', -}) -export class GridThumbnailComponent implements OnInit, OnChanges { - @Input() thumbnail: Bitstream; - - data: any = {}; - - /** - * The default 'holder.js' image - */ - @Input() defaultImage? = - 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjYwIiBoZWlnaHQ9IjE4MCIgdmlld0JveD0iMCAwIDI2MCAxODAiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjwhLS0KU291cmNlIFVSTDogaG9sZGVyLmpzLzEwMCV4MTgwL3RleHQ6Tm8gVGh1bWJuYWlsCkNyZWF0ZWQgd2l0aCBIb2xkZXIuanMgMi42LjAuCkxlYXJuIG1vcmUgYXQgaHR0cDovL2hvbGRlcmpzLmNvbQooYykgMjAxMi0yMDE1IEl2YW4gTWFsb3BpbnNreSAtIGh0dHA6Ly9pbXNreS5jbwotLT48ZGVmcz48c3R5bGUgdHlwZT0idGV4dC9jc3MiPjwhW0NEQVRBWyNob2xkZXJfMTVmNzJmMmFlMGIgdGV4dCB7IGZpbGw6I0FBQUFBQTtmb250LXdlaWdodDpib2xkO2ZvbnQtZmFtaWx5OkFyaWFsLCBIZWx2ZXRpY2EsIE9wZW4gU2Fucywgc2Fucy1zZXJpZiwgbW9ub3NwYWNlO2ZvbnQtc2l6ZToxM3B0IH0gXV0+PC9zdHlsZT48L2RlZnM+PGcgaWQ9ImhvbGRlcl8xNWY3MmYyYWUwYiI+PHJlY3Qgd2lkdGg9IjI2MCIgaGVpZ2h0PSIxODAiIGZpbGw9IiNFRUVFRUUiLz48Zz48dGV4dCB4PSI3Mi4yNDIxODc1IiB5PSI5NiI+Tm8gVGh1bWJuYWlsPC90ZXh0PjwvZz48L2c+PC9zdmc+'; - - src: string; - - errorHandler(event) { - event.currentTarget.src = this.defaultImage; - } - - /** - * Initialize the src - */ - ngOnInit(): void { - this.src = this.defaultImage; - - this.checkThumbnail(this.thumbnail); - } - - /** - * If the old input is undefined and the new one is a bitsream then set src - */ - ngOnChanges(changes: SimpleChanges): void { - if ( - !hasValue(changes.thumbnail.previousValue) && - hasValue(changes.thumbnail.currentValue) - ) { - this.checkThumbnail(changes.thumbnail.currentValue); - } - } - - /** - * check if the Bitstream has any content than set the src - */ - checkThumbnail(thumbnail: Bitstream) { - if ( - hasValue(thumbnail) && - hasValue(thumbnail._links) && - thumbnail._links.content.href - ) { - this.src = thumbnail._links.content.href; - } - } -} diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 4de0f2901e..c5a91bd02c 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -46,7 +46,6 @@ import { ThumbnailComponent } from '../thumbnail/thumbnail.component'; import { SearchFormComponent } from './search-form/search-form.component'; import { SearchResultGridElementComponent } from './object-grid/search-result-grid-element/search-result-grid-element.component'; import { ViewModeSwitchComponent } from './view-mode-switch/view-mode-switch.component'; -import { GridThumbnailComponent } from './object-grid/grid-thumbnail/grid-thumbnail.component'; import { VarDirective } from './utils/var.directive'; import { AuthNavMenuComponent } from './auth-nav-menu/auth-nav-menu.component'; import { LogOutComponent } from './log-out/log-out.component'; @@ -54,8 +53,7 @@ import { FormComponent } from './form/form.component'; import { DsDynamicOneboxComponent } from './form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component'; import { DsDynamicScrollableDropdownComponent } from './form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component'; import { - DsDynamicFormControlContainerComponent, - dsDynamicFormControlMapFn + DsDynamicFormControlContainerComponent, dsDynamicFormControlMapFn, } from './form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component'; import { DsDynamicFormComponent } from './form/builder/ds-dynamic-form-ui/ds-dynamic-form.component'; import { DragClickDirective } from './utils/drag-click.directive'; @@ -340,7 +338,6 @@ const COMPONENTS = [ SidebarFilterComponent, SidebarFilterSelectedOptionComponent, ThumbnailComponent, - GridThumbnailComponent, UploaderComponent, FileDropzoneNoUploaderComponent, ItemListPreviewComponent, From 9b95fc5de9b07adc038332f0c67848bf13448129 Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Thu, 27 May 2021 11:18:40 +0200 Subject: [PATCH 13/44] 79597: Add space between rows in FullFileSectionComponent --- .../file-section/full-file-section.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/+item-page/full/field-components/file-section/full-file-section.component.html b/src/app/+item-page/full/field-components/file-section/full-file-section.component.html index bc1c63cc32..c5393055df 100644 --- a/src/app/+item-page/full/field-components/file-section/full-file-section.component.html +++ b/src/app/+item-page/full/field-components/file-section/full-file-section.component.html @@ -11,7 +11,7 @@ [retainScrollPosition]="true"> -
+
From c717fc5ec815d0b29b244781b1efcf2e5b0ac0b7 Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Thu, 27 May 2021 15:51:54 +0200 Subject: [PATCH 14/44] 79597: Fix thumbnails ~ item page direct request --- .../metadata-field-wrapper.component.html | 2 +- .../publication/publication.component.html | 2 +- .../item-types/shared/item.component.ts | 21 ++++++---- .../untyped-item/untyped-item.component.html | 2 +- .../journal-issue.component.html | 2 +- .../journal-volume.component.html | 2 +- .../item-pages/journal/journal.component.html | 2 +- ...-search-result-grid-element.component.html | 2 +- .../org-unit/org-unit.component.html | 2 +- .../item-pages/person/person.component.html | 2 +- .../item-pages/project/project.component.html | 2 +- src/app/thumbnail/thumbnail.component.html | 18 ++++---- src/app/thumbnail/thumbnail.component.ts | 41 ++++++++++++++----- 13 files changed, 66 insertions(+), 34 deletions(-) diff --git a/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.html b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.html index c791cec600..a41aa0d67a 100644 --- a/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.html +++ b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.html @@ -1,4 +1,4 @@ -
+
{{ label }}
diff --git a/src/app/+item-page/simple/item-types/publication/publication.component.html b/src/app/+item-page/simple/item-types/publication/publication.component.html index 73219cbb8f..0758f7cda4 100644 --- a/src/app/+item-page/simple/item-types/publication/publication.component.html +++ b/src/app/+item-page/simple/item-types/publication/publication.component.html @@ -10,7 +10,7 @@
- + diff --git a/src/app/+item-page/simple/item-types/shared/item.component.ts b/src/app/+item-page/simple/item-types/shared/item.component.ts index 120eda930f..8763d8c899 100644 --- a/src/app/+item-page/simple/item-types/shared/item.component.ts +++ b/src/app/+item-page/simple/item-types/shared/item.component.ts @@ -4,8 +4,10 @@ import { environment } from '../../../../../environments/environment'; import { BitstreamDataService } from '../../../../core/data/bitstream-data.service'; import { Bitstream } from '../../../../core/shared/bitstream.model'; import { Item } from '../../../../core/shared/item.model'; -import { getFirstSucceededRemoteDataPayload } from '../../../../core/shared/operators'; +import { getFirstSucceededRemoteDataPayload, takeUntilCompletedRemoteData } from '../../../../core/shared/operators'; import { getItemPageRoute } from '../../../item-page-routing-paths'; +import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject'; +import { RemoteData } from '../../../../core/data/remote-data'; @Component({ selector: 'ds-item', @@ -17,6 +19,11 @@ import { getItemPageRoute } from '../../../item-page-routing-paths'; export class ItemComponent implements OnInit { @Input() object: Item; + /** + * The Item's thumbnail + */ + thumbnail$: BehaviorSubject>; + /** * Route to the item page */ @@ -28,12 +35,12 @@ export class ItemComponent implements OnInit { ngOnInit(): void { this.itemPageRoute = getItemPageRoute(this.object); - } - // TODO refactor to return RemoteData, and thumbnail template to deal with loading - getThumbnail(): Observable { - return this.bitstreamDataService.getThumbnailFor(this.object).pipe( - getFirstSucceededRemoteDataPayload() - ); + this.thumbnail$ = new BehaviorSubject>(undefined); + this.bitstreamDataService.getThumbnailFor(this.object).pipe( + takeUntilCompletedRemoteData(), + ).subscribe((rd: RemoteData) => { + this.thumbnail$.next(rd); + }); } } diff --git a/src/app/+item-page/simple/item-types/untyped-item/untyped-item.component.html b/src/app/+item-page/simple/item-types/untyped-item/untyped-item.component.html index 8d46a2c5a9..3e20da3094 100644 --- a/src/app/+item-page/simple/item-types/untyped-item/untyped-item.component.html +++ b/src/app/+item-page/simple/item-types/untyped-item/untyped-item.component.html @@ -10,7 +10,7 @@
- + diff --git a/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html b/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html index 5749c5797d..af87daa243 100644 --- a/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html +++ b/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html @@ -9,7 +9,7 @@
- +
- +
- +
- +
diff --git a/src/app/entity-groups/research-entities/item-pages/org-unit/org-unit.component.html b/src/app/entity-groups/research-entities/item-pages/org-unit/org-unit.component.html index 14d56d4104..67b79163ed 100644 --- a/src/app/entity-groups/research-entities/item-pages/org-unit/org-unit.component.html +++ b/src/app/entity-groups/research-entities/item-pages/org-unit/org-unit.component.html @@ -9,7 +9,7 @@
-
- diff --git a/src/app/entity-groups/research-entities/item-pages/project/project.component.html b/src/app/entity-groups/research-entities/item-pages/project/project.component.html index 0590c8bfe4..facecb4996 100644 --- a/src/app/entity-groups/research-entities/item-pages/project/project.component.html +++ b/src/app/entity-groups/research-entities/item-pages/project/project.component.html @@ -10,7 +10,7 @@
diff --git a/src/app/thumbnail/thumbnail.component.html b/src/app/thumbnail/thumbnail.component.html index 645bce9b80..593c1c10b8 100644 --- a/src/app/thumbnail/thumbnail.component.html +++ b/src/app/thumbnail/thumbnail.component.html @@ -1,10 +1,14 @@
- -
-
-
{{ placeholder | translate }}
+ + text-content + + + +
+
+
{{ placeholder | translate }}
+
-
+
- diff --git a/src/app/thumbnail/thumbnail.component.ts b/src/app/thumbnail/thumbnail.component.ts index 30911644f7..ec1e7eb368 100644 --- a/src/app/thumbnail/thumbnail.component.ts +++ b/src/app/thumbnail/thumbnail.component.ts @@ -1,6 +1,8 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { Component, Input, OnChanges } from '@angular/core'; import { Bitstream } from '../core/shared/bitstream.model'; import { hasValue } from '../shared/empty.util'; +import { RemoteData } from '../core/data/remote-data'; +import { BITSTREAM } from '../core/shared/bitstream.resource-type'; /** * This component renders a given Bitstream as a thumbnail. @@ -12,11 +14,11 @@ import { hasValue } from '../shared/empty.util'; styleUrls: ['./thumbnail.component.scss'], templateUrl: './thumbnail.component.html', }) -export class ThumbnailComponent implements OnInit { +export class ThumbnailComponent implements OnChanges { /** * The thumbnail Bitstream */ - @Input() thumbnail: Bitstream; + @Input() thumbnail: Bitstream | RemoteData; /** * The default image, used if the thumbnail isn't set or can't be downloaded. @@ -27,7 +29,7 @@ export class ThumbnailComponent implements OnInit { /** * The src attribute used in the template to render the image. */ - src: string; + src: string = null; /** * i18n key of thumbnail alt text @@ -44,18 +46,37 @@ export class ThumbnailComponent implements OnInit { */ @Input() limitWidth? = true; + isLoading: boolean; + /** - * Initialize the thumbnail. + * Resolve the thumbnail. * Use a default image if no actual image is available. */ - ngOnInit(): void { - if (hasValue(this.thumbnail) && hasValue(this.thumbnail._links) - && hasValue(this.thumbnail._links.content) - && this.thumbnail._links.content.href) { - this.src = this.thumbnail._links.content.href; + ngOnChanges(): void { + if (this.thumbnail === undefined || this.thumbnail === null) { + return; + } + if (this.thumbnail instanceof Bitstream) { + this.resolveThumbnail(this.thumbnail as Bitstream) + } else { + const thumbnailRD = this.thumbnail as RemoteData; + if (thumbnailRD.isLoading) { + this.isLoading = true; + } else { + this.resolveThumbnail(thumbnailRD.payload as Bitstream); + } + } + } + + private resolveThumbnail(thumbnail: Bitstream): void { + if (hasValue(thumbnail) && hasValue(thumbnail._links) + && hasValue(thumbnail._links.content) + && thumbnail._links.content.href) { + this.src = thumbnail._links.content.href; } else { this.src = this.defaultImage; } + this.isLoading = false; } /** From bcfb890e1aa1dae27e87fd57afc1cd6232532f0e Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Thu, 27 May 2021 16:34:52 +0200 Subject: [PATCH 15/44] 79597: Update unit tests --- src/app/thumbnail/thumbnail.component.html | 2 +- src/app/thumbnail/thumbnail.component.spec.ts | 125 +++++++++++++----- 2 files changed, 96 insertions(+), 31 deletions(-) diff --git a/src/app/thumbnail/thumbnail.component.html b/src/app/thumbnail/thumbnail.component.html index 593c1c10b8..a7f4c51510 100644 --- a/src/app/thumbnail/thumbnail.component.html +++ b/src/app/thumbnail/thumbnail.component.html @@ -1,4 +1,4 @@ -
+
text-content diff --git a/src/app/thumbnail/thumbnail.component.spec.ts b/src/app/thumbnail/thumbnail.component.spec.ts index 82eadc04de..bc9d159750 100644 --- a/src/app/thumbnail/thumbnail.component.spec.ts +++ b/src/app/thumbnail/thumbnail.component.spec.ts @@ -5,6 +5,10 @@ import { Bitstream } from '../core/shared/bitstream.model'; import { SafeUrlPipe } from '../shared/utils/safe-url-pipe'; import { ThumbnailComponent } from './thumbnail.component'; +import { RemoteData } from '../core/data/remote-data'; +import { + createFailedRemoteDataObject, createPendingRemoteDataObject, createSuccessfulRemoteDataObject, +} from '../shared/remote-data.utils'; // tslint:disable-next-line:pipe-prefix @Pipe({ name: 'translate' }) @@ -28,40 +32,12 @@ describe('ThumbnailComponent', () => { beforeEach(() => { fixture = TestBed.createComponent(ThumbnailComponent); - comp = fixture.componentInstance; // BannerComponent test instance + comp = fixture.componentInstance; // ThumbnailComponent test instance de = fixture.debugElement.query(By.css('div.thumbnail')); el = de.nativeElement; }); - describe('when the thumbnail exists', () => { - it('should display an image', () => { - const thumbnail = new Bitstream(); - thumbnail._links = { - self: { href: 'self.url' }, - bundle: { href: 'bundle.url' }, - format: { href: 'format.url' }, - content: { href: 'content.url' }, - }; - comp.thumbnail = thumbnail; - fixture.detectChanges(); - const image: HTMLElement = de.query(By.css('img')).nativeElement; - expect(image.getAttribute('src')).toBe(comp.thumbnail._links.content.href); - }); - it('should include the alt text', () => { - const thumbnail = new Bitstream(); - thumbnail._links = { - self: { href: 'self.url' }, - bundle: { href: 'bundle.url' }, - format: { href: 'format.url' }, - content: { href: 'content.url' }, - }; - comp.thumbnail = thumbnail; - fixture.detectChanges(); - const image: HTMLElement = de.query(By.css('img')).nativeElement; - expect(image.getAttribute('alt')).toBe('TRANSLATED ' + comp.alt); - }); - }); - describe(`when the thumbnail doesn't exist`, () => { + const withoutThumbnail = () => { describe('and there is a default image', () => { it('should display the default image', () => { comp.src = 'http://bit.stream'; @@ -73,6 +49,7 @@ describe('ThumbnailComponent', () => { comp.src = 'http://bit.stream'; comp.defaultImage = 'http://default.img'; comp.errorHandler(); + comp.ngOnChanges(); fixture.detectChanges(); const image: HTMLElement = de.query(By.css('img')).nativeElement; expect(image.getAttribute('alt')).toBe('TRANSLATED ' + comp.alt); @@ -84,10 +61,98 @@ describe('ThumbnailComponent', () => { comp.errorHandler(); expect(comp.src).toBe(null); + comp.ngOnChanges(); fixture.detectChanges(); const placeholder = fixture.debugElement.query(By.css('div.thumbnail-placeholder')).nativeElement; expect(placeholder.innerHTML).toBe('TRANSLATED ' + comp.placeholder); }); }); + }; + + describe('with thumbnail as Bitstream', () => { + let thumbnail: Bitstream; + beforeEach(() => { + thumbnail = new Bitstream(); + thumbnail._links = { + self: { href: 'self.url' }, + bundle: { href: 'bundle.url' }, + format: { href: 'format.url' }, + content: { href: 'content.url' }, + }; + }); + + it('should display an image', () => { + comp.thumbnail = thumbnail; + comp.ngOnChanges(); + fixture.detectChanges(); + const image: HTMLElement = de.query(By.css('img')).nativeElement; + expect(image.getAttribute('src')).toBe(comp.thumbnail._links.content.href); + }); + + it('should include the alt text', () => { + comp.thumbnail = thumbnail; + comp.ngOnChanges(); + fixture.detectChanges(); + const image: HTMLElement = de.query(By.css('img')).nativeElement; + expect(image.getAttribute('alt')).toBe('TRANSLATED ' + comp.alt); + }); + + describe('when there is no thumbnail', () => { + withoutThumbnail(); + }); + }); + + describe('with thumbnail as RemoteData', () => { + let thumbnail: RemoteData; + + describe('while loading', () => { + beforeEach(() => { + thumbnail = createPendingRemoteDataObject(); + }); + + it('should show a loading animation', () => { + comp.thumbnail = thumbnail; + comp.ngOnChanges(); + fixture.detectChanges(); + expect(de.query(By.css('ds-loading'))).toBeTruthy(); + }); + }); + + describe('when there is a thumbnail', () => { + beforeEach(() => { + const bitstream = new Bitstream(); + bitstream._links = { + self: { href: 'self.url' }, + bundle: { href: 'bundle.url' }, + format: { href: 'format.url' }, + content: { href: 'content.url' }, + }; + thumbnail = createSuccessfulRemoteDataObject(bitstream); + }); + + it('should display an image', () => { + comp.thumbnail = thumbnail; + comp.ngOnChanges(); + fixture.detectChanges(); + const image: HTMLElement = de.query(By.css('img')).nativeElement; + expect(image.getAttribute('src')).toBe(comp.thumbnail.payload._links.content.href); + }); + + it('should display the alt text', () => { + comp.thumbnail = thumbnail; + comp.ngOnChanges(); + fixture.detectChanges(); + const image: HTMLElement = de.query(By.css('img')).nativeElement; + expect(image.getAttribute('alt')).toBe('TRANSLATED ' + comp.alt); + }); + }); + + describe('when there is no thumbnail', () => { + beforeEach(() => { + thumbnail = createFailedRemoteDataObject(); + }); + + withoutThumbnail(); + }); }); }); From 120ecc6988cec452ab5c897155b712c368ed88df Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Thu, 27 May 2021 17:09:57 +0200 Subject: [PATCH 16/44] 79597: Fix ds-metadata-field-wrapper for thumbnails --- .../metadata-field-wrapper.component.html | 2 +- .../metadata-field-wrapper.component.ts | 7 +------ .../item-types/publication/publication.component.html | 2 +- .../item-types/untyped-item/untyped-item.component.html | 2 +- .../item-pages/journal-issue/journal-issue.component.html | 2 +- .../journal-volume/journal-volume.component.html | 2 +- .../item-pages/journal/journal.component.html | 2 +- .../item-pages/org-unit/org-unit.component.html | 2 +- .../item-pages/person/person.component.html | 2 +- .../item-pages/project/project.component.html | 2 +- .../item-detail-preview/item-detail-preview.component.html | 2 +- src/app/thumbnail/thumbnail.component.html | 2 +- src/app/thumbnail/thumbnail.component.ts | 3 +-- 13 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.html b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.html index a41aa0d67a..d69f87883b 100644 --- a/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.html +++ b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.html @@ -1,4 +1,4 @@ -
+
{{ label }}
diff --git a/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.ts b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.ts index 8af108cceb..8c4e200423 100644 --- a/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.ts +++ b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.ts @@ -17,10 +17,5 @@ export class MetadataFieldWrapperComponent { */ @Input() label: string; - /** - * Make hasNoValue() available in the template - */ - hasNoValue(o: any): boolean { - return hasNoValue(o); - } + @Input() hideIfNoTextContent = true; } diff --git a/src/app/+item-page/simple/item-types/publication/publication.component.html b/src/app/+item-page/simple/item-types/publication/publication.component.html index 0758f7cda4..57b460c814 100644 --- a/src/app/+item-page/simple/item-types/publication/publication.component.html +++ b/src/app/+item-page/simple/item-types/publication/publication.component.html @@ -9,7 +9,7 @@
- + diff --git a/src/app/+item-page/simple/item-types/untyped-item/untyped-item.component.html b/src/app/+item-page/simple/item-types/untyped-item/untyped-item.component.html index 3e20da3094..7ae9a1a909 100644 --- a/src/app/+item-page/simple/item-types/untyped-item/untyped-item.component.html +++ b/src/app/+item-page/simple/item-types/untyped-item/untyped-item.component.html @@ -9,7 +9,7 @@
- + diff --git a/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html b/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html index af87daa243..8e357140d8 100644 --- a/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html +++ b/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html @@ -8,7 +8,7 @@
- +
- +
- +
- +
- +
- +
- + diff --git a/src/app/thumbnail/thumbnail.component.html b/src/app/thumbnail/thumbnail.component.html index a7f4c51510..bf70928392 100644 --- a/src/app/thumbnail/thumbnail.component.html +++ b/src/app/thumbnail/thumbnail.component.html @@ -1,4 +1,4 @@ -
+
text-content diff --git a/src/app/thumbnail/thumbnail.component.ts b/src/app/thumbnail/thumbnail.component.ts index ec1e7eb368..3e122cde78 100644 --- a/src/app/thumbnail/thumbnail.component.ts +++ b/src/app/thumbnail/thumbnail.component.ts @@ -2,7 +2,6 @@ import { Component, Input, OnChanges } from '@angular/core'; import { Bitstream } from '../core/shared/bitstream.model'; import { hasValue } from '../shared/empty.util'; import { RemoteData } from '../core/data/remote-data'; -import { BITSTREAM } from '../core/shared/bitstream.resource-type'; /** * This component renders a given Bitstream as a thumbnail. @@ -57,7 +56,7 @@ export class ThumbnailComponent implements OnChanges { return; } if (this.thumbnail instanceof Bitstream) { - this.resolveThumbnail(this.thumbnail as Bitstream) + this.resolveThumbnail(this.thumbnail as Bitstream); } else { const thumbnailRD = this.thumbnail as RemoteData; if (thumbnailRD.isLoading) { From 4b238e18423f97583e3454e3a0947395e6fcdc18 Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Thu, 27 May 2021 18:03:43 +0200 Subject: [PATCH 17/44] 79597: Update ds-metadata-field-wrapper unit tests --- .../metadata-field-wrapper.component.spec.ts | 109 +++++++++++------- 1 file changed, 65 insertions(+), 44 deletions(-) diff --git a/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.spec.ts b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.spec.ts index 9c62b80cad..e17e5397b7 100644 --- a/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.spec.ts +++ b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.spec.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { MetadataFieldWrapperComponent } from './metadata-field-wrapper.component'; @@ -6,35 +6,34 @@ import { MetadataFieldWrapperComponent } from './metadata-field-wrapper.componen /* tslint:disable:max-classes-per-file */ @Component({ selector: 'ds-component-without-content', - template: '\n' + + template: '\n' + '' }) -class NoContentComponent {} +class NoContentComponent { + public hideIfNoTextContent = true; +} @Component({ selector: 'ds-component-with-empty-spans', - template: '\n' + + template: '\n' + ' \n' + ' \n' + '' }) -class SpanContentComponent {} +class SpanContentComponent { + @Input() hideIfNoTextContent = true; +} @Component({ selector: 'ds-component-with-text', - template: '\n' + + template: '\n' + ' The quick brown fox jumps over the lazy dog\n' + '' }) -class TextContentComponent {} +class TextContentComponent { + @Input() hideIfNoTextContent = true; +} -@Component({ - selector: 'ds-component-with-image', - template: '\n' + - ' an alt text\n' + - '' -}) -class ImgContentComponent {} /* tslint:enable:max-classes-per-file */ describe('MetadataFieldWrapperComponent', () => { @@ -43,7 +42,7 @@ describe('MetadataFieldWrapperComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [MetadataFieldWrapperComponent, NoContentComponent, SpanContentComponent, TextContentComponent, ImgContentComponent] + declarations: [MetadataFieldWrapperComponent, NoContentComponent, SpanContentComponent, TextContentComponent] }).compileComponents(); })); @@ -58,38 +57,60 @@ describe('MetadataFieldWrapperComponent', () => { expect(component).toBeDefined(); }); - it('should not show the component when there is no content', () => { - const parentFixture = TestBed.createComponent(NoContentComponent); - parentFixture.detectChanges(); - const parentNative = parentFixture.nativeElement; - const nativeWrapper = parentNative.querySelector(wrapperSelector); - expect(nativeWrapper.classList.contains('d-none')).toBe(true); + describe('with hideIfNoTextContent=true', () => { + it('should not show the component when there is no content', () => { + const parentFixture = TestBed.createComponent(NoContentComponent); + parentFixture.detectChanges(); + const parentNative = parentFixture.nativeElement; + const nativeWrapper = parentNative.querySelector(wrapperSelector); + expect(nativeWrapper.classList.contains('d-none')).toBe(true); + }); + + it('should not show the component when there is no text content', () => { + const parentFixture = TestBed.createComponent(SpanContentComponent); + parentFixture.detectChanges(); + const parentNative = parentFixture.nativeElement; + const nativeWrapper = parentNative.querySelector(wrapperSelector); + expect(nativeWrapper.classList.contains('d-none')).toBe(true); + }); + + it('should show the component when there is text content', () => { + const parentFixture = TestBed.createComponent(TextContentComponent); + parentFixture.detectChanges(); + const parentNative = parentFixture.nativeElement; + const nativeWrapper = parentNative.querySelector(wrapperSelector); + parentFixture.detectChanges(); + expect(nativeWrapper.classList.contains('d-none')).toBe(false); + }); }); - it('should not show the component when there is DOM content but not text or an image', () => { - const parentFixture = TestBed.createComponent(SpanContentComponent); - parentFixture.detectChanges(); - const parentNative = parentFixture.nativeElement; - const nativeWrapper = parentNative.querySelector(wrapperSelector); - expect(nativeWrapper.classList.contains('d-none')).toBe(true); - }); + describe('with hideIfNoTextContent=false', () => { + it('should show the component when there is no content', () => { + const parentFixture = TestBed.createComponent(NoContentComponent); + parentFixture.componentInstance.hideIfNoTextContent = false; + parentFixture.detectChanges(); + const parentNative = parentFixture.nativeElement; + const nativeWrapper = parentNative.querySelector(wrapperSelector); + expect(nativeWrapper.classList.contains('d-none')).toBe(false); + }); - it('should show the component when there is text content', () => { - const parentFixture = TestBed.createComponent(TextContentComponent); - parentFixture.detectChanges(); - const parentNative = parentFixture.nativeElement; - const nativeWrapper = parentNative.querySelector(wrapperSelector); - parentFixture.detectChanges(); - expect(nativeWrapper.classList.contains('d-none')).toBe(false); - }); + it('should show the component when there is no text content', () => { + const parentFixture = TestBed.createComponent(SpanContentComponent); + parentFixture.componentInstance.hideIfNoTextContent = false; + parentFixture.detectChanges(); + const parentNative = parentFixture.nativeElement; + const nativeWrapper = parentNative.querySelector(wrapperSelector); + expect(nativeWrapper.classList.contains('d-none')).toBe(false); + }); - it('should show the component when there is img content', () => { - const parentFixture = TestBed.createComponent(ImgContentComponent); - parentFixture.detectChanges(); - const parentNative = parentFixture.nativeElement; - const nativeWrapper = parentNative.querySelector(wrapperSelector); - parentFixture.detectChanges(); - expect(nativeWrapper.classList.contains('d-none')).toBe(false); + it('should show the component when there is text content', () => { + const parentFixture = TestBed.createComponent(TextContentComponent); + parentFixture.componentInstance.hideIfNoTextContent = false; + parentFixture.detectChanges(); + const parentNative = parentFixture.nativeElement; + const nativeWrapper = parentNative.querySelector(wrapperSelector); + parentFixture.detectChanges(); + expect(nativeWrapper.classList.contains('d-none')).toBe(false); + }); }); - }); From 95b98d3f7960776645eff3da8df00a0349a32a94 Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Mon, 31 May 2021 10:20:28 +0200 Subject: [PATCH 18/44] 79597: Remove unused imports --- .../metadata-field-wrapper/metadata-field-wrapper.component.ts | 1 - src/app/+item-page/simple/item-types/shared/item.component.ts | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.ts b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.ts index 8c4e200423..5c6b99248f 100644 --- a/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.ts +++ b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.ts @@ -1,5 +1,4 @@ import { Component, Input } from '@angular/core'; -import { hasNoValue } from '../../../shared/empty.util'; /** * This component renders any content inside this wrapper. diff --git a/src/app/+item-page/simple/item-types/shared/item.component.ts b/src/app/+item-page/simple/item-types/shared/item.component.ts index 8763d8c899..130f67edc7 100644 --- a/src/app/+item-page/simple/item-types/shared/item.component.ts +++ b/src/app/+item-page/simple/item-types/shared/item.component.ts @@ -1,10 +1,9 @@ import { Component, Input, OnInit } from '@angular/core'; -import { Observable } from 'rxjs'; import { environment } from '../../../../../environments/environment'; import { BitstreamDataService } from '../../../../core/data/bitstream-data.service'; import { Bitstream } from '../../../../core/shared/bitstream.model'; import { Item } from '../../../../core/shared/item.model'; -import { getFirstSucceededRemoteDataPayload, takeUntilCompletedRemoteData } from '../../../../core/shared/operators'; +import { takeUntilCompletedRemoteData } from '../../../../core/shared/operators'; import { getItemPageRoute } from '../../../item-page-routing-paths'; import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject'; import { RemoteData } from '../../../../core/data/remote-data'; From bb2892edd896b6fa6ea9bb8261dd77e6d799de5d Mon Sep 17 00:00:00 2001 From: Bruno Roemers Date: Tue, 8 Jun 2021 23:48:24 +0200 Subject: [PATCH 19/44] BUGFIX: Encode special characters when sending workflow action --- src/app/core/data/request.service.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/core/data/request.service.ts b/src/app/core/data/request.service.ts index 4a85df0d34..14499b8214 100644 --- a/src/app/core/data/request.service.ts +++ b/src/app/core/data/request.service.ts @@ -265,11 +265,13 @@ export class RequestService { if (isNotEmpty(body) && typeof body === 'object') { Object.keys(body) .forEach((param) => { - const paramValue = `${param}=${body[param]}`; + const encodedParam = encodeURIComponent(param); + const encodedBody = encodeURIComponent(body[param]); + const paramValue = `${encodedParam}=${encodedBody}`; queryParams = isEmpty(queryParams) ? queryParams.concat(paramValue) : queryParams.concat('&', paramValue); }); } - return encodeURI(queryParams); + return queryParams; } /** From a27a7a4083d5fd35cd9e4466e3c7c99062cbcf48 Mon Sep 17 00:00:00 2001 From: Bruno Roemers Date: Thu, 10 Jun 2021 15:00:03 +0200 Subject: [PATCH 20/44] Test requestService.uriEncodeBody --- src/app/core/data/request.service.spec.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/app/core/data/request.service.spec.ts b/src/app/core/data/request.service.spec.ts index e6dde7a032..7a07f6fe10 100644 --- a/src/app/core/data/request.service.spec.ts +++ b/src/app/core/data/request.service.spec.ts @@ -579,4 +579,19 @@ describe('RequestService', () => { }); }); }); + + describe('uriEncodeBody', () => { + it('should properly encode the body', () => { + const body = { + 'property1': 'multiple\nlines\nto\nsend', + 'property2': 'sp&ci@l characters', + 'sp&ci@l-chars in prop': 'test123', + }; + const queryParams = service.uriEncodeBody(body); + expect(queryParams).toEqual( + 'property1=multiple%0Alines%0Ato%0Asend&property2=sp%26ci%40l%20characters&sp%26ci%40l-chars%20in%20prop=test123' + ); + }); + }); + }); From c756c68f286e3a244a24fd3e33b3af829da54b24 Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Tue, 1 Jun 2021 12:46:23 +0200 Subject: [PATCH 21/44] move header changes to dspace theme --- .../+home-page/home-page-routing.module.ts | 1 + src/app/app.module.ts | 2 + .../header-navbar-wrapper.component.html | 1 + .../header-navbar-wrapper.component.scss | 4 -- ...hemed-header-navbar-wrapper.component.scss | 3 + .../themed-header-navbar-wrapper.component.ts | 25 +++++++++ src/app/header/header.component.html | 41 +++++++------- src/app/header/header.component.scss | 32 ++++++----- .../expandable-navbar-section.component.html | 2 +- .../navbar-section.component.html | 2 +- src/app/navbar/navbar.component.html | 31 ++++------ src/app/navbar/navbar.component.scss | 17 +----- src/app/navbar/navbar.component.ts | 3 +- src/app/root/root.component.html | 2 +- src/styles/_custom_variables.scss | 2 +- .../header-navbar-wrapper.component.html | 0 .../header-navbar-wrapper.component.scss | 0 .../header-navbar-wrapper.component.ts | 15 +++++ src/themes/custom/theme.module.ts | 2 + .../header-navbar-wrapper.component.html | 3 + .../header-navbar-wrapper.component.scss | 0 .../header-navbar-wrapper.component.ts | 13 +++++ .../dspace/app/header/header.component.html | 24 ++++++++ .../dspace/app/header/header.component.scss | 19 +++++++ .../dspace/app/header/header.component.ts | 13 +++++ .../dspace/app/navbar/navbar.component.html | 24 ++++++++ .../dspace/app/navbar/navbar.component.scss | 56 ++++++++++++++++++- .../dspace/app/navbar/navbar.component.ts | 2 +- src/themes/dspace/styles/_global-styles.scss | 12 +++- .../styles/_theme_css_variable_overrides.scss | 1 + src/themes/dspace/theme.module.ts | 4 ++ 31 files changed, 274 insertions(+), 82 deletions(-) create mode 100644 src/app/header-nav-wrapper/themed-header-navbar-wrapper.component.scss create mode 100644 src/app/header-nav-wrapper/themed-header-navbar-wrapper.component.ts create mode 100644 src/themes/custom/app/header-nav-wrapper/header-navbar-wrapper.component.html create mode 100644 src/themes/custom/app/header-nav-wrapper/header-navbar-wrapper.component.scss create mode 100644 src/themes/custom/app/header-nav-wrapper/header-navbar-wrapper.component.ts create mode 100644 src/themes/dspace/app/header-nav-wrapper/header-navbar-wrapper.component.html create mode 100644 src/themes/dspace/app/header-nav-wrapper/header-navbar-wrapper.component.scss create mode 100644 src/themes/dspace/app/header-nav-wrapper/header-navbar-wrapper.component.ts create mode 100644 src/themes/dspace/app/header/header.component.html create mode 100644 src/themes/dspace/app/header/header.component.scss create mode 100644 src/themes/dspace/app/header/header.component.ts create mode 100644 src/themes/dspace/app/navbar/navbar.component.html diff --git a/src/app/+home-page/home-page-routing.module.ts b/src/app/+home-page/home-page-routing.module.ts index ec6a547359..2a41c079da 100644 --- a/src/app/+home-page/home-page-routing.module.ts +++ b/src/app/+home-page/home-page-routing.module.ts @@ -20,6 +20,7 @@ import { ThemedHomePageComponent } from './themed-home-page.component'; id: 'statistics_site', active: true, visible: true, + index: 2, model: { type: MenuItemType.LINK, text: 'menu.section.statistics', diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 03cd819625..3d45ffbfc2 100755 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -46,6 +46,7 @@ import { ThemedForbiddenComponent } from './forbidden/themed-forbidden.component import { ThemedHeaderComponent } from './header/themed-header.component'; import { ThemedFooterComponent } from './footer/themed-footer.component'; import { ThemedBreadcrumbsComponent } from './breadcrumbs/themed-breadcrumbs.component'; +import { ThemedHeaderNavbarWrapperComponent } from './header-nav-wrapper/themed-header-navbar-wrapper.component'; export function getBase() { return environment.ui.nameSpace; @@ -129,6 +130,7 @@ const DECLARATIONS = [ HeaderComponent, ThemedHeaderComponent, HeaderNavbarWrapperComponent, + ThemedHeaderNavbarWrapperComponent, AdminSidebarComponent, AdminSidebarSectionComponent, ExpandableAdminSidebarSectionComponent, diff --git a/src/app/header-nav-wrapper/header-navbar-wrapper.component.html b/src/app/header-nav-wrapper/header-navbar-wrapper.component.html index c1843318b8..f99070b738 100644 --- a/src/app/header-nav-wrapper/header-navbar-wrapper.component.html +++ b/src/app/header-nav-wrapper/header-navbar-wrapper.component.html @@ -1,3 +1,4 @@
+
diff --git a/src/app/header-nav-wrapper/header-navbar-wrapper.component.scss b/src/app/header-nav-wrapper/header-navbar-wrapper.component.scss index a2ebd0d41a..b297979fd0 100644 --- a/src/app/header-nav-wrapper/header-navbar-wrapper.component.scss +++ b/src/app/header-nav-wrapper/header-navbar-wrapper.component.scss @@ -5,7 +5,3 @@ position: sticky; } } - -:host { - z-index: var(--ds-nav-z-index); -} diff --git a/src/app/header-nav-wrapper/themed-header-navbar-wrapper.component.scss b/src/app/header-nav-wrapper/themed-header-navbar-wrapper.component.scss new file mode 100644 index 0000000000..db392096aa --- /dev/null +++ b/src/app/header-nav-wrapper/themed-header-navbar-wrapper.component.scss @@ -0,0 +1,3 @@ +:host { + z-index: var(--ds-nav-z-index); +} diff --git a/src/app/header-nav-wrapper/themed-header-navbar-wrapper.component.ts b/src/app/header-nav-wrapper/themed-header-navbar-wrapper.component.ts new file mode 100644 index 0000000000..7f9c181fe2 --- /dev/null +++ b/src/app/header-nav-wrapper/themed-header-navbar-wrapper.component.ts @@ -0,0 +1,25 @@ +import { Component } from '@angular/core'; +import { ThemedComponent } from '../shared/theme-support/themed.component'; +import { HeaderNavbarWrapperComponent } from './header-navbar-wrapper.component'; + +/** + * Themed wrapper for BreadcrumbsComponent + */ +@Component({ + selector: 'ds-themed-header-navbar-wrapper', + styleUrls: ['./themed-header-navbar-wrapper.component.scss'], + templateUrl: '../shared/theme-support/themed.component.html', +}) +export class ThemedHeaderNavbarWrapperComponent extends ThemedComponent { + protected getComponentName(): string { + return 'HeaderNavbarWrapperComponent'; + } + + protected importThemedComponent(themeName: string): Promise { + return import(`../../themes/${themeName}/app/header-nav-wrapper/header-navbar-wrapper.component`); + } + + protected importUnthemedComponent(): Promise { + return import(`./header-navbar-wrapper.component`); + } +} diff --git a/src/app/header/header.component.html b/src/app/header/header.component.html index dc0d066a4e..a1fa051610 100644 --- a/src/app/header/header.component.html +++ b/src/app/header/header.component.html @@ -1,24 +1,23 @@ -
- - + +
+
diff --git a/src/app/header/header.component.scss b/src/app/header/header.component.scss index c85daf8516..922b2d02e1 100644 --- a/src/app/header/header.component.scss +++ b/src/app/header/header.component.scss @@ -1,19 +1,23 @@ -@media screen and (min-width: map-get($grid-breakpoints, md)) { - nav.navbar { - display: none; - } - .header { - background-color: var(--ds-header-bg); +.navbar-brand img { + max-height: var(--ds-header-logo-height); + max-width: 100%; + @media screen and (max-width: map-get($grid-breakpoints, sm)) { + max-height: var(--ds-header-logo-height-xs); } } -.navbar-brand img { - @media screen and (max-width: map-get($grid-breakpoints, md)) { - height: var(--ds-header-logo-height-xs); - } -} .navbar-toggler .navbar-toggler-icon { - background-image: none !important; - line-height: 1.5; - color: var(--bs-link-color); + background-image: none !important; + line-height: 1.5; } + +.navbar ::ng-deep { + a { + color: var(--ds-header-icon-color); + + &:hover, &focus { + color: var(--ds-header-icon-color-hover); + } + } +} + diff --git a/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.html b/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.html index a1c02bfa31..a7cf7c1856 100644 --- a/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.html +++ b/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.html @@ -1,4 +1,4 @@ - diff --git a/src/app/navbar/navbar.component.html b/src/app/navbar/navbar.component.html index 50e526b78b..2356077e43 100644 --- a/src/app/navbar/navbar.component.html +++ b/src/app/navbar/navbar.component.html @@ -1,24 +1,17 @@ diff --git a/src/app/navbar/navbar.component.scss b/src/app/navbar/navbar.component.scss index be6e8ac55e..d131bf95bf 100644 --- a/src/app/navbar/navbar.component.scss +++ b/src/app/navbar/navbar.component.scss @@ -1,14 +1,12 @@ nav.navbar { - border-top: 1px var(--ds-header-navbar-border-top-color) solid; - border-bottom: 1px var(--ds-header-navbar-border-bottom-color) solid; + border-bottom: 1px var(--bs-gray-400) solid; align-items: baseline; - color: var(--ds-header-icon-color); } /** Mobile menu styling **/ @media screen and (max-width: map-get($grid-breakpoints, md)) { .navbar { - width: 100%; + width: 100vw; background-color: var(--bs-white); position: absolute; overflow: hidden; @@ -31,20 +29,9 @@ nav.navbar { @media screen and (max-width: map-get($grid-breakpoints, md)) { > .container { padding: 0 var(--bs-spacer); - a.navbar-brand { - display: none; - } - .navbar-collapsed { - display: none; - } } padding: 0; } - height: 80px; -} - -a.navbar-brand img { - max-height: var(--ds-header-logo-height); } .navbar-nav { diff --git a/src/app/navbar/navbar.component.ts b/src/app/navbar/navbar.component.ts index ae5fb262ae..e741cea285 100644 --- a/src/app/navbar/navbar.component.ts +++ b/src/app/navbar/navbar.component.ts @@ -46,6 +46,7 @@ export class NavbarComponent extends MenuComponent { id: `browse_global_communities_and_collections`, active: false, visible: true, + index: 0, model: { type: MenuItemType.LINK, text: `menu.section.browse_global_communities_and_collections`, @@ -57,11 +58,11 @@ export class NavbarComponent extends MenuComponent { id: 'browse_global', active: false, visible: true, + index: 1, model: { type: MenuItemType.TEXT, text: 'menu.section.browse_global' } as TextMenuItemModel, - index: 0 }, ]; // Read the different Browse-By types from config and add them to the browse menu diff --git a/src/app/root/root.component.html b/src/app/root/root.component.html index aef07d79f4..67d04f999f 100644 --- a/src/app/root/root.component.html +++ b/src/app/root/root.component.html @@ -4,7 +4,7 @@ value: (!(sidebarVisible | async) ? 'hidden' : (slideSidebarOver | async) ? 'shown' : 'expanded'), params: {collapsedSidebarWidth: (collapsedSidebarWidth | async), totalSidebarWidth: (totalSidebarWidth | async)} }"> - + diff --git a/src/styles/_custom_variables.scss b/src/styles/_custom_variables.scss index 298be09f67..dc76d772d1 100644 --- a/src/styles/_custom_variables.scss +++ b/src/styles/_custom_variables.scss @@ -20,7 +20,7 @@ --ds-sidebar-z-index: 20; --ds-header-bg: #{$white}; - --ds-header-logo-height: 40px; + --ds-header-logo-height: 50px; --ds-header-logo-height-xs: 50px; --ds-header-icon-color: #{$cyan}; --ds-header-icon-color-hover: #{darken($white, 15%)}; diff --git a/src/themes/custom/app/header-nav-wrapper/header-navbar-wrapper.component.html b/src/themes/custom/app/header-nav-wrapper/header-navbar-wrapper.component.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/themes/custom/app/header-nav-wrapper/header-navbar-wrapper.component.scss b/src/themes/custom/app/header-nav-wrapper/header-navbar-wrapper.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/themes/custom/app/header-nav-wrapper/header-navbar-wrapper.component.ts b/src/themes/custom/app/header-nav-wrapper/header-navbar-wrapper.component.ts new file mode 100644 index 0000000000..875b5f69b8 --- /dev/null +++ b/src/themes/custom/app/header-nav-wrapper/header-navbar-wrapper.component.ts @@ -0,0 +1,15 @@ +import { Component } from '@angular/core'; +import { HeaderNavbarWrapperComponent as BaseComponent } from '../../../../app/header-nav-wrapper/header-navbar-wrapper.component'; + +/** + * This component represents a wrapper for the horizontal navbar and the header + */ +@Component({ + selector: 'ds-header-navbar-wrapper', + // styleUrls: ['header-navbar-wrapper.component.scss'], + styleUrls: ['../../../../app/header-nav-wrapper/header-navbar-wrapper.component.scss'], + // templateUrl: 'header-navbar-wrapper.component.html', + templateUrl: '../../../../app/header-nav-wrapper/header-navbar-wrapper.component.html', +}) +export class HeaderNavbarWrapperComponent extends BaseComponent { +} diff --git a/src/themes/custom/theme.module.ts b/src/themes/custom/theme.module.ts index 23fcf4c325..49b54cd850 100644 --- a/src/themes/custom/theme.module.ts +++ b/src/themes/custom/theme.module.ts @@ -78,6 +78,7 @@ import { NavbarComponent } from './app/navbar/navbar.component'; import { HeaderComponent } from './app/header/header.component'; import { FooterComponent } from './app/footer/footer.component'; import { BreadcrumbsComponent } from './app/breadcrumbs/breadcrumbs.component'; +import { HeaderNavbarWrapperComponent } from './app/header-nav-wrapper/header-navbar-wrapper.component'; const DECLARATIONS = [ HomePageComponent, @@ -117,6 +118,7 @@ const DECLARATIONS = [ FooterComponent, HeaderComponent, NavbarComponent, + HeaderNavbarWrapperComponent, BreadcrumbsComponent ]; diff --git a/src/themes/dspace/app/header-nav-wrapper/header-navbar-wrapper.component.html b/src/themes/dspace/app/header-nav-wrapper/header-navbar-wrapper.component.html new file mode 100644 index 0000000000..091d152258 --- /dev/null +++ b/src/themes/dspace/app/header-nav-wrapper/header-navbar-wrapper.component.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/src/themes/dspace/app/header-nav-wrapper/header-navbar-wrapper.component.scss b/src/themes/dspace/app/header-nav-wrapper/header-navbar-wrapper.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/themes/dspace/app/header-nav-wrapper/header-navbar-wrapper.component.ts b/src/themes/dspace/app/header-nav-wrapper/header-navbar-wrapper.component.ts new file mode 100644 index 0000000000..36e23e174a --- /dev/null +++ b/src/themes/dspace/app/header-nav-wrapper/header-navbar-wrapper.component.ts @@ -0,0 +1,13 @@ +import { Component } from '@angular/core'; +import { HeaderNavbarWrapperComponent as BaseComponent } from '../../../../app/header-nav-wrapper/header-navbar-wrapper.component'; + +/** + * This component represents a wrapper for the horizontal navbar and the header + */ +@Component({ + selector: 'ds-header-navbar-wrapper', + styleUrls: ['header-navbar-wrapper.component.scss'], + templateUrl: 'header-navbar-wrapper.component.html', +}) +export class HeaderNavbarWrapperComponent extends BaseComponent { +} diff --git a/src/themes/dspace/app/header/header.component.html b/src/themes/dspace/app/header/header.component.html new file mode 100644 index 0000000000..dc0d066a4e --- /dev/null +++ b/src/themes/dspace/app/header/header.component.html @@ -0,0 +1,24 @@ +
+ + + +
diff --git a/src/themes/dspace/app/header/header.component.scss b/src/themes/dspace/app/header/header.component.scss new file mode 100644 index 0000000000..ab418865f1 --- /dev/null +++ b/src/themes/dspace/app/header/header.component.scss @@ -0,0 +1,19 @@ +@media screen and (min-width: map-get($grid-breakpoints, md)) { + nav.navbar { + display: none; + } + .header { + background-color: var(--ds-header-bg); + } +} + +.navbar-brand img { + @media screen and (max-width: map-get($grid-breakpoints, md)) { + height: var(--ds-header-logo-height-xs); + } +} +.navbar-toggler .navbar-toggler-icon { + background-image: none !important; + line-height: 1.5; + color: var(--bs-link-color); +} diff --git a/src/themes/dspace/app/header/header.component.ts b/src/themes/dspace/app/header/header.component.ts new file mode 100644 index 0000000000..6da89b47d5 --- /dev/null +++ b/src/themes/dspace/app/header/header.component.ts @@ -0,0 +1,13 @@ +import { Component } from '@angular/core'; +import { HeaderComponent as BaseComponent } from '../../../../app/header/header.component'; + +/** + * Represents the header with the logo and simple navigation + */ +@Component({ + selector: 'ds-header', + styleUrls: ['header.component.scss'], + templateUrl: 'header.component.html', +}) +export class HeaderComponent extends BaseComponent { +} diff --git a/src/themes/dspace/app/navbar/navbar.component.html b/src/themes/dspace/app/navbar/navbar.component.html new file mode 100644 index 0000000000..50e526b78b --- /dev/null +++ b/src/themes/dspace/app/navbar/navbar.component.html @@ -0,0 +1,24 @@ + + diff --git a/src/themes/dspace/app/navbar/navbar.component.scss b/src/themes/dspace/app/navbar/navbar.component.scss index 463a4269ee..210847c1d9 100644 --- a/src/themes/dspace/app/navbar/navbar.component.scss +++ b/src/themes/dspace/app/navbar/navbar.component.scss @@ -1,5 +1,57 @@ -@import 'src/app/navbar/navbar.component.scss'; - nav.navbar { + border-top: 1px var(--ds-header-navbar-border-top-color) solid; border-bottom: 5px var(--bs-green) solid; + align-items: baseline; + color: var(--ds-header-icon-color); +} + +/** Mobile menu styling **/ +@media screen and (max-width: map-get($grid-breakpoints, md)) { + .navbar { + width: 100%; + background-color: var(--bs-white); + position: absolute; + overflow: hidden; + height: 0; + &.open { + height: 100vh; //doesn't matter because wrapper is sticky + } + } +} + +@media screen and (min-width: map-get($grid-breakpoints, md)) { + .reset-padding-md { + margin-left: calc(var(--bs-spacer) / -2); + margin-right: calc(var(--bs-spacer) / -2); + } +} + +/* TODO remove when https://github.com/twbs/bootstrap/issues/24726 is fixed */ +.navbar-expand-md.navbar-container { + @media screen and (max-width: map-get($grid-breakpoints, md)) { + > .container { + padding: 0 var(--bs-spacer); + a.navbar-brand { + display: none; + } + .navbar-collapsed { + display: none; + } + } + padding: 0; + } + height: 80px; +} + +a.navbar-brand img { + max-height: var(--ds-header-logo-height); +} + +.navbar-nav { + ::ng-deep a.nav-link { + color: var(--ds-navbar-link-color); + } + ::ng-deep a.nav-link:hover { + color: var(--ds-navbar-link-color-hover); + } } diff --git a/src/themes/dspace/app/navbar/navbar.component.ts b/src/themes/dspace/app/navbar/navbar.component.ts index e375011683..321351a933 100644 --- a/src/themes/dspace/app/navbar/navbar.component.ts +++ b/src/themes/dspace/app/navbar/navbar.component.ts @@ -8,7 +8,7 @@ import { slideMobileNav } from '../../../../app/shared/animations/slide'; @Component({ selector: 'ds-navbar', styleUrls: ['./navbar.component.scss'], - templateUrl: '../../../../app/navbar/navbar.component.html', + templateUrl: './navbar.component.html', animations: [slideMobileNav] }) export class NavbarComponent extends BaseComponent { diff --git a/src/themes/dspace/styles/_global-styles.scss b/src/themes/dspace/styles/_global-styles.scss index 1fb60b64a2..72fac11156 100644 --- a/src/themes/dspace/styles/_global-styles.scss +++ b/src/themes/dspace/styles/_global-styles.scss @@ -3,7 +3,7 @@ // imports the base global style @import '../../../styles/_global-styles.scss'; -.facet-filter,.setting-option { +.facet-filter, .setting-option { background-color: var(--bs-light); border-radius: var(--bs-border-radius); @@ -21,3 +21,13 @@ font-size: 1.1rem } } + +header { + ds-navbar-section > li, + ds-expandable-navbar-section > li { + display: flex; + flex-direction: column; + justify-content: center; + height: 100%; + } +} diff --git a/src/themes/dspace/styles/_theme_css_variable_overrides.scss b/src/themes/dspace/styles/_theme_css_variable_overrides.scss index 2a61babdb7..e4b4b61f45 100644 --- a/src/themes/dspace/styles/_theme_css_variable_overrides.scss +++ b/src/themes/dspace/styles/_theme_css_variable_overrides.scss @@ -1,6 +1,7 @@ // Override or add CSS variables for your theme here :root { + --ds-header-logo-height: 40px; --ds-banner-text-background: rgba(0, 0, 0, 0.45); --ds-banner-background-gradient-width: 300px; --ds-home-news-link-color: #{$green}; diff --git a/src/themes/dspace/theme.module.ts b/src/themes/dspace/theme.module.ts index ed840c2e25..40138aa490 100644 --- a/src/themes/dspace/theme.module.ts +++ b/src/themes/dspace/theme.module.ts @@ -41,9 +41,13 @@ import { CollectionPageModule } from '../../app/+collection-page/collection-page import { SubmissionModule } from '../../app/submission/submission.module'; import { MyDSpacePageModule } from '../../app/+my-dspace-page/my-dspace-page.module'; import { NavbarComponent } from './app/navbar/navbar.component'; +import { HeaderComponent } from './app/header/header.component'; +import { HeaderNavbarWrapperComponent } from './app/header-nav-wrapper/header-navbar-wrapper.component'; const DECLARATIONS = [ HomeNewsComponent, + HeaderComponent, + HeaderNavbarWrapperComponent, NavbarComponent ]; From 74a17da5b846b7bea48e325d57a6690d31fbe891 Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Tue, 1 Jun 2021 13:25:01 +0200 Subject: [PATCH 22/44] fix issue where home page background image would wrap around on certain screen widths --- .../dspace/app/+home-page/home-news/home-news.component.scss | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/themes/dspace/app/+home-page/home-news/home-news.component.scss b/src/themes/dspace/app/+home-page/home-news/home-news.component.scss index b5a070e51e..5e89f6b62f 100644 --- a/src/themes/dspace/app/+home-page/home-news/home-news.component.scss +++ b/src/themes/dspace/app/+home-page/home-news/home-news.component.scss @@ -6,12 +6,8 @@ color: white; background-color: var(--bs-info); position: relative; - background-position-y: -200px; background-image: url('/assets/dspace/images/banner.jpg'); background-size: cover; - @media screen and (max-width: map-get($grid-breakpoints, lg)) { - background-position-y: 0; - } .container { position: relative; From 2ddda1c766eb2062e6f32d476c89cde5e57226ff Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Tue, 1 Jun 2021 16:03:45 +0200 Subject: [PATCH 23/44] enable e2e stacktrace --- e2e/protractor.conf.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/e2e/protractor.conf.js b/e2e/protractor.conf.js index 51180c8044..93bf7f3301 100644 --- a/e2e/protractor.conf.js +++ b/e2e/protractor.conf.js @@ -69,7 +69,6 @@ exports.config = { plugins: [{ path: '../node_modules/protractor-istanbul-plugin' }], - framework: 'jasmine', jasmineNodeOpts: { showColors: true, @@ -85,7 +84,7 @@ exports.config = { onPrepare: function () { jasmine.getEnv().addReporter(new SpecReporter({ spec: { - displayStacktrace: true + displayStacktrace: 'pretty' } })); } From f2a29a642576dd8b116280db4f2c0b5b66ee953d Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Fri, 4 Jun 2021 10:35:42 +0200 Subject: [PATCH 24/44] improve structure double footer --- src/app/footer/footer.component.html | 109 ++++++++++++++------------- src/app/footer/footer.component.scss | 19 +++-- src/styles/_custom_variables.scss | 10 +-- 3 files changed, 75 insertions(+), 63 deletions(-) diff --git a/src/app/footer/footer.component.html b/src/app/footer/footer.component.html index bc407c2a97..4990290037 100644 --- a/src/app/footer/footer.component.html +++ b/src/app/footer/footer.component.html @@ -1,72 +1,79 @@ -