From 33f3a1530bdd2eb61a3a5241ab5a57c516a4107d Mon Sep 17 00:00:00 2001
From: mateuswetah
Date: Thu, 9 Jul 2020 18:05:27 -0300
Subject: [PATCH] Gets rid of placeholder control for items list, collecitons
list and terms list block using ToolbarButton #399.
---
.../collections-list/index.js | 48 +++++++++----------
.../dynamic-items-list/index.js | 45 ++++++++---------
.../tainacan-items/items-list/index.js | 46 +++++++++---------
.../tainacan-terms/terms-list/index.js | 44 ++++++++---------
4 files changed, 86 insertions(+), 97 deletions(-)
diff --git a/src/views/gutenberg-blocks/tainacan-collections/collections-list/index.js b/src/views/gutenberg-blocks/tainacan-collections/collections-list/index.js
index 8d4227c2c..b2b2c4401 100644
--- a/src/views/gutenberg-blocks/tainacan-collections/collections-list/index.js
+++ b/src/views/gutenberg-blocks/tainacan-collections/collections-list/index.js
@@ -2,7 +2,7 @@ const { registerBlockType } = wp.blocks;
const { __ } = wp.i18n;
-const { RangeControl, IconButton, Button, ToggleControl, Placeholder, Toolbar } = wp.components;
+const { RangeControl, IconButton, Button, ToggleControl, Placeholder, Toolbar, PanelBody, ToolbarButton } = wp.components;
const { InspectorControls, BlockControls } = wp.editor;
@@ -11,7 +11,7 @@ import CollectionsModal from './collections-modal.js';
registerBlockType('tainacan/collections-list', {
title: __('Tainacan Collections List', 'tainacan'),
icon:
-
+ { __( 'Select collections', 'tainacan' ) }
+
+
+ : null }
+
@@ -287,25 +304,6 @@ registerBlockType('tainacan/collections-list', {
onCancelSelection={ () => setAttributes({ isModalOpen: false }) }/>
: null
}
- { selectedCollectionsHTML.length ? (
-
-
-
-
-
- {__('Expose collections from your Tainacan repository', 'tainacan')}
-
-
-
- ): null
- }
) : null
}
diff --git a/src/views/gutenberg-blocks/tainacan-items/dynamic-items-list/index.js b/src/views/gutenberg-blocks/tainacan-items/dynamic-items-list/index.js
index be5adcd3f..7593b5c63 100644
--- a/src/views/gutenberg-blocks/tainacan-items/dynamic-items-list/index.js
+++ b/src/views/gutenberg-blocks/tainacan-items/dynamic-items-list/index.js
@@ -2,7 +2,7 @@ const { registerBlockType } = wp.blocks;
const { __ } = wp.i18n;
-const { ResizableBox, FocalPointPicker, SelectControl, RangeControl, Spinner, Button, ToggleControl, Tooltip, Placeholder, Toolbar, ColorPicker, ColorPalette, BaseControl, PanelBody } = wp.components;
+const { ResizableBox, FocalPointPicker, SelectControl, RangeControl, Spinner, Button, ToggleControl, Tooltip, Placeholder, Toolbar, ToolbarButton, ColorPicker, ColorPalette, BaseControl, PanelBody } = wp.components;
const { InspectorControls, BlockControls } = wp.editor;
@@ -452,19 +452,19 @@ registerBlockType('tainacan/dynamic-items-list', {
const layoutControls = [
{
icon: 'grid-view',
- title: __( 'Grid View' ),
+ title: __( 'Grid View', 'tainacan' ),
onClick: () => updateLayout('grid'),
isActive: layout === 'grid',
},
{
icon: 'list-view',
- title: __( 'List View' ),
+ title: __( 'List View', 'tainacan' ),
onClick: () => updateLayout('list'),
isActive: layout === 'list',
},
{
icon: 'layout',
- title: __( 'Mosaic View' ),
+ title: __( 'Mosaic View', 'tainacan' ),
onClick: () => updateLayout('mosaic'),
isActive: layout === 'mosaic',
}
@@ -482,6 +482,22 @@ registerBlockType('tainacan/dynamic-items-list', {
+ { items.length ?
+
+
+
+
+
+
+
+ {__('Configure search', 'tainacan')}
+
+
+ : null }
@@ -719,27 +735,6 @@ registerBlockType('tainacan/dynamic-items-list', {
: null
}
- { items.length ? (
-
-
-
-
-
- {__('Dynamically list items from a Tainacan items search', 'tainacan')}
-
-
-
- ): null
- }
) : null
}
diff --git a/src/views/gutenberg-blocks/tainacan-items/items-list/index.js b/src/views/gutenberg-blocks/tainacan-items/items-list/index.js
index 4387437d9..bd4abae75 100644
--- a/src/views/gutenberg-blocks/tainacan-items/items-list/index.js
+++ b/src/views/gutenberg-blocks/tainacan-items/items-list/index.js
@@ -2,7 +2,7 @@ const { registerBlockType } = wp.blocks;
const { __ } = wp.i18n;
-const { RangeControl, IconButton, Button, ToggleControl, Placeholder, Toolbar } = wp.components;
+const { RangeControl, IconButton, Button, ToggleControl, Placeholder, Toolbar, PanelBody, ToolbarButton } = wp.components;
const { InspectorControls, BlockControls } = wp.editor;
@@ -201,13 +201,13 @@ registerBlockType('tainacan/items-list', {
const layoutControls = [
{
icon: 'grid-view',
- title: __( 'Grid View' ),
+ title: __( 'Grid View', 'tainacan' ),
onClick: () => updateLayout('grid'),
isActive: layout === 'grid',
},
{
icon: 'list-view',
- title: __( 'List View' ),
+ title: __( 'List View', 'tainacan' ),
onClick: () => updateLayout('list'),
isActive: layout === 'list',
}
@@ -225,12 +225,29 @@ registerBlockType('tainacan/items-list', {
+ { selectedItemsHTML.length ?
+
+
+
+
+
+
+
+ { __( 'Add more items', 'tainacan' ) }
+
+
+ : null }
+
@@ -296,25 +313,6 @@ registerBlockType('tainacan/items-list', {
onCancelSelection={ () => setAttributes({ isModalOpen: false }) }/>
: null
}
- { selectedItemsHTML.length ? (
-
-
-
-
-
- {__('Expose items from your Tainacan collections', 'tainacan')}
-
-
-
- ): null
- }
) : null
}
diff --git a/src/views/gutenberg-blocks/tainacan-terms/terms-list/index.js b/src/views/gutenberg-blocks/tainacan-terms/terms-list/index.js
index 43ec7d9e4..5dd0af6d3 100644
--- a/src/views/gutenberg-blocks/tainacan-terms/terms-list/index.js
+++ b/src/views/gutenberg-blocks/tainacan-terms/terms-list/index.js
@@ -2,7 +2,7 @@ const { registerBlockType } = wp.blocks;
const { __ } = wp.i18n;
-const { IconButton, Button, ToggleControl, Placeholder, Toolbar } = wp.components;
+const { IconButton, Button, ToggleControl, Placeholder, Toolbar, PanelBody, ToolbarButton } = wp.components;
const { InspectorControls, BlockControls } = wp.editor;
@@ -191,13 +191,13 @@ registerBlockType('tainacan/terms-list', {
const layoutControls = [
{
icon: 'grid-view',
- title: __( 'Grid View' ),
+ title: __( 'Grid View', 'tainacan' ),
onClick: () => updateLayout('grid'),
isActive: layout === 'grid',
},
{
icon: 'list-view',
- title: __( 'List View' ),
+ title: __( 'List View', 'tainacan' ),
onClick: () => updateLayout('list'),
isActive: layout === 'list',
}
@@ -215,12 +215,28 @@ registerBlockType('tainacan/terms-list', {
+ { selectedTermsHTML.length ?
+
+
+
+
+
+
+
+ { __( 'Select terms', 'tainacan' ) }
+
+
+ : null }
-
+
{ layout == 'list' ?
: null }
-
+
@@ -274,24 +290,6 @@ registerBlockType('tainacan/terms-list', {
onCancelSelection={ () => setAttributes({ isModalOpen: false }) }/>
: null
}
- { selectedTermsHTML.length ? (
-
-
-
-
-
- {__('Expose terms from your Tainacan taxonomies', 'tainacan')}
-
-
-
- ): null
- }
) : null
}