59334: removed unnecessary config entry

This commit is contained in:
lotte
2019-02-21 11:59:04 +01:00
parent 1cea791cba
commit 3c104a460b
9 changed files with 73 additions and 38 deletions

View File

@@ -79,8 +79,5 @@ module.exports = {
code: 'nl', code: 'nl',
label: 'Nederlands', label: 'Nederlands',
active: false, active: false,
}], }]
item: {
}
}; };

View File

@@ -123,6 +123,7 @@
"status": { "status": {
"head": "Item Status", "head": "Item Status",
"description": "Welcome to the item management page. From here you can withdraw, reinstate, move or delete the item. You may also update or add new metadata / bitstreams on the other tabs.", "description": "Welcome to the item management page. From here you can withdraw, reinstate, move or delete the item. You may also update or add new metadata / bitstreams on the other tabs.",
"title": "Item Edit - Status",
"labels": { "labels": {
"id": "Item Internal ID", "id": "Item Internal ID",
"handle": "Handle", "handle": "Handle",
@@ -165,16 +166,20 @@
} }
}, },
"bitstreams": { "bitstreams": {
"head": "Item Bitstreams" "head": "Item Bitstreams",
"title": "Item Edit - Bitstreams"
}, },
"metadata": { "metadata": {
"head": "Item Metadata" "head": "Item Metadata",
"title": "Item Edit - Metadata"
}, },
"view": { "view": {
"head": "View Item" "head": "View Item",
"title": "Item Edit - Item"
}, },
"curate": { "curate": {
"head": "Curate" "head": "Curate",
"title": "Item Edit - Curate"
} }
}, },
"modify.overview": { "modify.overview": {
@@ -256,6 +261,10 @@
"invalid": { "invalid": {
"title": "Metadata invalid", "title": "Metadata invalid",
"content": "Your changes were not saved. Please make sure all fields are valid before you save." "content": "Your changes were not saved. Please make sure all fields are valid before you save."
},
"saved": {
"title": "Metadata saved",
"content": "Your changes to this item's metadata were saved."
} }
} }
} }

View File

@@ -32,29 +32,34 @@ const ITEM_EDIT_DELETE_PATH = 'delete';
children: [ children: [
{ {
path: '', path: '',
redirectTo: 'status' redirectTo: 'status',
}, },
{ {
path: 'status', path: 'status',
component: ItemStatusComponent component: ItemStatusComponent,
data: { title: 'item.edit.tabs.status.title' }
}, },
{ {
path: 'bitstreams', path: 'bitstreams',
component: ItemBitstreamsComponent component: ItemBitstreamsComponent,
data: { title: 'item.edit.tabs.bitstreams.title' }
}, },
{ {
path: 'metadata', path: 'metadata',
component: ItemMetadataComponent component: ItemMetadataComponent,
data: { title: 'item.edit.tabs.metadata.title' }
}, },
{ {
path: 'view', path: 'view',
/* TODO - change when view page exists */ /* TODO - change when view page exists */
component: ItemBitstreamsComponent component: ItemBitstreamsComponent,
data: { title: 'item.edit.tabs.view.title' }
}, },
{ {
path: 'curate', path: 'curate',
/* TODO - change when curate page exists */ /* TODO - change when curate page exists */
component: ItemBitstreamsComponent component: ItemBitstreamsComponent,
data: { title: 'item.edit.tabs.curate.title' }
}, },
] ]
}, },

View File

@@ -23,25 +23,29 @@
</div> </div>
</td> </td>
<td class="w-100"> <td class="w-100">
<div *ngIf="!(editable | async)"> <div class="value-field">
<span>{{metadata?.value}}</span> <div *ngIf="!(editable | async)">
</div> <span>{{metadata?.value}}</span>
<div *ngIf="(editable | async)" class="field-container"> </div>
<div *ngIf="(editable | async)" class="field-container">
<textarea class="form-control" type="textarea" [(ngModel)]="metadata.value" [dsDebounce] <textarea class="form-control" type="textarea" [(ngModel)]="metadata.value" [dsDebounce]
(onDebounce)="update()"></textarea> (onDebounce)="update()"></textarea>
</div>
</div> </div>
</td> </td>
<td class="text-center"> <td class="text-center">
<div *ngIf="!(editable | async)"> <div class="language-field">
<span>{{metadata?.language}}</span> <div *ngIf="!(editable | async)">
</div> <span>{{metadata?.language}}</span>
<div *ngIf="(editable | async)" class="field-container"> </div>
<input class="form-control" type="text" [(ngModel)]="metadata.language" [dsDebounce] <div *ngIf="(editable | async)" class="field-container">
(onDebounce)="update()"/> <input class="form-control" type="text" [(ngModel)]="metadata.language" [dsDebounce]
(onDebounce)="update()"/>
</div>
</div> </div>
</td> </td>
<td class="text-center"> <td class="text-center">
<div class="btn-group"> <div class="btn-group edit-field">
<button [disabled]="!(canSetEditable() | async)" *ngIf="!(editable | async)" <button [disabled]="!(canSetEditable() | async)" *ngIf="!(editable | async)"
(click)="setEditable(true)" class="btn btn-outline-primary btn-sm" (click)="setEditable(true)" class="btn btn-outline-primary btn-sm"
title="{{'item.edit.metadata.edit.buttons.edit' | translate}}"> title="{{'item.edit.metadata.edit.buttons.edit' | translate}}">

View File

@@ -7,4 +7,8 @@
.metadata-field { .metadata-field {
width: $edit-item-metadata-field-width; width: $edit-item-metadata-field-width;
}
.language-field {
width: $edit-item-language-field-width;
} }

View File

