101198: in place links replaced with buttons

This commit is contained in:
lotte
2023-04-19 15:50:00 +02:00
parent ca864379c8
commit 43d5bf372b
8 changed files with 152 additions and 129 deletions

View File

@@ -8,10 +8,10 @@
<span class="fa fa-chevron-right invisible" aria-hidden="true"></span> <span class="fa fa-chevron-right invisible" aria-hidden="true"></span>
</button> </button>
<div class="align-middle pt-2"> <div class="align-middle pt-2">
<a *ngIf="node!==loadingNode" [routerLink]="[]" (click)="getNextPage(node)" <button *ngIf="node!==loadingNode" (click)="getNextPage(node)"
class="btn btn-outline-primary btn-sm" role="button"> class="btn btn-outline-primary btn-sm" role="button">
<i class="fas fa-angle-down"></i> {{ 'communityList.showMore' | translate }} <i class="fas fa-angle-down"></i> {{ 'communityList.showMore' | translate }}
</a> </button>
<ds-themed-loading *ngIf="node===loadingNode && dataSource.loading$ | async" class="ds-themed-loading"></ds-themed-loading> <ds-themed-loading *ngIf="node===loadingNode && dataSource.loading$ | async" class="ds-themed-loading"></ds-themed-loading>
</div> </div>
</div> </div>

View File

