Merge branch 'develop' of https://github.com/tainacan/tainacan into develop
This commit is contained in:
commit
0fb748d0ad
|
@ -229,7 +229,7 @@
|
|||
v-if="registeredViewModes[viewMode] != undefined"
|
||||
@input="updateViewModeslist(viewMode)"
|
||||
:value="checkIfViewModeEnabled(viewMode)"
|
||||
:disabled="checkIfViewModeEnabled(viewMode) && form.enabled_view_modes.filter((aViewMode) => registeredViewModes[aViewMode].full_screen != true).length <= 1">
|
||||
:disabled="checkIfViewModeEnabled(viewMode) && form.enabled_view_modes.filter((aViewMode) => (registeredViewModes[aViewMode] && registeredViewModes[aViewMode].full_screen != true)).length <= 1">
|
||||
<span
|
||||
class="gray-icon"
|
||||
:class="{
|
||||
|
@ -829,7 +829,7 @@ export default {
|
|||
|
||||
// Puts a valid view mode as default if the current one is not in the list anymore.
|
||||
if (!this.checkIfViewModeEnabled(this.form.default_view_mode)) {
|
||||
const validViewModeIndex = this.form.enabled_view_modes.findIndex((aViewMode) => !this.registeredViewModes[aViewMode].full_screen);
|
||||
const validViewModeIndex = this.form.enabled_view_modes.findIndex((aViewMode) => (this.registeredViewModes[aViewMode] && !this.registeredViewModes[aViewMode].full_screen));
|
||||
if (validViewModeIndex >= 0)
|
||||
this.form.default_view_mode = this.form.enabled_view_modes[validViewModeIndex];
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
getInputPlaceholder() {
|
||||
if (this.metadatumType == 'Tainacan\\Metadata_Types\\Relationship')
|
||||
return this.$i18n.get('info_type_to_add_items');
|
||||
else if (this.metadatumType == 'Tainacan\\Metadata_Types\\Core_Author')
|
||||
else if (this.metadatumType == 'Tainacan\\Metadata_Types\\User')
|
||||
return this.$i18n.get('info_type_to_add_users');
|
||||
else
|
||||
return this.$i18n.get('info_type_to_add_metadata');
|
||||
|
@ -125,7 +125,7 @@
|
|||
if (this.getOptionsValuesCancel != undefined)
|
||||
this.getOptionsValuesCancel.cancel('Facet search Canceled.');
|
||||
|
||||
if ( this.metadatumType === 'Tainacan\\Metadata_Types\\Relationship' || this.metadatumType === 'Tainacan\\Metadata_Types\\Core_Author' )
|
||||
if ( this.metadatumType === 'Tainacan\\Metadata_Types\\Relationship' || this.metadatumType === 'Tainacan\\Metadata_Types\\User' )
|
||||
promise = this.getValuesRelationship( this.searchQuery, this.isRepositoryLevel, valuesToIgnore, this.searchOffset, this.searchNumber );
|
||||
else
|
||||
promise = this.getValuesPlainText( this.metadatumId, this.searchQuery, this.isRepositoryLevel, valuesToIgnore, this.searchOffset, this.searchNumber );
|
||||
|
@ -189,7 +189,7 @@
|
|||
.catch(error => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
} else if (this.metadatumType === 'Tainacan\\Metadata_Types\\Core_Author') {
|
||||
} else if (this.metadatumType === 'Tainacan\\Metadata_Types\\User') {
|
||||
let query = qs.stringify({ include: metadata.value });
|
||||
let endpoint = '/users/';
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
lang="en"
|
||||
:step="getStep"/>
|
||||
</template>
|
||||
itemMetadatum
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<template>
|
||||
<section>
|
||||
<b-field :addons="false">
|
||||
<label class="label is-inline">
|
||||
{{ $i18n.getHelperTitle('tainacan-user', 'default_author') }}<span> * </span>
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('tainacan-user', 'default_author')"
|
||||
:message="$i18n.getHelperMessage('tainacan-user', 'default_author')"/>
|
||||
</label>
|
||||
<b-checkbox
|
||||
v-model="defaultAuthor"
|
||||
@input="onUpdateDefaultAuthor"
|
||||
true-value="yes"
|
||||
false-value="no">
|
||||
{{ $i18n.get('label_default_author_user') }}
|
||||
</b-checkbox>
|
||||
</b-field>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
value: [ String, Object, Array ]
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
defaultAuthor: String
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.defaultAuthor = this.value && this.value.default_author ? this.value.default_author : 'no';
|
||||
},
|
||||
methods: {
|
||||
onUpdateDefaultAuthor(value) {
|
||||
this.$emit('input', { default_author: value });
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -17,8 +17,9 @@ class User extends Metadata_Type {
|
|||
parent::__construct();
|
||||
$this->set_primitive_type('user');
|
||||
$this->set_component('tainacan-user');
|
||||
$this->set_form_component('tainacan-form-user');
|
||||
$this->set_name( __('User', 'tainacan') );
|
||||
$this->set_description( __('A registered user on wordpress', 'tainacan') );
|
||||
$this->set_description( __('A registered user on WordPress', 'tainacan') );
|
||||
$this->set_preview_template('
|
||||
<div>
|
||||
<div class="control is-clearfix">
|
||||
|
@ -28,26 +29,19 @@ class User extends Metadata_Type {
|
|||
');
|
||||
}
|
||||
|
||||
/**
|
||||
* generate the metadata for this metadatum type
|
||||
*/
|
||||
public function form() {
|
||||
|
||||
}
|
||||
|
||||
function user_exists($user) {
|
||||
if ( empty($user) )
|
||||
return true;
|
||||
// if( !is_int($user) )
|
||||
// return username_exists($user) !== false;
|
||||
|
||||
global $wpdb;
|
||||
// Check cache:
|
||||
if (wp_cache_get($user, 'users')) return true;
|
||||
// Check database:
|
||||
if ($wpdb->get_var($wpdb->prepare("SELECT EXISTS (SELECT 1 FROM $wpdb->users WHERE ID = %d)", $user)))
|
||||
return true;
|
||||
return false;
|
||||
global $wpdb;
|
||||
// Check cache:
|
||||
if (wp_cache_get($user, 'users')) return true;
|
||||
// Check database:
|
||||
if ($wpdb->get_var($wpdb->prepare("SELECT EXISTS (SELECT 1 FROM $wpdb->users WHERE ID = %d)", $user)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,6 +69,18 @@ class User extends Metadata_Type {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function get_form_labels(){
|
||||
return [
|
||||
'default_author' => [
|
||||
'title' => __( 'Defaults to author user', 'tainacan' ),
|
||||
'description' => __( 'This sets the default value of this metadata as the current item author.', 'tainacan' ),
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function validate_options( Metadatum $metadatum ) {
|
||||
if ( !in_array($metadatum->get_status(), apply_filters('tainacan-status-require-validation', ['publish','future','private'])) ) {
|
||||
return true;
|
||||
|
|
|
@ -537,12 +537,7 @@
|
|||
let validEditionActions = {};
|
||||
|
||||
for (let [actionKey, action] of Object.entries(isMultiple ? this.editionActionsForMultiple : this.editionActionsForNotMultiple)) {
|
||||
if ( (metadatumID != 'status' &&
|
||||
metadatumID != 'comments' &&
|
||||
(this.getMetadataByID(metadatumID) && this.getMetadataByID(metadatumID).metadata_type_object && this.getMetadataByID(metadatumID).metadata_type_object.component !== 'tainacan-author')
|
||||
) ||
|
||||
actionKey != 'clear'
|
||||
)
|
||||
if ((metadatumID != 'status' && metadatumID != 'comments') || actionKey != 'clear')
|
||||
validEditionActions[actionKey] = action;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import FormRelationship from '../components/metadata-types/relationship/FormRela
|
|||
import FormTaxonomy from '../components/metadata-types/taxonomy/FormTaxonomy.vue';
|
||||
import FormSelectbox from '../components/metadata-types/selectbox/FormSelectbox.vue';
|
||||
import FormNumeric from '../components/metadata-types/numeric/FormNumeric.vue';
|
||||
import FormUser from '../components/metadata-types/user/FormUser.vue';
|
||||
|
||||
import FilterNumeric from '../components/filter-types/numeric/Numeric.vue';
|
||||
import FilterDate from '../components/filter-types/date/Date.vue';
|
||||
|
@ -102,6 +103,7 @@ Vue.component('tainacan-form-relationship', FormRelationship);
|
|||
Vue.component('tainacan-form-taxonomy', FormTaxonomy);
|
||||
Vue.component('tainacan-form-selectbox', FormSelectbox);
|
||||
Vue.component('tainacan-form-numeric', FormNumeric);
|
||||
Vue.component('tainacan-form-user', FormUser);
|
||||
|
||||
/* Filters */
|
||||
Vue.component('tainacan-filter-numeric', FilterNumeric);
|
||||
|
|
|
@ -107,7 +107,7 @@ export const setOrderBy = ({ state, commit }, orderBy ) => {
|
|||
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
|
||||
commit('setPostQueryAttribute', { attr: 'metatype', value: 'DATETIME' } );
|
||||
} else if (orderBy.metadata_type_object.core) {
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: orderBy.metadata_type_object.related_mapped_prop == 'author_id' ? 'author' : orderBy.metadata_type_object.related_mapped_prop } );
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: orderBy.metadata_type_object.related_mapped_prop } );
|
||||
commit('removePostQueryAttribute', 'metakey');
|
||||
commit('removePostQueryAttribute', 'metatype');
|
||||
} else {
|
||||
|
|
|
@ -704,7 +704,7 @@
|
|||
|
||||
if (
|
||||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug == 'creation_date' && (!metadatum.metadata_type_object || !metadatum.metadata_type_object.core)) && this.orderBy == 'date') ||
|
||||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (metadatum.metadata_type_object != undefined && metadatum.metadata_type_object.core)) && this.orderBy == (metadatum.metadata_type_object.related_mapped_prop == 'author_id' ? 'author' : metadatum.metadata_type_object.related_mapped_prop)) ||
|
||||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (metadatum.metadata_type_object != undefined && metadatum.metadata_type_object.core)) && this.orderBy == metadatum.metadata_type_object.related_mapped_prop) ||
|
||||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (!metadatum.metadata_type_object || !metadatum.metadata_type_object.core)) && this.orderBy == metadatum.slug) ||
|
||||
((this.orderBy == 'meta_value' || this.orderBy == 'meta_value_num') && this.getMetaKey() == metadatum.id)
|
||||
)
|
||||
|
@ -1002,15 +1002,6 @@
|
|||
id: undefined,
|
||||
display: true
|
||||
});
|
||||
metadata.push({
|
||||
name: this.$i18n.get('label_author'),
|
||||
metadatum: 'row_author',
|
||||
metadata_type_object: {core: true, related_mapped_prop: 'author_id'},
|
||||
metadata_type: undefined,
|
||||
slug: 'author',
|
||||
id: undefined,
|
||||
display: true
|
||||
});
|
||||
}
|
||||
|
||||
let fetchOnlyMetadatumIds = [];
|
||||
|
|
|
@ -96,24 +96,10 @@
|
|||
</span>
|
||||
<span
|
||||
v-if="metadatum.id != undefined && metadatum.metadata_type_object"
|
||||
class="label-details">
|
||||
class="label-details"
|
||||
:class="{ 'has-text-weight-bold': metadatum.metadata_type_object.core }">
|
||||
({{ metadatum.metadata_type_object.name }})
|
||||
<em v-if="metadatum.collection_id != collectionId">{{ $i18n.get('label_inherited') }}</em>
|
||||
<em
|
||||
v-if="metadatum.metadata_type_object.core &&
|
||||
metadatum.metadata_type_object.related_mapped_prop == 'title'">
|
||||
{{ $i18n.get('label_core_title') }}
|
||||
</em>
|
||||
<em
|
||||
v-if="metadatum.metadata_type_object.core &&
|
||||
metadatum.metadata_type_object.related_mapped_prop == 'description'">
|
||||
{{ $i18n.get('label_core_description') }}
|
||||
</em>
|
||||
<em
|
||||
v-if="metadatum.metadata_type_object.core &&
|
||||
metadatum.metadata_type_object.related_mapped_prop == 'author_id'">
|
||||
{{ $i18n.get('label_core_author') }}
|
||||
</em>
|
||||
<span
|
||||
class="not-saved"
|
||||
v-if="(editForms[metadatum.id] != undefined && editForms[metadatum.id].saved != true) || metadatum.status == 'auto-draft'">
|
||||
|
|
|
@ -20,6 +20,8 @@ export default class CollectionModal extends React.Component {
|
|||
collectionPage: 1,
|
||||
collectionOrderBy: 'date-desc',
|
||||
temporaryCollectionId: '',
|
||||
temporaryCollectionDefaultViewMode: '',
|
||||
temporaryCollectionEnabledViewModes: [],
|
||||
searchCollectionName: '',
|
||||
collections: [],
|
||||
collectionsRequestSource: undefined
|
||||
|
@ -37,6 +39,8 @@ export default class CollectionModal extends React.Component {
|
|||
this.setState({
|
||||
collectionId: this.props.existingCollectionId,
|
||||
temporaryCollectionId: this.props.existingCollectionId,
|
||||
temporaryCollectionDefaultViewMode: this.props.existingCollectionDefaultViewMode,
|
||||
temporaryCollectionEnabledViewModes: this.props.existingCollectionEnabledViewModes,
|
||||
collectionPage: 1
|
||||
});
|
||||
|
||||
|
@ -83,7 +87,9 @@ export default class CollectionModal extends React.Component {
|
|||
for (let collection of response.data) {
|
||||
otherModalCollections.push({
|
||||
name: collection.name,
|
||||
id: collection.id
|
||||
id: collection.id,
|
||||
default_view_mode: collection.default_view_mode,
|
||||
enabled_view_modes: collection.enabled_view_modes
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -100,10 +106,10 @@ export default class CollectionModal extends React.Component {
|
|||
});
|
||||
}
|
||||
|
||||
selectCollection(selectedCollectionId) {
|
||||
this.setState({ collectionId: selectedCollectionId });
|
||||
|
||||
this.props.onSelectCollection(selectedCollectionId);
|
||||
selectCollection({ collectionId, collectionDefaultViewMode, collectionEnabledViewModes }) {
|
||||
collectionId = collectionId;
|
||||
this.setState({ collectionId: collectionId });
|
||||
this.props.onSelectCollection({ collectionId, collectionDefaultViewMode, collectionEnabledViewModes });
|
||||
}
|
||||
|
||||
fetchCollections(name) {
|
||||
|
@ -134,7 +140,12 @@ export default class CollectionModal extends React.Component {
|
|||
|
||||
tainacan.get(endpoint, { cancelToken: aCollectionRequestSource.token })
|
||||
.then(response => {
|
||||
let someCollections = response.data.map((collection) => ({ name: collection.name, id: collection.id + '' }));
|
||||
let someCollections = response.data.map((collection) => ({
|
||||
name: collection.name,
|
||||
id: collection.id + '',
|
||||
default_view_mode: collection.default_view_mode,
|
||||
enabled_view_modes: collection.enabled_view_modes
|
||||
}));
|
||||
|
||||
this.setState({
|
||||
isLoadingCollections: false,
|
||||
|
@ -215,7 +226,13 @@ export default class CollectionModal extends React.Component {
|
|||
})
|
||||
}
|
||||
onChange={ ( aCollectionId ) => {
|
||||
const selectedCollection = this.state.modalCollections.find((aCollection => aCollectionId == aCollection.id));
|
||||
this.state.temporaryCollectionId = aCollectionId;
|
||||
this.state.temporaryCollectionDefaultViewMode = selectedCollection.default_view_mode;
|
||||
this.state.temporaryCollectionEnabledViewModes = selectedCollection.enabled_view_modes;
|
||||
this.setState({ temporaryCollectionId: aCollectionId });
|
||||
this.setState({ temporaryCollectionDefaultViewMode: selectedCollection.default_view_mode });
|
||||
this.setState({ temporaryCollectionEnabledViewModes: selectedCollection.enabled_view_modes });
|
||||
} } />
|
||||
}
|
||||
</div>
|
||||
|
@ -241,7 +258,13 @@ export default class CollectionModal extends React.Component {
|
|||
})
|
||||
}
|
||||
onChange={ ( aCollectionId ) => {
|
||||
const selectedCollection = this.state.modalCollections.find((aCollection => aCollectionId == aCollection.id));
|
||||
this.state.temporaryCollectionId = aCollectionId;
|
||||
this.state.temporaryCollectionDefaultViewMode = selectedCollection.default_view_mode;
|
||||
this.state.temporaryCollectionEnabledViewModes = selectedCollection.enabled_view_modes;
|
||||
this.setState({ temporaryCollectionId: aCollectionId });
|
||||
this.setState({ temporaryCollectionDefaultViewMode: selectedCollection.default_view_mode });
|
||||
this.setState({ temporaryCollectionEnabledViewModes: selectedCollection.enabled_view_modes });
|
||||
} } />
|
||||
}
|
||||
</div>
|
||||
|
@ -273,7 +296,11 @@ export default class CollectionModal extends React.Component {
|
|||
<Button
|
||||
isPrimary
|
||||
disabled={ this.state.temporaryCollectionId == undefined || this.state.temporaryCollectionId == null || this.state.temporaryCollectionId == ''}
|
||||
onClick={ () => this.selectCollection(this.state.temporaryCollectionId) }>
|
||||
onClick={ () => this.selectCollection({
|
||||
collectionId: this.state.temporaryCollectionId,
|
||||
collectionDefaultViewMode: this.state.temporaryCollectionDefaultViewMode,
|
||||
collectionEnabledViewModes: this.state.temporaryCollectionEnabledViewModes
|
||||
}) }>
|
||||
{__('Use selected Collection', 'tainacan')}
|
||||
</Button>
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@ const { registerBlockType } = wp.blocks;
|
|||
|
||||
const { __ } = wp.i18n;
|
||||
|
||||
const { Button, ColorPicker, BaseControl, RangeControl, FontSizePicker, HorizontalRule, SelectControl, ToggleControl, Placeholder, PanelBody } = wp.components;
|
||||
const { Button, ColorPicker, BaseControl, CheckboxControl, RangeControl, FontSizePicker, HorizontalRule, SelectControl, ToggleControl, Placeholder, PanelBody } = wp.components;
|
||||
|
||||
const { InspectorControls } = wp.editor;
|
||||
|
||||
|
@ -46,7 +46,15 @@ registerBlockType('tainacan/faceted-search', {
|
|||
},
|
||||
enabledViewModes: {
|
||||
type: Array,
|
||||
default: [ 'cards', 'masonry', 'table' ]
|
||||
default: Object.keys(tainacan_plugin.registered_view_modes)
|
||||
},
|
||||
collectionDefaultViewMode: {
|
||||
type: String,
|
||||
default: 'masonry'
|
||||
},
|
||||
collectionEnabledViewModes: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
hideFilters: {
|
||||
type: Boolean,
|
||||
|
@ -185,6 +193,8 @@ registerBlockType('tainacan/faceted-search', {
|
|||
collectionId,
|
||||
defaultViewMode,
|
||||
enabledViewModes,
|
||||
collectionDefaultViewMode,
|
||||
collectionEnabledViewModes,
|
||||
hideFilters,
|
||||
hideHideFiltersButton,
|
||||
hideSearch,
|
||||
|
@ -340,7 +350,7 @@ registerBlockType('tainacan/faceted-search', {
|
|||
}
|
||||
}
|
||||
/>
|
||||
<BaseControl
|
||||
<BaseControl
|
||||
id="defaultViewModeSelect"
|
||||
label={ __('Forced default view mode', 'tainacan')}
|
||||
help={ __('The default view mode to be forced against the one setted on the repository', 'tainacan') }>
|
||||
|
@ -360,6 +370,33 @@ registerBlockType('tainacan/faceted-search', {
|
|||
} }
|
||||
/>
|
||||
</BaseControl>
|
||||
|
||||
<BaseControl
|
||||
id="enabledViewModeCheckboxesList"
|
||||
label={ __('Forced enabled view modes', 'tainacan') }
|
||||
help={ __('Select the view modes that you wish to be available for user selection on the items list.', 'tainacan') }>
|
||||
|
||||
{
|
||||
Object.entries(tainacan_plugin.registered_view_modes).map(aRegisteredViewMode => {
|
||||
return (
|
||||
<CheckboxControl
|
||||
label={ aRegisteredViewMode[1].label }
|
||||
checked={ enabledViewModes.includes(aRegisteredViewMode[0]) }
|
||||
onChange={ () => {
|
||||
let index = enabledViewModes.findIndex(aViewMode => aViewMode == aRegisteredViewMode[0]);
|
||||
if (index > -1)
|
||||
enabledViewModes.splice(index, 1);
|
||||
else
|
||||
enabledViewModes.push(aRegisteredViewMode[0]);
|
||||
|
||||
setAttributes({ enabledViewModes: enabledViewModes });
|
||||
} }
|
||||
/>
|
||||
)
|
||||
})
|
||||
}
|
||||
</BaseControl>
|
||||
|
||||
</PanelBody>
|
||||
|
||||
<PanelBody
|
||||
|
@ -659,7 +696,17 @@ registerBlockType('tainacan/faceted-search', {
|
|||
] }
|
||||
onChange={ ( aListType) => {
|
||||
listType = aListType;
|
||||
setAttributes({ listType: aListType });
|
||||
|
||||
if (listType != 'collection') {
|
||||
enabledViewModes = Object.keys(tainacan_plugin.registered_view_modes);
|
||||
defaultViewMode = 'masonry';
|
||||
}
|
||||
|
||||
setAttributes({
|
||||
listType: aListType,
|
||||
enabledViewModes: enabledViewModes,
|
||||
defaultViewMode: defaultViewMode
|
||||
});
|
||||
} }
|
||||
/>
|
||||
|
||||
|
@ -869,11 +916,19 @@ registerBlockType('tainacan/faceted-search', {
|
|||
|
||||
{ isCollectionModalOpen ?
|
||||
<CollectionModal
|
||||
existingCollectionId={ collectionId }
|
||||
onSelectCollection={ (selectedCollectionId) => {
|
||||
collectionId = selectedCollectionId;
|
||||
existingCollectionId={ collectionId }
|
||||
existingCollectionDefaultViewMode={ collectionDefaultViewMode }
|
||||
existingCollectionEnabledViewModes={ collectionEnabledViewModes }
|
||||
onSelectCollection={ ({ collectionId, collectionDefaultViewMode, collectionEnabledViewModes }) => {
|
||||
collectionId = collectionId;
|
||||
collectionDefaultViewMode = collectionDefaultViewMode ? collectionDefaultViewMode : defaultViewMode;
|
||||
collectionEnabledViewModes = collectionEnabledViewModes && collectionEnabledViewModes.length ? collectionEnabledViewModes : enabledViewModes;
|
||||
setAttributes({
|
||||
collectionId: collectionId,
|
||||
collectionDefaultViewMode: collectionEnabledViewModes,
|
||||
defaultViewMode: collectionEnabledViewModes,
|
||||
collectionEnabledViewModes: collectionEnabledViewModes,
|
||||
enabledViewModes: collectionEnabledViewModes,
|
||||
isCollectionModalOpen: false
|
||||
});
|
||||
}}
|
||||
|
@ -891,9 +946,12 @@ registerBlockType('tainacan/faceted-search', {
|
|||
}}
|
||||
onSelectTerm={ (selectedTermId) => {
|
||||
termId = selectedTermId;
|
||||
enabledViewModes = tainacan_plugin.registered_view_modes;
|
||||
|
||||
setAttributes({
|
||||
termId: selectedTermId,
|
||||
isTermModalOpen: false
|
||||
isTermModalOpen: false,
|
||||
enabledViewModes: enabledViewModes
|
||||
});
|
||||
}}
|
||||
onCancelSelection={ () => setAttributes({ isTermModalOpen: false }) }/>
|
||||
|
@ -910,6 +968,8 @@ registerBlockType('tainacan/faceted-search', {
|
|||
collectionId,
|
||||
defaultViewMode,
|
||||
enabledViewModes,
|
||||
collectionDefaultViewMode,
|
||||
collectionEnabledViewModes,
|
||||
hideFilters,
|
||||
hideHideFiltersButton,
|
||||
hideSearch,
|
||||
|
@ -965,7 +1025,7 @@ registerBlockType('tainacan/faceted-search', {
|
|||
term-id={ listType == 'term' ? termId : null }
|
||||
taxonomy={ listType == 'term' ? 'tnc_tax_' + taxonomyId : null }
|
||||
collection-id={ listType == 'collection' ? collectionId : null }
|
||||
default-view-mode={ defaultViewMode == 'none' ? defaultViewMode : 'masonry' }
|
||||
default-view-mode={ defaultViewMode == 'none' ? defaultViewMode : (listType == 'collection' ? collectionDefaultViewMode : 'masonry') }
|
||||
is-forced-view-mode={ defaultViewMode == 'none' ? true : false }
|
||||
enabled-view-modes={ enabledViewModes.toString() }
|
||||
hide-filters = { hideFilters.toString() }
|
||||
|
|
|
@ -231,7 +231,6 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'label_inherited' => __( 'Inherited', 'tainacan' ),
|
||||
'label_core_title' => __( 'Core Title', 'tainacan' ),
|
||||
'label_core_description' => __( 'Core Description', 'tainacan' ),
|
||||
'label_core_author' => __( 'Core Author', 'tainacan' ),
|
||||
'label_sorting' => __( 'Sorting', 'tainacan' ),
|
||||
'label_sorting_direction' => __( 'Sorting direction', 'tainacan' ),
|
||||
'label_sort' => __( 'Sort', 'tainacan' ),
|
||||
|
@ -460,6 +459,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'label_associated_roles' => __( 'Associated roles', 'tainacan' ),
|
||||
'label_inherited_roles' => __( 'Inherited roles', 'tainacan' ),
|
||||
'label_editing_capabilitiy' => __( 'Editing capabilitiy', 'tainacan' ),
|
||||
'label_default_author_user' => __( 'Set the item author as default value', 'tainacan' ),
|
||||
|
||||
// Instructions. More complex sentences to guide user and placeholders
|
||||
'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),
|
||||
|
|
|
@ -629,7 +629,7 @@
|
|||
for (let metadatum of this.sortingMetadata) {
|
||||
if (
|
||||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug == 'creation_date' && (!metadatum.metadata_type_object || !metadatum.metadata_type_object.core)) && this.orderBy == 'date') ||
|
||||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (metadatum.metadata_type_object != undefined && metadatum.metadata_type_object.core)) && this.orderBy == (metadatum.metadata_type_object.related_mapped_prop == 'author_id' ? 'author' : metadatum.metadata_type_object.related_mapped_prop)) ||
|
||||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (metadatum.metadata_type_object != undefined && metadatum.metadata_type_object.core)) && this.orderBy == metadatum.metadata_type_object.related_mapped_prop) ||
|
||||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (!metadatum.metadata_type_object || !metadatum.metadata_type_object.core)) && this.orderBy == metadatum.slug) ||
|
||||
((this.orderBy == 'meta_value' || this.orderBy == 'meta_value_num') && this.getMetaKey() == metadatum.id)
|
||||
)
|
||||
|
@ -903,15 +903,6 @@
|
|||
id: undefined,
|
||||
display: true
|
||||
});
|
||||
metadata.push({
|
||||
name: this.$i18n.get('label_author'),
|
||||
metadatum: 'row_author',
|
||||
metadata_type_object: {core: true, related_mapped_prop: 'author_id'},
|
||||
metadata_type: undefined,
|
||||
slug: 'author',
|
||||
id: undefined,
|
||||
display: true
|
||||
});
|
||||
}
|
||||
|
||||
let fetchOnlyMetadatumIds = [];
|
||||
|
|
Loading…
Reference in New Issue