mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
110889: Added config to disable community/collection sidebar
This commit is contained in:
@@ -279,8 +279,17 @@ item:
|
||||
# settings menu. See pageSizeOptions in 'pagination-component-options.model.ts'.
|
||||
pageSize: 5
|
||||
|
||||
# Community Page Config
|
||||
community:
|
||||
# Search tab config
|
||||
searchSection:
|
||||
showSidebar: true
|
||||
|
||||
# Collection Page Config
|
||||
collection:
|
||||
# Search tab config
|
||||
searchSection:
|
||||
showSidebar: true
|
||||
edit:
|
||||
undoTimeout: 10000 # 10 seconds
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<ds-themed-search
|
||||
[showSidebar]="showSidebar$ | async"
|
||||
[showScopeSelector]="false"
|
||||
[hideScopeInUrl]="true"
|
||||
[scope]="(comcol$ | async)?.id">
|
||||
|
@@ -2,6 +2,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ComcolSearchSectionComponent } from './comcol-search-section.component';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRouteStub } from '../../../testing/active-router.stub';
|
||||
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||
import { environment } from '../../../../../environments/environment.test';
|
||||
|
||||
describe('ComcolSearchSectionComponent', () => {
|
||||
let component: ComcolSearchSectionComponent;
|
||||
@@ -17,6 +19,7 @@ describe('ComcolSearchSectionComponent', () => {
|
||||
ComcolSearchSectionComponent,
|
||||
],
|
||||
providers: [
|
||||
{ provide: APP_CONFIG, useValue: environment },
|
||||
{ provide: ActivatedRoute, useValue: route },
|
||||
],
|
||||
}).compileComponents();
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, Inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ActivatedRoute, Data } from '@angular/router';
|
||||
import { map } from 'rxjs/operators';
|
||||
@@ -7,7 +7,12 @@ import { SearchConfigurationService } from '../../../../core/shared/search/searc
|
||||
import { RemoteData } from '../../../../core/data/remote-data';
|
||||
import { Community } from '../../../../core/shared/community.model';
|
||||
import { Collection } from '../../../../core/shared/collection.model';
|
||||
import { APP_CONFIG, AppConfig } from '../../../../../config/app-config.interface';
|
||||
import { hasValue } from '../../../empty.util';
|
||||
|
||||
/**
|
||||
* The search tab on community & collection pages
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-comcol-search-section',
|
||||
templateUrl: './comcol-search-section.component.html',
|
||||
@@ -23,7 +28,10 @@ export class ComcolSearchSectionComponent implements OnInit {
|
||||
|
||||
comcol$: Observable<Community | Collection>;
|
||||
|
||||
showSidebar$: Observable<boolean>;
|
||||
|
||||
constructor(
|
||||
@Inject(APP_CONFIG) public appConfig: AppConfig,
|
||||
protected route: ActivatedRoute,
|
||||
) {
|
||||
}
|
||||
@@ -32,6 +40,9 @@ export class ComcolSearchSectionComponent implements OnInit {
|
||||
this.comcol$ = this.route.data.pipe(
|
||||
map((data: Data) => (data.dso as RemoteData<Community | Collection>).payload),
|
||||
);
|
||||
this.showSidebar$ = this.comcol$.pipe(
|
||||
map((comcol: Community | Collection) => hasValue(comcol) && this.appConfig[comcol.type as any].searchSection.showSidebar),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ import { SubmissionConfig } from './submission-config.interface';
|
||||
import { FormConfig } from './form-config.interfaces';
|
||||
import { LangConfig } from './lang-config.interface';
|
||||
import { ItemConfig } from './item-config.interface';
|
||||
import { CommunityPageConfig } from './community-page-config.interface';
|
||||
import { CollectionPageConfig } from './collection-page-config.interface';
|
||||
import { ThemeConfig } from './theme.model';
|
||||
import { AuthConfig } from './auth-config.interfaces';
|
||||
@@ -39,6 +40,7 @@ interface AppConfig extends Config {
|
||||
communityList: CommunityListConfig;
|
||||
homePage: HomeConfig;
|
||||
item: ItemConfig;
|
||||
community: CommunityPageConfig;
|
||||
collection: CollectionPageConfig;
|
||||
themes: ThemeConfig[];
|
||||
mediaViewer: MediaViewerConfig;
|
||||
|
@@ -1,7 +1,18 @@
|
||||
import { Config } from './config.interface';
|
||||
|
||||
/**
|
||||
* Collection Page Config
|
||||
*/
|
||||
export interface CollectionPageConfig extends Config {
|
||||
searchSection: CollectionSearchSectionConfig;
|
||||
edit: {
|
||||
undoTimeout: number;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Config related to the collection's search tab
|
||||
*/
|
||||
export interface CollectionSearchSectionConfig {
|
||||
showSidebar: boolean;
|
||||
}
|
||||
|
15
src/config/community-page-config.interface.ts
Normal file
15
src/config/community-page-config.interface.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Config } from './config.interface';
|
||||
|
||||
/**
|
||||
* Community Page Config
|
||||
*/
|
||||
export interface CommunityPageConfig extends Config {
|
||||
searchSection: CommunitySearchSectionConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Config related to the community's search tab
|
||||
*/
|
||||
export interface CommunitySearchSectionConfig {
|
||||
showSidebar: boolean;
|
||||
}
|
@@ -22,6 +22,7 @@ import { HomeConfig } from './homepage-config.interface';
|
||||
import { MarkdownConfig } from './markdown-config.interface';
|
||||
import { FilterVocabularyConfig } from './filter-vocabulary-config';
|
||||
import { DiscoverySortConfig } from './discovery-sort.config';
|
||||
import { CommunityPageConfig } from './community-page-config.interface';
|
||||
|
||||
export class DefaultAppConfig implements AppConfig {
|
||||
production = false;
|
||||
@@ -287,8 +288,18 @@ export class DefaultAppConfig implements AppConfig {
|
||||
}
|
||||
};
|
||||
|
||||
// Community Page Config
|
||||
community: CommunityPageConfig = {
|
||||
searchSection: {
|
||||
showSidebar: true,
|
||||
},
|
||||
};
|
||||
|
||||
// Collection Page Config
|
||||
collection: CollectionPageConfig = {
|
||||
searchSection: {
|
||||
showSidebar: true,
|
||||
},
|
||||
edit: {
|
||||
undoTimeout: 10000 // 10 seconds
|
||||
}
|
||||
|
@@ -257,7 +257,15 @@ export const environment: BuildConfig = {
|
||||
pageSize: 5
|
||||
}
|
||||
},
|
||||
community: {
|
||||
searchSection: {
|
||||
showSidebar: true,
|
||||
},
|
||||
},
|
||||
collection: {
|
||||
searchSection: {
|
||||
showSidebar: true,
|
||||
},
|
||||
edit: {
|
||||
undoTimeout: 10000 // 10 seconds
|
||||
}
|
||||
|
Reference in New Issue
Block a user