Skip to content

Commit

Permalink
Merge pull request #401 from atmire/Group-Entity-Types
Browse files Browse the repository at this point in the history
Group logical entity types together
  • Loading branch information
tdonohue committed May 31, 2019
2 parents 984da54 + b8822e9 commit 95bd8c8
Show file tree
Hide file tree
Showing 65 changed files with 221 additions and 124 deletions.
36 changes: 18 additions & 18 deletions resources/i18n/en.json
Expand Up @@ -302,6 +302,12 @@
},
"listelement": {
"badge": "Person"
},
"search": {
"title": "DSpace Angular :: Person Search",
"results": {
"head": "Person Search Results"
}
}
},
"project": {
Expand Down Expand Up @@ -342,6 +348,12 @@
},
"listelement": {
"badge": "Journal"
},
"search": {
"title": "DSpace Angular :: Journal Search",
"results": {
"head": "Journal Search Results"
}
}
},
"journalvolume": {
Expand Down Expand Up @@ -378,6 +390,12 @@
},
"listelement": {
"badge": "Publication"
},
"search": {
"title": "DSpace Angular :: Publication Search",
"results": {
"head": "Publication Search Results"
}
}
},
"nav": {
Expand Down Expand Up @@ -481,24 +499,6 @@
}
},
"search": {
"journal": {
"title": "DSpace Angular :: Journal Search",
"results": {
"head": "Journal Search Results"
}
},
"person": {
"title": "DSpace Angular :: Person Search",
"results": {
"head": "Person Search Results"
}
},
"publication": {
"title": "DSpace Angular :: Publication Search",
"results": {
"head": "Publication Search Results"
}
},
"title": "DSpace Angular :: Search",
"description": "",
"form": {
Expand Down
Expand Up @@ -33,6 +33,7 @@ const ITEM_EDIT_DELETE_PATH = 'delete';
{
path: '',
redirectTo: 'status',
pathMatch: 'full'
},
{
path: 'status',
Expand Down
31 changes: 12 additions & 19 deletions src/app/+item-page/item-page.module.ts
Expand Up @@ -20,16 +20,12 @@ import { FullFileSectionComponent } from './full/field-components/file-section/f
import { RelatedItemsComponent } from './simple/related-items/related-items-component';
import { SearchPageModule } from '../+search-page/search-page.module';
import { PublicationComponent } from './simple/item-types/publication/publication.component';
import { PersonComponent } from './simple/item-types/person/person.component';
import { OrgunitComponent } from './simple/item-types/orgunit/orgunit.component';
import { ProjectComponent } from './simple/item-types/project/project.component';
import { JournalComponent } from './simple/item-types/journal/journal.component';
import { JournalVolumeComponent } from './simple/item-types/journal-volume/journal-volume.component';
import { JournalIssueComponent } from './simple/item-types/journal-issue/journal-issue.component';
import { ItemComponent } from './simple/item-types/shared/item.component';
import { EditItemPageModule } from './edit-item-page/edit-item-page.module';
import { MetadataRepresentationListComponent } from './simple/metadata-representation-list/metadata-representation-list.component';
import { RelatedEntitiesSearchComponent } from './simple/related-entities/related-entities-search/related-entities-search.component';
import { MetadataValuesComponent } from './field-components/metadata-values/metadata-values.component';
import { MetadataFieldWrapperComponent } from './field-components/metadata-field-wrapper/metadata-field-wrapper.component';

@NgModule({
imports: [
Expand All @@ -53,26 +49,23 @@ import { RelatedEntitiesSearchComponent } from './simple/related-entities/relate
CollectionsComponent,
FullFileSectionComponent,
PublicationComponent,
ProjectComponent,
OrgunitComponent,
PersonComponent,
RelatedItemsComponent,
ItemComponent,
GenericItemPageFieldComponent,
JournalComponent,
JournalIssueComponent,
JournalVolumeComponent,
MetadataRepresentationListComponent,
RelatedEntitiesSearchComponent
],
exports: [
ItemComponent,
MetadataValuesComponent,
MetadataFieldWrapperComponent,
GenericItemPageFieldComponent,
RelatedEntitiesSearchComponent,
RelatedItemsComponent,
MetadataRepresentationListComponent
],
entryComponents: [
PublicationComponent,
ProjectComponent,
OrgunitComponent,
PersonComponent,
JournalComponent,
JournalIssueComponent,
JournalVolumeComponent
PublicationComponent
]
})
export class ItemPageModule {
Expand Down
8 changes: 3 additions & 5 deletions src/app/+search-page/filtered-search-page.guard.ts
Expand Up @@ -4,10 +4,8 @@ import { Observable } from 'rxjs';

@Injectable()
/**
* Assemble the correct i18n key for the filtered search page's title depending on the current route's filter parameter
* and title data.
* The format of the key will be "{title}{filter}.title" with:
* - title: The prefix of the key stored in route.data
* Assemble the correct i18n key for the filtered search page's title depending on the current route's filter parameter.
* The format of the key will be "{filter}.search.title" with:
* - filter: The current filter stored in route.params
*/
export class FilteredSearchPageGuard implements CanActivate {
Expand All @@ -16,7 +14,7 @@ export class FilteredSearchPageGuard implements CanActivate {
state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
const filter = route.params.filter;

const newTitle = route.data.title + filter + '.title';
const newTitle = filter + '.search.title';

route.data = { title: newTitle };
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/app/+search-page/search-page-routing.module.ts
Expand Up @@ -9,7 +9,7 @@ import { FilteredSearchPageGuard } from './filtered-search-page.guard';
imports: [
RouterModule.forChild([
{ path: '', component: SearchPageComponent, data: { title: 'search.title' } },
{ path: ':filter', component: FilteredSearchPageComponent, canActivate: [FilteredSearchPageGuard], data: { title: 'search.' }}
{ path: ':filter', component: FilteredSearchPageComponent, canActivate: [FilteredSearchPageGuard]}
])
]
})
Expand Down
Expand Up @@ -62,7 +62,7 @@ export class SearchResultsComponent {
*/
getTitleKey() {
if (isNotEmpty(this.fixedFilter)) {
return 'search.' + this.fixedFilter + '.results.head'
return this.fixedFilter + '.search.results.head'
} else {
return 'search.results.head';
}
Expand Down
10 changes: 9 additions & 1 deletion src/app/app.module.ts
Expand Up @@ -37,6 +37,8 @@ import { AdminSidebarComponent } from './+admin/admin-sidebar/admin-sidebar.comp
import { AdminSidebarSectionComponent } from './+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component';
import { ExpandableAdminSidebarSectionComponent } from './+admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component';
import { NavbarModule } from './navbar/navbar.module';
import { JournalEntitiesModule } from './entity-groups/journal-entities/journal-entities.module';
import { ResearchEntitiesModule } from './entity-groups/research-entities/research-entities.module';

export function getConfig() {
return ENV_CONFIG;
Expand Down Expand Up @@ -66,6 +68,11 @@ const IMPORTS = [
StoreRouterConnectingModule,
];

const ENTITY_IMPORTS = [
JournalEntitiesModule,
ResearchEntitiesModule
];

IMPORTS.push(
StoreDevtoolsModule.instrument({
maxAge: 100,
Expand Down Expand Up @@ -112,7 +119,8 @@ const EXPORTS = [

@NgModule({
imports: [
...IMPORTS
...IMPORTS,
...ENTITY_IMPORTS
],
providers: [
...PROVIDERS
Expand Down
@@ -1,12 +1,12 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
import { By } from '@angular/platform-browser';
import { Item } from '../../../../../core/shared/item.model';
import { TruncatePipe } from '../../../../utils/truncate.pipe';
import { TruncatableService } from '../../../../truncatable/truncatable.service';
import { ITEM } from '../../../../items/switcher/item-type-switcher.component';
import { JournalIssueListElementComponent } from './journal-issue-list-element.component';
import { of as observableOf } from 'rxjs';
import { Item } from '../../../../core/shared/item.model';
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';

let journalIssueListElementComponent: JournalIssueListElementComponent;
let fixture: ComponentFixture<JournalIssueListElementComponent>;
Expand Down
@@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator';
import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component';
import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator';
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';

@rendersItemType('JournalIssue', ItemViewMode.Element)
@Component({
Expand Down
@@ -1,12 +1,12 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
import { By } from '@angular/platform-browser';
import { Item } from '../../../../../core/shared/item.model';
import { TruncatePipe } from '../../../../utils/truncate.pipe';
import { TruncatableService } from '../../../../truncatable/truncatable.service';
import { ITEM } from '../../../../items/switcher/item-type-switcher.component';
import { JournalVolumeListElementComponent } from './journal-volume-list-element.component';
import { of as observableOf } from 'rxjs';
import { Item } from '../../../../core/shared/item.model';
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';

let journalVolumeListElementComponent: JournalVolumeListElementComponent;
let fixture: ComponentFixture<JournalVolumeListElementComponent>;
Expand Down
@@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator';
import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component';
import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator';
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';

@rendersItemType('JournalVolume', ItemViewMode.Element)
@Component({
Expand Down
@@ -1,12 +1,12 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
import { By } from '@angular/platform-browser';
import { Item } from '../../../../../core/shared/item.model';
import { TruncatePipe } from '../../../../utils/truncate.pipe';
import { TruncatableService } from '../../../../truncatable/truncatable.service';
import { ITEM } from '../../../../items/switcher/item-type-switcher.component';
import { JournalListElementComponent } from './journal-list-element.component';
import { of as observableOf } from 'rxjs';
import { Item } from '../../../../core/shared/item.model';
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';

let journalListElementComponent: JournalListElementComponent;
let fixture: ComponentFixture<JournalListElementComponent>;
Expand Down
@@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator';
import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component';
import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator';
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';

@rendersItemType('Journal', ItemViewMode.Element)
@Component({
Expand Down
Expand Up @@ -2,9 +2,12 @@ import { Item } from '../../../../core/shared/item.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { PaginatedList } from '../../../../core/data/paginated-list';
import { PageInfo } from '../../../../core/shared/page-info.model';
import { createRelationshipsObservable, getItemPageFieldsTest } from '../shared/item.component.spec';
import { JournalIssueComponent } from './journal-issue.component';
import { of as observableOf } from 'rxjs';
import {
createRelationshipsObservable,
getItemPageFieldsTest
} from '../../../../+item-page/simple/item-types/shared/item.component.spec';

const mockItem: Item = Object.assign(new Item(), {
bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))),
Expand Down
Expand Up @@ -5,8 +5,11 @@ import { Item } from '../../../../core/shared/item.model';
import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator';
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
import { isNotEmpty } from '../../../../shared/empty.util';
import { ItemComponent } from '../shared/item.component';
import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils';
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
import {
filterRelationsByTypeLabel,
relationsToItems
} from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';

@rendersItemType('JournalIssue', ItemViewMode.Full)
@Component({
Expand Down
Expand Up @@ -2,9 +2,12 @@ import { Item } from '../../../../core/shared/item.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { PaginatedList } from '../../../../core/data/paginated-list';
import { PageInfo } from '../../../../core/shared/page-info.model';
import { createRelationshipsObservable, getItemPageFieldsTest } from '../shared/item.component.spec';
import { JournalVolumeComponent } from './journal-volume.component';
import { of as observableOf } from 'rxjs';
import {
createRelationshipsObservable,
getItemPageFieldsTest
} from '../../../../+item-page/simple/item-types/shared/item.component.spec';

const mockItem: Item = Object.assign(new Item(), {
bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))),
Expand Down
Expand Up @@ -5,8 +5,11 @@ import { Item } from '../../../../core/shared/item.model';
import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator';
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
import { isNotEmpty } from '../../../../shared/empty.util';
import { ItemComponent } from '../shared/item.component';
import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils';
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
import {
filterRelationsByTypeLabel,
relationsToItems
} from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';

@rendersItemType('JournalVolume', ItemViewMode.Full)
@Component({
Expand Down
Expand Up @@ -8,13 +8,13 @@ import { Item } from '../../../../core/shared/item.model';
import { By } from '@angular/platform-browser';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { MockTranslateLoader } from '../../../../shared/mocks/mock-translate-loader';
import { GenericItemPageFieldComponent } from '../../field-components/specific-field/generic/generic-item-page-field.component';
import { RemoteData } from '../../../../core/data/remote-data';
import { PaginatedList } from '../../../../core/data/paginated-list';
import { PageInfo } from '../../../../core/shared/page-info.model';
import { isNotEmpty } from '../../../../shared/empty.util';
import { JournalComponent } from './journal.component';
import { of as observableOf } from 'rxjs';
import { GenericItemPageFieldComponent } from '../../../../+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component';

let comp: JournalComponent;
let fixture: ComponentFixture<JournalComponent>;
Expand Down
Expand Up @@ -5,8 +5,11 @@ import { Item } from '../../../../core/shared/item.model';
import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator';
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
import { isNotEmpty } from '../../../../shared/empty.util';
import { ItemComponent } from '../shared/item.component';
import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils';
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
import {
filterRelationsByTypeLabel,
relationsToItems
} from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';

@rendersItemType('Journal', ItemViewMode.Full)
@Component({
Expand Down

0 comments on commit 95bd8c8

Please sign in to comment.