mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
45621: commit before small sidebar changes
This commit is contained in:
@@ -6,13 +6,13 @@
|
|||||||
<input type="checkbox" [checked]="true"/>
|
<input type="checkbox" [checked]="true"/>
|
||||||
<span class="filter-value">{{value}}</span>
|
<span class="filter-value">{{value}}</span>
|
||||||
</a>
|
</a>
|
||||||
<a *ngFor="let value of filterValues; let i=index" class="d-block"
|
<a *ngFor="let value of filterValues; let i=index" class="d-block row"
|
||||||
[routerLink]="[getSearchLink()]"
|
[routerLink]="[getSearchLink()]"
|
||||||
[queryParams]="getQueryParamsWith(value.value) | async">
|
[queryParams]="getQueryParamsWith(value.value) | async">
|
||||||
<ng-template [ngIf]="i < (facetCount | async)">
|
<ng-template [ngIf]="i < (facetCount | async)">
|
||||||
<input type="checkbox" [checked]="false"/>
|
<span class="col-10"><input type="checkbox" [checked]="false"/>
|
||||||
<span class="filter-value">{{value.value}}</span>
|
<span class="filter-value">{{value.value}}</span></span>
|
||||||
<span class="filter-value-count float-right">({{value.count}})</span>
|
<span class="col-2 filter-value-count">({{value.count}})</span>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</a>
|
</a>
|
||||||
<div class="clearfix toggle-more-filters">
|
<div class="clearfix toggle-more-filters">
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<h2>{{"search.filters.head" | translate}}</h2>
|
<h3>{{"search.filters.head" | translate}}</h3>
|
||||||
<div *ngIf="(filters | async).hasSucceeded">
|
<div *ngIf="(filters | async).hasSucceeded">
|
||||||
<div *ngFor="let filter of (filters | async).payload">
|
<div *ngFor="let filter of (filters | async).payload">
|
||||||
<ds-search-filter class="d-block mb-3 p-3" [filter]="filter"></ds-search-filter>
|
<ds-search-filter class="d-block mb-3 p-3" [filter]="filter"></ds-search-filter>
|
||||||
|
@@ -1,19 +1,15 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="search-page row">
|
<div class="search-page row">
|
||||||
<div class="col-3">
|
<ds-search-sidebar *ngIf="!(isMobileView | async)" class="col-3 sidebar-sm-sticky"
|
||||||
<ds-search-sidebar *ngIf="!(isMobileView | async)" class="sidebar-sm-sticky"
|
|
||||||
id="search-sidebar"
|
id="search-sidebar"
|
||||||
[resultCount]="(resultsRDObs | async)?.pageInfo?.totalElements"></ds-search-sidebar>
|
[resultCount]="(resultsRDObs | async)?.pageInfo?.totalElements"></ds-search-sidebar>
|
||||||
</div>
|
<div class="col-12 col-sm-9">
|
||||||
<div class="col-9">
|
|
||||||
<div id="search-header" class="row">
|
|
||||||
<ds-search-form id="search-form"
|
<ds-search-form id="search-form"
|
||||||
[query]="query"
|
[query]="query"
|
||||||
[scope]="(scopeObjectRDObs | async)?.payload"
|
[scope]="(scopeObjectRDObs | async)?.payload"
|
||||||
[currentParams]="currentParams"
|
[currentParams]="currentParams"
|
||||||
[scopes]="(scopeListRDObs | async)?.payload">
|
[scopes]="(scopeListRDObs | async)?.payload">
|
||||||
</ds-search-form>
|
</ds-search-form>
|
||||||
</div>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div id="search-body"
|
<div id="search-body"
|
||||||
class="row-offcanvas row-offcanvas-left"
|
class="row-offcanvas row-offcanvas-left"
|
||||||
|
@@ -1,25 +1,22 @@
|
|||||||
<h3 class="mt-3">{{ 'search.sidebar.settings.title' | translate}}</h3>
|
<h3>{{ 'search.sidebar.settings.title' | translate}}</h3>
|
||||||
<div *ngIf="[searchOptions].sort" class="setting-option result-order-settings d-block mb-3 px-3 py-2 ng-tns-c13-5">
|
<div *ngIf="[searchOptions].sort" class="setting-option result-order-settings mb-3 p-3">
|
||||||
<h4>{{ 'search.sidebar.settings.sort-by' | translate}}</h4>
|
<h5>{{ 'search.sidebar.settings.sort-by' | translate}}</h5>
|
||||||
<div class="form-group">
|
<select class="form-control" (change)="reloadOrder($event)">
|
||||||
<select class="form-control" (change)="reloadOrder($event)">
|
<option *ngFor="let direction of (sortDirections | dsKeys); let currentElementIndex = index"
|
||||||
<option *ngFor="let direction of (sortDirections | dsKeys); let currentElementIndex = index" [value]="currentElementIndex"
|
[value]="currentElementIndex"
|
||||||
[selected]="direction === searchOptions.sort? 'selected': null">
|
[selected]="direction === searchOptions.sort? 'selected': null">
|
||||||
{{direction.value}}
|
{{direction.value}}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="searchOptions.pagination.pageSize" class="setting-option page-size-settings d-block mb-3 px-3 py-2 ng-tns-c13-5">
|
<div *ngIf="searchOptions.pagination.pageSize" class="setting-option page-size-settings mb-3 p-3">
|
||||||
<h4>{{ 'search.sidebar.settings.rpp' | translate}}</h4>
|
<h5>{{ 'search.sidebar.settings.rpp' | translate}}</h5>
|
||||||
|
|
||||||
<div class="form-group">
|
<select class="form-control" (change)="reloadRPP($event)">
|
||||||
<select class="form-control" (change)="reloadRPP($event)">
|
|
||||||
<option *ngFor="let item of searchOptions.pagination.pageSizeOptions" [value]="item"
|
<option *ngFor="let item of searchOptions.pagination.pageSizeOptions" [value]="item"
|
||||||
[selected]="item === searchOptions.pagination.pageSize ? 'selected': null">
|
[selected]="item === searchOptions.pagination.pageSize ? 'selected': null">
|
||||||
{{item}}
|
{{item}}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
@@ -2,13 +2,16 @@
|
|||||||
<div id="sidebar-options" class="d-block d-sm-none search-controls clearfix">
|
<div id="sidebar-options" class="d-block d-sm-none search-controls clearfix">
|
||||||
<small class="results">{{resultCount}} {{"search.sidebar.results" | translate}}</small>
|
<small class="results">{{resultCount}} {{"search.sidebar.results" | translate}}</small>
|
||||||
<button (click)="toggleSidebar.emit()"
|
<button (click)="toggleSidebar.emit()"
|
||||||
aria-controls="#search-body" class="btn btn-outline-primary float-right close-sidebar"><i
|
aria-controls="#search-body"
|
||||||
|
class="btn btn-outline-primary float-right close-sidebar"><i
|
||||||
class="fa fa-arrow-right"></i> {{"search.sidebar.close" | translate}}
|
class="fa fa-arrow-right"></i> {{"search.sidebar.close" | translate}}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="search-sidebar-content">
|
<div id="search-sidebar-content">
|
||||||
<ds-view-mode-switch class="d-none d-sm-block"></ds-view-mode-switch>
|
<ds-view-mode-switch class="d-none d-sm-block"></ds-view-mode-switch>
|
||||||
<ds-search-filters></ds-search-filters>
|
<div class="sidebar-content">
|
||||||
<ds-search-settings></ds-search-settings>
|
<ds-search-filters></ds-search-filters>
|
||||||
|
<ds-search-settings></ds-search-settings>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -8,4 +8,8 @@
|
|||||||
ds-view-mode-switch {
|
ds-view-mode-switch {
|
||||||
margin-bottom: $spacer;
|
margin-bottom: $spacer;
|
||||||
}
|
}
|
||||||
|
.sidebar-content > *:not(:last-child) {
|
||||||
|
margin-bottom: 4*$spacer;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,16 +3,26 @@ import { Effect, Actions } from '@ngrx/effects'
|
|||||||
import * as fromRouter from '@ngrx/router-store';
|
import * as fromRouter from '@ngrx/router-store';
|
||||||
|
|
||||||
import { SearchSidebarCollapseAction } from './search-sidebar.actions';
|
import { SearchSidebarCollapseAction } from './search-sidebar.actions';
|
||||||
|
import { URLBaser } from '../../core/url-baser/url-baser';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SearchSidebarEffects {
|
export class SearchSidebarEffects {
|
||||||
|
private previousPath: string;
|
||||||
@Effect() routeChange$ = this.actions$
|
@Effect() routeChange$ = this.actions$
|
||||||
.ofType(fromRouter.ROUTER_NAVIGATION)
|
.ofType(fromRouter.ROUTER_NAVIGATION)
|
||||||
|
.filter((action) => this.previousPath !== this.getBaseUrl(action))
|
||||||
|
.do((action) => {this.previousPath = this.getBaseUrl(action)})
|
||||||
.map(() => new SearchSidebarCollapseAction());
|
.map(() => new SearchSidebarCollapseAction());
|
||||||
|
|
||||||
constructor(private actions$: Actions) {
|
constructor(private actions$: Actions) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getBaseUrl(action: any): string {
|
||||||
|
/* tslint:disable:no-string-literal */
|
||||||
|
const url: string = action['payload'].routerState.url;
|
||||||
|
return new URLBaser(url).toString();
|
||||||
|
/* tslint:enable:no-string-literal */
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
39
src/app/core/url-baser/url-baser.ts
Normal file
39
src/app/core/url-baser/url-baser.ts
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import { isEmpty } from '../../shared/empty.util';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts the base URL
|
||||||
|
* from a URL with query parameters
|
||||||
|
*/
|
||||||
|
export class URLBaser {
|
||||||
|
private original: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new URLBaser
|
||||||
|
*
|
||||||
|
* @param originalURL
|
||||||
|
* a string representing the original URL with possible query parameters
|
||||||
|
*/
|
||||||
|
constructor(originalURL: string) {
|
||||||
|
this.original = originalURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the query parameters from the original URL of this URLBaser
|
||||||
|
*
|
||||||
|
* @return {string}
|
||||||
|
* The base URL
|
||||||
|
*/
|
||||||
|
toString(): string {
|
||||||
|
if (isEmpty(this.original)) {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
const index = this.original.indexOf('?');
|
||||||
|
if (index < 0) {
|
||||||
|
return this.original;
|
||||||
|
} else {
|
||||||
|
return this.original.substring(0, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -25,7 +25,6 @@ export class RouteService {
|
|||||||
return this.route.queryParamMap.map((map) => map.getAll(paramName).indexOf(paramValue) > -1);
|
return this.route.queryParamMap.map((map) => map.getAll(paramName).indexOf(paramValue) > -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
addQueryParameterValue(paramName: string, paramValue: string): Observable<Params> {
|
addQueryParameterValue(paramName: string, paramValue: string): Observable<Params> {
|
||||||
return this.route.queryParams.map((currentParams) => {
|
return this.route.queryParams.map((currentParams) => {
|
||||||
const newParam = {};
|
const newParam = {};
|
||||||
|
Reference in New Issue
Block a user