Merge branch 'develop' of https://github.com/tainacan/tainacan into develop

This commit is contained in:
weryques 2018-09-06 11:15:20 -03:00
commit 5227f150fe
8 changed files with 72 additions and 44 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -189,14 +189,16 @@ export default {
this.$store.dispatch('search/add_fetchonly_meta', metadatum ); this.$store.dispatch('search/add_fetchonly_meta', metadatum );
this.updateURLQueries(); this.updateURLQueries();
}, },
addFetchOnly( metadatum ){ addFetchOnly( metadatum, ignorePrefs ){
this.$store.dispatch('search/add_fetchonly', metadatum ); this.$store.dispatch('search/add_fetchonly', metadatum );
this.updateURLQueries(); this.updateURLQueries();
let prefsFetchOnly = this.collectionId != undefined ? 'fetch_only_' + this.collectionId : 'fetch_only'; if (!ignorePrefs) {
if (JSON.stringify(this.$userPrefs.get(prefsFetchOnly)) != JSON.stringify(metadatum)) { let prefsFetchOnly = this.collectionId != undefined ? 'fetch_only_' + this.collectionId : 'fetch_only';
this.$userPrefs.set(prefsFetchOnly, metadatum) if (JSON.stringify(this.$userPrefs.get(prefsFetchOnly)) != JSON.stringify(metadatum)) {
.catch(() => { this.$console.log("Error setting user prefs for fetch_only"); }); this.$userPrefs.set(prefsFetchOnly, metadatum)
.catch(() => { this.$console.log("Error setting user prefs for fetch_only"); });
}
} }
}, },
cleanFetchOnly() { cleanFetchOnly() {

View File

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

View File

@ -84,8 +84,8 @@ export default {
$tainacan-input-color: #1d1d1d; $tainacan-input-color: #1d1d1d;
$gray1: #f2f2f2; $gray1: #f2f2f2;
$gray2: #e5e5e5; $gray2: #e5e5e5;
$gray4: #898d8f;
$gray3: #dcdcdc; $gray3: #dcdcdc;
$gray4: #898d8f;
@import "../../src/admin/scss/_view-mode-masonry.scss"; @import "../../src/admin/scss/_view-mode-masonry.scss";

View File

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