@@ -16,6 +16,7 @@ import { of as observableOf } from 'rxjs';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { isEmpty, isNotEmpty } from '../../shared/empty.util'; import { isEmpty, isNotEmpty } from '../../shared/empty.util';
import { FlatNode } from '../flat-node.model'; import { FlatNode } from '../flat-node.model';
import { RouterLinkWithHref } from '@angular/router';
describe('CommunityListComponent', () => { describe('CommunityListComponent', () => {
let component: CommunityListComponent; let component: CommunityListComponent;
@@ -194,7 +195,7 @@ describe('CommunityListComponent', () => {
}), }),
CdkTreeModule, CdkTreeModule,
RouterTestingModule], RouterTestingModule],
declarations: [CommunityListComponent], declarations: [CommunityListComponent, RouterLinkWithHref],
providers: [CommunityListComponent, providers: [CommunityListComponent,
{ provide: CommunityListService, useValue: communityListServiceStub },], { provide: CommunityListService, useValue: communityListServiceStub },],
schemas: [CUSTOM_ELEMENTS_SCHEMA], schemas: [CUSTOM_ELEMENTS_SCHEMA],
@@ -230,9 +231,14 @@ describe('CommunityListComponent', () => {
expect(showMoreEl).toBeTruthy(); expect(showMoreEl).toBeTruthy();
}); });
it('should not render the show more button as an empty link', () => {
const debugElements = fixture.debugElement.queryAll(By.directive(RouterLinkWithHref));
expect(debugElements).toBeTruthy();
});
describe('when show more of top communities is clicked', () => { describe('when show more of top communities is clicked', () => {
beforeEach(fakeAsync(() => { beforeEach(fakeAsync(() => {
const showMoreLink = fixture.debugElement.query(By.css('.show-more-node a')); const showMoreLink = fixture.debugElement.query(By.css('.show-more-node .btn-outline-primary'));
showMoreLink.triggerEventHandler('click', { showMoreLink.triggerEventHandler('click', {
preventDefault: () => {/**/ preventDefault: () => {/**/
} }
@@ -240,6 +246,7 @@ describe('CommunityListComponent', () => {
tick(); tick();
fixture.detectChanges(); fixture.detectChanges();
})); }));
it('tree contains maximum of currentPage (2) * (2) elementsPerPage of first top communities, or less if there are less communities (3)', () => { it('tree contains maximum of currentPage (2) * (2) elementsPerPage of first top communities, or less if there are less communities (3)', () => {
const expandableNodesFound = fixture.debugElement.queryAll(By.css('.expandable-node a')); const expandableNodesFound = fixture.debugElement.queryAll(By.css('.expandable-node a'));
const childlessNodesFound = fixture.debugElement.queryAll(By.css('.childless-node a')); const childlessNodesFound = fixture.debugElement.queryAll(By.css('.childless-node a'));

View File

@@ -8,10 +8,10 @@
</ds-file-download-link> </ds-file-download-link>
<ds-themed-loading *ngIf="isLoading" message="{{'loading.default' | translate}}" [showMessage]="false"></ds-themed-loading> <ds-themed-loading *ngIf="isLoading" message="{{'loading.default' | translate}}" [showMessage]="false"></ds-themed-loading>
<div *ngIf="!isLastPage" class="mt-1" id="view-more"> <div *ngIf="!isLastPage" class="mt-1" id="view-more">
<a class="bitstream-view-more btn btn-outline-secondary btn-sm" [routerLink]="[]" (click)="getNextPage()">{{'item.page.bitstreams.view-more' | translate}}</a> <button class="bitstream-view-more btn btn-outline-secondary btn-sm" (click)="getNextPage()">{{'item.page.bitstreams.view-more' | translate}}</button>
</div> </div>
<div *ngIf="isLastPage && currentPage != 1" class="mt-1" id="collapse"> <div *ngIf="isLastPage && currentPage != 1" class="mt-1" id="collapse">
<a class="bitstream-collapse btn btn-outline-secondary btn-sm" [routerLink]="[]" (click)="currentPage = undefined; getNextPage();">{{'item.page.bitstreams.collapse' | translate}}</a> <button class="bitstream-collapse btn btn-outline-secondary btn-sm" (click)="currentPage = undefined; getNextPage();">{{'item.page.bitstreams.collapse' | translate}}</button>
</div> </div>
</div> </div>
</ds-metadata-field-wrapper> </ds-metadata-field-wrapper>

View File

@@ -7,12 +7,12 @@
<ds-themed-loading *ngIf="(i + 1) === objects.length && (i > 0) && (!representations || representations?.length === 0)" message="{{'loading.default' | translate}}"></ds-themed-loading> <ds-themed-loading *ngIf="(i + 1) === objects.length && (i > 0) && (!representations || representations?.length === 0)" message="{{'loading.default' | translate}}"></ds-themed-loading>
<div class="d-inline-block w-100 mt-2" *ngIf="(i + 1) === objects.length && representations?.length > 0"> <div class="d-inline-block w-100 mt-2" *ngIf="(i + 1) === objects.length && representations?.length > 0">
<div *ngIf="(objects.length * incrementBy) < total" class="float-left"> <div *ngIf="(objects.length * incrementBy) < total" class="float-left">
<a [routerLink]="[]" (click)="increase()">{{'item.page.related-items.view-more' | <button class="btn btn-link btn-link-inline" (click)="increase()">{{'item.page.related-items.view-more' |
translate:{ amount: (total - (objects.length * incrementBy) < incrementBy) ? total - (objects.length * incrementBy) : incrementBy } }}</a> translate:{ amount: (total - (objects.length * incrementBy) < incrementBy) ? total - (objects.length * incrementBy) : incrementBy } }}</button>
</div> </div>
<div *ngIf="objects.length > 1" class="float-right"> <div *ngIf="objects.length > 1" class="float-right">
<a [routerLink]="[]" (click)="decrease()">{{'item.page.related-items.view-less' | <button class="btn btn-link btn-link-inline" (click)="decrease()">{{'item.page.related-items.view-less' |
translate:{ amount: representations?.length } }}</a> translate:{ amount: representations?.length } }}</button>
</div> </div>
</div> </div>
</ng-container> </ng-container>

View File

@@ -7,12 +7,12 @@
<ds-themed-loading *ngIf="(i + 1) === objects.length && (itemsRD || i > 0) && !(itemsRD?.hasSucceeded && itemsRD?.payload && itemsRD?.payload?.page?.length > 0)" message="{{'loading.default' | translate}}"></ds-themed-loading> <ds-themed-loading *ngIf="(i + 1) === objects.length && (itemsRD || i > 0) && !(itemsRD?.hasSucceeded && itemsRD?.payload && itemsRD?.payload?.page?.length > 0)" message="{{'loading.default' | translate}}"></ds-themed-loading>
<div class="d-inline-block w-100 mt-2" *ngIf="(i + 1) === objects.length && itemsRD?.payload?.page?.length > 0"> <div class="d-inline-block w-100 mt-2" *ngIf="(i + 1) === objects.length && itemsRD?.payload?.page?.length > 0">
<div *ngIf="itemsRD?.payload?.totalPages > objects.length" class="float-left" id="view-more"> <div *ngIf="itemsRD?.payload?.totalPages > objects.length" class="float-left" id="view-more">
<a [routerLink]="[]" (click)="increase()">{{'item.page.related-items.view-more' | <button class="btn btn-link btn-link-inline" (click)="increase()">{{'item.page.related-items.view-more' |
translate:{ amount: (itemsRD?.payload?.totalElements - (incrementBy * objects.length) < incrementBy) ? itemsRD?.payload?.totalElements - (incrementBy * objects.length) : incrementBy } }}</a> translate:{ amount: (itemsRD?.payload?.totalElements - (incrementBy * objects.length) < incrementBy) ? itemsRD?.payload?.totalElements - (incrementBy * objects.length) : incrementBy } }}</button>
</div> </div>
<div *ngIf="objects.length > 1" class="float-right" id="view-less"> <div *ngIf="objects.length > 1" class="float-right" id="view-less">
<a [routerLink]="[]" (click)="decrease()">{{'item.page.related-items.view-less' | <button class="btn btn-link btn-link-inline" (click)="decrease()">{{'item.page.related-items.view-less' |
translate:{ amount: itemsRD?.payload?.page?.length } }}</a> translate:{ amount: itemsRD?.payload?.page?.length } }}</button>
</div> </div>
</div> </div>
</ng-container> </ng-container>

View File

@@ -4,9 +4,9 @@
<input #searchInput [@toggleAnimation]="isExpanded" [attr.aria-label]="('nav.search' | translate)" name="query" <input #searchInput [@toggleAnimation]="isExpanded" [attr.aria-label]="('nav.search' | translate)" name="query"
formControlName="query" type="text" placeholder="{{searchExpanded ? ('nav.search' | translate) : ''}}" formControlName="query" type="text" placeholder="{{searchExpanded ? ('nav.search' | translate) : ''}}"
class="d-inline-block bg-transparent position-absolute form-control dropdown-menu-right p-1" [attr.data-test]="'header-search-box' | dsBrowserOnly"> class="d-inline-block bg-transparent position-absolute form-control dropdown-menu-right p-1" [attr.data-test]="'header-search-box' | dsBrowserOnly">
<a class="submit-icon" [routerLink]="" (click)="searchExpanded ? onSubmit(searchForm.value) : expand()" [attr.data-test]="'header-search-icon' | dsBrowserOnly"> <button class="submit-icon btn btn-link ds-btn-link" type="button" (click)="searchExpanded ? onSubmit(searchForm.value) : expand()" [attr.data-test]="'header-search-icon' | dsBrowserOnly">
<em class="fas fa-search fa-lg fa-fw"></em> <em class="fas fa-search fa-lg fa-fw"></em>
</a> </button>
</form> </form>
</div> </div>
</div> </div>

View File

@@ -10,7 +10,7 @@ input[type="text"] {
} }
} }
a.submit-icon { .submit-icon {
cursor: pointer; cursor: pointer;
position: sticky; position: sticky;
top: 0; top: 0;

View File

@@ -45,9 +45,9 @@ ds-admin-sidebar {
} }
.media-viewer .media-viewer
.change-gallery .change-gallery
.ngx-gallery .ngx-gallery
ngx-gallery-preview.ngx-gallery-active { ngx-gallery-preview.ngx-gallery-active {
right: 0; right: 0;
left: auto; left: auto;
width: calc(100% - 53px); width: calc(100% - 53px);
@@ -93,10 +93,11 @@ ngb-modal-backdrop {
} }
.researcher-profile-switch button:focus{ .researcher-profile-switch button:focus {
outline: none !important; outline: none !important;
} }
.researcher-profile-switch .switch.checked{
.researcher-profile-switch .switch.checked {
color: #fff; color: #fff;
} }
@@ -117,10 +118,11 @@ ngb-modal-backdrop {
} }
.custom-accordion .card-header button { .custom-accordion .card-header button {
-webkit-box-shadow: none!important; -webkit-box-shadow: none !important;
box-shadow: none!important; box-shadow: none !important;
width: 100%; width: 100%;
} }
.custom-accordion .card:first-of-type { .custom-accordion .card:first-of-type {
border-bottom: var(--bs-card-border-width) solid var(--bs-card-border-color) !important; border-bottom: var(--bs-card-border-width) solid var(--bs-card-border-color) !important;
border-bottom-left-radius: var(--bs-card-border-radius) !important; border-bottom-left-radius: var(--bs-card-border-radius) !important;
@@ -155,6 +157,7 @@ ds-dynamic-form-control-container.d-none {
.modal-body ds-listable-object-component-loader div.row > div:first-child { .modal-body ds-listable-object-component-loader div.row > div:first-child {
display: none; display: none;
} }
.modal-body ds-listable-object-component-loader div.row > div:nth-child(2) { .modal-body ds-listable-object-component-loader div.row > div:nth-child(2) {
flex: 0 0 100%; flex: 0 0 100%;
max-width: 100%; max-width: 100%;
@@ -176,6 +179,7 @@ ds-dynamic-form-control-container.d-none {
padding: 0.1rem; padding: 0.1rem;
} }
} }
.thumb-font-1 { .thumb-font-1 {
.thumbnail-placeholder { .thumbnail-placeholder {
@media screen and (max-width: map-get($grid-breakpoints, sm)) { @media screen and (max-width: map-get($grid-breakpoints, sm)) {
@@ -190,12 +194,14 @@ ds-dynamic-form-control-container.d-none {
padding: 0.125rem; padding: 0.125rem;
} }
} }
.thumb-font-2 { .thumb-font-2 {
.thumbnail-placeholder { .thumbnail-placeholder {
font-size: 0.9rem; font-size: 0.9rem;
padding: 0.125rem; padding: 0.125rem;
} }
} }
.thumb-font-3 { .thumb-font-3 {
.thumbnail-placeholder { .thumbnail-placeholder {
font-size: 1.25rem; font-size: 1.25rem;
@@ -203,4 +209,14 @@ ds-dynamic-form-control-container.d-none {
} }
} }
.btn.btn-link.btn-link-inline {
display: inline;
padding: 0;
&:not(:disabled){
&:hover, &:focus {
box-shadow: none;
}
}
}