Skip to content
Snippets Groups Projects
Unverified Commit ad77640f authored by Tim Donohue's avatar Tim Donohue Committed by GitHub
Browse files

Merge pull request #512 from atmire/Community-and-Collection-logos

Community and collection logos
parents 4b67dbf1 42d12a83
Branches
Tags
No related merge requests found
Showing
with 259 additions and 37 deletions
......@@ -244,6 +244,8 @@
"collection.create.head": "Create a Collection",
"collection.create.notifications.success": "Successfully created the Collection",
"collection.create.sub-head": "Create a Collection for Community {{ parent }}",
"collection.delete.cancel": "Cancel",
......@@ -302,6 +304,46 @@
"collection.edit.logo.label": "Collection logo",
"collection.edit.logo.notifications.add.error": "Uploading Collection logo failed. Please verify the content before retrying.",
"collection.edit.logo.notifications.add.success": "Upload Collection logo successful.",
"collection.edit.logo.notifications.delete.success.title": "Logo deleted",
"collection.edit.logo.notifications.delete.success.content": "Successfully deleted the collection's logo",
"collection.edit.logo.notifications.delete.error.title": "Error deleting logo",
"collection.edit.logo.upload": "Drop a Collection Logo to upload",
"collection.edit.notifications.success": "Successfully edited the Collection",
"collection.edit.return": "Return",
"collection.edit.tabs.curate.head": "Curate",
"collection.edit.tabs.curate.title": "Collection Edit - Curate",
"collection.edit.tabs.metadata.head": "Edit Metadata",
"collection.edit.tabs.metadata.title": "Collection Edit - Metadata",
"collection.edit.tabs.roles.head": "Assign Roles",
"collection.edit.tabs.roles.title": "Collection Edit - Roles",
"collection.edit.tabs.source.head": "Content Source",
"collection.edit.tabs.source.title": "Collection Edit - Content Source",
"collection.form.abstract": "Short Description",
"collection.form.description": "Introductory text (HTML)",
......@@ -350,6 +392,8 @@
"community.create.head": "Create a Community",
"community.create.notifications.success": "Successfully created the Community",
"community.create.sub-head": "Create a Sub-Community for Community {{ parent }}",
"community.delete.cancel": "Cancel",
......@@ -368,6 +412,44 @@
"community.edit.head": "Edit Community",
"community.edit.logo.label": "Community logo",
"community.edit.logo.notifications.add.error": "Uploading Community logo failed. Please verify the content before retrying.",
"community.edit.logo.notifications.add.success": "Upload Community logo successful.",
"community.edit.logo.notifications.delete.success.title": "Logo deleted",
"community.edit.logo.notifications.delete.success.content": "Successfully deleted the community's logo",
"community.edit.logo.notifications.delete.error.title": "Error deleting logo",
"community.edit.logo.upload": "Drop a Community Logo to upload",
"community.edit.notifications.success": "Successfully edited the Community",
"community.edit.return": "Return",
"community.edit.tabs.curate.head": "Curate",
"community.edit.tabs.curate.title": "Community Edit - Curate",
"community.edit.tabs.metadata.head": "Edit Metadata",
"community.edit.tabs.metadata.title": "Community Edit - Metadata",
"community.edit.tabs.roles.head": "Assign Roles",
"community.edit.tabs.roles.title": "Community Edit - Roles",
"community.form.abstract": "Short Description",
"community.form.description": "Introductory text (HTML)",
......@@ -1771,7 +1853,7 @@
"uploader.drag-message": "Drag & Drop your files here",
"uploader.or": ", or",
"uploader.or": ", or ",
"uploader.processing": "Processing",
......
import { Component, Input } from '@angular/core';
import { DynamicInputModel, DynamicTextAreaModel } from '@ng-dynamic-forms/core';
import { DynamicFormService, DynamicInputModel, DynamicTextAreaModel } from '@ng-dynamic-forms/core';
import { DynamicFormControlModel } from '@ng-dynamic-forms/core/src/model/dynamic-form-control.model';
import { Collection } from '../../core/shared/collection.model';
import { ComColFormComponent } from '../../shared/comcol-forms/comcol-form/comcol-form.component';
import { NormalizedCollection } from '../../core/cache/models/normalized-collection.model';
import { Location } from '@angular/common';
import { TranslateService } from '@ngx-translate/core';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { CommunityDataService } from '../../core/data/community-data.service';
import { AuthService } from '../../core/auth/auth.service';
import { RequestService } from '../../core/data/request.service';
import { ObjectCacheService } from '../../core/cache/object-cache.service';
/**
* Form used for creating and editing collections
......@@ -22,7 +28,7 @@ export class CollectionFormComponent extends ComColFormComponent<Collection> {
/**
* @type {Collection.type} This is a collection-type form
*/
protected type = Collection.type;
type = Collection.type;
/**
* The dynamic form fields used for creating/editing a collection
......@@ -65,4 +71,15 @@ export class CollectionFormComponent extends ComColFormComponent<Collection> {
name: 'dc.description.provenance',
}),
];
public constructor(protected location: Location,
protected formService: DynamicFormService,
protected translate: TranslateService,
protected notificationsService: NotificationsService,
protected authService: AuthService,
protected dsoService: CommunityDataService,
protected requestService: RequestService,
protected objectCache: ObjectCacheService) {
super(location, formService, translate, notificationsService, authService, requestService, objectCache);
}
}
......@@ -5,7 +5,6 @@ import { CollectionPageComponent } from './collection-page.component';
import { CollectionPageResolver } from './collection-page.resolver';
import { CreateCollectionPageComponent } from './create-collection-page/create-collection-page.component';
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';
......@@ -39,12 +38,8 @@ const COLLECTION_EDIT_PATH = ':id/edit';
},
{
path: COLLECTION_EDIT_PATH,
pathMatch: 'full',
component: EditCollectionPageComponent,
canActivate: [AuthenticatedGuard],
resolve: {
dso: CollectionPageResolver
}
loadChildren: './edit-collection-page/edit-collection-page.module#EditCollectionPageModule',
canActivate: [AuthenticatedGuard]
},
{
path: ':id/delete',
......
......@@ -5,15 +5,17 @@
<div *ngIf="collectionRD?.payload as collection">
<ds-view-tracker [object]="collection"></ds-view-tracker>
<header class="comcol-header border-bottom mb-4 pb-4">
<!-- Collection Name -->
<ds-comcol-page-header
[name]="collection.name">
</ds-comcol-page-header>
<!-- Collection logo -->
<ds-comcol-page-logo *ngIf="logoRD$"
[logo]="(logoRD$ | async)?.payload" [alternateText]="'Collection Logo'">
[logo]="(logoRD$ | async)?.payload"
[alternateText]="'Collection Logo'"
[alternateText]="'Collection Logo'">
</ds-comcol-page-logo>
<!-- Collection Name -->
<ds-comcol-page-header
[name]="collection.name">
</ds-comcol-page-header>
<!-- Handle -->
<ds-comcol-page-handle
[content]="collection.handle"
......
......@@ -7,7 +7,6 @@ import { CollectionPageComponent } from './collection-page.component';
import { CollectionPageRoutingModule } from './collection-page-routing.module';
import { CreateCollectionPageComponent } from './create-collection-page/create-collection-page.component';
import { CollectionFormComponent } from './collection-form/collection-form.component';
import { EditCollectionPageComponent } from './edit-collection-page/edit-collection-page.component';
import { DeleteCollectionPageComponent } from './delete-collection-page/delete-collection-page.component';
import { CollectionItemMapperComponent } from './collection-item-mapper/collection-item-mapper.component';
import { SearchService } from '../core/shared/search/search.service';
......@@ -23,11 +22,13 @@ import { StatisticsModule } from '../statistics/statistics.module';
declarations: [
CollectionPageComponent,
CreateCollectionPageComponent,
EditCollectionPageComponent,
DeleteCollectionPageComponent,
CollectionFormComponent,
CollectionItemMapperComponent
],
exports: [
CollectionFormComponent
],
providers: [
SearchService,
]
......
......@@ -4,5 +4,5 @@
<h2 id="sub-header" class="border-bottom pb-2">{{'collection.create.sub-head' | translate:{ parent: (parentRD$| async)?.payload.name } }}</h2>
</div>
</div>
<ds-collection-form (submitForm)="onSubmit($event)"></ds-collection-form>
<ds-collection-form (submitForm)="onSubmit($event)" (finish)="navigateToNewPage()"></ds-collection-form>
</div>
......@@ -10,6 +10,8 @@ import { CollectionDataService } from '../../core/data/collection-data.service';
import { of as observableOf } from 'rxjs';
import { CommunityDataService } from '../../core/data/community-data.service';
import { CreateCollectionPageComponent } from './create-collection-page.component';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { NotificationsServiceStub } from '../../shared/testing/notifications-service-stub';
describe('CreateCollectionPageComponent', () => {
let comp: CreateCollectionPageComponent;
......@@ -27,6 +29,7 @@ describe('CreateCollectionPageComponent', () => {
},
{ provide: RouteService, useValue: { getQueryParameterValue: () => observableOf('1234') } },
{ provide: Router, useValue: {} },
{ provide: NotificationsService, useValue: new NotificationsServiceStub() }
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
......
......@@ -5,6 +5,8 @@ import { Router } from '@angular/router';
import { CreateComColPageComponent } from '../../shared/comcol-forms/create-comcol-page/create-comcol-page.component';
import { Collection } from '../../core/shared/collection.model';
import { CollectionDataService } from '../../core/data/collection-data.service';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { TranslateService } from '@ngx-translate/core';
/**
* Component that represents the page where a user can create a new Collection
......@@ -16,13 +18,16 @@ import { CollectionDataService } from '../../core/data/collection-data.service';
})
export class CreateCollectionPageComponent extends CreateComColPageComponent<Collection> {
protected frontendURL = '/collections/';
protected type = Collection.type;
public constructor(
protected communityDataService: CommunityDataService,
protected collectionDataService: CollectionDataService,
protected routeService: RouteService,
protected router: Router
protected router: Router,
protected notificationsService: NotificationsService,
protected translate: TranslateService
) {
super(collectionDataService, communityDataService, routeService, router);
super(collectionDataService, communityDataService, routeService, router, notificationsService, translate);
}
}
import { Component } from '@angular/core';
/**
* Component for managing a collection's curation tasks
*/
@Component({
selector: 'ds-collection-curate',
templateUrl: './collection-curate.component.html',
})
export class CollectionCurateComponent {
/* TODO: Implement Collection Edit - Curate */
}
<ds-collection-form (submitForm)="onSubmit($event)"
[dso]="(dsoRD$ | async)?.payload"
(finish)="navigateToHomePage()"></ds-collection-form>
<a class="btn btn-danger"
[routerLink]="'/collections/' + (dsoRD$ | async)?.payload.uuid + '/delete'">{{'collection.edit.delete'
| translate}}</a>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule } from '@ngx-translate/core';
import { SharedModule } from '../../../shared/shared.module';
import { CommonModule } from '@angular/common';
import { RouterTestingModule } from '@angular/router/testing';
import { CollectionDataService } from '../../../core/data/collection-data.service';
import { ActivatedRoute } from '@angular/router';
import { of as observableOf } from 'rxjs/internal/observable/of';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { CollectionMetadataComponent } from './collection-metadata.component';
import { NotificationsService } from '../../../shared/notifications/notifications.service';
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
describe('CollectionMetadataComponent', () => {
let comp: CollectionMetadataComponent;
let fixture: ComponentFixture<CollectionMetadataComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule],
declarations: [CollectionMetadataComponent],
providers: [
{ provide: CollectionDataService, useValue: {} },
{ provide: ActivatedRoute, useValue: { parent: { data: observableOf({ dso: { payload: {} } }) } } },
{ provide: NotificationsService, useValue: new NotificationsServiceStub() }
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CollectionMetadataComponent);
comp = fixture.componentInstance;
fixture.detectChanges();
});
describe('frontendURL', () => {
it('should have the right frontendURL set', () => {
expect((comp as any).frontendURL).toEqual('/collections/');
})
});
});
import { Component } from '@angular/core';
import { ComcolMetadataComponent } from '../../../shared/comcol-forms/edit-comcol-page/comcol-metadata/comcol-metadata.component';
import { Collection } from '../../../core/shared/collection.model';
import { CollectionDataService } from '../../../core/data/collection-data.service';
import { ActivatedRoute, Router } from '@angular/router';
import { NotificationsService } from '../../../shared/notifications/notifications.service';
import { TranslateService } from '@ngx-translate/core';
/**
* Component for editing a collection's metadata
*/
@Component({
selector: 'ds-collection-metadata',
templateUrl: './collection-metadata.component.html',
})
export class CollectionMetadataComponent extends ComcolMetadataComponent<Collection> {
protected frontendURL = '/collections/';
protected type = Collection.type;
public constructor(
protected collectionDataService: CollectionDataService,
protected router: Router,
protected route: ActivatedRoute,
protected notificationsService: NotificationsService,
protected translate: TranslateService
) {
super(collectionDataService, router, route, notificationsService, translate);
}
}
import { Component } from '@angular/core';
/**
* Component for managing a collection's roles
*/
@Component({
selector: 'ds-collection-roles',
templateUrl: './collection-roles.component.html',
})
export class CollectionRolesComponent {
/* TODO: Implement Collection Edit - Roles */
}
import { Component } from '@angular/core';
/**
* Component for managing the content source of the collection
*/
@Component({
selector: 'ds-collection-source',
templateUrl: './collection-source.component.html',
})
export class CollectionSourceComponent {
/* TODO: Implement Collection Edit - Content Source */
}
<div class="container">
<div class="row">
<div class="col-12 pb-4">
<h2 id="header" class="border-bottom pb-2">{{ 'collection.edit.head' | translate }}</h2>
<ds-collection-form (submitForm)="onSubmit($event)" [dso]="(dsoRD$ | async)?.payload"></ds-collection-form>
<a class="btn btn-danger"
[routerLink]="'/collections/' + (dsoRD$ | async)?.payload.uuid + '/delete'">{{'collection.edit.delete'
| translate}}</a>
</div>
</div>
</div>
......@@ -13,13 +13,29 @@ describe('EditCollectionPageComponent', () => {
let comp: EditCollectionPageComponent;
let fixture: ComponentFixture<EditCollectionPageComponent>;
const routeStub = {
data: observableOf({
dso: { payload: {} }
}),
routeConfig: {
children: []
},
snapshot: {
firstChild: {
routeConfig: {
path: 'mockUrl'
}
}
}
};
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule],
declarations: [EditCollectionPageComponent],
providers: [
{ provide: CollectionDataService, useValue: {} },
{ provide: ActivatedRoute, useValue: { data: observableOf({ dso: { payload: {} } }) } },
{ provide: ActivatedRoute, useValue: routeStub },
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
......@@ -31,9 +47,9 @@ describe('EditCollectionPageComponent', () => {
fixture.detectChanges();
});
describe('frontendURL', () => {
it('should have the right frontendURL set', () => {
expect((comp as any).frontendURL).toEqual('/collections/');
describe('type', () => {
it('should have the right type set', () => {
expect((comp as any).type).toEqual('collection');
})
});
});
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment