Uses string instead of boolean to new collection properties

This commit is contained in:
mateuswetah 2020-09-25 17:24:06 -03:00
parent d37da61b77
commit bf84c64c54
3 changed files with 20 additions and 6 deletions

View File

@ -468,6 +468,8 @@
<b-switch
id="tainacan-checkbox-allow-submission"
size="is-small"
true-value="yes"
false-value="no"
v-model="form.allows_submission" />
<help-button
:title="$i18n.getHelperTitle('collections', 'allows_submission')"
@ -476,7 +478,7 @@
<transition name="filter-item">
<div
v-if="form.allows_submission"
v-if="form.allows_submission === 'yes'"
class="item-submission-options">
<!-- Allows Submissions by anonynmous user ------------------------ -->
@ -489,6 +491,8 @@
<b-switch
id="tainacan-checkbox-allow-submission"
size="is-small"
true-value="yes"
false-value="no"
v-model="form.submission_anonymous_user" />
<help-button
:title="$i18n.getHelperTitle('collections', 'submission_anonymous_user')"
@ -621,9 +625,9 @@ export default {
enabled_view_modes: [],
default_view_mode: [],
allow_comments: '',
allows_submission: false,
allows_submission: 'no',
submission_default_status: 'draft',
submission_anonymous_user: false,
submission_anonymous_user: 'no',
hide_items_thumbnail_on_lists: ''
},
thumbnail: {},

View File

@ -140,8 +140,18 @@ export default class CollectionModal extends React.Component {
paged: this.state.collectionPage
}
if (this.props.filterOptionsBy && Object.keys(this.props.filterOptionsBy).length !== 0)
query = {...query, meta_query: this.props.filterOptionsBy}
if (this.props.filterOptionsBy && Object.keys(this.props.filterOptionsBy).length !== 0) {
let metaqueries = [];
for (let metaquery of Object.keys(this.props.filterOptionsBy)) {
metaqueries.push({
key: metaquery,
value: this.props.filterOptionsBy[key]
})
}
query = {...query, metaquery: metaqueries}
}
let endpoint = '/collections/?' + qs.stringify(query);

View File

@ -630,7 +630,7 @@ registerBlockType('tainacan/item-submission-form', {
{ isCollectionModalOpen ?
<CollectionModal
filterOptionsBy={ { allows_submission: true } }
filterOptionsBy={ { allows_submission: 'yes' } }
existingCollectionId={ collectionId }
onSelectCollection={ ({ collectionId}) => {
collectionId = collectionId;