mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 18:44:14 +00:00
63669: Edit Communtiy/Collection Tabs
This commit is contained in:
@@ -30,7 +30,26 @@
|
|||||||
},
|
},
|
||||||
"edit": {
|
"edit": {
|
||||||
"head": "Edit Collection",
|
"head": "Edit Collection",
|
||||||
"delete": "Delete this collection"
|
"delete": "Delete this collection",
|
||||||
|
"tabs": {
|
||||||
|
"metadata": {
|
||||||
|
"title": "Collection Edit - Metadata",
|
||||||
|
"head": "Edit Metadata"
|
||||||
|
},
|
||||||
|
"roles": {
|
||||||
|
"title": "Collection Edit - Roles",
|
||||||
|
"head": "Assign Roles"
|
||||||
|
},
|
||||||
|
"source": {
|
||||||
|
"title": "Collection Edit - Content Source",
|
||||||
|
"head": "Content Source"
|
||||||
|
},
|
||||||
|
"curate": {
|
||||||
|
"title": "Collection Edit - Curate",
|
||||||
|
"head": "Curate"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"return": "Return"
|
||||||
},
|
},
|
||||||
"create": {
|
"create": {
|
||||||
"head": "Create a Collection",
|
"head": "Create a Collection",
|
||||||
@@ -72,7 +91,22 @@
|
|||||||
},
|
},
|
||||||
"edit": {
|
"edit": {
|
||||||
"head": "Edit Community",
|
"head": "Edit Community",
|
||||||
"delete": "Delete this community"
|
"delete": "Delete this community",
|
||||||
|
"tabs": {
|
||||||
|
"metadata": {
|
||||||
|
"title": "Community Edit - Metadata",
|
||||||
|
"head": "Edit Metadata"
|
||||||
|
},
|
||||||
|
"roles": {
|
||||||
|
"title": "Community Edit - Roles",
|
||||||
|
"head": "Assign Roles"
|
||||||
|
},
|
||||||
|
"curate": {
|
||||||
|
"title": "Community Edit - Curate",
|
||||||
|
"head": "Curate"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"return": "Return"
|
||||||
},
|
},
|
||||||
"create": {
|
"create": {
|
||||||
"head": "Create a Community",
|
"head": "Create a Community",
|
||||||
|
@@ -5,7 +5,6 @@ import { CollectionPageComponent } from './collection-page.component';
|
|||||||
import { CollectionPageResolver } from './collection-page.resolver';
|
import { CollectionPageResolver } from './collection-page.resolver';
|
||||||
import { CreateCollectionPageComponent } from './create-collection-page/create-collection-page.component';
|
import { CreateCollectionPageComponent } from './create-collection-page/create-collection-page.component';
|
||||||
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
|
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 { CreateCollectionPageGuard } from './create-collection-page/create-collection-page.guard';
|
||||||
import { DeleteCollectionPageComponent } from './delete-collection-page/delete-collection-page.component';
|
import { DeleteCollectionPageComponent } from './delete-collection-page/delete-collection-page.component';
|
||||||
import { URLCombiner } from '../core/url-combiner/url-combiner';
|
import { URLCombiner } from '../core/url-combiner/url-combiner';
|
||||||
@@ -38,12 +37,8 @@ const COLLECTION_EDIT_PATH = ':id/edit';
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: COLLECTION_EDIT_PATH,
|
path: COLLECTION_EDIT_PATH,
|
||||||
pathMatch: 'full',
|
loadChildren: './edit-collection-page/edit-collection-page.module#EditCollectionPageModule',
|
||||||
component: EditCollectionPageComponent,
|
canActivate: [AuthenticatedGuard]
|
||||||
canActivate: [AuthenticatedGuard],
|
|
||||||
resolve: {
|
|
||||||
dso: CollectionPageResolver
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':id/delete',
|
path: ':id/delete',
|
||||||
|
@@ -7,7 +7,6 @@ import { CollectionPageComponent } from './collection-page.component';
|
|||||||
import { CollectionPageRoutingModule } from './collection-page-routing.module';
|
import { CollectionPageRoutingModule } from './collection-page-routing.module';
|
||||||
import { CreateCollectionPageComponent } from './create-collection-page/create-collection-page.component';
|
import { CreateCollectionPageComponent } from './create-collection-page/create-collection-page.component';
|
||||||
import { CollectionFormComponent } from './collection-form/collection-form.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 { DeleteCollectionPageComponent } from './delete-collection-page/delete-collection-page.component';
|
||||||
import { SearchService } from '../+search-page/search-service/search.service';
|
import { SearchService } from '../+search-page/search-service/search.service';
|
||||||
|
|
||||||
@@ -20,10 +19,12 @@ import { SearchService } from '../+search-page/search-service/search.service';
|
|||||||
declarations: [
|
declarations: [
|
||||||
CollectionPageComponent,
|
CollectionPageComponent,
|
||||||
CreateCollectionPageComponent,
|
CreateCollectionPageComponent,
|
||||||
EditCollectionPageComponent,
|
|
||||||
DeleteCollectionPageComponent,
|
DeleteCollectionPageComponent,
|
||||||
CollectionFormComponent
|
CollectionFormComponent
|
||||||
],
|
],
|
||||||
|
exports: [
|
||||||
|
CollectionFormComponent
|
||||||
|
],
|
||||||
providers: [
|
providers: [
|
||||||
SearchService
|
SearchService
|
||||||
]
|
]
|
||||||
|
@@ -0,0 +1,9 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-collection-curate',
|
||||||
|
templateUrl: './collection-curate.component.html',
|
||||||
|
})
|
||||||
|
export class CollectionCurateComponent {
|
||||||
|
/* TODO: Implement Collection Edit - Curate */
|
||||||
|
}
|
@@ -0,0 +1,4 @@
|
|||||||
|
<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>
|
@@ -0,0 +1,21 @@
|
|||||||
|
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';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-collection-metadata',
|
||||||
|
templateUrl: './collection-metadata.component.html',
|
||||||
|
})
|
||||||
|
export class CollectionMetadataComponent extends ComcolMetadataComponent<Collection> {
|
||||||
|
protected frontendURL = '/collections/';
|
||||||
|
|
||||||
|
public constructor(
|
||||||
|
protected collectionDataService: CollectionDataService,
|
||||||
|
protected router: Router,
|
||||||
|
protected route: ActivatedRoute
|
||||||
|
) {
|
||||||
|
super(collectionDataService, router, route);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,9 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-collection-roles',
|
||||||
|
templateUrl: './collection-roles.component.html',
|
||||||
|
})
|
||||||
|
export class CollectionRolesComponent {
|
||||||
|
/* TODO: Implement Collection Edit - Roles */
|
||||||
|
}
|
@@ -0,0 +1,9 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-collection-source',
|
||||||
|
templateUrl: './collection-source.component.html',
|
||||||
|
})
|
||||||
|
export class CollectionSourceComponent {
|
||||||
|
/* TODO: Implement Collection Edit - Content Source */
|
||||||
|
}
|
@@ -1,11 +0,0 @@
|
|||||||
<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>
|
|
@@ -1 +0,0 @@
|
|||||||
|
|
@@ -2,24 +2,30 @@ import { Component } from '@angular/core';
|
|||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { EditComColPageComponent } from '../../shared/comcol-forms/edit-comcol-page/edit-comcol-page.component';
|
import { EditComColPageComponent } from '../../shared/comcol-forms/edit-comcol-page/edit-comcol-page.component';
|
||||||
import { Collection } from '../../core/shared/collection.model';
|
import { Collection } from '../../core/shared/collection.model';
|
||||||
import { CollectionDataService } from '../../core/data/collection-data.service';
|
import { getCollectionPageRoute } from '../collection-page-routing.module';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component that represents the page where a user can edit an existing Collection
|
* Component that represents the page where a user can edit an existing Collection
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-edit-collection',
|
selector: 'ds-edit-collection',
|
||||||
styleUrls: ['./edit-collection-page.component.scss'],
|
templateUrl: '../../shared/comcol-forms/edit-comcol-page/edit-comcol-page.component.html'
|
||||||
templateUrl: './edit-collection-page.component.html'
|
|
||||||
})
|
})
|
||||||
export class EditCollectionPageComponent extends EditComColPageComponent<Collection> {
|
export class EditCollectionPageComponent extends EditComColPageComponent<Collection> {
|
||||||
protected frontendURL = '/collections/';
|
protected type = 'collection';
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
protected collectionDataService: CollectionDataService,
|
|
||||||
protected router: Router,
|
protected router: Router,
|
||||||
protected route: ActivatedRoute
|
protected route: ActivatedRoute
|
||||||
) {
|
) {
|
||||||
super(collectionDataService, router, route);
|
super(router, route);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the collection page url
|
||||||
|
* @param collection The collection for which the url is requested
|
||||||
|
*/
|
||||||
|
getPageUrl(collection: Collection): string {
|
||||||
|
return getCollectionPageRoute(collection.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,32 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { EditCollectionPageComponent } from './edit-collection-page.component';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { SharedModule } from '../../shared/shared.module';
|
||||||
|
import { EditCollectionPageRoutingModule } from './edit-collection-page.routing.module';
|
||||||
|
import { CollectionMetadataComponent } from './collection-metadata/collection-metadata.component';
|
||||||
|
import { CollectionPageModule } from '../collection-page.module';
|
||||||
|
import { CollectionRolesComponent } from './collection-roles/collection-roles.component';
|
||||||
|
import { CollectionCurateComponent } from './collection-curate/collection-curate.component';
|
||||||
|
import { CollectionSourceComponent } from './collection-source/collection-source.component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module that contains all components related to the Edit Collection page administrator functionality
|
||||||
|
*/
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
SharedModule,
|
||||||
|
EditCollectionPageRoutingModule,
|
||||||
|
CollectionPageModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
EditCollectionPageComponent,
|
||||||
|
CollectionMetadataComponent,
|
||||||
|
CollectionRolesComponent,
|
||||||
|
CollectionCurateComponent,
|
||||||
|
CollectionSourceComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class EditCollectionPageModule {
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,58 @@
|
|||||||
|
import { RouterModule } from '@angular/router';
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { EditCollectionPageComponent } from './edit-collection-page.component';
|
||||||
|
import { CollectionPageResolver } from '../collection-page.resolver';
|
||||||
|
import { CollectionMetadataComponent } from './collection-metadata/collection-metadata.component';
|
||||||
|
import { CollectionRolesComponent } from './collection-roles/collection-roles.component';
|
||||||
|
import { CollectionSourceComponent } from './collection-source/collection-source.component';
|
||||||
|
import { CollectionCurateComponent } from './collection-curate/collection-curate.component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Routing module that handles the routing for the Edit Collection page administrator functionality
|
||||||
|
*/
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
RouterModule.forChild([
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: EditCollectionPageComponent,
|
||||||
|
resolve: {
|
||||||
|
dso: CollectionPageResolver
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
redirectTo: 'metadata',
|
||||||
|
pathMatch: 'full'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'metadata',
|
||||||
|
component: CollectionMetadataComponent,
|
||||||
|
data: { title: 'collection.edit.tabs.metadata.title' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'roles',
|
||||||
|
component: CollectionRolesComponent,
|
||||||
|
data: { title: 'collection.edit.tabs.roles.title' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'source',
|
||||||
|
component: CollectionSourceComponent,
|
||||||
|
data: { title: 'collection.edit.tabs.source.title' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'curate',
|
||||||
|
component: CollectionCurateComponent,
|
||||||
|
data: { title: 'collection.edit.tabs.curate.title' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
])
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
CollectionPageResolver,
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class EditCollectionPageRoutingModule {
|
||||||
|
|
||||||
|
}
|
@@ -5,7 +5,6 @@ import { CommunityPageComponent } from './community-page.component';
|
|||||||
import { CommunityPageResolver } from './community-page.resolver';
|
import { CommunityPageResolver } from './community-page.resolver';
|
||||||
import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component';
|
import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component';
|
||||||
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
|
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 { CreateCommunityPageGuard } from './create-community-page/create-community-page.guard';
|
||||||
import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component';
|
import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component';
|
||||||
import { URLCombiner } from '../core/url-combiner/url-combiner';
|
import { URLCombiner } from '../core/url-combiner/url-combiner';
|
||||||
@@ -38,12 +37,8 @@ const COMMUNITY_EDIT_PATH = ':id/edit';
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: COMMUNITY_EDIT_PATH,
|
path: COMMUNITY_EDIT_PATH,
|
||||||
pathMatch: 'full',
|
loadChildren: './edit-community-page/edit-community-page.module#EditCommunityPageModule',
|
||||||
component: EditCommunityPageComponent,
|
canActivate: [AuthenticatedGuard]
|
||||||
canActivate: [AuthenticatedGuard],
|
|
||||||
resolve: {
|
|
||||||
dso: CommunityPageResolver
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':id/delete',
|
path: ':id/delete',
|
||||||
|
@@ -9,7 +9,6 @@ import { CommunityPageRoutingModule } from './community-page-routing.module';
|
|||||||
import {CommunityPageSubCommunityListComponent} from './sub-community-list/community-page-sub-community-list.component';
|
import {CommunityPageSubCommunityListComponent} from './sub-community-list/community-page-sub-community-list.component';
|
||||||
import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component';
|
import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component';
|
||||||
import { CommunityFormComponent } from './community-form/community-form.component';
|
import { CommunityFormComponent } from './community-form/community-form.component';
|
||||||
import { EditCommunityPageComponent } from './edit-community-page/edit-community-page.component';
|
|
||||||
import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component';
|
import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@@ -23,9 +22,11 @@ import { DeleteCommunityPageComponent } from './delete-community-page/delete-com
|
|||||||
CommunityPageSubCollectionListComponent,
|
CommunityPageSubCollectionListComponent,
|
||||||
CommunityPageSubCommunityListComponent,
|
CommunityPageSubCommunityListComponent,
|
||||||
CreateCommunityPageComponent,
|
CreateCommunityPageComponent,
|
||||||
EditCommunityPageComponent,
|
|
||||||
DeleteCommunityPageComponent,
|
DeleteCommunityPageComponent,
|
||||||
CommunityFormComponent
|
CommunityFormComponent
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
CommunityFormComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -0,0 +1,9 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-community-curate',
|
||||||
|
templateUrl: './community-curate.component.html',
|
||||||
|
})
|
||||||
|
export class CommunityCurateComponent {
|
||||||
|
/* TODO: Implement Community Edit - Curate */
|
||||||
|
}
|
@@ -0,0 +1,4 @@
|
|||||||
|
<ds-community-form (submitForm)="onSubmit($event)" [dso]="(dsoRD$ | async)?.payload"></ds-community-form>
|
||||||
|
<a class="btn btn-danger"
|
||||||
|
[routerLink]="'/communities/' + (dsoRD$ | async)?.payload.uuid + '/delete'">{{'community.edit.delete'
|
||||||
|
| translate}}</a>
|
@@ -0,0 +1,21 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { ComcolMetadataComponent } from '../../../shared/comcol-forms/edit-comcol-page/comcol-metadata/comcol-metadata.component';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { Community } from '../../../core/shared/community.model';
|
||||||
|
import { CommunityDataService } from '../../../core/data/community-data.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-community-metadata',
|
||||||
|
templateUrl: './community-metadata.component.html',
|
||||||
|
})
|
||||||
|
export class CommunityMetadataComponent extends ComcolMetadataComponent<Community> {
|
||||||
|
protected frontendURL = '/communities/';
|
||||||
|
|
||||||
|
public constructor(
|
||||||
|
protected communityDataService: CommunityDataService,
|
||||||
|
protected router: Router,
|
||||||
|
protected route: ActivatedRoute
|
||||||
|
) {
|
||||||
|
super(communityDataService, router, route);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,9 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-community-roles',
|
||||||
|
templateUrl: './community-roles.component.html',
|
||||||
|
})
|
||||||
|
export class CommunityRolesComponent {
|
||||||
|
/* TODO: Implement Community Edit - Roles */
|
||||||
|
}
|
@@ -1,12 +0,0 @@
|
|||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 pb-4">
|
|
||||||
<h2 id="header" class="border-bottom pb-2">{{ 'community.edit.head' | translate }}</h2>
|
|
||||||
<ds-community-form (submitForm)="onSubmit($event)"
|
|
||||||
[dso]="(dsoRD$ | async)?.payload"></ds-community-form>
|
|
||||||
<a class="btn btn-danger"
|
|
||||||
[routerLink]="'/communities/' + (dsoRD$ | async)?.payload.uuid + '/delete'">{{'community.edit.delete'
|
|
||||||
| translate}}</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@@ -1 +0,0 @@
|
|||||||
|
|
@@ -1,25 +1,31 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Community } from '../../core/shared/community.model';
|
import { Community } from '../../core/shared/community.model';
|
||||||
import { CommunityDataService } from '../../core/data/community-data.service';
|
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { EditComColPageComponent } from '../../shared/comcol-forms/edit-comcol-page/edit-comcol-page.component';
|
import { EditComColPageComponent } from '../../shared/comcol-forms/edit-comcol-page/edit-comcol-page.component';
|
||||||
|
import { getCommunityPageRoute } from '../community-page-routing.module';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component that represents the page where a user can edit an existing Community
|
* Component that represents the page where a user can edit an existing Community
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-edit-community',
|
selector: 'ds-edit-community',
|
||||||
styleUrls: ['./edit-community-page.component.scss'],
|
templateUrl: '../../shared/comcol-forms/edit-comcol-page/edit-comcol-page.component.html'
|
||||||
templateUrl: './edit-community-page.component.html'
|
|
||||||
})
|
})
|
||||||
export class EditCommunityPageComponent extends EditComColPageComponent<Community> {
|
export class EditCommunityPageComponent extends EditComColPageComponent<Community> {
|
||||||
protected frontendURL = '/communities/';
|
protected type = 'community';
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
protected communityDataService: CommunityDataService,
|
|
||||||
protected router: Router,
|
protected router: Router,
|
||||||
protected route: ActivatedRoute
|
protected route: ActivatedRoute
|
||||||
) {
|
) {
|
||||||
super(communityDataService, router, route);
|
super(router, route);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the community page url
|
||||||
|
* @param community The community for which the url is requested
|
||||||
|
*/
|
||||||
|
getPageUrl(community: Community): string {
|
||||||
|
return getCommunityPageRoute(community.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,30 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { SharedModule } from '../../shared/shared.module';
|
||||||
|
import { EditCommunityPageRoutingModule } from './edit-community-page.routing.module';
|
||||||
|
import { CommunityPageModule } from '../community-page.module';
|
||||||
|
import { EditCommunityPageComponent } from './edit-community-page.component';
|
||||||
|
import { CommunityCurateComponent } from './community-curate/community-curate.component';
|
||||||
|
import { CommunityMetadataComponent } from './community-metadata/community-metadata.component';
|
||||||
|
import { CommunityRolesComponent } from './community-roles/community-roles.component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module that contains all components related to the Edit Community page administrator functionality
|
||||||
|
*/
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
SharedModule,
|
||||||
|
EditCommunityPageRoutingModule,
|
||||||
|
CommunityPageModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
EditCommunityPageComponent,
|
||||||
|
CommunityCurateComponent,
|
||||||
|
CommunityMetadataComponent,
|
||||||
|
CommunityRolesComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class EditCommunityPageModule {
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,52 @@
|
|||||||
|
import { CommunityPageResolver } from '../community-page.resolver';
|
||||||
|
import { EditCommunityPageComponent } from './edit-community-page.component';
|
||||||
|
import { RouterModule } from '@angular/router';
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommunityMetadataComponent } from './community-metadata/community-metadata.component';
|
||||||
|
import { CommunityRolesComponent } from './community-roles/community-roles.component';
|
||||||
|
import { CommunityCurateComponent } from './community-curate/community-curate.component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Routing module that handles the routing for the Edit Community page administrator functionality
|
||||||
|
*/
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
RouterModule.forChild([
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: EditCommunityPageComponent,
|
||||||
|
resolve: {
|
||||||
|
dso: CommunityPageResolver
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
redirectTo: 'metadata',
|
||||||
|
pathMatch: 'full'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'metadata',
|
||||||
|
component: CommunityMetadataComponent,
|
||||||
|
data: { title: 'community.edit.tabs.metadata.title' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'roles',
|
||||||
|
component: CommunityRolesComponent,
|
||||||
|
data: { title: 'community.edit.tabs.roles.title' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'curate',
|
||||||
|
component: CommunityCurateComponent,
|
||||||
|
data: { title: 'community.edit.tabs.curate.title' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
])
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
CommunityPageResolver,
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class EditCommunityPageRoutingModule {
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,48 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
||||||
|
import { Observable } from 'rxjs/internal/Observable';
|
||||||
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { first, map } from 'rxjs/operators';
|
||||||
|
import { getSucceededRemoteData } from '../../../../core/shared/operators';
|
||||||
|
import { isNotUndefined } from '../../../empty.util';
|
||||||
|
import { DataService } from '../../../../core/data/data.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-comcol-metadata',
|
||||||
|
template: ''
|
||||||
|
})
|
||||||
|
export class ComcolMetadataComponent<TDomain extends DSpaceObject> implements OnInit {
|
||||||
|
/**
|
||||||
|
* Frontend endpoint for this type of DSO
|
||||||
|
*/
|
||||||
|
protected frontendURL: string;
|
||||||
|
|
||||||
|
public dsoRD$: Observable<RemoteData<TDomain>>;
|
||||||
|
|
||||||
|
public constructor(
|
||||||
|
protected dsoDataService: DataService<TDomain>,
|
||||||
|
protected router: Router,
|
||||||
|
protected route: ActivatedRoute
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.dsoRD$ = this.route.parent.data.pipe(first(), map((data) => data.dso));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {TDomain} dso The updated version of the DSO
|
||||||
|
* Updates an existing DSO based on the submitted user data and navigates to the edited object's home page
|
||||||
|
*/
|
||||||
|
onSubmit(dso: TDomain) {
|
||||||
|
this.dsoDataService.update(dso)
|
||||||
|
.pipe(getSucceededRemoteData())
|
||||||
|
.subscribe((dsoRD: RemoteData<TDomain>) => {
|
||||||
|
if (isNotUndefined(dsoRD)) {
|
||||||
|
const newUUID = dsoRD.payload.uuid;
|
||||||
|
this.router.navigate([this.frontendURL + newUUID]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,24 @@
|
|||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<h2 class="border-bottom">{{ type + '.edit.head' | translate }}</h2>
|
||||||
|
<div class="pt-2">
|
||||||
|
<ul class="nav nav-tabs justify-content-start mb-2">
|
||||||
|
<li *ngFor="let page of pages" class="nav-item">
|
||||||
|
<a class="nav-link"
|
||||||
|
[ngClass]="{'active' : page === currentPage}"
|
||||||
|
[routerLink]="['./' + page]">
|
||||||
|
{{ type + '.edit.tabs.' + page + '.head' | translate}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="tab-pane active">
|
||||||
|
<div class="mb-4">
|
||||||
|
<router-outlet></router-outlet>
|
||||||
|
</div>
|
||||||
|
<a [routerLink]="getPageUrl((dsoRD$ | async)?.payload)" class="btn btn-outline-secondary">{{ type + '.edit.return' | translate }}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { isNotUndefined } from '../../empty.util';
|
import { isNotEmpty, isNotUndefined } from '../../empty.util';
|
||||||
import { first, map } from 'rxjs/operators';
|
import { first, map } from 'rxjs/operators';
|
||||||
import { getSucceededRemoteData } from '../../../core/shared/operators';
|
import { getSucceededRemoteData } from '../../../core/shared/operators';
|
||||||
import { DataService } from '../../../core/data/data.service';
|
import { DataService } from '../../../core/data/data.service';
|
||||||
@@ -13,41 +13,48 @@ import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
|||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-edit-comcol',
|
selector: 'ds-edit-comcol',
|
||||||
template: ''
|
templateUrl: './edit-comcol-page.component.html'
|
||||||
})
|
})
|
||||||
export class EditComColPageComponent<TDomain extends DSpaceObject> implements OnInit {
|
export class EditComColPageComponent<TDomain extends DSpaceObject> implements OnInit {
|
||||||
/**
|
/**
|
||||||
* Frontend endpoint for this type of DSO
|
* The type of DSpaceObject (used to create i18n messages)
|
||||||
*/
|
*/
|
||||||
protected frontendURL: string;
|
protected type: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The initial DSO object
|
* The current page outlet string
|
||||||
*/
|
*/
|
||||||
|
public currentPage: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All possible page outlet strings
|
||||||
|
*/
|
||||||
|
public pages: string[];
|
||||||
|
|
||||||
public dsoRD$: Observable<RemoteData<TDomain>>;
|
public dsoRD$: Observable<RemoteData<TDomain>>;
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
protected dsoDataService: DataService<TDomain>,
|
|
||||||
protected router: Router,
|
protected router: Router,
|
||||||
protected route: ActivatedRoute
|
protected route: ActivatedRoute
|
||||||
) {
|
) {
|
||||||
|
this.router.events.subscribe(() => {
|
||||||
|
this.currentPage = this.route.snapshot.firstChild.routeConfig.path;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
this.pages = this.route.routeConfig.children
|
||||||
|
.map((child: any) => child.path)
|
||||||
|
.filter((path: string) => isNotEmpty(path)); // ignore reroutes
|
||||||
this.dsoRD$ = this.route.data.pipe(first(), map((data) => data.dso));
|
this.dsoRD$ = this.route.data.pipe(first(), map((data) => data.dso));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {TDomain} dso The updated version of the DSO
|
* Get the dso's page url
|
||||||
* Updates an existing DSO based on the submitted user data and navigates to the edited object's home page
|
* This method is expected to be overridden in the edit community/collection page components
|
||||||
|
* @param dso The DSpaceObject for which the url is requested
|
||||||
*/
|
*/
|
||||||
onSubmit(dso: TDomain) {
|
getPageUrl(dso: TDomain): string {
|
||||||
this.dsoDataService.update(dso)
|
return this.router.url;
|
||||||
.pipe(getSucceededRemoteData())
|
|
||||||
.subscribe((dsoRD: RemoteData<TDomain>) => {
|
|
||||||
if (isNotUndefined(dsoRD)) {
|
|
||||||
const newUUID = dsoRD.payload.uuid;
|
|
||||||
this.router.navigate([this.frontendURL + newUUID]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -139,6 +139,7 @@ import { UserMenuComponent } from './auth-nav-menu/user-menu/user-menu.component
|
|||||||
import { ClaimedTaskActionsReturnToPoolComponent } from './mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component';
|
import { ClaimedTaskActionsReturnToPoolComponent } from './mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component';
|
||||||
import { ItemDetailPreviewFieldComponent } from './object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component';
|
import { ItemDetailPreviewFieldComponent } from './object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component';
|
||||||
import { AbstractTrackableComponent } from './trackable/abstract-trackable.component';
|
import { AbstractTrackableComponent } from './trackable/abstract-trackable.component';
|
||||||
|
import { ComcolMetadataComponent } from './comcol-forms/edit-comcol-page/comcol-metadata/comcol-metadata.component';
|
||||||
|
|
||||||
const MODULES = [
|
const MODULES = [
|
||||||
// Do NOT include UniversalModule, HttpModule, or JsonpModule here
|
// Do NOT include UniversalModule, HttpModule, or JsonpModule here
|
||||||
@@ -259,7 +260,8 @@ const COMPONENTS = [
|
|||||||
TypedItemSearchResultListElementComponent,
|
TypedItemSearchResultListElementComponent,
|
||||||
ItemTypeSwitcherComponent,
|
ItemTypeSwitcherComponent,
|
||||||
BrowseByComponent,
|
BrowseByComponent,
|
||||||
AbstractTrackableComponent
|
AbstractTrackableComponent,
|
||||||
|
ComcolMetadataComponent
|
||||||
];
|
];
|
||||||
|
|
||||||
const ENTRY_COMPONENTS = [
|
const ENTRY_COMPONENTS = [
|
||||||
|
Reference in New Issue
Block a user