Prevents non existing view modes to be loaded in items page. Fixes padding for cards and thumbnail view modes.

This commit is contained in:
Mateus Machado Luna 2018-09-06 11:04:32 -03:00
parent fa40ac7418
commit 76b97feefe
5 changed files with 25 additions and 13 deletions

View File

@ -1134,14 +1134,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

View File

@ -22,8 +22,8 @@
margin: 15px;
max-width: 425px;
min-width: 425px;
min-height: 215px;
max-height: 215px;
min-height: 210px;
max-height: 210px;
cursor: pointer;
@media screen and (max-width: 480px) {
@ -79,7 +79,7 @@
}
.metadata-title {
flex-shrink: 0;
padding: 0.5rem 4.75rem 0.5rem 2.75rem;
padding: 0.6rem 4.75rem 0.5rem 2.75rem;
margin-bottom: -27px;
min-height: 40px;
font-size: 0.875rem !important;

View File

@ -40,10 +40,8 @@
opacity: 0;
padding: 3px 8px;
transition: visibility 0.2s, opacity 0.2s;
margin-top: -43px;
margin-top: -31px;
background-color: $gray2;
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
a {
margin-left: 12px;

View File

@ -132,7 +132,7 @@ export default {
@import "../../src/admin/scss/_view-mode-cards.scss";
.tainacan-cards-container .tainacan-card .metadata-title {
padding: 0.75rem;
padding: 0.6rem 0.75rem;
margin-bottom: 0px;
}
</style>

View File

@ -134,7 +134,7 @@ export default {
@import "../../src/admin/scss/_view-mode-records.scss";
.tainacan-records-container .tainacan-record .metadata-title {
padding: 0.75rem;
padding: 0.6rem 0.75rem;
margin-bottom: 0px;
}
</style>