Skip to content

Commit

Permalink
Merge branch 'added-recently-added-section-to-community-page_contribu…
Browse files Browse the repository at this point in the history
…te-7.6' into added-recently-added-section-to-community-page_contribute-main

# Conflicts:
#	config/config.example.yml
#	src/app/shared/search-form/search-form.component.ts
#	src/assets/i18n/en.json5
#	src/config/app-config.interface.ts
#	src/config/default-app-config.ts
  • Loading branch information
alexandrevryghem committed Feb 15, 2024
2 parents 0551229 + eab8aa0 commit e73b493
Show file tree
Hide file tree
Showing 33 changed files with 207 additions and 195 deletions.
12 changes: 8 additions & 4 deletions config/config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,14 @@ vocabularies:
vocabulary: 'srsc'
enabled: true

# Default collection/community sorting order at Advanced search, Create/update community and collection when there are not a query.
comcolSelectionSort:
sortField: 'dc.title'
sortDirection: 'ASC'
# Common community & collection page config
comcol:
# Default collection/community sorting order at Advanced search, Create/update community and collection when there are not a query.
sortConfig:
sortField: 'dc.title'
sortDirection: 'ASC'
searchSection:
showSidebar: true

# Example of fallback collection for suggestions import
# suggestion:
Expand Down
4 changes: 2 additions & 2 deletions src/app/collection-page/collection-page-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { DSOEditMenuResolver } from '../shared/dso-page/dso-edit-menu.resolver';
import { ComcolBrowseByComponent } from '../shared/comcol/sections/comcol-browse-by/comcol-browse-by.component';
import { BrowseByGuard } from '../browse-by/browse-by-guard';
import { BrowseByI18nBreadcrumbResolver } from '../browse-by/browse-by-i18n-breadcrumb.resolver';
import { CollectionRecentlyAddedComponent } from './sections/recently-added/collection-recently-added.component';
import { ComcolSearchSectionComponent } from '../shared/comcol/sections/comcol-search-section/comcol-search-section.component';

