Applies last changes on ItemsPage to TermItemsPage

This commit is contained in:
Mateus Machado Luna 2018-09-06 11:11:03 -03:00
parent f0b6217ca9
commit fe14bacc13
1 changed files with 29 additions and 15 deletions

View File

@ -942,15 +942,15 @@
else if (metadatum.display == 'yes')
display = true;
// // Deciding display based on user prefs
// if (prefsFetchOnlyObject != undefined &&
// prefsFetchOnlyObject.meta != undefined) {
// let index = prefsFetchOnlyObject.meta.findIndex(metadatumId => metadatumId == metadatum.id);
// if (index >= 0)
// display = true;
// else
// display = false;
// }
// Deciding display based on user prefs
if (prefsFetchOnlyObject != undefined &&
prefsFetchOnlyObject.meta != undefined) {
let index = prefsFetchOnlyObject.meta.findIndex(metadatumId => metadatumId == metadatum.id);
if (index >= 0)
display = true;
else
display = false;
}
metadata.push(
{
@ -1042,7 +1042,7 @@
'2': 'author_name',
'3': 'title',
'4': 'description'
});
}, true);
this.sortingMetadata.push({
name: this.$i18n.get('label_title'),
@ -1132,14 +1132,28 @@
let prefsViewMode = !this.isRepositoryLevel ? 'view_mode_' + this.collectionId : 'view_mode';
if (this.$userPrefs.get(prefsViewMode) == undefined)
this.$eventBusSearch.setInitialViewMode(this.defaultViewMode);
else
this.$eventBusSearch.setInitialViewMode(this.$userPrefs.get(prefsViewMode));
else {
let existingViewModeIndex = Object.keys(this.registeredViewModes).findIndex(viewMode => viewMode == this.$userPrefs.get(prefsViewMode));
if (existingViewModeIndex >= 0)
this.$eventBusSearch.setInitialViewMode(this.$userPrefs.get(prefsViewMode));
else
this.$eventBusSearch.setInitialViewMode(this.defaultViewMode);
}
} else {
let prefsAdminViewMode = !this.isRepositoryLevel ? 'admin_view_mode_' + this.collectionId : 'admin_view_mode';
if (this.$userPrefs.get(prefsAdminViewMode) == undefined)
this.$eventBusSearch.setInitialAdminViewMode('cards');
else
this.$eventBusSearch.setInitialAdminViewMode(this.$userPrefs.get(prefsAdminViewMode));
this.$eventBusSearch.setInitialAdminViewMode('table');
else {
let existingViewMode = this.$userPrefs.get(prefsAdminViewMode);
if (existingViewMode == 'cards' ||
existingViewMode == 'table' ||
existingViewMode == 'records' ||
existingViewMode == 'grid' ||
existingViewMode == 'masonry')
this.$eventBusSearch.setInitialAdminViewMode(this.$userPrefs.get(prefsAdminViewMode));
else
this.$eventBusSearch.setInitialAdminViewMode('table');
}
}
// Watches window resize to adjust filter's top position and compression on mobile