Skip to content

Commit

Permalink
holdings: customize the delete message
Browse files Browse the repository at this point in the history
* Closes rero/rero-ils#2253.
* Uses ng-core v1.13.2.

Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
  • Loading branch information
Garfield-fr authored and jma committed Aug 11, 2021
1 parent 048a43f commit de3154f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"@ngx-loading-bar/http-client": "^5.1.1",
"@ngx-loading-bar/router": "^5.1.1",
"@ngx-translate/core": "^13.0.0",
"@rero/ng-core": "^1.12.2",
"@rero/ng-core": "^1.13.2",
"bootstrap": "^4.6.0",
"browserslist": ">=4.16.5",
"crypto-js": "^3.3.0",
Expand Down
11 changes: 11 additions & 0 deletions projects/admin/src/app/routes/documents-route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { DetailComponent, RouteInterface } from '@rero/ng-core';
import { Observable, of } from 'rxjs';
import { CanUpdateGuard } from '../guard/can-update.guard';
import { DocumentsBriefViewComponent } from '../record/brief-view/documents-brief-view/documents-brief-view.component';
import { DocumentEditorComponent } from '../record/custom-editor/document-editor/document-editor.component';
Expand Down Expand Up @@ -93,6 +94,16 @@ export class DocumentsRoute extends BaseRoute implements RouteInterface {
listHeaders: {
Accept: 'application/rero+json, application/json'
}
},
{
key: 'holdings',
name: 'holdings',
deleteMessage: (pid: string): Observable<string[]> => {
return of([
this._routeToolService.translateService.instant('Do you really want to delete this record?'),
this._routeToolService.translateService.instant('This will also delete all items and issues of the holdings.')
]);
}
}
]
}
Expand Down
16 changes: 16 additions & 0 deletions projects/admin/src/app/routes/holdings-route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
import { FormlyFieldConfig } from '@ngx-formly/core';
import { DetailComponent, JSONSchema7, Record, RecordService, RouteInterface } from '@rero/ng-core';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { CanUpdateGuard } from '../guard/can-update.guard';
import { HoldingEditorComponent } from '../record/custom-editor/holding-editor/holding-editor.component';
Expand All @@ -35,6 +36,7 @@ export class HoldingsRoute extends BaseRoute implements RouteInterface {
* @return Object
*/
getConfiguration() {

return {
matcher: (url: any) => this.routeMatcher(url, this.name),
children: [
Expand Down Expand Up @@ -70,6 +72,20 @@ export class HoldingsRoute extends BaseRoute implements RouteInterface {
return this.populateLocationsByCurrentUserLibrary(
field, jsonSchema
);
},
deleteMessage: (pid: string): Observable<string[]> => {
return of([
this._routeToolService.translateService.instant('Do you really want to delete this record?'),
this._routeToolService.translateService.instant('This will also delete all items and issues of the holdings.')
]);
},
redirectUrl: (record: any, action: string) => {
switch (action) {
case 'delete':
return of(`/records/documents/detail/${record.metadata.document.pid}`);
default:
return of(`/records/holdings/detail/${record.metadata.pid}`);
}
}
}
]
Expand Down

0 comments on commit de3154f

Please sign in to comment.