@NgModule({
imports: [
Expand Down Expand Up @@ -73,7 +73,7 @@ import { CollectionRecentlyAddedComponent } from './sections/recently-added/coll
{
path: '',
pathMatch: 'full',
component: CollectionRecentlyAddedComponent,
component: ComcolSearchSectionComponent,
},
{
path: 'browse/:id',
Expand Down
2 changes: 0 additions & 2 deletions src/app/collection-page/collection-page.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { ComcolModule } from '../shared/comcol/comcol.module';
import { DsoSharedModule } from '../dso-shared/dso-shared.module';
import { DsoPageModule } from '../shared/dso-page/dso-page.module';
import { BrowseByPageModule } from '../browse-by/browse-by-page.module';
import { CollectionRecentlyAddedComponent } from './sections/recently-added/collection-recently-added.component';

const DECLARATIONS = [
CollectionPageComponent,
Expand All @@ -29,7 +28,6 @@ const DECLARATIONS = [
EditItemTemplatePageComponent,
ThemedEditItemTemplatePageComponent,
CollectionItemMapperComponent,
CollectionRecentlyAddedComponent,
];

@NgModule({
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 6 additions & 0 deletions src/app/community-page/community-page-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { SubComColSectionComponent } from './sections/sub-com-col-section/sub-co
import { BrowseByI18nBreadcrumbResolver } from '../browse-by/browse-by-i18n-breadcrumb.resolver';
import { BrowseByGuard } from '../browse-by/browse-by-guard';
import { ComcolBrowseByComponent } from '../shared/comcol/sections/comcol-browse-by/comcol-browse-by.component';
import { ComcolSearchSectionComponent } from '../shared/comcol/sections/comcol-search-section/comcol-search-section.component';

@NgModule({
imports: [
Expand Down Expand Up @@ -56,6 +57,11 @@ import { ComcolBrowseByComponent } from '../shared/comcol/sections/comcol-browse
{
path: '',
pathMatch: 'full',
component: ComcolSearchSectionComponent,
},
{
path: 'subcoms-cols',
pathMatch: 'full',
component: SubComColSectionComponent,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('SubComColSectionComponent', () => {

beforeEach(async () => {
activatedRoute = new ActivatedRouteStub();
activatedRoute.parent = new ActivatedRouteStub();

await TestBed.configureTestingModule({
declarations: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class SubComColSectionComponent implements OnInit {
}

ngOnInit(): void {
this.community$ = this.route.data.pipe(
this.community$ = this.route.parent.data.pipe(
map((data: Data) => (data.dso as RemoteData<Community>).payload),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,21 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit {
if (this.contentType === 'collection') {
comColRoute = getCollectionPageRoute(this.id);
allOptions.push({
id: 'recent_submissions',
label: 'collection.page.browse.recent.head',
id: 'search',
label: 'collection.page.browse.search.head',
routerLink: comColRoute,
});
} else if (this.contentType === 'community') {
comColRoute = getCommunityPageRoute(this.id);
allOptions.push({
id: 'search',
label: 'collection.page.browse.search.head',
routerLink: comColRoute,
});
allOptions.push({
id: 'comcols',
label: 'community.all-lists.head',
routerLink: comColRoute,
routerLink: `${comColRoute}/subcoms-cols`,
});
}

Expand Down
4 changes: 4 additions & 0 deletions src/app/shared/comcol/comcol.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { FormModule } from '../form/form.module';
import { UploadModule } from '../upload/upload.module';
import { ComcolBrowseByComponent } from './sections/comcol-browse-by/comcol-browse-by.component';
import { BrowseByModule } from '../../browse-by/browse-by.module';
import { SearchModule } from '../search/search.module';
import { ComcolSearchSectionComponent } from './sections/comcol-search-section/comcol-search-section.component';

const COMPONENTS = [
ComcolPageContentComponent,
Expand All @@ -33,6 +35,7 @@ const COMPONENTS = [
ComcolRoleComponent,
ThemedComcolPageHandleComponent,
ComcolBrowseByComponent,
ComcolSearchSectionComponent,
];

@NgModule({
Expand All @@ -45,6 +48,7 @@ const COMPONENTS = [
SharedModule,
UploadModule,
BrowseByModule,
SearchModule,
],
exports: [
...COMPONENTS,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<ds-themed-search
[showSidebar]="appConfig.comcol.searchSection.showSidebar"
[showScopeSelector]="false"
[hideScopeInUrl]="true"
[scope]="(comcol$ | async)?.id">
</ds-themed-search>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ComcolSearchSectionComponent } from './comcol-search-section.component';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRouteStub } from '../../../testing/active-router.stub';
import { APP_CONFIG } from '../../../../../config/app-config.interface';
import { environment } from '../../../../../environments/environment.test';

describe('ComcolSearchSectionComponent', () => {
let component: ComcolSearchSectionComponent;
let fixture: ComponentFixture<ComcolSearchSectionComponent>;

let route: ActivatedRouteStub;

beforeEach(async () => {
route = new ActivatedRouteStub();

await TestBed.configureTestingModule({
declarations: [
ComcolSearchSectionComponent,
],
providers: [
{ provide: APP_CONFIG, useValue: environment },
{ provide: ActivatedRoute, useValue: route },
],
}).compileComponents();

fixture = TestBed.createComponent(ComcolSearchSectionComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Component, OnInit, Inject } from '@angular/core';
import { Observable } from 'rxjs';
import { ActivatedRoute, Data } from '@angular/router';
import { map } from 'rxjs/operators';
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
import { RemoteData } from '../../../../core/data/remote-data';
import { Community } from '../../../../core/shared/community.model';
import { Collection } from '../../../../core/shared/collection.model';
import { APP_CONFIG, AppConfig } from '../../../../../config/app-config.interface';

@Component({
selector: 'ds-comcol-search-section',
templateUrl: './comcol-search-section.component.html',
styleUrls: ['./comcol-search-section.component.scss'],
providers: [
{
provide: SEARCH_CONFIG_SERVICE,
useClass: SearchConfigurationService,
},
],
})
export class ComcolSearchSectionComponent implements OnInit {

comcol$: Observable<Community | Collection>;

constructor(
@Inject(APP_CONFIG) public appConfig: AppConfig,
protected route: ActivatedRoute,
) {
}

ngOnInit(): void {
this.comcol$ = this.route.data.pipe(
map((data: Data) => (data.dso as RemoteData<Community | Collection>).payload),
);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class CreateCollectionParentSelectorComponent extends DSOSelectorModalWra
selectorTypes = [DSpaceObjectType.COMMUNITY];
action = SelectorActionType.CREATE;
header = 'dso-selector.create.collection.sub-level';
defaultSort = new SortOptions(environment.comcolSelectionSort.sortField, environment.comcolSelectionSort.sortDirection as SortDirection);
defaultSort = new SortOptions(environment.comcol.sortConfig.sortField, environment.comcol.sortConfig.sortDirection as SortDirection);

constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
super(activeModal, route);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class CreateCommunityParentSelectorComponent extends DSOSelectorModalWrap
objectType = DSpaceObjectType.COMMUNITY;
selectorTypes = [DSpaceObjectType.COMMUNITY];
action = SelectorActionType.CREATE;
defaultSort = new SortOptions(environment.comcolSelectionSort.sortField, environment.comcolSelectionSort.sortDirection as SortDirection);
defaultSort = new SortOptions(environment.comcol.sortConfig.sortField, environment.comcol.sortConfig.sortDirection as SortDirection);

constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
super(activeModal, route);
Expand Down
Loading

0 comments on commit e73b493

Please sign in to comment.