Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New themed components & minor CSS fixes #2442

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c9a19a7
100839: Created themeable BrowseByComponent
alexandrevryghem Apr 12, 2023
2764127
100839: Added themed BrowseByComponent to custom theme
alexandrevryghem Apr 12, 2023
6487b5e
100839: Added themed BrowseEntryListElementComponent to custom theme
alexandrevryghem Apr 12, 2023
479ec16
Added PersonComponent to custom theme
alexandrevryghem Apr 28, 2023
dfb67fc
Themed LogInComponent
alexandrevryghem May 4, 2023
ae2ce87
Fix focus on navbar using different color
alexandrevryghem May 25, 2023
bcf703f
Fix ccLicense checkbox margin
alexandrevryghem Jun 6, 2023
53b7467
Merge remote-tracking branch 'upstream/main' into css-improvements-7.6
alexandrevryghem Jun 6, 2023
ec50448
Fix long search facets name not displaying correctly
alexandrevryghem Jun 16, 2023
7e0563e
Merge tag 'dspace-7.6' into atmire-contributions-august_contribute-7.6
alexandrevryghem Aug 16, 2023
15ba395
Merge remote-tracking branch 'alex/themed-log-in-component_contribute…
alexandrevryghem Aug 16, 2023
1a17664
Merge remote-tracking branch 'alex/w2p-100839_created-themeable-brows…
alexandrevryghem Aug 16, 2023
76f6eb3
Merge remote-tracking branch 'alex/added-themeable-person-component_c…
alexandrevryghem Aug 16, 2023
0892859
Removed RecentItemListComponent's unnecessary float causing alignment…
alexandrevryghem Aug 25, 2023
cdc6b92
Merge branch 'fix-recent-submission-float_contribute-7.6' into atmire…
alexandrevryghem Aug 25, 2023
8a9862e
Merge remote-tracking branch 'upstream/main' into atmire-contribution…
alexandrevryghem Aug 30, 2023
a27d6d1
Themed RegisterEmailFormComponent
alexandrevryghem Oct 2, 2023
a29dae5
Merge tag 'dspace-7.6' into themed-register-email-form-component_cont…
alexandrevryghem Oct 3, 2023
c24f366
Merge remote-tracking branch 'alex/themed-register-email-form-compone…
alexandrevryghem Oct 26, 2023
5fc7f8c
Merge branch 'atmire-contributions-august_contribute-7.6-real' into a…
alexandrevryghem Oct 26, 2023
82cca67
Merge remote-tracking branch 'upstream/main' into atmire-contribution…
alexandrevryghem Oct 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,19 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent {
const lastItemRD = this.browseService.getFirstItemFor(definition, scope, SortDirection.DESC);
this.subs.push(
observableCombineLatest([firstItemRD, lastItemRD]).subscribe(([firstItem, lastItem]) => {
let lowerLimit = this.getLimit(firstItem, metadataKeys, this.appConfig.browseBy.defaultLowerLimit);
let upperLimit = this.getLimit(lastItem, metadataKeys, new Date().getUTCFullYear());
const options = [];
const oneYearBreak = Math.floor((upperLimit - this.appConfig.browseBy.oneYearLimit) / 5) * 5;
const fiveYearBreak = Math.floor((upperLimit - this.appConfig.browseBy.fiveYearLimit) / 10) * 10;
let lowerLimit: number = this.getLimit(firstItem, metadataKeys, this.appConfig.browseBy.defaultLowerLimit);
let upperLimit: number = this.getLimit(lastItem, metadataKeys, new Date().getUTCFullYear());
const options: number[] = [];
const oneYearBreak: number = Math.floor((upperLimit - this.appConfig.browseBy.oneYearLimit) / 5) * 5;
const fiveYearBreak: number = Math.floor((upperLimit - this.appConfig.browseBy.fiveYearLimit) / 10) * 10;
if (lowerLimit <= fiveYearBreak) {
lowerLimit -= 10;
} else if (lowerLimit <= oneYearBreak) {
lowerLimit -= 5;
} else {
lowerLimit -= 1;
}
let i = upperLimit;
let i: number = upperLimit;
while (i > lowerLimit) {
options.push(i);
if (i <= fiveYearBreak) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<section class="comcol-page-browse-section">
<div class="browse-by-metadata w-100">
<ds-browse-by *ngIf="startsWithOptions" class="col-xs-12 w-100"
<ds-themed-browse-by *ngIf="startsWithOptions" class="col-xs-12 w-100"
title="{{'browse.title' | translate:
{
collection: dsoNameService.getName((parent$ | async)?.payload),
Expand All @@ -48,7 +48,7 @@
[startsWithOptions]="startsWithOptions"
(prev)="goPrev()"
(next)="goNext()">
</ds-browse-by>
</ds-themed-browse-by>
<ds-themed-loading *ngIf="!startsWithOptions" message="{{'loading.browse-by-page' | translate}}"></ds-themed-loading>
</div>
</section>
Expand Down
2 changes: 2 additions & 0 deletions src/app/browse-by/browse-by.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { ThemedBrowseByTaxonomyPageComponent } from './browse-by-taxonomy-page/t
import { SharedBrowseByModule } from '../shared/browse-by/shared-browse-by.module';
import { DsoPageModule } from '../shared/dso-page/dso-page.module';
import { FormModule } from '../shared/form/form.module';
import { SharedModule } from '../shared/shared.module';

const ENTRY_COMPONENTS = [
// put only entry components that use custom decorator
Expand All @@ -35,6 +36,7 @@ const ENTRY_COMPONENTS = [
ComcolModule,
DsoPageModule,
FormModule,
SharedModule,
],
declarations: [
BrowseBySwitcherComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<ds-register-email-form
<ds-themed-register-email-form
[MESSAGE_PREFIX]="'forgot-email.form'" [typeRequest]="typeRequest">
</ds-register-email-form>
</ds-themed-register-email-form>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<ng-container *ngVar="(itemRD$ | async) as itemRD">
<div class="mt-4" [ngClass]="placeholderFontClass" *ngIf="itemRD?.hasSucceeded && itemRD?.payload?.page.length > 0" @fadeIn>
<div class="d-flex flex-row border-bottom mb-4 pb-4 ng-tns-c416-2"></div>
<div class="d-flex flex-row border-bottom mb-4 pb-4"></div>
<h2> {{'home.recent-submissions.head' | translate}}</h2>
<div class="my-4" *ngFor="let item of itemRD?.payload?.page">
<ds-listable-object-component-loader [object]="item" [viewMode]="viewMode" class="pb-4">
</ds-listable-object-component-loader>
</div>
<button (click)="onLoadMore()" class="btn btn-primary search-button mt-4 float-left ng-tns-c290-40"> {{'vocabulary-treeview.load-more' | translate }} ...</button>
<button (click)="onLoadMore()" class="btn btn-primary search-button mt-4"> {{'vocabulary-treeview.load-more' | translate }} ...</button>
</div>
<ds-error *ngIf="itemRD?.hasFailed" message="{{'error.recent-submissions' | translate}}"></ds-error>
<ds-loading *ngIf="!itemRD || itemRD.isLoading" message="{{'loading.recent-submissions' | translate}}">
Expand Down
4 changes: 2 additions & 2 deletions src/app/login-page/login-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<div>
<img class="mb-4 login-logo" src="assets/images/dspace-logo.png" alt="{{'repository.image.logo' | translate}}">
<h1 class="h3 mb-0 font-weight-normal">{{"login.form.header" | translate}}</h1>
<ds-log-in
[isStandalonePage]="true"></ds-log-in>
<ds-themed-log-in
[isStandalonePage]="true"></ds-themed-log-in>
</div>
</div>
</div>
7 changes: 4 additions & 3 deletions src/app/navbar/navbar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ nav.navbar {
.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);

&:hover, &:focus {
color: var(--ds-navbar-link-color-hover);
}
}
}
10 changes: 8 additions & 2 deletions src/app/register-email-form/register-email-form.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SharedModule } from '../shared/shared.module';
import { RegisterEmailFormComponent } from './register-email-form.component';
import { ThemedRegisterEmailFormComponent } from './themed-registry-email-form.component';

const DECLARATIONS = [
RegisterEmailFormComponent,
ThemedRegisterEmailFormComponent,
];

@NgModule({
imports: [
CommonModule,
SharedModule
],
declarations: [
RegisterEmailFormComponent,
...DECLARATIONS,
],
providers: [],
exports: [
RegisterEmailFormComponent,
...DECLARATIONS,
]
})

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Component, Input } from '@angular/core';
import { ThemedComponent } from '../shared/theme-support/themed.component';
import { RegisterEmailFormComponent } from './register-email-form.component';

/**
* Themed wrapper for {@link RegisterEmailFormComponent}
*/
@Component({
selector: 'ds-themed-register-email-form',
styleUrls: [],
templateUrl: '../shared/theme-support/themed.component.html',
})
export class ThemedRegisterEmailFormComponent extends ThemedComponent<RegisterEmailFormComponent> {

@Input() MESSAGE_PREFIX: string;

@Input() typeRequest: string;

protected inAndOutputNames: (keyof RegisterEmailFormComponent & keyof this)[] = [
'MESSAGE_PREFIX',
'typeRequest',
];

protected getComponentName(): string {
return 'RegisterEmailFormComponent';
}

protected importThemedComponent(themeName: string): Promise<any> {
return import(`../../themes/${themeName}/app/register-email-form/register-email-form.component`);
}

protected importUnthemedComponent(): Promise<any> {
return import('./register-email-form.component');
}

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<ds-register-email-form
<ds-themed-register-email-form
[MESSAGE_PREFIX]="'register-page.registration'" [typeRequest]="typeRequest">
</ds-register-email-form>
</ds-themed-register-email-form>
4 changes: 2 additions & 2 deletions src/app/shared/auth-nav-menu/auth-nav-menu.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
ngbDropdownToggle>{{ 'nav.login' | translate }}</a>
<div class="loginDropdownMenu" [ngClass]="{'pl-3 pr-3': (loading | async)}" ngbDropdownMenu
[attr.aria-label]="'nav.login' | translate">
<ds-log-in
[isStandalonePage]="false"></ds-log-in>
<ds-themed-log-in
[isStandalonePage]="false"></ds-themed-log-in>
</div>
</div>
</li>
Expand Down
13 changes: 9 additions & 4 deletions src/app/shared/browse-by/shared-browse-by.module.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { NgModule } from '@angular/core';
import { BrowseByComponent } from './browse-by.component';
import { ThemedBrowseByComponent } from './themed-browse-by.component';
import { CommonModule } from '@angular/common';
import { SharedModule } from '../shared.module';
import { ResultsBackButtonModule } from '../results-back-button/results-back-button.module';
import { BrowseByRoutingModule } from '../../browse-by/browse-by-routing.module';
import { AccessControlRoutingModule } from '../../access-control/access-control-routing.module';

const DECLARATIONS = [
BrowseByComponent,
ThemedBrowseByComponent,
];

@NgModule({
declarations: [
BrowseByComponent,
],
...DECLARATIONS,
],
imports: [
ResultsBackButtonModule,
BrowseByRoutingModule,
Expand All @@ -18,8 +24,7 @@ import { AccessControlRoutingModule } from '../../access-control/access-control-
SharedModule,
],
exports: [
BrowseByComponent,
SharedModule,
...DECLARATIONS,
]
})
export class SharedBrowseByModule { }
76 changes: 76 additions & 0 deletions src/app/shared/browse-by/themed-browse-by.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { ThemedComponent } from '../theme-support/themed.component';
import { BrowseByComponent } from './browse-by.component';
import { Observable } from 'rxjs';
import { RemoteData } from '../../core/data/remote-data';
import { PaginatedList } from '../../core/data/paginated-list.model';
import { ListableObject } from '../object-collection/shared/listable-object.model';
import { PaginationComponentOptions } from '../pagination/pagination-component-options.model';
import { SortOptions, SortDirection } from '../../core/cache/models/sort-options.model';
import { StartsWithType } from '../starts-with/starts-with-decorator';

/**
* Themed wrapper for {@link BrowseByComponent}
*/
@Component({
selector: 'ds-themed-browse-by',
styleUrls: [],
templateUrl: '../theme-support/themed.component.html',
})
export class ThemedBrowseByComponent extends ThemedComponent<BrowseByComponent> {

@Input() title: string;

@Input() parentname: string;

@Input() objects$: Observable<RemoteData<PaginatedList<ListableObject>>>;

@Input() paginationConfig: PaginationComponentOptions;

@Input() sortConfig: SortOptions;

@Input() type: StartsWithType;

@Input() startsWithOptions: number[];

@Input() showPaginator: boolean;

@Input() hideGear: boolean;

@Output() prev: EventEmitter<boolean> = new EventEmitter();

Check warning on line 40 in src/app/shared/browse-by/themed-browse-by.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/shared/browse-by/themed-browse-by.component.ts#L40

Added line #L40 was not covered by tests

@Output() next: EventEmitter<boolean> = new EventEmitter();

Check warning on line 42 in src/app/shared/browse-by/themed-browse-by.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/shared/browse-by/themed-browse-by.component.ts#L42

Added line #L42 was not covered by tests

@Output() pageSizeChange: EventEmitter<number> = new EventEmitter();

Check warning on line 44 in src/app/shared/browse-by/themed-browse-by.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/shared/browse-by/themed-browse-by.component.ts#L44

Added line #L44 was not covered by tests

@Output() sortDirectionChange: EventEmitter<SortDirection> = new EventEmitter();

Check warning on line 46 in src/app/shared/browse-by/themed-browse-by.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/shared/browse-by/themed-browse-by.component.ts#L46

Added line #L46 was not covered by tests

protected inAndOutputNames: (keyof BrowseByComponent & keyof this)[] = [

Check warning on line 48 in src/app/shared/browse-by/themed-browse-by.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/shared/browse-by/themed-browse-by.component.ts#L48

Added line #L48 was not covered by tests
'title',
'parentname',
'objects$',
'paginationConfig',
'sortConfig',
'type',
'startsWithOptions',
'showPaginator',
'hideGear',
'prev',
'next',
'pageSizeChange',
'sortDirectionChange',
];

protected getComponentName(): string {
return 'BrowseByComponent';

Check warning on line 65 in src/app/shared/browse-by/themed-browse-by.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/shared/browse-by/themed-browse-by.component.ts#L65

Added line #L65 was not covered by tests
}

protected importThemedComponent(themeName: string): Promise<any> {
return import(`../../../themes/${themeName}/app/shared/browse-by/browse-by.component.ts`);

Check warning on line 69 in src/app/shared/browse-by/themed-browse-by.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/shared/browse-by/themed-browse-by.component.ts#L69

Added line #L69 was not covered by tests
}

protected importUnthemedComponent(): Promise<any> {
return import('./browse-by.component');

Check warning on line 73 in src/app/shared/browse-by/themed-browse-by.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/shared/browse-by/themed-browse-by.component.ts#L73

Added line #L73 was not covered by tests
}

}
5 changes: 4 additions & 1 deletion src/app/shared/log-in/log-in.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { RouterTestingModule } from '@angular/router/testing';
import { HardRedirectService } from '../../core/services/hard-redirect.service';
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
import { of } from 'rxjs';
import { ThemeService } from '../theme-support/theme.service';
import { getMockThemeService } from '../mocks/theme-service.mock';

describe('LogInComponent', () => {

Expand Down Expand Up @@ -75,6 +77,7 @@ describe('LogInComponent', () => {
{ provide: HardRedirectService, useValue: hardRedirectService },
{ provide: AuthorizationDataService, useValue: authorizationService },
provideMockStore({ initialState }),
{ provide: ThemeService, useValue: getMockThemeService() },
LogInComponent
],
schemas: [
Expand All @@ -91,7 +94,7 @@ describe('LogInComponent', () => {

// synchronous beforeEach
beforeEach(() => {
const html = `<ds-log-in [isStandalonePage]="isStandalonePage"> </ds-log-in>`;
const html = `<ds-themed-log-in [isStandalonePage]="isStandalonePage"> </ds-themed-log-in>`;

testFixture = createTestComponent(html, TestComponent) as ComponentFixture<TestComponent>;
testComp = testFixture.componentInstance;
Expand Down
33 changes: 33 additions & 0 deletions src/app/shared/log-in/themed-log-in.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Component, Input } from '@angular/core';
import { ThemedComponent } from '../theme-support/themed.component';
import { LogInComponent } from './log-in.component';

/**
* Themed wrapper for {@link LogInComponent}
*/
@Component({
selector: 'ds-themed-log-in',
styleUrls: [],
templateUrl: './../theme-support/themed.component.html'
})
export class ThemedLogInComponent extends ThemedComponent<LogInComponent> {

@Input() isStandalonePage: boolean;

protected inAndOutputNames: (keyof LogInComponent & keyof this)[] = [
'isStandalonePage',
];

protected getComponentName(): string {
return 'LogInComponent';

Check warning on line 22 in src/app/shared/log-in/themed-log-in.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/shared/log-in/themed-log-in.component.ts#L22

Added line #L22 was not covered by tests
}

protected importThemedComponent(themeName: string): Promise<any> {
return import(`../../../themes/${themeName}/app/shared/log-in/log-in.component`);
}

protected importUnthemedComponent(): Promise<any> {
return import('./log-in.component');

Check warning on line 30 in src/app/shared/log-in/themed-log-in.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/shared/log-in/themed-log-in.component.ts#L30

Added line #L30 was not covered by tests
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[attr.aria-label]="(((collapsed$ | async) ? 'search.filters.filter.expand' : 'search.filters.filter.collapse') | translate) + ' ' + (('search.filters.filter.' + filter.name + '.head') | translate | lowercase)"
[attr.data-test]="'filter-toggle' | dsBrowserOnly"
>
<h4 class="d-inline-block mb-0">
<h4 class="d-inline-block text-left mt-auto mb-auto">
{{'search.filters.filter.' + filter.name + '.head'| translate}}
</h4>
<span class="filter-toggle flex-grow-1 fas p-auto"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
line-height: var(--bs-line-height-base);
text-align: right;
position: relative;
top: -0.125rem; // Fix weird outline shape in Chrome
}

> button {
Expand Down
2 changes: 2 additions & 0 deletions src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ import {
import { LogInContainerComponent } from './log-in/container/log-in-container.component';
import { LogInPasswordComponent } from './log-in/methods/password/log-in-password.component';
import { LogInComponent } from './log-in/log-in.component';
import { ThemedLogInComponent } from './log-in/themed-log-in.component';
import { MissingTranslationHelper } from './translate/missing-translation.helper';
import { FileValidator } from './utils/require-file.validator';
import { FileValueAccessorDirective } from './utils/file-value-accessor.directive';
Expand Down Expand Up @@ -339,6 +340,7 @@ const COMPONENTS = [
LoadingComponent,
ThemedLoadingComponent,
LogInComponent,
ThemedLogInComponent,
LogOutComponent,
ObjectListComponent,
ThemedObjectListComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ <h5>
<div class="m-2">
<div (click)="setAccepted(!accepted)">
<input type="checkbox"
class="mr-2"
title="accepted"
[checked]="accepted">
<span> {{ 'submission.sections.ccLicense.confirmation' | translate }}</span>
Expand Down
Loading
Loading