Merge branch 'develop' into feature/358

This commit is contained in:
mateuswetah 2021-06-14 18:00:17 -03:00
commit 685b6c245a
13 changed files with 36 additions and 26 deletions

View File

@ -28,6 +28,7 @@ module.exports = {
},
globals: {
'tainacan_plugin': true,
'tainacan_blocks': true,
'_': true,
'jQuery': true,
'tainacan_extra_components': true,

View File

@ -20,16 +20,16 @@ class Export_Handler {
'class_name' => '\Tainacan\Exporter\CSV'
]);
$this->register_exporter([
'name' => 'Vocabulary CSV',
'description' => __('Allows you to export a taxonomy to a CSV file', 'tainacan'),
'slug' => 'vocabularycsv',
'class_name' => '\Tainacan\Exporter\Term_Exporter',
'manual_mapping' => false,
'manual_collection' => false
]);
do_action('tainacan-register-exporters');
$this->register_exporter([
'name' => 'Vocabulary CSV',
'description' => __('Allows you to export a taxonomy to a CSV file', 'tainacan'),
'slug' => 'vocabularycsv',
'class_name' => '\Tainacan\Exporter\Term_Exporter',
'manual_mapping' => false,
'manual_collection' => false
]);
do_action('tainacan-register-exporters', $this);
add_action( 'tainacan-enqueue-admin-scripts', array($this, 'enqueue_scripts') );
}

View File

@ -9,7 +9,7 @@
<span class="has-text-weight-bold">
{{ collection && collection.name ? collection.name : '' }}
<span
v-if="collection.status && $statusHelper.hasIcon(collection.status)"
v-if="collection && collection.status && $statusHelper.hasIcon(collection.status)"
class="icon has-text-white"
v-tooltip="{
content: $i18n.get('status_' + collection.status),

View File

@ -3,7 +3,9 @@ export const ThumbnailHelperPlugin = {};
export const ThumbnailHelperFunctions = () => {
return {
imagesFolderPath: tainacan_plugin.base_url + '/assets/images/',
imagesFolderPath() {
return tainacan_plugin ? (tainacan_plugin.base_url + '/assets/images/') : (tainacan_blocks ? (tainacan_blocks.base_url + '/assets/images/') : '/assets/images/');
},
getSrc(thumbnail, tainacanSize, documentType) {
const wordpressSize = this.getWordpressFallbackSize(tainacanSize);
return (thumbnail && thumbnail[tainacanSize]) ? thumbnail[tainacanSize][0] : ((thumbnail && thumbnail[wordpressSize]) ? thumbnail[wordpressSize][0] : this.getEmptyThumbnailPlaceholder(documentType, tainacanSize));
@ -78,13 +80,13 @@ export const ThumbnailHelperFunctions = () => {
case 'tainacan-medium':
case 'medium_large':
case 'medium':
return this.imagesFolderPath + imageSrc + '_medium.png';
return this.imagesFolderPath() + imageSrc + '_medium.png';
case 'tainacan-small':
case 'thumbnail':
return this.imagesFolderPath + imageSrc + '_small.png';
return this.imagesFolderPath() + imageSrc + '_small.png';
case 'full':
default:
return this.imagesFolderPath + imageSrc + '.png';
return this.imagesFolderPath() + imageSrc + '.png';
}
},
getWordpressFallbackSize(tainacanSize) {

View File

@ -342,6 +342,10 @@ function tainacan_blocks_add_plugin_settings() {
foreach(TAINACAN_BLOCKS as $block_slug => $block_options) {
wp_localize_script( $block_slug, 'tainacan_blocks', $settings );
if ( isset($block_options['has_theme_script']) && $block_options['has_theme_script'] ) {
wp_localize_script( $block_slug . '-theme', 'tainacan_blocks', $settings );
}
}
// The faceded search block also uses this settings for checking gutenberg version

View File

@ -245,8 +245,8 @@ export default {
},
created() {
this.tainacanAxios = axios.create({ baseURL: this.tainacanApiRoot });
if (tainacan_plugin && tainacan_plugin.nonce)
this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce;
if (tainacan_blocks && tainacan_blocks.nonce)
this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_blocks.nonce;
this.fetchCollections();

View File

@ -12,7 +12,8 @@ import axios from 'axios';
import qs from 'qs';
import { ThumbnailHelperFunctions } from '../../../admin/js/utilities.js';
import TainacanBlocksCompatToolbar from '../../js/tainacan-blocks-compat-toolbar.js';
import DeprecatedBlocks from './carousel-collections-deprecated.js'
import DeprecatedBlocks from './carousel-collections-deprecated.js';
import 'swiper/css/swiper.min.css';
registerBlockType('tainacan/carousel-collections-list', {
title: __('Tainacan Collections Carousel', 'tainacan'),

View File

@ -218,8 +218,8 @@ export default {
},
created() {
this.tainacanAxios = axios.create({ baseURL: this.tainacanApiRoot });
if (tainacan_plugin && tainacan_plugin.nonce)
this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce;
if (tainacan_blocks && tainacan_blocks.nonce)
this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_blocks.nonce;
this.offset = 0;
this.fetchFacets();
},

View File

@ -254,8 +254,8 @@ export default {
},
created() {
this.tainacanAxios = axios.create({ baseURL: this.tainacanApiRoot });
if (tainacan_plugin && tainacan_plugin.nonce)
this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce;
if (tainacan_blocks && tainacan_blocks.nonce)
this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_blocks.nonce;
if (this.showCollectionHeader)
this.fetchCollectionForHeader();

View File

@ -13,6 +13,7 @@ import qs from 'qs';
import { ThumbnailHelperFunctions } from '../../../admin/js/utilities.js';
import TainacanBlocksCompatToolbar from '../../js/tainacan-blocks-compat-toolbar.js';
import DeprecatedBlocks from './carousel-items-deprecated.js';
import 'swiper/css/swiper.min.css';
registerBlockType('tainacan/carousel-items-list', {
title: __('Tainacan Collection\'s Items Carousel', 'tainacan'),

View File

@ -325,8 +325,8 @@ export default {
},
created() {
this.tainacanAxios = axios.create({ baseURL: this.tainacanApiRoot });
if (tainacan_plugin && tainacan_plugin.nonce)
this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce;
if (tainacan_blocks && tainacan_blocks.nonce)
this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_blocks.nonce;
this.localOrder = this.order;

View File

@ -219,8 +219,8 @@ export default {
},
created() {
this.tainacanAxios = axios.create({ baseURL: this.tainacanApiRoot });
if (tainacan_plugin && tainacan_plugin.nonce)
this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce;
if (tainacan_blocks && tainacan_blocks.nonce)
this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_blocks.nonce;
this.fetchTerms();

View File

@ -13,6 +13,7 @@ import qs from 'qs';
import { ThumbnailHelperFunctions } from '../../../admin/js/utilities.js';
import TainacanBlocksCompatToolbar from '../../js/tainacan-blocks-compat-toolbar.js';
import DeprecatedBlocks from './carousel-terms-list-deprecated.js';
import 'swiper/css/swiper.min.css';
registerBlockType('tainacan/carousel-terms-list', {
title: __('Tainacan Terms Carousel', 'tainacan'),