mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Make the default tab for browsing communities and collections configurable
This commit is contained in:
@@ -325,12 +325,20 @@ item:
|
|||||||
|
|
||||||
# Community Page Config
|
# Community Page Config
|
||||||
community:
|
community:
|
||||||
|
# Default tab to be shown when browsing a Community. Valid values are: comcols, search, or browse_<field>
|
||||||
|
# <field> must be any of the configured "browse by" fields, e.g., dateissued, author, title, or subject
|
||||||
|
# When the default tab is not the 'search' tab, the search tab is moved to the last position
|
||||||
|
defaultBrowseTab: search
|
||||||
# Search tab config
|
# Search tab config
|
||||||
searchSection:
|
searchSection:
|
||||||
showSidebar: true
|
showSidebar: true
|
||||||
|
|
||||||
# Collection Page Config
|
# Collection Page Config
|
||||||
collection:
|
collection:
|
||||||
|
# Default tab to be shown when browsing a Collection. Valid values are: search, or browse_<field>
|
||||||
|
# <field> must be any of the configured "browse by" fields, e.g., dateissued, author, title, or subject
|
||||||
|
# When the default tab is not the 'search' tab, the search tab is moved to the last position
|
||||||
|
defaultBrowseTab: search
|
||||||
# Search tab config
|
# Search tab config
|
||||||
searchSection:
|
searchSection:
|
||||||
showSidebar: true
|
showSidebar: true
|
||||||
|
@@ -85,9 +85,13 @@ export const ROUTES: Route[] = [
|
|||||||
component: ThemedCollectionPageComponent,
|
component: ThemedCollectionPageComponent,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: 'search',
|
||||||
pathMatch: 'full',
|
pathMatch: 'full',
|
||||||
component: ComcolSearchSectionComponent,
|
component: ComcolSearchSectionComponent,
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: browseByI18nBreadcrumbResolver,
|
||||||
|
},
|
||||||
|
data: { breadcrumbKey: 'collection.search' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'browse/:id',
|
path: 'browse/:id',
|
||||||
|
@@ -72,9 +72,13 @@ export const ROUTES: Route[] = [
|
|||||||
component: ThemedCommunityPageComponent,
|
component: ThemedCommunityPageComponent,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: 'search',
|
||||||
pathMatch: 'full',
|
pathMatch: 'full',
|
||||||
component: ComcolSearchSectionComponent,
|
component: ComcolSearchSectionComponent,
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: i18nBreadcrumbResolver,
|
||||||
|
},
|
||||||
|
data: { breadcrumbKey: 'community.search' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'subcoms-cols',
|
path: 'subcoms-cols',
|
||||||
|
@@ -5,6 +5,7 @@ import {
|
|||||||
} from '@angular/common';
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
|
Inject,
|
||||||
Input,
|
Input,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
@@ -33,6 +34,7 @@ import {
|
|||||||
take,
|
take,
|
||||||
} from 'rxjs/operators';
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { APP_CONFIG, AppConfig } from '../../../../config/app-config.interface';
|
||||||
import { getCollectionPageRoute } from '../../../collection-page/collection-page-routing-paths';
|
import { getCollectionPageRoute } from '../../../collection-page/collection-page-routing-paths';
|
||||||
import { getCommunityPageRoute } from '../../../community-page/community-page-routing-paths';
|
import { getCommunityPageRoute } from '../../../community-page/community-page-routing-paths';
|
||||||
import { BrowseService } from '../../../core/browse/browse.service';
|
import { BrowseService } from '../../../core/browse/browse.service';
|
||||||
@@ -82,6 +84,7 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit {
|
|||||||
subs: Subscription[] = [];
|
subs: Subscription[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@Inject(APP_CONFIG) public appConfig: AppConfig,
|
||||||
public router: Router,
|
public router: Router,
|
||||||
private browseService: BrowseService,
|
private browseService: BrowseService,
|
||||||
) {
|
) {
|
||||||
@@ -99,14 +102,14 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit {
|
|||||||
allOptions.push({
|
allOptions.push({
|
||||||
id: 'search',
|
id: 'search',
|
||||||
label: 'collection.page.browse.search.head',
|
label: 'collection.page.browse.search.head',
|
||||||
routerLink: comColRoute,
|
routerLink: `${comColRoute}/search`,
|
||||||
});
|
});
|
||||||
} else if (this.contentType === 'community') {
|
} else if (this.contentType === 'community') {
|
||||||
comColRoute = getCommunityPageRoute(this.id);
|
comColRoute = getCommunityPageRoute(this.id);
|
||||||
allOptions.push({
|
allOptions.push({
|
||||||
id: 'search',
|
id: 'search',
|
||||||
label: 'collection.page.browse.search.head',
|
label: 'collection.page.browse.search.head',
|
||||||
routerLink: comColRoute,
|
routerLink: `${comColRoute}/search`,
|
||||||
});
|
});
|
||||||
allOptions.push({
|
allOptions.push({
|
||||||
id: 'comcols',
|
id: 'comcols',
|
||||||
@@ -120,6 +123,10 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit {
|
|||||||
label: `browse.comcol.by.${config.id}`,
|
label: `browse.comcol.by.${config.id}`,
|
||||||
routerLink: `${comColRoute}/browse/${config.id}`,
|
routerLink: `${comColRoute}/browse/${config.id}`,
|
||||||
})));
|
})));
|
||||||
|
|
||||||
|
if (this.appConfig[this.contentType].defaultBrowseTab !== 'search') {
|
||||||
|
allOptions.push(allOptions.shift())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return allOptions;
|
return allOptions;
|
||||||
}),
|
}),
|
||||||
@@ -140,6 +147,15 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
this.allOptions$.pipe(
|
||||||
|
take(1),
|
||||||
|
).subscribe((allOptions: ComColPageNavOption[]) => {
|
||||||
|
if (!allOptions.find(o => o.routerLink === this.router.url?.split('?')[0])) {
|
||||||
|
var option = allOptions.find(o => o.id === this.appConfig[this.contentType].defaultBrowseTab);
|
||||||
|
void this.router.navigate([option.routerLink], { queryParams: option.params });
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
|
@@ -1324,6 +1324,8 @@
|
|||||||
|
|
||||||
"collection.page.news": "News",
|
"collection.page.news": "News",
|
||||||
|
|
||||||
|
"collection.search.breadcrumbs": "Search",
|
||||||
|
|
||||||
"collection.search.results.head": "Search Results",
|
"collection.search.results.head": "Search Results",
|
||||||
|
|
||||||
"collection.select.confirm": "Confirm selected",
|
"collection.select.confirm": "Confirm selected",
|
||||||
@@ -1562,6 +1564,8 @@
|
|||||||
|
|
||||||
"community.all-lists.head": "Subcommunities and Collections",
|
"community.all-lists.head": "Subcommunities and Collections",
|
||||||
|
|
||||||
|
"community.search.breadcrumbs": "Search",
|
||||||
|
|
||||||
"community.search.results.head": "Search Results",
|
"community.search.results.head": "Search Results",
|
||||||
|
|
||||||
"community.sub-collection-list.head": "Collections in this Community",
|
"community.sub-collection-list.head": "Collections in this Community",
|
||||||
|
@@ -1929,6 +1929,9 @@
|
|||||||
// "collection.page.news": "News",
|
// "collection.page.news": "News",
|
||||||
"collection.page.news": "Noticias",
|
"collection.page.news": "Noticias",
|
||||||
|
|
||||||
|
// "collection.search.breadcrumbs": "Search",
|
||||||
|
"collection.search.breadcrumbs": "Buscar",
|
||||||
|
|
||||||
// "collection.select.confirm": "Confirm selected",
|
// "collection.select.confirm": "Confirm selected",
|
||||||
"collection.select.confirm": "Confirmar seleccionado",
|
"collection.select.confirm": "Confirmar seleccionado",
|
||||||
|
|
||||||
@@ -2250,6 +2253,9 @@
|
|||||||
// "community.all-lists.head": "Subcommunities and Collections",
|
// "community.all-lists.head": "Subcommunities and Collections",
|
||||||
"community.all-lists.head": "Subcomunidades y colecciones",
|
"community.all-lists.head": "Subcomunidades y colecciones",
|
||||||
|
|
||||||
|
// "community.search.breadcrumbs": "Search",
|
||||||
|
"community.search.breadcrumbs": "Buscar",
|
||||||
|
|
||||||
// "community.sub-collection-list.head": "Collections in this Community",
|
// "community.sub-collection-list.head": "Collections in this Community",
|
||||||
"community.sub-collection-list.head": "Colecciones de esta comunidad",
|
"community.sub-collection-list.head": "Colecciones de esta comunidad",
|
||||||
|
|
||||||
|
@@ -4,6 +4,7 @@ import { Config } from './config.interface';
|
|||||||
* Collection Page Config
|
* Collection Page Config
|
||||||
*/
|
*/
|
||||||
export interface CollectionPageConfig extends Config {
|
export interface CollectionPageConfig extends Config {
|
||||||
|
defaultBrowseTab: string;
|
||||||
searchSection: CollectionSearchSectionConfig;
|
searchSection: CollectionSearchSectionConfig;
|
||||||
edit: {
|
edit: {
|
||||||
undoTimeout: number;
|
undoTimeout: number;
|
||||||
|
@@ -4,6 +4,7 @@ import { Config } from './config.interface';
|
|||||||
* Community Page Config
|
* Community Page Config
|
||||||
*/
|
*/
|
||||||
export interface CommunityPageConfig extends Config {
|
export interface CommunityPageConfig extends Config {
|
||||||
|
defaultBrowseTab: string;
|
||||||
searchSection: CommunitySearchSectionConfig;
|
searchSection: CommunitySearchSectionConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -333,6 +333,7 @@ export class DefaultAppConfig implements AppConfig {
|
|||||||
|
|
||||||
// Community Page Config
|
// Community Page Config
|
||||||
community: CommunityPageConfig = {
|
community: CommunityPageConfig = {
|
||||||
|
defaultBrowseTab: 'search',
|
||||||
searchSection: {
|
searchSection: {
|
||||||
showSidebar: true,
|
showSidebar: true,
|
||||||
},
|
},
|
||||||
@@ -340,6 +341,7 @@ export class DefaultAppConfig implements AppConfig {
|
|||||||
|
|
||||||
// Collection Page Config
|
// Collection Page Config
|
||||||
collection: CollectionPageConfig = {
|
collection: CollectionPageConfig = {
|
||||||
|
defaultBrowseTab: 'search',
|
||||||
searchSection: {
|
searchSection: {
|
||||||
showSidebar: true,
|
showSidebar: true,
|
||||||
},
|
},
|
||||||
|
@@ -267,11 +267,13 @@ export const environment: BuildConfig = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
community: {
|
community: {
|
||||||
|
defaultBrowseTab: 'search',
|
||||||
searchSection: {
|
searchSection: {
|
||||||
showSidebar: true,
|
showSidebar: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
collection: {
|
collection: {
|
||||||
|
defaultBrowseTab: 'search',
|
||||||
searchSection: {
|
searchSection: {
|
||||||
showSidebar: true,
|
showSidebar: true,
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user