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',
label: 'Nederlands',
active: false,
}],
item: {
}
}]
};

View File

@@ -123,6 +123,7 @@
"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.",
"title": "Item Edit - Status",
"labels": {
"id": "Item Internal ID",
"handle": "Handle",
@@ -165,16 +166,20 @@
}
},
"bitstreams": {
"head": "Item Bitstreams"
"head": "Item Bitstreams",
"title": "Item Edit - Bitstreams"
},
"metadata": {
"head": "Item Metadata"
"head": "Item Metadata",
"title": "Item Edit - Metadata"
},
"view": {
"head": "View Item"
"head": "View Item",
"title": "Item Edit - Item"
},
"curate": {
"head": "Curate"
"head": "Curate",
"title": "Item Edit - Curate"
}
},
"modify.overview": {
@@ -256,6 +261,10 @@
"invalid": {
"title": "Metadata invalid",
"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: [
{
path: '',
redirectTo: 'status'
redirectTo: 'status',
},
{
path: 'status',
component: ItemStatusComponent
component: ItemStatusComponent,
data: { title: 'item.edit.tabs.status.title' }
},
{
path: 'bitstreams',
component: ItemBitstreamsComponent
component: ItemBitstreamsComponent,
data: { title: 'item.edit.tabs.bitstreams.title' }
},
{
path: 'metadata',
component: ItemMetadataComponent
component: ItemMetadataComponent,
data: { title: 'item.edit.tabs.metadata.title' }
},
{
path: 'view',
/* TODO - change when view page exists */
component: ItemBitstreamsComponent
component: ItemBitstreamsComponent,
data: { title: 'item.edit.tabs.view.title' }
},
{
path: 'curate',
/* TODO - change when curate page exists */
component: ItemBitstreamsComponent
component: ItemBitstreamsComponent,
data: { title: 'item.edit.tabs.curate.title' }
},
]
},

View File

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

View File

@@ -8,3 +8,7 @@
.metadata-field {
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;
const infoNotification: INotification = new Notification('id', NotificationType.Info, 'info');
const warningNotification: INotification = new Notification('id', NotificationType.Warning, 'warning');
const successNotification: INotification = new Notification('id', NotificationType.Success, 'success');
const date = new Date();
const router = new RouterStub();
let routeStub;
@@ -38,7 +39,8 @@ let itemService;
const notificationsService = jasmine.createSpyObj('notificationsService',
{
info: infoNotification,
warning: warningNotification
warning: warningNotification,
success: successNotification
}
);
const metadatum1 = Object.assign(new Metadatum(), {

View File

@@ -45,6 +45,8 @@ export class ItemMetadataComponent implements OnInit {
*/
private discardTimeOut: number;
private notitifactionPrefix = 'item.edit.metadata.notifications.';
constructor(
private itemService: ItemDataService,
private objectUpdatesService: ObjectUpdatesService,
@@ -82,7 +84,6 @@ export class ItemMetadataComponent implements OnInit {
}
});
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
*/
discard() {
const title = this.translateService.instant('item.edit.metadata.notifications.discarded.title');
const content = this.translateService.instant('item.edit.metadata.notifications.discarded.content');
const undoNotification = this.notificationsService.info(title, content, { timeOut: this.discardTimeOut });
const undoNotification = this.notificationsService.info(this.getNotificationTitle('discarded'), this.getNotificationContent('discarded'), { timeOut: this.discardTimeOut });
this.objectUpdatesService.discardFieldUpdates(this.url, undoNotification);
}
@@ -147,12 +146,11 @@ export class ItemMetadataComponent implements OnInit {
this.item = rd.payload;
this.initializeOriginalFields();
this.updates$ = this.objectUpdatesService.getFieldUpdates(this.url, this.item.metadata);
this.notificationsService.success(this.getNotificationTitle('saved'), this.getNotificationContent('saved'));
}
)
} else {
const title = this.translateService.instant('item.edit.metadata.notifications.invalid.title');
const content = this.translateService.instant('item.edit.metadata.notifications.invalid.content');
this.notificationsService.error(title, content);
this.notificationsService.error(this.getNotificationTitle('invalid'), this.getNotificationContent('invalid'));
}
});
}
@@ -180,9 +178,7 @@ export class ItemMetadataComponent implements OnInit {
this.objectUpdatesService.getLastModified(this.url).pipe(first()).subscribe(
(updateVersion: Date) => {
if (updateVersion.getDate() !== currentVersion.getDate()) {
const title = this.translateService.instant('item.edit.metadata.notifications.outdated.title');
const content = this.translateService.instant('item.edit.metadata.notifications.outdated.content');
this.notificationsService.warning(title, content);
this.notificationsService.warning(this.getNotificationTitle('outdated'), this.getNotificationContent('outdated'));
this.initializeOriginalFields();
}
}
@@ -195,4 +191,21 @@ export class ItemMetadataComponent implements OnInit {
private isValid() {
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
*/
@Input() valid;
@Input() valid = true;
/**
* Output for when the form is submitted

View File

@@ -26,3 +26,4 @@ $dark-scrollbar-foreground: #47495d;
$edit-item-button-min-width: 100px;
$edit-item-metadata-field-width: 190px;
$edit-item-language-field-width: 43px;