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