Skip to content

Commit

Permalink
Merge 0a1138f into 1103f18
Browse files Browse the repository at this point in the history
  • Loading branch information
LotteHofstede committed Mar 8, 2019
2 parents 1103f18 + 0a1138f commit a7abe99
Show file tree
Hide file tree
Showing 41 changed files with 1,346 additions and 53 deletions.
28 changes: 28 additions & 0 deletions resources/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -668,5 +668,33 @@
},
"chips": {
"remove": "Remove chip"
},
"dso-selector": {
"create": {
"community": {
"head": "New community",
"sub-level": "Create a new community in",
"top-level": "Create a new top-level community"
},
"collection": {
"head": "New collection"
},
"item": {
"head": "New item"
}
},
"edit": {
"community": {
"head": "Edit community"
},
"collection": {
"head": "Edit collection"
},
"item": {
"head": "Edit item"
}
},
"placeholder": "Search for a {{ type }}",
"no-results": "No {{ type }} found"
}
}
28 changes: 23 additions & 5 deletions src/app/+admin/admin-sidebar/admin-sidebar.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { AuthService } from '../../core/auth/auth.service';

import { of as observableOf } from 'rxjs';
import { By } from '@angular/platform-browser';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';

describe('AdminSidebarComponent', () => {
let comp: AdminSidebarComponent;
Expand All @@ -26,7 +27,12 @@ describe('AdminSidebarComponent', () => {
{ provide: Injector, useValue: {} },
{ provide: MenuService, useValue: menuService },
{ provide: CSSVariableService, useClass: CSSVariableServiceStub },
{ provide: AuthService, useClass: AuthServiceStub }
{ provide: AuthService, useClass: AuthServiceStub },
{
provide: NgbModal, useValue: {
open: () => {/*comment*/}
}
}
],
schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(AdminSidebarComponent, {
Expand Down Expand Up @@ -96,7 +102,10 @@ describe('AdminSidebarComponent', () => {
beforeEach(() => {
spyOn(menuService, 'toggleMenu');
const sidebarToggler = fixture.debugElement.query(By.css('#sidebar-collapse-toggle')).query(By.css('a.shortcut-icon'));
sidebarToggler.triggerEventHandler('click', {preventDefault: () => {/**/}});
sidebarToggler.triggerEventHandler('click', {
preventDefault: () => {/**/
}
});
});

it('should call toggleMenu on the menuService', () => {
Expand All @@ -108,7 +117,10 @@ describe('AdminSidebarComponent', () => {
beforeEach(() => {
spyOn(menuService, 'toggleMenu');
const sidebarToggler = fixture.debugElement.query(By.css('#sidebar-collapse-toggle')).query(By.css('.sidebar-collapsible')).query(By.css('a'));
sidebarToggler.triggerEventHandler('click', {preventDefault: () => {/**/}});
sidebarToggler.triggerEventHandler('click', {
preventDefault: () => {/**/
}
});
});

it('should call toggleMenu on the menuService', () => {
Expand All @@ -120,7 +132,10 @@ describe('AdminSidebarComponent', () => {
it('should call expandPreview on the menuService after 100ms', fakeAsync(() => {
spyOn(menuService, 'expandMenuPreview');
const sidebarToggler = fixture.debugElement.query(By.css('nav.navbar'));
sidebarToggler.triggerEventHandler('mouseenter', {preventDefault: () => {/**/}});
sidebarToggler.triggerEventHandler('mouseenter', {
preventDefault: () => {/**/
}
});
tick(99);
expect(menuService.expandMenuPreview).not.toHaveBeenCalled();
tick(1);
Expand All @@ -132,7 +147,10 @@ describe('AdminSidebarComponent', () => {
it('should call collapseMenuPreview on the menuService after 400ms', fakeAsync(() => {
spyOn(menuService, 'collapseMenuPreview');
const sidebarToggler = fixture.debugElement.query(By.css('nav.navbar'));
sidebarToggler.triggerEventHandler('mouseleave', {preventDefault: () => {/**/}});
sidebarToggler.triggerEventHandler('mouseleave', {
preventDefault: () => {/**/
}
});
tick(399);
expect(menuService.collapseMenuPreview).not.toHaveBeenCalled();
tick(1);
Expand Down
62 changes: 41 additions & 21 deletions src/app/+admin/admin-sidebar/admin-sidebar.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, Injector, OnInit } from '@angular/core';
import { Observable } from 'rxjs/internal/Observable';
import { slide, slideHorizontal, slideSidebar } from '../../shared/animations/slide';
import { slideHorizontal, slideSidebar } from '../../shared/animations/slide';
import { CSSVariableService } from '../../shared/sass-helper/sass-helper.service';
import { MenuService } from '../../shared/menu/menu.service';
import { MenuID, MenuItemType } from '../../shared/menu/initial-menus-state';
Expand All @@ -10,6 +10,14 @@ import { LinkMenuItemModel } from '../../shared/menu/menu-item/models/link.model
import { AuthService } from '../../core/auth/auth.service';
import { first, map } from 'rxjs/operators';
import { combineLatest as combineLatestObservable } from 'rxjs';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { OnClickMenuItemModel } from '../../shared/menu/menu-item/models/onclick.model';
import { CreateCommunityParentSelectorComponent } from '../../shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component';
import { CreateItemParentSelectorComponent } from '../../shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component';
import { CreateCollectionParentSelectorComponent } from '../../shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component';
import { EditItemSelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component';
import { EditCommunitySelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component';
import { EditCollectionSelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component';

/**
* Component representing the admin sidebar
Expand Down Expand Up @@ -52,7 +60,8 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
constructor(protected menuService: MenuService,
protected injector: Injector,
private variableService: CSSVariableService,
private authService: AuthService
private authService: AuthService,
private modalService: NgbModal
) {
super(menuService, injector);
}
Expand Down Expand Up @@ -104,32 +113,38 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
active: false,
visible: true,
model: {
type: MenuItemType.LINK,
type: MenuItemType.ONCLICK,
text: 'menu.section.new_community',
link: '/communities/submission'
} as LinkMenuItemModel,
function: () => {
this.modalService.open(CreateCommunityParentSelectorComponent);
}
} as OnClickMenuItemModel,
},
{
id: 'new_collection',
parentID: 'new',
active: false,
visible: true,
model: {
type: MenuItemType.LINK,
type: MenuItemType.ONCLICK,
text: 'menu.section.new_collection',
link: '/collections/submission'
} as LinkMenuItemModel,
function: () => {
this.modalService.open(CreateCollectionParentSelectorComponent);
}
} as OnClickMenuItemModel,
},
{
id: 'new_item',
parentID: 'new',
active: false,
visible: true,
model: {
type: MenuItemType.LINK,
type: MenuItemType.ONCLICK,
text: 'menu.section.new_item',
link: '/items/submission'
} as LinkMenuItemModel,
function: () => {
this.modalService.open(CreateItemParentSelectorComponent);
}
} as OnClickMenuItemModel,
},
{
id: 'new_item_version',
Expand Down Expand Up @@ -161,32 +176,38 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
active: false,
visible: true,
model: {
type: MenuItemType.LINK,
type: MenuItemType.ONCLICK,
text: 'menu.section.edit_community',
link: '#'
} as LinkMenuItemModel,
function: () => {
this.modalService.open(EditCommunitySelectorComponent);
}
} as OnClickMenuItemModel,
},
{
id: 'edit_collection',
parentID: 'edit',
active: false,
visible: true,
model: {
type: MenuItemType.LINK,
type: MenuItemType.ONCLICK,
text: 'menu.section.edit_collection',
link: '#'
} as LinkMenuItemModel,
function: () => {
this.modalService.open(EditCollectionSelectorComponent);
}
} as OnClickMenuItemModel,
},
{
id: 'edit_item',
parentID: 'edit',
active: false,
visible: true,
model: {
type: MenuItemType.LINK,
type: MenuItemType.ONCLICK,
text: 'menu.section.edit_item',
link: '#'
} as LinkMenuItemModel,
function: () => {
this.modalService.open(EditItemSelectorComponent);
}
} as OnClickMenuItemModel,
},

/* Import */
Expand Down Expand Up @@ -223,7 +244,6 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
link: '#'
} as LinkMenuItemModel,
},

/* Export */
{
id: 'export',
Expand Down
4 changes: 3 additions & 1 deletion src/app/+admin/admin.module.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { NgModule } from '@angular/core';
import { AdminRegistriesModule } from './admin-registries/admin-registries.module';
import { AdminRoutingModule } from './admin-routing.module';
import { SharedModule } from '../shared/shared.module';

@NgModule({
imports: [
AdminRegistriesModule,
AdminRoutingModule,
]
SharedModule,
],
})
export class AdminModule {

Expand Down
23 changes: 21 additions & 2 deletions src/app/+collection-page/collection-page-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,36 @@ import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
import { EditCollectionPageComponent } from './edit-collection-page/edit-collection-page.component';
import { CreateCollectionPageGuard } from './create-collection-page/create-collection-page.guard';
import { DeleteCollectionPageComponent } from './delete-collection-page/delete-collection-page.component';
import { URLCombiner } from '../core/url-combiner/url-combiner';
import { getCollectionModulePath } from '../app-routing.module';

export const COLLECTION_PARENT_PARAMETER = 'parent';

export function getCollectionPageRoute(collectionId: string) {
return new URLCombiner(getCollectionModulePath(), collectionId).toString();
}

export function getCollectionEditPath(id: string) {
return new URLCombiner(getCollectionModulePath(), COLLECTION_EDIT_PATH.replace(/:id/, id)).toString()
}

export function getCollectionCreatePath() {
return new URLCombiner(getCollectionModulePath(), COLLECTION_CREATE_PATH).toString()
}

const COLLECTION_CREATE_PATH = 'create';
const COLLECTION_EDIT_PATH = ':id/edit';

@NgModule({
imports: [
RouterModule.forChild([
{
path: 'create',
path: COLLECTION_CREATE_PATH,
component: CreateCollectionPageComponent,
canActivate: [AuthenticatedGuard, CreateCollectionPageGuard]
},
{
path: ':id/edit',
path: COLLECTION_EDIT_PATH,
pathMatch: 'full',
component: EditCollectionPageComponent,
canActivate: [AuthenticatedGuard],
Expand Down
1 change: 0 additions & 1 deletion src/app/+collection-page/collection-page.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { DeleteCollectionPageComponent } from './delete-collection-page/delete-c
imports: [
CommonModule,
SharedModule,
SearchPageModule,
CollectionPageRoutingModule
],
declarations: [
Expand Down
23 changes: 21 additions & 2 deletions src/app/+community-page/community-page-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,36 @@ import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
import { EditCommunityPageComponent } from './edit-community-page/edit-community-page.component';
import { CreateCommunityPageGuard } from './create-community-page/create-community-page.guard';
import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component';
import { URLCombiner } from '../core/url-combiner/url-combiner';
import { getCommunityModulePath } from '../app-routing.module';

export const COMMUNITY_PARENT_PARAMETER = 'parent';

export function getCommunityPageRoute(communityId: string) {
return new URLCombiner(getCommunityModulePath(), communityId).toString();
}

export function getCommunityEditPath(id: string) {
return new URLCombiner(getCommunityModulePath(), COMMUNITY_EDIT_PATH.replace(/:id/, id)).toString()
}

export function getCommunityCreatePath() {
return new URLCombiner(getCommunityModulePath(), COMMUNITY_CREATE_PATH).toString()
}

const COMMUNITY_CREATE_PATH = 'create';
const COMMUNITY_EDIT_PATH = ':id/edit';

@NgModule({
imports: [
RouterModule.forChild([
{
path: 'create',
path: COMMUNITY_CREATE_PATH,
component: CreateCommunityPageComponent,
canActivate: [AuthenticatedGuard, CreateCommunityPageGuard]
},
{
path: ':id/edit',
path: COMMUNITY_EDIT_PATH,
pathMatch: 'full',
component: EditCommunityPageComponent,
canActivate: [AuthenticatedGuard],
Expand Down
15 changes: 6 additions & 9 deletions src/app/+search-page/search-page.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { CommunitySearchResultListElementComponent } from '../shared/object-list
import { ItemSearchResultGridElementComponent } from '../shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component';
import { CommunitySearchResultGridElementComponent } from '../shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component'
import { CollectionSearchResultGridElementComponent } from '../shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component';
import { SearchService } from './search-service/search.service';
import { SearchSidebarComponent } from './search-sidebar/search-sidebar.component';
import { SearchSidebarService } from './search-sidebar/search-sidebar.service';
import { SearchSidebarEffects } from './search-sidebar/search-sidebar.effects';
Expand Down Expand Up @@ -46,13 +45,12 @@ const effects = [
SearchResultsComponent,
SearchSidebarComponent,
SearchSettingsComponent,
ItemSearchResultListElementComponent,
CollectionSearchResultListElementComponent,
CommunitySearchResultListElementComponent,
// ItemSearchResultListElementComponent,
// CollectionSearchResultListElementComponent,
// CommunitySearchResultListElementComponent,
ItemSearchResultGridElementComponent,
CollectionSearchResultGridElementComponent,
CommunitySearchResultGridElementComponent,
CommunitySearchResultListElementComponent,
SearchFiltersComponent,
SearchFilterComponent,
SearchFacetFilterComponent,
Expand All @@ -65,15 +63,14 @@ const effects = [
SearchBooleanFilterComponent,
],
providers: [
SearchService,
SearchSidebarService,
SearchFilterService,
SearchConfigurationService
],
entryComponents: [
ItemSearchResultListElementComponent,
CollectionSearchResultListElementComponent,
CommunitySearchResultListElementComponent,
// ItemSearchResultListElementComponent,
// CollectionSearchResultListElementComponent,
// CommunitySearchResultListElementComponent,
ItemSearchResultGridElementComponent,
CollectionSearchResultGridElementComponent,
CommunitySearchResultGridElementComponent,
Expand Down

0 comments on commit a7abe99

Please sign in to comment.