@@ -30,6 +30,7 @@ let el: HTMLElement;
let objectUpdatesService; let objectUpdatesService;
const infoNotification: INotification = new Notification('id', NotificationType.Info, 'info'); const infoNotification: INotification = new Notification('id', NotificationType.Info, 'info');
const warningNotification: INotification = new Notification('id', NotificationType.Warning, 'warning'); const warningNotification: INotification = new Notification('id', NotificationType.Warning, 'warning');
const successNotification: INotification = new Notification('id', NotificationType.Success, 'success');
const date = new Date(); const date = new Date();
const router = new RouterStub(); const router = new RouterStub();
let routeStub; let routeStub;
@@ -38,7 +39,8 @@ let itemService;
const notificationsService = jasmine.createSpyObj('notificationsService', const notificationsService = jasmine.createSpyObj('notificationsService',
{ {
info: infoNotification, info: infoNotification,
warning: warningNotification warning: warningNotification,
success: successNotification
} }
); );
const metadatum1 = Object.assign(new Metadatum(), { const metadatum1 = Object.assign(new Metadatum(), {

View File

@@ -45,6 +45,8 @@ export class ItemMetadataComponent implements OnInit {
*/ */
private discardTimeOut: number; private discardTimeOut: number;
private notitifactionPrefix = 'item.edit.metadata.notifications.';
constructor( constructor(
private itemService: ItemDataService, private itemService: ItemDataService,
private objectUpdatesService: ObjectUpdatesService, private objectUpdatesService: ObjectUpdatesService,
@@ -82,7 +84,6 @@ export class ItemMetadataComponent implements OnInit {
} }
}); });
this.updates$ = this.objectUpdatesService.getFieldUpdates(this.url, this.item.metadata); this.updates$ = this.objectUpdatesService.getFieldUpdates(this.url, this.item.metadata);
} }
/** /**
@@ -99,9 +100,7 @@ export class ItemMetadataComponent implements OnInit {
* Shows a notification to remind the user that they can undo this * Shows a notification to remind the user that they can undo this
*/ */
discard() { discard() {
const title = this.translateService.instant('item.edit.metadata.notifications.discarded.title'); const undoNotification = this.notificationsService.info(this.getNotificationTitle('discarded'), this.getNotificationContent('discarded'), { timeOut: this.discardTimeOut });
const content = this.translateService.instant('item.edit.metadata.notifications.discarded.content');
const undoNotification = this.notificationsService.info(title, content, { timeOut: this.discardTimeOut });
this.objectUpdatesService.discardFieldUpdates(this.url, undoNotification); this.objectUpdatesService.discardFieldUpdates(this.url, undoNotification);
} }
@@ -147,12 +146,11 @@ export class ItemMetadataComponent implements OnInit {
this.item = rd.payload; this.item = rd.payload;
this.initializeOriginalFields(); this.initializeOriginalFields();
this.updates$ = this.objectUpdatesService.getFieldUpdates(this.url, this.item.metadata); this.updates$ = this.objectUpdatesService.getFieldUpdates(this.url, this.item.metadata);
this.notificationsService.success(this.getNotificationTitle('saved'), this.getNotificationContent('saved'));
} }
) )
} else { } else {
const title = this.translateService.instant('item.edit.metadata.notifications.invalid.title'); this.notificationsService.error(this.getNotificationTitle('invalid'), this.getNotificationContent('invalid'));
const content = this.translateService.instant('item.edit.metadata.notifications.invalid.content');
this.notificationsService.error(title, content);
} }
}); });
} }
@@ -180,9 +178,7 @@ export class ItemMetadataComponent implements OnInit {
this.objectUpdatesService.getLastModified(this.url).pipe(first()).subscribe( this.objectUpdatesService.getLastModified(this.url).pipe(first()).subscribe(
(updateVersion: Date) => { (updateVersion: Date) => {
if (updateVersion.getDate() !== currentVersion.getDate()) { if (updateVersion.getDate() !== currentVersion.getDate()) {
const title = this.translateService.instant('item.edit.metadata.notifications.outdated.title'); this.notificationsService.warning(this.getNotificationTitle('outdated'), this.getNotificationContent('outdated'));
const content = this.translateService.instant('item.edit.metadata.notifications.outdated.content');
this.notificationsService.warning(title, content);
this.initializeOriginalFields(); this.initializeOriginalFields();
} }
} }
@@ -195,4 +191,21 @@ export class ItemMetadataComponent implements OnInit {
private isValid() { private isValid() {
return this.objectUpdatesService.isValidPage(this.url); return this.objectUpdatesService.isValidPage(this.url);
} }
/**
* Get translated notification title
* @param key
*/
private getNotificationTitle(key: string) {
return this.translateService.instant(this.notitifactionPrefix + key + '.title');
}
/**
* Get translated notification content
* @param key
*/
private getNotificationContent(key: string) {
return this.translateService.instant(this.notitifactionPrefix + key + '.content');
}
} }

View File

@@ -63,7 +63,7 @@ export class InputSuggestionsComponent implements ControlValueAccessor, OnChange
/** /**
* Whether or not the current input is valid * Whether or not the current input is valid
*/ */
@Input() valid; @Input() valid = true;
/** /**
* Output for when the form is submitted * Output for when the form is submitted

View File

@@ -25,4 +25,5 @@ $dark-scrollbar-background: $admin-sidebar-active-bg;
$dark-scrollbar-foreground: #47495d; $dark-scrollbar-foreground: #47495d;
$edit-item-button-min-width: 100px; $edit-item-button-min-width: 100px;
$edit-item-metadata-field-width: 190px; $edit-item-metadata-field-width: 190px;
$edit-item-language-field-width: 43px;