mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 14:03:06 +00:00
New modules for back button and browse-by
This commit is contained in:
@@ -4,16 +4,21 @@ import { BrowseByModule } from './browse-by.module';
|
|||||||
import { ItemDataService } from '../core/data/item-data.service';
|
import { ItemDataService } from '../core/data/item-data.service';
|
||||||
import { BrowseService } from '../core/browse/browse.service';
|
import { BrowseService } from '../core/browse/browse.service';
|
||||||
import { BrowseByGuard } from './browse-by-guard';
|
import { BrowseByGuard } from './browse-by-guard';
|
||||||
|
import { SharedBrowseByModule } from '../shared/shared-browse-by/shared-browse-by.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
SharedBrowseByModule,
|
||||||
BrowseByRoutingModule,
|
BrowseByRoutingModule,
|
||||||
BrowseByModule.withEntryComponents()
|
BrowseByModule.withEntryComponents(),
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
ItemDataService,
|
ItemDataService,
|
||||||
BrowseService,
|
BrowseService,
|
||||||
BrowseByGuard
|
BrowseByGuard,
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class BrowseByPageModule {
|
export class BrowseByPageModule {
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { BrowseByTitlePageComponent } from './browse-by-title-page/browse-by-title-page.component';
|
import { BrowseByTitlePageComponent } from './browse-by-title-page/browse-by-title-page.component';
|
||||||
import { SharedModule } from '../shared/shared.module';
|
|
||||||
import { BrowseByMetadataPageComponent } from './browse-by-metadata-page/browse-by-metadata-page.component';
|
import { BrowseByMetadataPageComponent } from './browse-by-metadata-page/browse-by-metadata-page.component';
|
||||||
import { BrowseByDatePageComponent } from './browse-by-date-page/browse-by-date-page.component';
|
import { BrowseByDatePageComponent } from './browse-by-date-page/browse-by-date-page.component';
|
||||||
import { BrowseBySwitcherComponent } from './browse-by-switcher/browse-by-switcher.component';
|
import { BrowseBySwitcherComponent } from './browse-by-switcher/browse-by-switcher.component';
|
||||||
@@ -10,6 +9,7 @@ import { ComcolModule } from '../shared/comcol/comcol.module';
|
|||||||
import { ThemedBrowseByMetadataPageComponent } from './browse-by-metadata-page/themed-browse-by-metadata-page.component';
|
import { ThemedBrowseByMetadataPageComponent } from './browse-by-metadata-page/themed-browse-by-metadata-page.component';
|
||||||
import { ThemedBrowseByDatePageComponent } from './browse-by-date-page/themed-browse-by-date-page.component';
|
import { ThemedBrowseByDatePageComponent } from './browse-by-date-page/themed-browse-by-date-page.component';
|
||||||
import { ThemedBrowseByTitlePageComponent } from './browse-by-title-page/themed-browse-by-title-page.component';
|
import { ThemedBrowseByTitlePageComponent } from './browse-by-title-page/themed-browse-by-title-page.component';
|
||||||
|
import { SharedBrowseByModule } from '../shared/shared-browse-by/shared-browse-by.module';
|
||||||
|
|
||||||
const ENTRY_COMPONENTS = [
|
const ENTRY_COMPONENTS = [
|
||||||
// put only entry components that use custom decorator
|
// put only entry components that use custom decorator
|
||||||
@@ -25,9 +25,9 @@ const ENTRY_COMPONENTS = [
|
|||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
SharedBrowseByModule,
|
||||||
CommonModule,
|
CommonModule,
|
||||||
ComcolModule,
|
ComcolModule,
|
||||||
SharedModule
|
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
BrowseBySwitcherComponent,
|
BrowseBySwitcherComponent,
|
||||||
@@ -45,7 +45,7 @@ export class BrowseByModule {
|
|||||||
*/
|
*/
|
||||||
static withEntryComponents() {
|
static withEntryComponents() {
|
||||||
return {
|
return {
|
||||||
ngModule: SharedModule,
|
ngModule: SharedBrowseByModule,
|
||||||
providers: ENTRY_COMPONENTS.map((component) => ({provide: component}))
|
providers: ENTRY_COMPONENTS.map((component) => ({provide: component}))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -96,7 +96,7 @@ const DECLARATIONS = [
|
|||||||
ResearchEntitiesModule.withEntryComponents(),
|
ResearchEntitiesModule.withEntryComponents(),
|
||||||
NgxGalleryModule,
|
NgxGalleryModule,
|
||||||
NgbAccordionModule,
|
NgbAccordionModule,
|
||||||
UploadModule,
|
UploadModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
...DECLARATIONS,
|
...DECLARATIONS,
|
||||||
|
@@ -7,6 +7,7 @@ import { TranslateModule } from '@ngx-translate/core';
|
|||||||
import { DYNAMIC_FORM_CONTROL_MAP_FN } from '@ng-dynamic-forms/core';
|
import { DYNAMIC_FORM_CONTROL_MAP_FN } from '@ng-dynamic-forms/core';
|
||||||
import { dsDynamicFormControlMapFn } from '../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component';
|
import { dsDynamicFormControlMapFn } from '../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component';
|
||||||
import { TabbedRelatedEntitiesSearchComponent } from './simple/related-entities/tabbed-related-entities-search/tabbed-related-entities-search.component';
|
import { TabbedRelatedEntitiesSearchComponent } from './simple/related-entities/tabbed-related-entities-search/tabbed-related-entities-search.component';
|
||||||
|
import { ResultsBackButtonModule } from '../shared/results-back-button/results-back-button.module';
|
||||||
|
|
||||||
const COMPONENTS = [
|
const COMPONENTS = [
|
||||||
RelatedEntitiesSearchComponent,
|
RelatedEntitiesSearchComponent,
|
||||||
@@ -21,7 +22,8 @@ const COMPONENTS = [
|
|||||||
CommonModule,
|
CommonModule,
|
||||||
SearchModule,
|
SearchModule,
|
||||||
SharedModule,
|
SharedModule,
|
||||||
TranslateModule
|
TranslateModule,
|
||||||
|
ResultsBackButtonModule
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
...COMPONENTS
|
...COMPONENTS
|
||||||
|
@@ -58,7 +58,7 @@ export class ItemComponent implements OnInit {
|
|||||||
// Show the back to results button when the previous context was search, browse,
|
// Show the back to results button when the previous context was search, browse,
|
||||||
// or recent submissions pagination.
|
// or recent submissions pagination.
|
||||||
this.showBackButton = this.routeService.getPreviousUrl().pipe(
|
this.showBackButton = this.routeService.getPreviousUrl().pipe(
|
||||||
filter(url => /^(\/search|\/browse|\/collections)/.test(url)),
|
filter(url => /^(\/search|\/browse|\/collections|\/admin\/search|\/mydspace)/.test(url)),
|
||||||
take(1),
|
take(1),
|
||||||
map(() => true)
|
map(() => true)
|
||||||
);
|
);
|
||||||
|
@@ -0,0 +1,21 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { ResultsBackButtonComponent } from './results-back-button.component';
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
ResultsBackButtonComponent
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
TranslateModule
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
ResultsBackButtonComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class ResultsBackButtonModule {
|
||||||
|
|
||||||
|
}
|
@@ -44,6 +44,10 @@ import { ConfigurationProperty } from '../../core/shared/configuration-property.
|
|||||||
import { SearchConfigurationServiceStub } from '../testing/search-configuration-service.stub';
|
import { SearchConfigurationServiceStub } from '../testing/search-configuration-service.stub';
|
||||||
import { SearchConfigurationService } from '../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../core/shared/search/search-configuration.service';
|
||||||
import { getMockThemeService } from '../mocks/theme-service.mock';
|
import { getMockThemeService } from '../mocks/theme-service.mock';
|
||||||
|
import { ResultsBackButtonModule } from '../results-back-button/results-back-button.module';
|
||||||
|
import { SharedModule } from '../shared.module';
|
||||||
|
import { BrowseByRoutingModule } from '../../browse-by/browse-by-routing.module';
|
||||||
|
import { AccessControlRoutingModule } from '../../access-control/access-control-routing.module';
|
||||||
|
|
||||||
@listableObjectComponent(BrowseEntry, ViewMode.ListElement, DEFAULT_CONTEXT, 'custom')
|
@listableObjectComponent(BrowseEntry, ViewMode.ListElement, DEFAULT_CONTEXT, 'custom')
|
||||||
@Component({
|
@Component({
|
||||||
@@ -112,7 +116,11 @@ describe('BrowseByComponent', () => {
|
|||||||
themeService = getMockThemeService('dspace');
|
themeService = getMockThemeService('dspace');
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
ResultsBackButtonModule,
|
||||||
|
BrowseByRoutingModule,
|
||||||
|
AccessControlRoutingModule,
|
||||||
CommonModule,
|
CommonModule,
|
||||||
|
SharedModule,
|
||||||
NgbModule,
|
NgbModule,
|
||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
@@ -123,7 +131,7 @@ describe('BrowseByComponent', () => {
|
|||||||
RouterTestingModule,
|
RouterTestingModule,
|
||||||
NoopAnimationsModule
|
NoopAnimationsModule
|
||||||
],
|
],
|
||||||
declarations: [],
|
declarations: [BrowseByComponent],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: SearchConfigurationService, useValue: new SearchConfigurationServiceStub() },
|
{ provide: SearchConfigurationService, useValue: new SearchConfigurationServiceStub() },
|
||||||
{ provide: ConfigurationDataService, useValue: configurationDataService },
|
{ provide: ConfigurationDataService, useValue: configurationDataService },
|
26
src/app/shared/shared-browse-by/shared-browse-by.module.ts
Normal file
26
src/app/shared/shared-browse-by/shared-browse-by.module.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowseByComponent } from './browse-by.component';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { SharedModule } from '../shared.module';
|
||||||
|
import { ResultsBackButtonModule } from '../results-back-button/results-back-button.module';
|
||||||
|
import { BrowseByRoutingModule } from '../../browse-by/browse-by-routing.module';
|
||||||
|
import { AccessControlRoutingModule } from '../../access-control/access-control-routing.module';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
BrowseByComponent,
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
ResultsBackButtonModule,
|
||||||
|
BrowseByRoutingModule,
|
||||||
|
AccessControlRoutingModule,
|
||||||
|
CommonModule,
|
||||||
|
SharedModule,
|
||||||
|
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
BrowseByComponent,
|
||||||
|
SharedModule,
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class SharedBrowseByModule { }
|
@@ -95,7 +95,6 @@ import {
|
|||||||
ClaimedTaskActionsRejectComponent
|
ClaimedTaskActionsRejectComponent
|
||||||
} from './mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component';
|
} from './mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component';
|
||||||
import { ObjNgFor } from './utils/object-ngfor.pipe';
|
import { ObjNgFor } from './utils/object-ngfor.pipe';
|
||||||
import { BrowseByComponent } from './browse-by/browse-by.component';
|
|
||||||
import {
|
import {
|
||||||
BrowseEntryListElementComponent
|
BrowseEntryListElementComponent
|
||||||
} from './object-list/browse-entry-list-element/browse-entry-list-element.component';
|
} from './object-list/browse-entry-list-element/browse-entry-list-element.component';
|
||||||
@@ -317,7 +316,6 @@ import {
|
|||||||
} from './object-list/listable-notification-object/listable-notification-object.component';
|
} from './object-list/listable-notification-object/listable-notification-object.component';
|
||||||
import { ThemedResultsBackButtonComponent } from './results-back-button/themed-results-back-button.component';
|
import { ThemedResultsBackButtonComponent } from './results-back-button/themed-results-back-button.component';
|
||||||
import { ThemedCollectionDropdownComponent } from './collection-dropdown/themed-collection-dropdown.component';
|
import { ThemedCollectionDropdownComponent } from './collection-dropdown/themed-collection-dropdown.component';
|
||||||
import { ResultsBackButtonComponent } from './results-back-button/results-back-button.component';
|
|
||||||
|
|
||||||
|
|
||||||
const MODULES = [
|
const MODULES = [
|
||||||
@@ -338,7 +336,7 @@ const MODULES = [
|
|||||||
DragDropModule,
|
DragDropModule,
|
||||||
CdkTreeModule,
|
CdkTreeModule,
|
||||||
GoogleRecaptchaModule,
|
GoogleRecaptchaModule,
|
||||||
MenuModule,
|
MenuModule
|
||||||
];
|
];
|
||||||
|
|
||||||
const ROOT_MODULES = [
|
const ROOT_MODULES = [
|
||||||
@@ -398,7 +396,6 @@ const COMPONENTS = [
|
|||||||
ItemSubmitterComponent,
|
ItemSubmitterComponent,
|
||||||
ItemDetailPreviewComponent,
|
ItemDetailPreviewComponent,
|
||||||
ItemDetailPreviewFieldComponent,
|
ItemDetailPreviewFieldComponent,
|
||||||
ResultsBackButtonComponent,
|
|
||||||
ThemedResultsBackButtonComponent,
|
ThemedResultsBackButtonComponent,
|
||||||
ClaimedTaskActionsComponent,
|
ClaimedTaskActionsComponent,
|
||||||
ClaimedTaskActionsLoaderComponent,
|
ClaimedTaskActionsLoaderComponent,
|
||||||
@@ -409,7 +406,7 @@ const COMPONENTS = [
|
|||||||
ViewModeSwitchComponent,
|
ViewModeSwitchComponent,
|
||||||
TruncatableComponent,
|
TruncatableComponent,
|
||||||
TruncatablePartComponent,
|
TruncatablePartComponent,
|
||||||
BrowseByComponent,
|
// BrowseByComponent,
|
||||||
InputSuggestionsComponent,
|
InputSuggestionsComponent,
|
||||||
FilterInputSuggestionsComponent,
|
FilterInputSuggestionsComponent,
|
||||||
ValidationSuggestionsComponent,
|
ValidationSuggestionsComponent,
|
||||||
|
@@ -45,6 +45,8 @@ import { CommunityListElementComponent } from './app/shared/object-list/communit
|
|||||||
import { CollectionListElementComponent} from './app/shared/object-list/collection-list-element/collection-list-element.component';
|
import { CollectionListElementComponent} from './app/shared/object-list/collection-list-element/collection-list-element.component';
|
||||||
import { ResultsBackButtonComponent } from './app/shared/results-back-button/results-back-button.component';
|
import { ResultsBackButtonComponent } from './app/shared/results-back-button/results-back-button.component';
|
||||||
import { CollectionDropdownComponent } from './app/shared/collection-dropdown/collection-dropdown.component';
|
import { CollectionDropdownComponent } from './app/shared/collection-dropdown/collection-dropdown.component';
|
||||||
|
import { SharedBrowseByModule } from '../../app/shared/shared-browse-by/shared-browse-by.module';
|
||||||
|
import { ResultsBackButtonModule } from '../../app/shared/results-back-button/results-back-button.module';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,6 +86,8 @@ const DECLARATIONS = [
|
|||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
SharedModule,
|
SharedModule,
|
||||||
|
SharedBrowseByModule,
|
||||||
|
ResultsBackButtonModule,
|
||||||
SearchModule,
|
SearchModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
RootModule,
|
RootModule,
|
||||||
|
@@ -117,6 +117,8 @@ import { BrowseByTitlePageComponent } from './app/browse-by/browse-by-title-page
|
|||||||
import {
|
import {
|
||||||
ExternalSourceEntryImportModalComponent
|
ExternalSourceEntryImportModalComponent
|
||||||
} from './app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component';
|
} from './app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component';
|
||||||
|
import { SharedBrowseByModule } from '../../app/shared/shared-browse-by/shared-browse-by.module';
|
||||||
|
import { ResultsBackButtonModule } from '../../app/shared/results-back-button/results-back-button.module';
|
||||||
|
|
||||||
const DECLARATIONS = [
|
const DECLARATIONS = [
|
||||||
FileSectionComponent,
|
FileSectionComponent,
|
||||||
@@ -212,6 +214,8 @@ const DECLARATIONS = [
|
|||||||
ScrollToModule,
|
ScrollToModule,
|
||||||
SearchPageModule,
|
SearchPageModule,
|
||||||
SharedModule,
|
SharedModule,
|
||||||
|
SharedBrowseByModule,
|
||||||
|
ResultsBackButtonModule,
|
||||||
StatisticsModule,
|
StatisticsModule,
|
||||||
StatisticsPageModule,
|
StatisticsPageModule,
|
||||||
StoreModule,
|
StoreModule,
|
||||||
|
@@ -9,6 +9,8 @@ import { HeaderNavbarWrapperComponent } from './app/header-nav-wrapper/header-na
|
|||||||
import { SearchModule } from '../../app/shared/search/search.module';
|
import { SearchModule } from '../../app/shared/search/search.module';
|
||||||
import { RootModule } from '../../app/root.module';
|
import { RootModule } from '../../app/root.module';
|
||||||
import { NavbarModule } from '../../app/navbar/navbar.module';
|
import { NavbarModule } from '../../app/navbar/navbar.module';
|
||||||
|
import { SharedBrowseByModule } from '../../app/shared/shared-browse-by/shared-browse-by.module';
|
||||||
|
import { ResultsBackButtonModule } from '../../app/shared/results-back-button/results-back-button.module';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add components that use a custom decorator to ENTRY_COMPONENTS as well as DECLARATIONS.
|
* Add components that use a custom decorator to ENTRY_COMPONENTS as well as DECLARATIONS.
|
||||||
@@ -30,6 +32,8 @@ const DECLARATIONS = [
|
|||||||
CommonModule,
|
CommonModule,
|
||||||
SharedModule,
|
SharedModule,
|
||||||
SearchModule,
|
SearchModule,
|
||||||
|
SharedBrowseByModule,
|
||||||
|
ResultsBackButtonModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
RootModule,
|
RootModule,
|
||||||
NavbarModule,
|
NavbarModule,
|
||||||
|
@@ -55,6 +55,9 @@ import {
|
|||||||
} from '../../app/shared/resource-policies/resource-policies.module';
|
} from '../../app/shared/resource-policies/resource-policies.module';
|
||||||
import { ComcolModule } from '../../app/shared/comcol/comcol.module';
|
import { ComcolModule } from '../../app/shared/comcol/comcol.module';
|
||||||
import { RootModule } from '../../app/root.module';
|
import { RootModule } from '../../app/root.module';
|
||||||
|
import { BrowseByPageModule } from '../../app/browse-by/browse-by-page.module';
|
||||||
|
import { ResultsBackButtonModule } from '../../app/shared/results-back-button/results-back-button.module';
|
||||||
|
import { SharedBrowseByModule } from '../../app/shared/shared-browse-by/shared-browse-by.module';
|
||||||
|
|
||||||
const DECLARATIONS = [
|
const DECLARATIONS = [
|
||||||
];
|
];
|
||||||
@@ -68,6 +71,8 @@ const DECLARATIONS = [
|
|||||||
RootModule,
|
RootModule,
|
||||||
BitstreamFormatsModule,
|
BitstreamFormatsModule,
|
||||||
BrowseByModule,
|
BrowseByModule,
|
||||||
|
BrowseByPageModule,
|
||||||
|
ResultsBackButtonModule,
|
||||||
CollectionFormModule,
|
CollectionFormModule,
|
||||||
CollectionPageModule,
|
CollectionPageModule,
|
||||||
CommonModule,
|
CommonModule,
|
||||||
@@ -95,6 +100,7 @@ const DECLARATIONS = [
|
|||||||
ScrollToModule,
|
ScrollToModule,
|
||||||
SearchPageModule,
|
SearchPageModule,
|
||||||
SharedModule,
|
SharedModule,
|
||||||
|
SharedBrowseByModule,
|
||||||
StatisticsModule,
|
StatisticsModule,
|
||||||
StatisticsPageModule,
|
StatisticsPageModule,
|
||||||
StoreModule,
|
StoreModule,
|
||||||
|
Reference in New Issue
Block a user