mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
108588: Moved sub communities & collections from community page to new component
This commit is contained in:
@@ -15,6 +15,7 @@ import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
|
||||
import { ThemedCommunityPageComponent } from './themed-community-page.component';
|
||||
import { MenuItemType } from '../shared/menu/menu-item-type.model';
|
||||
import { DSOEditMenuResolver } from '../shared/dso-page/dso-edit-menu.resolver';
|
||||
import { SubComColSectionComponent } from './sections/sub-com-col-section/sub-com-col-section.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -46,9 +47,15 @@ import { DSOEditMenuResolver } from '../shared/dso-page/dso-edit-menu.resolver';
|
||||
canActivate: [AuthenticatedGuard],
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
path: '**',
|
||||
component: ThemedCommunityPageComponent,
|
||||
pathMatch: 'full',
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: SubComColSectionComponent,
|
||||
},
|
||||
],
|
||||
}
|
||||
],
|
||||
data: {
|
||||
|
@@ -20,6 +20,7 @@ import {
|
||||
ThemedCollectionPageSubCollectionListComponent
|
||||
} from './sections/sub-com-col-section/sub-collection-list/themed-community-page-sub-collection-list.component';
|
||||
import { DsoPageModule } from '../shared/dso-page/dso-page.module';
|
||||
import { SubComColSectionComponent } from './sections/sub-com-col-section/sub-com-col-section.component';
|
||||
|
||||
const DECLARATIONS = [CommunityPageComponent,
|
||||
ThemedCommunityPageComponent,
|
||||
@@ -28,7 +29,9 @@ const DECLARATIONS = [CommunityPageComponent,
|
||||
ThemedCollectionPageSubCollectionListComponent,
|
||||
CommunityPageSubCommunityListComponent,
|
||||
CreateCommunityPageComponent,
|
||||
DeleteCommunityPageComponent];
|
||||
DeleteCommunityPageComponent,
|
||||
SubComColSectionComponent,
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@@ -0,0 +1,8 @@
|
||||
<ng-container *ngIf="(community$ | async) as community">
|
||||
<ds-themed-community-page-sub-community-list
|
||||
[community]="community">
|
||||
</ds-themed-community-page-sub-community-list>
|
||||
<ds-themed-community-page-sub-collection-list
|
||||
[community]="community">
|
||||
</ds-themed-community-page-sub-collection-list>
|
||||
</ng-container>
|
@@ -0,0 +1,32 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { SubComColSectionComponent } from './sub-com-col-section.component';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
|
||||
|
||||
describe('SubComColSectionComponent', () => {
|
||||
let component: SubComColSectionComponent;
|
||||
let fixture: ComponentFixture<SubComColSectionComponent>;
|
||||
|
||||
let activatedRoute: ActivatedRouteStub;
|
||||
|
||||
beforeEach(async () => {
|
||||
activatedRoute = new ActivatedRouteStub();
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
SubComColSectionComponent,
|
||||
],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: activatedRoute },
|
||||
],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(SubComColSectionComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -0,0 +1,28 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { Community } from '../../../core/shared/community.model';
|
||||
import { ActivatedRoute, Data } from '@angular/router';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-sub-com-col-section',
|
||||
templateUrl: './sub-com-col-section.component.html',
|
||||
styleUrls: ['./sub-com-col-section.component.scss'],
|
||||
})
|
||||
export class SubComColSectionComponent implements OnInit {
|
||||
|
||||
community$: Observable<Community>;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.community$ = this.route.data.pipe(
|
||||
map((data: Data) => (data.dso as RemoteData<Community>).payload),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user