Skip to content

Commit ee08d7b

Browse files
[DURACOM-413] add german labels, force uuid in url for administrative pages
1 parent 80c7858 commit ee08d7b

3 files changed

Lines changed: 35 additions & 19 deletions

File tree

src/app/item-page/item-page.resolver.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,20 @@ describe('itemPageResolver', () => {
167167
done();
168168
});
169169
});
170+
171+
it('should replace dspace.customurl if the current route is an administrative one', (done) => {
172+
spyOn(router, 'navigateByUrl').and.callThrough();
173+
174+
const route = { params: { id: customUrl } } as any;
175+
const state = { url: `/entities/person/${customUrl}/edit` } as any;
176+
177+
resolver(route, state, router, itemService, store, authService)
178+
.pipe(first())
179+
.subscribe(() => {
180+
expect(router.navigateByUrl).toHaveBeenCalledWith(`/entities/person/${uuid}/edit`);
181+
done();
182+
});
183+
});
170184
});
171185

172186
});

src/app/item-page/item-page.resolver.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,20 @@ export const itemPageResolver: ResolveFn<RemoteData<Item>> = (
5959
return itemRD$.pipe(
6060
map((rd: RemoteData<Item>) => {
6161
if (rd.hasSucceeded && hasValue(rd.payload)) {
62-
const isItemEditPage = state.url.includes('/edit');
62+
const isItemEditPage = state.url.includes('/edit') || state.url.includes('/bitstreams');
6363
let itemRoute = isItemEditPage ? state.url : router.parseUrl(getItemPageRoute(rd.payload)).toString();
6464
if (hasValue(rd.payload.metadata) && rd.payload.hasMetadata('dspace.customurl')) {
65-
if (route.params.id !== rd.payload.firstMetadataValue('dspace.customurl')) {
66-
const newUrl = itemRoute.replace(route.params.id,rd.payload.firstMetadataValue('dspace.customurl'));
65+
const customUrl = rd.payload.firstMetadataValue('dspace.customurl');
66+
let newUrl: string;
67+
if (route.params.id !== customUrl && !isItemEditPage) {
68+
newUrl = itemRoute.replace(route.params.id,rd.payload.firstMetadataValue('dspace.customurl'));
69+
} else if (isItemEditPage && route.params.id === customUrl) {
70+
// In case of an edit page, we need to ensure we navigate to the edit page of the item ID, not the custom URL
71+
const itemId = rd.payload.uuid;
72+
newUrl = itemRoute.replace(rd.payload.firstMetadataValue('dspace.customurl'), itemId);
73+
}
74+
75+
if (hasValue(newUrl)) {
6776
router.navigateByUrl(newUrl);
6877
}
6978
} else {

src/assets/i18n/de.json5

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2920,23 +2920,20 @@
29202920

29212921
// "error.validation.license.required": "You must grant this license to complete your submission. If you are unable to grant this license at this time you may save your work and return later or remove the submission.",
29222922
// TODO New key - Add a translation
2923-
"error.validation.license.required": "You must grant this license to complete your submission. If you are unable to grant this license at this time you may save your work and return later or remove the submission.",
2923+
"error.validation.license.required": "Um die Veröffentlichung abzuschließen, müssen Sie die Lizenzbedingungen akzeptieren. Wenn Sie zur Zeit dazu nicht in der Lage sind, können Sie Ihre Arbeit sichern und später dazu zurückkehren, um zuzustimmen oder die Einreichung zu löschen.",
29242924

29252925
// "error.validation.cclicense.required": "You must grant this cclicense to complete your submission. If you are unable to grant the cclicense at this time, you may save your work and return later or remove the submission.",
29262926
// TODO New key - Add a translation
29272927
"error.validation.cclicense.required": "You must grant this cclicense to complete your submission. If you are unable to grant the cclicense at this time, you may save your work and return later or remove the submission.",
29282928

29292929
// "error.validation.custom-url.conflict": "The custom url has been already used, please try with a new one.",
2930-
// TODO New key - Add a translation
2931-
"error.validation.custom-url.conflict": "The custom url has been already used, please try with a new one.",
2930+
"error.validation.custom-url.conflict": "Die sprechende URL wird bereits andersweitig genutzt. Bitte versuchen Sie es mit einer anderen URL.",
29322931

29332932
// "error.validation.custom-url.empty": "The custom url is required and cannot be empty.",
2934-
// TODO New key - Add a translation
2935-
"error.validation.custom-url.empty": "The custom url is required and cannot be empty.",
2933+
"error.validation.custom-url.empty": "Die sprechende URL ist erforderlich und darf nicht leer sein.",
29362934

29372935
// "error.validation.custom-url.invalid-characters": "The custom url contains invalid characters.",
2938-
// TODO New key - Add a translation
2939-
"error.validation.custom-url.invalid-characters": "The custom url contains invalid characters.",
2936+
"error.validation.custom-url.invalid-characters": "Die sprechende URL enthält ungültige Zeichen.",
29402937

29412938
// "error.validation.pattern": "This input is restricted by the current pattern: {{ pattern }}.",
29422939
"error.validation.pattern": "Die Eingabe muss dem folgenden Muster entsprechen: {{ pattern }}.",
@@ -8497,8 +8494,7 @@
84978494
"submission.sections.submit.progressbar.CClicense": "Creative commons license",
84988495

84998496
// "submission.sections.submit.progressbar.CustomUrlStep": "Custom Url",
8500-
// TODO New key - Add a translation
8501-
"submission.sections.submit.progressbar.CustomUrlStep": "Custom Url",
8497+
"submission.sections.submit.progressbar.CustomUrlStep": "Sprechende URL",
85028498

85038499
// "submission.sections.submit.progressbar.describe.recycle": "Recycle",
85048500
"submission.sections.submit.progressbar.describe.recycle": "Wiederverwerten",
@@ -8670,12 +8666,10 @@
86708666
"submission.sections.custom-url.label.previous-urls": "Previous Urls",
86718667

86728668
// "submission.sections.custom-url.alert.info": "Define here a custom URL which will be used to reach the item instead of using an internal randomly generated UUID identifier. ",
8673-
// TODO New key - Add a translation
8674-
"submission.sections.custom-url.alert.info": "Define here a custom URL which will be used to reach the item instead of using an internal randomly generated UUID identifier. ",
8669+
"submission.sections.custom-url.alert.info": "Legen Sie hier eine sprechende URL fest, über die das Item anstelle eines zufällig generierten internen UUID Identifiers erreichbar ist. ",
86758670

86768671
// "submission.sections.custom-url.url.placeholder": "Custom URL",
8677-
// TODO New key - Add a translation
8678-
"submission.sections.custom-url.url.placeholder": "Custom URL",
8672+
"submission.sections.custom-url.url.placeholder": "Sprechende URL",
86798673

86808674
// "submission.sections.accesses.form.discoverable-description": "When checked, this item will be discoverable in search/browse. When unchecked, the item will only be available via a direct link and will never appear in search/browse.",
86818675
"submission.sections.accesses.form.discoverable-description": "Wenn ausgewählt, kann das Item in der Suche/im Browsing gefunden werden. Wenn nicht ausgewählt, ist das Item nur über einen direkten Link aufrufbar und erscheint nie in der Suche/im Browsing.",
@@ -11145,12 +11139,11 @@
1114511139
"item.preview.organization.url": "URL",
1114611140

1114711141
// "item.preview.organization.address.addressLocality": "City",
11148-
// TODO New key - Add a translation
11149-
"item.preview.organization.address.addressLocality": "City",
11142+
"item.preview.organization.address.addressLocality": "Stadt",
1115011143

1115111144
// "item.preview.organization.alternateName": "Alternative name",
1115211145
// TODO New key - Add a translation
1115311146
"item.preview.organization.alternateName": "Alternative name",
1115411147

1115511148

11156-
}
11149+
}

0 commit comments

Comments
 (0)