Merge branch 'release/0.18.4'
This commit is contained in:
commit
447a97ba64
4
build.sh
4
build.sh
|
@ -14,12 +14,12 @@ current_OS=`uname`
|
|||
# For macOS (Darwin)
|
||||
if [ $current_OS == "Darwin" ]; then
|
||||
find src *.js -type f \( -name "*.js" -or -name "*.vue" -or -name "webpack.common.js" -or -name "webpack.dev.js" -or -name "webpack.prod.js" \) -exec md5 {} \; | sort -k 2 | md5 > last-js-build.md5
|
||||
find ./src/views/admin/scss/ ./src/views/gutenberg-blocks/ ./src/views/gutenberg-blocks/tainacan-collections/collections-list ./src/views/gutenberg-blocks/tainacan-facets/facets-list ./src/views/gutenberg-blocks/tainacan-items/dynamic-items-list ./src/views/gutenberg-blocks/tainacan-items/items-list ./src/views/gutenberg-blocks/tainacan-terms/terms-list -type f \( -name "*.scss" \) -exec md5 {} \; | sort -k 2 | md5 > last-sass-build.md5
|
||||
find ./src/views/admin/scss/ ./src/views/gutenberg-blocks/ ./src/views/gutenberg-blocks/tainacan-blocks/collections-list ./src/views/gutenberg-blocks/tainacan-blocks/facets-list ./src/views/gutenberg-blocks/tainacan-blocks/dynamic-items-list ./src/views/gutenberg-blocks/tainacan-blocks/items-list ./src/views/gutenberg-blocks/tainacan-blocks/terms-list -type f \( -name "*.scss" \) -exec md5 {} \; | sort -k 2 | md5 > last-sass-build.md5
|
||||
find ./composer.json -type f \( -name "composer.json" \) -exec md5 {} \; | sort -k 2 | md5 > last-composer-build.md5
|
||||
find ./package.json -type f \( -name "package.json" -or -name "package-lock.json" \) -exec md5 {} \; | sort -k 2 | md5 > last-package-build.md5
|
||||
else
|
||||
find src *.js -type f \( -name "*.js" -or -name "*.vue" -or -name "webpack.common.js" -or -name "webpack.dev.js" -or -name "webpack.prod.js" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-js-build.md5
|
||||
find ./src/views/admin/scss/ ./src/views/roles/ ./src/views/media-component/ ./src/views/reports/ ./src/views/gutenberg-blocks ./src/views/gutenberg-blocks/tainacan-collections/collections-list ./src/views/gutenberg-blocks/tainacan-facets/facets-list ./src/views/gutenberg-blocks/tainacan-items/dynamic-items-list ./src/views/gutenberg-blocks/tainacan-items/items-list ./src/views/gutenberg-blocks/tainacan-terms/terms-list -type f \( -name "*.scss" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-sass-build.md5
|
||||
find ./src/views/admin/scss/ ./src/views/roles/ ./src/views/media-component/ ./src/views/reports/ ./src/views/gutenberg-blocks ./src/views/gutenberg-blocks/tainacan-blocks/collections-list ./src/views/gutenberg-blocks/tainacan-blocks/facets-list ./src/views/gutenberg-blocks/tainacan-blocks/dynamic-items-list ./src/views/gutenberg-blocks/tainacan-blocks/items-list ./src/views/gutenberg-blocks/tainacan-blocks/terms-list -type f \( -name "*.scss" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-sass-build.md5
|
||||
find ./composer.json -type f \( -name "composer.json" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-composer-build.md5
|
||||
find ./package.json -type f \( -name "package.json" -or -name "package-lock.json" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-package-build.md5
|
||||
fi
|
||||
|
|
|
@ -16,31 +16,31 @@ sass -E 'UTF-8' --cache-location .tmp/sass-cache-3 src/views/reports/tainacan-re
|
|||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-4 src/views/media-component/media-component.scss:src/assets/css/media-component.css
|
||||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-5 src/views/gutenberg-blocks/tainacan-collections/collections-list/collections-list.scss:src/assets/css/tainacan-gutenberg-block-collections-list.css
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-5 src/views/gutenberg-blocks/tainacan-blocks/collections-list/style.scss:src/assets/css/tainacan-gutenberg-block-collections-list.css
|
||||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-6 src/views/gutenberg-blocks/tainacan-collections/carousel-collections-list/carousel-collections-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-collections-list.css
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-6 src/views/gutenberg-blocks/tainacan-blocks/carousel-collections-list/style.scss:src/assets/css/tainacan-gutenberg-block-carousel-collections-list.css
|
||||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-7 src/views/gutenberg-blocks/tainacan-items/items-list/items-list.scss:src/assets/css/tainacan-gutenberg-block-items-list.css
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-7 src/views/gutenberg-blocks/tainacan-blocks/items-list/style.scss:src/assets/css/tainacan-gutenberg-block-items-list.css
|
||||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-8 src/views/gutenberg-blocks/tainacan-items/dynamic-items-list/dynamic-items-list.scss:src/assets/css/tainacan-gutenberg-block-dynamic-items-list.css
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-8 src/views/gutenberg-blocks/tainacan-blocks/dynamic-items-list/style.scss:src/assets/css/tainacan-gutenberg-block-dynamic-items-list.css
|
||||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-9 src/views/gutenberg-blocks/tainacan-items/search-bar/search-bar.scss:src/assets/css/tainacan-gutenberg-block-search-bar.css
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-9 src/views/gutenberg-blocks/tainacan-blocks/search-bar/style.scss:src/assets/css/tainacan-gutenberg-block-search-bar.css
|
||||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-10 src/views/gutenberg-blocks/tainacan-items/carousel-items-list/carousel-items-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-items-list.css
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-10 src/views/gutenberg-blocks/tainacan-blocks/carousel-items-list/style.scss:src/assets/css/tainacan-gutenberg-block-carousel-items-list.css
|
||||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-12 src/views/gutenberg-blocks/tainacan-items/carousel-items-list/carousel-items-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-items-list.css
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-12 src/views/gutenberg-blocks/tainacan-blocks/carousel-items-list/style.scss:src/assets/css/tainacan-gutenberg-block-carousel-items-list.css
|
||||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-12 src/views/gutenberg-blocks/tainacan-terms/terms-list/terms-list.scss:src/assets/css/tainacan-gutenberg-block-terms-list.css
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-12 src/views/gutenberg-blocks/tainacan-blocks/terms-list/style.scss:src/assets/css/tainacan-gutenberg-block-terms-list.css
|
||||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-13 src/views/gutenberg-blocks/tainacan-facets/facets-list/facets-list.scss:src/assets/css/tainacan-gutenberg-block-facets-list.css
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-13 src/views/gutenberg-blocks/tainacan-blocks/facets-list/style.scss:src/assets/css/tainacan-gutenberg-block-facets-list.css
|
||||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-14 src/views/gutenberg-blocks/tainacan-terms/carousel-terms-list/carousel-terms-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-terms-list.css
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-14 src/views/gutenberg-blocks/tainacan-blocks/carousel-terms-list/style.scss:src/assets/css/tainacan-gutenberg-block-carousel-terms-list.css
|
||||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-15 src/views/gutenberg-blocks/tainacan-facets/faceted-search/faceted-search.scss:src/assets/css/tainacan-gutenberg-block-faceted-search.css
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-15 src/views/gutenberg-blocks/tainacan-blocks/faceted-search/style.scss:src/assets/css/tainacan-gutenberg-block-faceted-search.css
|
||||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-16 src/views/gutenberg-blocks/tainacan-items/item-submission-form/item-submission-form.scss:src/assets/css/tainacan-gutenberg-block-item-submission-form.css
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-16 src/views/gutenberg-blocks/tainacan-blocks/item-submission-form/style.scss:src/assets/css/tainacan-gutenberg-block-item-submission-form.css
|
||||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-17 src/views/gutenberg-blocks/tainacan-items/carousel-related-items/carousel-related-items.scss:src/assets/css/tainacan-gutenberg-block-carousel-related-items.css
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-17 src/views/gutenberg-blocks/tainacan-blocks/carousel-related-items/style.scss:src/assets/css/tainacan-gutenberg-block-carousel-related-items.css
|
||||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-18 src/views/gutenberg-blocks/gutenberg-blocks-style.scss:src/assets/css/tainacan-gutenberg-block-common-styles.css
|
||||
|
||||
|
|
|
@ -2889,6 +2889,11 @@
|
|||
"typedarray": "^0.0.6"
|
||||
}
|
||||
},
|
||||
"conditioner-core": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/conditioner-core/-/conditioner-core-2.3.3.tgz",
|
||||
"integrity": "sha512-IiXkkTceFuvuU05vvSUo+SfERaHce5p5pbXvJvov3+pmHOMtKR7YD+70F+vbRtkCsLX83dR626znGqwGc/OFEg=="
|
||||
},
|
||||
"connect-history-api-fallback": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz",
|
||||
|
@ -7570,6 +7575,13 @@
|
|||
"resolved": "https://registry.npmjs.org/photoswipe/-/photoswipe-4.1.3.tgz",
|
||||
"integrity": "sha512-89Z43IRUyw7ycTolo+AaiDn3W1EEIfox54hERmm9bI12IB9cvRfHSHez3XhAyU8XW2EAFrC+2sKMhh7SJwn0bA=="
|
||||
},
|
||||
"picomatch": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz",
|
||||
"integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"pify": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
|
||||
|
@ -7671,9 +7683,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"postcss": {
|
||||
"version": "7.0.30",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.30.tgz",
|
||||
"integrity": "sha512-nu/0m+NtIzoubO+xdAlwZl/u5S5vi/y6BCsoL8D+8IxsD3XvBS8X4YEADNIVXKVuQvduiucnRv+vPIqj56EGMQ==",
|
||||
"version": "7.0.36",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.36.tgz",
|
||||
"integrity": "sha512-BebJSIUMwJHRH0HAQoxN4u1CN86glsrwsW0q7T+/m44eXOUAxSNdHRkNZPYz5vVUbg17hFgOQDE7fZk7li3pZw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^2.4.2",
|
||||
|
@ -7773,14 +7785,25 @@
|
|||
}
|
||||
},
|
||||
"chalk": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz",
|
||||
"integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==",
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"supports-color": "^5.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"supports-color": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "^3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"fast-deep-equal": {
|
||||
|
@ -7796,14 +7819,14 @@
|
|||
"dev": true
|
||||
},
|
||||
"postcss": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.2.tgz",
|
||||
"integrity": "sha512-fmaUY5370keLUTx+CnwRxtGiuFTcNBLQBqr1oE3WZ/euIYmGAo0OAgOhVJ3ByDnVmOR3PK+0V9VebzfjRIUcqw==",
|
||||
"version": "7.0.36",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.36.tgz",
|
||||
"integrity": "sha512-BebJSIUMwJHRH0HAQoxN4u1CN86glsrwsW0q7T+/m44eXOUAxSNdHRkNZPYz5vVUbg17hFgOQDE7fZk7li3pZw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^2.4.1",
|
||||
"chalk": "^2.4.2",
|
||||
"source-map": "^0.6.1",
|
||||
"supports-color": "^5.4.0"
|
||||
"supports-color": "^6.1.0"
|
||||
}
|
||||
},
|
||||
"punycode": {
|
||||
|
@ -7830,9 +7853,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "5.4.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
|
||||
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
|
||||
"integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "^3.0.0"
|
||||
|
@ -10943,14 +10966,136 @@
|
|||
"integrity": "sha512-ajtqwEW/QhnrBZQsZxCLHThZZaa+Db45c92Asf46ZDXu6uHXgbfVuBaJ4gzD2r4UX0oMJHstFwd2r2HM4l8umg=="
|
||||
},
|
||||
"watchpack": {
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.1.tgz",
|
||||
"integrity": "sha512-+IF9hfUFOrYOOaKyfaI7h7dquUIOgyEMoQMLA7OP5FxegKA2+XdXThAZ9TU2kucfhDH7rfMHs1oPYziVGWRnZA==",
|
||||
"version": "1.7.5",
|
||||
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz",
|
||||
"integrity": "sha512-9P3MWk6SrKjHsGkLT2KHXdQ/9SNkyoJbabxnKOoJepsvJjJG8uYTR3yTPxPQvNDI3w4Nz1xnE0TLHK4RIVe/MQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chokidar": "^2.1.8",
|
||||
"chokidar": "^3.4.1",
|
||||
"graceful-fs": "^4.1.2",
|
||||
"neo-async": "^2.5.0"
|
||||
"neo-async": "^2.5.0",
|
||||
"watchpack-chokidar2": "^2.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"anymatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
|
||||
"integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"normalize-path": "^3.0.0",
|
||||
"picomatch": "^2.0.4"
|
||||
}
|
||||
},
|
||||
"binary-extensions": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
|
||||
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"braces": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
||||
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"fill-range": "^7.0.1"
|
||||
}
|
||||
},
|
||||
"chokidar": {
|
||||
"version": "3.5.2",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz",
|
||||
"integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"anymatch": "~3.1.2",
|
||||
"braces": "~3.0.2",
|
||||
"fsevents": "~2.3.2",
|
||||
"glob-parent": "~5.1.2",
|
||||
"is-binary-path": "~2.1.0",
|
||||
"is-glob": "~4.0.1",
|
||||
"normalize-path": "~3.0.0",
|
||||
"readdirp": "~3.6.0"
|
||||
}
|
||||
},
|
||||
"fill-range": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"to-regex-range": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"fsevents": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
||||
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"glob-parent": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"is-glob": "^4.0.1"
|
||||
}
|
||||
},
|
||||
"is-binary-path": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
|
||||
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"binary-extensions": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"is-number": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
|
||||
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"readdirp": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
|
||||
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"picomatch": "^2.2.1"
|
||||
}
|
||||
},
|
||||
"to-regex-range": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
||||
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"is-number": "^7.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"watchpack-chokidar2": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz",
|
||||
"integrity": "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"chokidar": "^2.1.8"
|
||||
}
|
||||
},
|
||||
"wbuf": {
|
||||
|
|
|
@ -9,11 +9,12 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"apexcharts": "^3.26.3",
|
||||
"countup.js": "^2.0.7",
|
||||
"axios": "^0.21.1",
|
||||
"blurhash": "^1.1.3",
|
||||
"buefy": "^0.9.7",
|
||||
"bulma": "^0.9.2",
|
||||
"conditioner-core": "^2.3.3",
|
||||
"countup.js": "^2.0.7",
|
||||
"css-vars-ponyfill": "^2.3.1",
|
||||
"mdi": "^2.2.43",
|
||||
"moment": "^2.25.3",
|
||||
|
|
|
@ -656,7 +656,7 @@ a.pswp__share--download:hover {
|
|||
cursor: zoom-in !important; }
|
||||
.tainacan-media-component__swiper-main li.swiper-slide {
|
||||
height: 100%;
|
||||
max-width: calc(100% - var(--swiper-navigation-size, 44px) - var(--swiper-navigation-size, 44px));
|
||||
max-width: 100%;
|
||||
padding: 0 var(--swiper-navigation-size, 44px);
|
||||
opacity: 1.0;
|
||||
transition: opacity 0.2s linear; }
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -152,7 +152,8 @@
|
|||
-ms-grid-row: 1;
|
||||
-ms-grid-row-span: 2;
|
||||
grid-column: 1/3;
|
||||
grid-row: 1/3; }
|
||||
grid-row: 1/3;
|
||||
padding-bottom: 100% !important; }
|
||||
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper-container .swiper-slide.collection-list-item-grid .collection-items-grid > * {
|
||||
flex-basis: 50%;
|
||||
width: 100%;
|
||||
|
@ -170,6 +171,7 @@
|
|||
top: calc(50% - 42px);
|
||||
bottom: initial;
|
||||
background: none;
|
||||
background-color: transparent !important;
|
||||
border: none;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -150,6 +150,7 @@
|
|||
top: calc(50% - 42px);
|
||||
bottom: initial;
|
||||
background: none;
|
||||
background-color: transparent !important;
|
||||
border: none;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"version": 3,
|
||||
"mappings": "AAEA,yCAA0C;EACtC,MAAM,EAAE,UAAU;EAClB,KAAK,EAAE,IAAI;EAGX,4DAAmB;IACf,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,MAAM;IACvB,WAAW,EAAE,MAAM;IACnB,KAAK,EAAE,oCAAmC;AAI9C,qCAIC;EAHG,EAAE;IAAC,OAAO,EAAE,GAAG;EACf,GAAG;IAAC,OAAO,EAAE,GAAG;EAChB,IAAI;IAAC,OAAO,EAAE,GAAG;AAErB,kCAIC;EAHG,EAAE;IAAC,OAAO,EAAE,GAAG;EACf,GAAG;IAAC,OAAO,EAAE,GAAG;EAChB,IAAI;IAAC,OAAO,EAAE,GAAG;AAErB,gCAIC;EAHG,EAAE;IAAC,OAAO,EAAE,GAAG;EACf,GAAG;IAAC,OAAO,EAAE,GAAG;EAChB,IAAI;IAAC,OAAO,EAAE,GAAG;AAErB,6BAIC;EAHG,EAAE;IAAC,OAAO,EAAE,GAAG;EACf,GAAG;IAAC,OAAO,EAAE,GAAG;EAChB,IAAI;IAAC,OAAO,EAAE,GAAG;EAErB,mDAAU;IACN,aAAa,EAAE,GAAG;IAClB,UAAU,EAAE,oCAAmC;IAE/C,iBAAiB,EAAE,qCAAqC;IACxD,cAAc,EAAE,qCAAqC;IACrD,YAAY,EAAE,qCAAqC;IACnD,SAAS,EAAE,qCAAqC;EAIpD,gFAAuC;IACnC,QAAQ,EAAE,QAAQ;IAElB,0FAAY;MACR,UAAU,EAAE,KAAK",
|
||||
"sources": ["../../views/gutenberg-blocks/tainacan-items/carousel-related-items/carousel-related-items.scss"],
|
||||
"sources": ["../../views/gutenberg-blocks/tainacan-blocks/carousel-related-items/style.scss"],
|
||||
"names": [],
|
||||
"file": "tainacan-gutenberg-block-carousel-related-items.css"
|
||||
}
|
||||
|
|
|
@ -152,7 +152,8 @@
|
|||
-ms-grid-row: 1;
|
||||
-ms-grid-row-span: 2;
|
||||
grid-column: 1/3;
|
||||
grid-row: 1/3; }
|
||||
grid-row: 1/3;
|
||||
padding-bottom: 100% !important; }
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container .swiper-slide.term-list-item-grid .term-items-grid > * {
|
||||
flex-basis: 50%;
|
||||
width: 100%;
|
||||
|
@ -170,6 +171,7 @@
|
|||
top: calc(50% - 42px);
|
||||
bottom: initial;
|
||||
background: none;
|
||||
background-color: transparent !important;
|
||||
border: none;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
|
@ -318,7 +320,9 @@
|
|||
display: -ms-grid;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
grid-template-rows: 50% 50%; }
|
||||
grid-template-rows: 1fr 1fr;
|
||||
grid-gap: 5px;
|
||||
gap: 5px; }
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item .term-items-grid img:first-of-type {
|
||||
flex-basis: 100%;
|
||||
-ms-grid-column: 1;
|
||||
|
@ -329,7 +333,6 @@
|
|||
grid-row: 1/3; }
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item .term-items-grid img {
|
||||
flex-basis: 50%;
|
||||
padding: 2px;
|
||||
margin-bottom: 0px; }
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.terms-list-item {
|
||||
width: calc(20% - 32px);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"version": 3,
|
||||
"mappings": "AAEA,mCAAoC;EAChC,MAAM,EAAE,QAAQ;EAGhB,uDAAoB;IAChB,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,CAAC;EAIZ;gGAC2D;IACvD,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,CAAC;EAId;8FACyD;IACrD,qBAAqB,EAAE,wBAAwB;IAC/C,eAAe,EAAE,iBAAiB;IAClC,kBAAkB,EAAE,eAAe;IAEnC;mGAAG;MACC,UAAU,EAAE,YAAY;MACxB,YAAY,EAAE,YAAY;MAC1B,WAAW,EAAE,YAAY;MACzB,MAAM,EAAE,gBAAgB;MAExB;yGAAI;QACA,MAAM,EAAE,gBAAgB;QACxB,aAAa,EAAE,cAAc;EAIzC;sFACiD;IAC7C,OAAO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B;UAC/B,KAAK,EAAE,oBAAoB;MAG/B,yCAA0C;QA7C9C;oHAAwB;UA8ChB,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,yCAA0C;QAlD9C;oHAAwB;UAmDhB,SAAS,EAAE,iBAAiB;UAC5B,KAAK,EAAE,iBAAiB",
|
||||
"sources": ["../../views/gutenberg-blocks/tainacan-collections/collections-list/collections-list.scss","../../views/gutenberg-blocks/gutenberg-blocks-variables.scss"],
|
||||
"sources": ["../../views/gutenberg-blocks/tainacan-blocks/collections-list/style.scss","../../views/gutenberg-blocks/gutenberg-blocks-variables.scss"],
|
||||
"names": [],
|
||||
"file": "tainacan-gutenberg-block-collections-list.css"
|
||||
}
|
||||
|
|
|
@ -95,6 +95,8 @@
|
|||
flex-shrink: 2; }
|
||||
.wp-block-tainacan-modal .modal-search-area .components-base-control .components-base-control__field {
|
||||
flex-wrap: wrap; }
|
||||
.wp-block-tainacan-modal .modal-search-area .components-base-control .components-base-control__field .components-select-control {
|
||||
width: 100%; }
|
||||
.wp-block-tainacan-modal .modal-search-area .components-base-control label.components-base-control__label {
|
||||
font-weight: 500;
|
||||
color: var(--tainacan-block-gray5, #454647);
|
||||
|
@ -127,29 +129,25 @@
|
|||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field .components-base-control {
|
||||
overflow: hidden;
|
||||
padding-left: 1px; }
|
||||
.wp-block-tainacan-modal .modal-checkbox-list svg.components-checkbox-control__checked,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field svg.components-checkbox-control__checked {
|
||||
fill: black; }
|
||||
.wp-block-tainacan-modal .modal-checkbox-list .modal-checkbox-list-item,
|
||||
.wp-block-tainacan-modal .modal-checkbox-list .components-radio-control__option,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field .modal-checkbox-list-item,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field .components-radio-control__option {
|
||||
display: flex;
|
||||
justify-content: flex-start; }
|
||||
justify-content: flex-start;
|
||||
align-items: center; }
|
||||
.wp-block-tainacan-modal .modal-checkbox-list .modal-checkbox-list-item img,
|
||||
.wp-block-tainacan-modal .modal-checkbox-list .components-radio-control__option img,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field .modal-checkbox-list-item img,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field .components-radio-control__option img {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin-right: 10px; }
|
||||
margin-right: 10px;
|
||||
margin-bottom: 8px; }
|
||||
.wp-block-tainacan-modal .modal-checkbox-list .modal-checkbox-list-item label,
|
||||
.wp-block-tainacan-modal .modal-checkbox-list .components-radio-control__option label,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field .modal-checkbox-list-item label,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field .components-radio-control__option label {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
display: inline-block;
|
||||
max-width: 85%; }
|
||||
@media only screen and (max-width: 768px) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"version": 3,
|
||||
"mappings": "AAIA,KAAM;EACF,sBAAsB,CAAC,QAAU;EACjC,sBAAsB,CAAC,QAAU;EACjC,sBAAsB,CAAC,QAAU;EACjC,sBAAsB,CAAC,QAAU;EACjC,sBAAsB,CAAC,QAAU;EACjC,sBAAsB,CAAC,QAAU;EACjC,wBAAwB,CAAC,QAAY;;AAIzC,kDAAmD;EAC/C,WAAW,EAAE,iBAAiB;EAC9B,aAAa,EAAE,YAAY;EAC3B,UAAU,EAAE,oCAAmC;EAE/C,iFAA+B;IAC3B,aAAa,EAAE,CAAC;EAEpB,oFAAkC;IAC9B,OAAO,EAAE,IAAI;IACb,cAAc,EAAE,GAAG;IACnB,eAAe,EAAE,MAAM;IACvB,WAAW,EAAE,QAAQ;IACrB,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,GAAG;IACd,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C;UAJ9C;;;4HAAM;YAI0C,SAAS,EAAE,GAAG;IAGlE;iJAAmE;MAC/D,SAAS,EAAE,IAAI;MACf,UAAU,EAAE,IAAI;EAGxB,gDAAwB;IACpB,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,MAAM;IAEvB,kDAAE;MACE,KAAK,EAAE,oCAAmC;MAC1C,YAAY,EAAE,IAAI;MAClB,UAAU,EAAE,GAAG;EAGvB,2CAAmB;IACf,UAAU,EAAE,iBAAiB;IAC7B,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,aAAa;IAC9B,OAAO,EAAE,gBAAgB;IACzB,MAAM,EAAE,OAAO;IAEf,6CAAE;MACE,OAAO,EAAE,MAAM;MACf,KAAK,EAAE,oCAAmC",
|
||||
"sources": ["../../views/gutenberg-blocks/gutenberg-blocks-style.scss","../../views/gutenberg-blocks/gutenberg-blocks-variables.scss"],
|
||||
"names": [],
|
||||
"file": "tainacan-gutenberg-block-common-styles.css"
|
||||
|
|
|
@ -324,6 +324,7 @@
|
|||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
min-width: 100%;
|
||||
flex-basis: 100%;
|
||||
justify-content: center;
|
||||
align-items: center; }
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"version": 3,
|
||||
"mappings": "AAEA,iCAAkC;EAC9B,MAAM,EAAE,MAAM;EAGd,oDAAmB;IACf,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,MAAM;IACvB,WAAW,EAAE,MAAM;IACnB,KAAK,EAAE,oCAAmC;EAG9C,kDAAiB;IACb,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,OAAO;IAClB,UAAU,EAAE,MAAM;IAClB,KAAK,EAAE,oCAAmC;IAC1C,UAAU,EAAE,MAAM;IAClB,MAAM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,IAAI;QACX,KAAK,EAAE,IAAI;MAEf,2FAAuB;QACnB,gBAAgB,EAAE,qDAAmD;QACrE,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,GAAG;QACV,aAAa,EAAE,GAAG;QAClB,MAAM,EAAE,eAAe;QACvB,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,IAAI;QAEV,0GAAiB;UACb,KAAK,EAAE,GAAG;EAM1B,mDAAkB;IACd,SAAS,EAAE,eAAe;EAI1B,mFAAgB;IACZ,OAAO,EAAE,4HAA4H;EAEzI,iGAA8B;IAC1B,OAAO,EAAE,sDAAsD;EAEnE,gGAA6B;IACzB,aAAa,EAAE,GAAG;EAEtB,wGAAqC;IACjC,YAAY,EAAE,uCAAuC;IACrD,aAAa,EAAE,uCAAuC",
|
||||
"sources": ["../../views/gutenberg-blocks/tainacan-facets/faceted-search/faceted-search.scss"],
|
||||
"sources": ["../../views/gutenberg-blocks/tainacan-blocks/faceted-search/style.scss"],
|
||||
"names": [],
|
||||
"file": "tainacan-gutenberg-block-faceted-search.css"
|
||||
}
|
||||
|
|
|
@ -311,8 +311,10 @@
|
|||
.wp-block-tainacan-facets-list ul.facets-list-edit.facets-layout-grid li.facet-list-item {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 100%;
|
||||
flex-basis: 220px; }
|
||||
min-width: 100%;
|
||||
flex-basis: 220px;
|
||||
min-width: 100%;
|
||||
max-width: 220px; }
|
||||
.wp-block-tainacan-facets-list ul.facets-list.facets-layout-grid li.facet-list-item a,
|
||||
.wp-block-tainacan-facets-list ul.facets-list-edit.facets-layout-grid li.facet-list-item a {
|
||||
color: var(--tainacan-block-gray5, #454647);
|
||||
|
@ -372,7 +374,9 @@
|
|||
display: -ms-grid;
|
||||
display: grid;
|
||||
align-items: self-start;
|
||||
list-style-type: none; }
|
||||
list-style-type: none;
|
||||
grid-gap: 12px;
|
||||
gap: 12px; }
|
||||
.wp-block-tainacan-facets-list ul.facets-list.facets-layout-list.max-columns-count-7,
|
||||
.wp-block-tainacan-facets-list ul.facets-list-edit.facets-layout-list.max-columns-count-7 {
|
||||
grid-template-columns: repeat(7, auto); }
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"version": 3,
|
||||
"mappings": "AAEA,uBAAwB;EACpB,MAAM,EAAE,kBAAkB;EAE1B,sDAA+B;IAC3B,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,OAAO;IAClB,KAAK,EAAE,oCAAmC;;AAGlD,uCAAwC;EACpC,MAAM,EAAE,QAAQ;EAGhB,0DAAmB;IACf,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,MAAM;IACvB,WAAW,EAAE,MAAM;IACnB,KAAK,EAAE,oCAAmC;EAG9C,wDAAiB;IACb,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,OAAO;IAClB,UAAU,EAAE,MAAM;IAClB,KAAK,EAAE,oCAAmC;IAC1C,UAAU,EAAE,MAAM;IAClB,MAAM,EAAE,QAAQ;EAEpB,yEAAkC;IAC9B,gBAAgB,EAAE,uCAAuC;IACzD,OAAO,EAAE,YAAY;IACrB,SAAS,EAAE,OAAO;IAClB,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,MAAM;IACjB,cAAc,EAAE,MAAM;IACtB,aAAa,EAAE,GAAG;IAClB,MAAM,EAAE,kCAAgC;IACxC,QAAQ,EAAE,MAAM;IAEhB,oFAAW;MACP,gBAAgB,EAAE,qDAAmD;MACrE,MAAM,EAAE,MAAM;MACd,KAAK,EAAE,GAAG;MACV,SAAS,EAAE,MAAM;MACjB,aAAa,EAAE,GAAG;MAClB,OAAO,EAAE,YAAY;MAErB,kGAAgB;QACZ,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,GAAG;QACf,MAAM,EAAE,MAAM;MAElB,mGAAiB;QACb,gBAAgB,EAAE,oDAAkD;QACpE,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AM,EAAE,KAAK;QACb,SAAS,EAAE,KAAK;QAChB,UAAU,EAAE,KAAK;QACjB,aAAa,EAAE,IAAI;IAG3B,8FAAqB;MACjB,OAAO,EAAE,KAAK;MACd,OAAO,EAAE,IAAI;MACb,SAAS,EAAE,IAAI;MACf,eAAe,EAAE,UAAU;IAE/B,2FAAkB;MACd,KAAK,EAAE,IAAI;MACX,OAAO,EAAE,SAAS;MAClB,OAAO,EAAE,IAAI;MACb,SAAS,EAAE,MAAM;MACjB,cAAc,EAAE,MAAM;MAEtB,0GAAe;QACX,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,MAAM;QACtB,SAAS,EAAE,MAAM;QAEjB,sHAAY;UACR,KAAK,EAAE,IAAI;UACX,SAAS,EAAE,IAAI;UACf,MAAM,EAAE,gBAAgB;QAE5B,uHAAe;UACX,aAAa,EAAE,sEAAoE;UACnF,aAAa,EAAE,KAAK;IAIhC,sFAAa;MACT,OAAO,EAAE,WAAW;MACpB,OAAO,EAAE,IAAI;MACb,WAAW,EAAE,MAAM;MACnB,eAAe,EAAE,aAAa;MAE9B,mGAAa;QACT,gBAAgB,EAAE,oDAAkD;MAExE,mGAAa;QACT,MAAM,EAAE,KAAK",
|
||||
"sources": ["../../views/gutenberg-blocks/tainacan-items/item-submission-form/item-submission-form.scss"],
|
||||
"sources": ["../../views/gutenberg-blocks/tainacan-blocks/item-submission-form/style.scss"],
|
||||
"names": [],
|
||||
"file": "tainacan-gutenberg-block-item-submission-form.css"
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"version": 3,
|
||||
"mappings": "AAEA,6BAA8B;EAC1B,MAAM,EAAE,QAAQ;EAGhB,iDAAoB;IAChB,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,CAAC;EAIZ;8EAC+C;IAC3C,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,CAAC;EAId;4EAC6C;IACzC,qBAAqB,EAAE,wBAAwB;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AE,IAAI;QACf,OAAO,EAAE,GAAG;QACZ,YAAY,EAAE,IAAI;MAGtB;mHAAyB;QACrB,OAAO,EAAE,IAAI;MAGjB;kGAAU;QACN,KAAK,EAAE,oCAAmC;QAC1C,eAAe,EAAE,IAAI;MAGzB,0CAA2C;QAlC/C;4FAAkB;UAmCV,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,0CAA2C;QAvC/C;4FAAkB;UAwCV,SAAS,EAAE,oBAAoB;UAC/B,KAAK,EAAE,oBAAoB;MAG/B,yCAA0C;QA5C9C;4FAAkB;UA6CV,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,yCAA0C;QAjD9C;4FAAkB;UAkDV,SAAS,EAAE,iBAAiB;UAC5B,KAAK,EAAE,iBAAiB",
|
||||
"sources": ["../../views/gutenberg-blocks/tainacan-items/items-list/items-list.scss","../../views/gutenberg-blocks/gutenberg-blocks-variables.scss"],
|
||||
"sources": ["../../views/gutenberg-blocks/tainacan-blocks/items-list/style.scss","../../views/gutenberg-blocks/gutenberg-blocks-variables.scss"],
|
||||
"names": [],
|
||||
"file": "tainacan-gutenberg-block-items-list.css"
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"version": 3,
|
||||
"mappings": "AAEA,yCAA0C;EACtC,MAAM,EAAE,IAAI;EACZ,eAAe,EAAE,MAAM;;AAE3B,6BAA8B;EAC1B,MAAM,EAAE,QAAQ;EAEhB,wDAA2B;IACvB,KAAK,EAAE,IAAI;IAEX,mFAA2B;MACvB,MAAM,EAAE,GAAG;MACX,SAAS,EAAE,IAAI;MACf,OAAO,EAAE,IAAI;MACb,eAAe,EAAE,MAAM;MACvB,WAAW,EAAE,OAAO;MACpB,MAAM,EAAE,MAAM;MACd,MAAM,EAAE,8CAA6C;MACrD,UAAU,EAAE,sBAAsB;MAElC,mGAAkB;QACd,WAAW,EAAE,CAAC;QACd,eAAe,EAAE,UAAU;M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C,MAAM,EAAE,MAAM;QACd,eAAe,EAAE,IAAI;QACrB,SAAS,EAAE,KAAK;QAChB,WAAW,EAAE,KAAK;QAClB,aAAa,EAAE,QAAQ;QACvB,KAAK,EAAE,OAAO;QACd,kHAAQ;UACJ,eAAe,EAAE,IAAI;MAG7B,oHAAW;QACP,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,IAAI;QAChB,WAAW,EAAE,MAAM;QACnB,SAAS,EAAE,GAAG;IAItB,0CAA2C;MACvC,yGAAoC;QAChC,aAAa,EAAE,GAAG",
|
||||
"sources": ["../../views/gutenberg-blocks/tainacan-items/search-bar/search-bar.scss"],
|
||||
"sources": ["../../views/gutenberg-blocks/tainacan-blocks/search-bar/style.scss"],
|
||||
"names": [],
|
||||
"file": "tainacan-gutenberg-block-search-bar.css"
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"version": 3,
|
||||
"mappings": "AAEA,6BAA8B;EAC1B,MAAM,EAAE,QAAQ;EAGhB,iDAAoB;IAChB,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,CAAC;EAIZ;8EAC+C;IAC3C,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,CAAC;EAId;oEACqC;IACjC,OAAO,EAAE,CAAC;ICpBd,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,IAAI;IDmBT,gBAAgB,EAAE,6BAA6B;IAC/C,qBAAqB,EAAE,wBAAwB;IAC/C,QAAQ,EAAE,GAAG;IACb,eAAe,EAAE,YAAY;IAC7B,eAAe,EAAE,IAAI;IAErB;wFAAkB;MACd,QAAQ,EAAE,QAAQ;MAClB,OAAO,EAAE,KAAK;MACd,MAAM,EAAE,mBAAmB;MAC3B,aAAa,EAAE,IAAI;MACnB,KAAK,EAAE,KAAK;MAEZ;4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ACqC;IACjC,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,MAAM;IACnB,eAAe,EAAE,IAAI;IAErB;wFAAkB;MACd,QAAQ,EAAE,QAAQ;MAClB,MAAM,EAAE,mBAAmB;MAC3B,aAAa,EAAE,IAAI;MACnB,UAAU,EAAE,IAAI;MAChB,SAAS,EAAE,gBAAgB;MAC3B,KAAK,EAAE,gBAAgB;MAEvB;4FAAE;QACE,KAAK,EAAE,oCAAmC;QAC1C,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,MAAM;QACnB,UAAU,EAAE,SAAS;QACrB,UAAU,EAAE,UAAU;MAG1B;8FAAI;QACA,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,GAAG;QACZ,YAAY,EAAE,IAAI;MAGtB;mHAAyB;QACrB,OAAO,EAAE,IAAI;MAGjB;kGAAU;QACN,KAAK,EAAE,oCAAmC;QAC1C,eAAe,EAAE,IAAI;MAGzB,0CAA2C;QAlC/C;4FAAkB;UAmCV,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,0CAA2C;QAvC/C;4FAAkB;UAwCV,SAAS,EAAE,oBAAoB;UAC/B,KAAK,EAAE,oBAAoB;MAG/B,yCAA0C;QA5C9C;4FAAkB;UA6CV,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,yCAA0C;QAjD9C;4FAAkB;UAkDV,SAAS,EAAE,iBAAiB;UAC5B,KAAK,EAAE,iBAAiB",
|
||||
"sources": ["../../views/gutenberg-blocks/tainacan-terms/terms-list/terms-list.scss","../../views/gutenberg-blocks/gutenberg-blocks-variables.scss"],
|
||||
"sources": ["../../views/gutenberg-blocks/tainacan-blocks/terms-list/style.scss","../../views/gutenberg-blocks/gutenberg-blocks-variables.scss"],
|
||||
"names": [],
|
||||
"file": "tainacan-gutenberg-block-terms-list.css"
|
||||
}
|
||||
|
|
|
@ -363,7 +363,8 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
'title',
|
||||
'meta_value',
|
||||
'meta_value_num',
|
||||
'menu_order'
|
||||
'menu_order',
|
||||
'rand'
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ class REST_Items_Controller extends REST_Controller {
|
|||
}
|
||||
|
||||
if ( $request['context'] === 'edit' ) {
|
||||
add_filter( 'taiancan_add_related_item', function( $related_item ) {
|
||||
add_filter( 'tainacan_add_related_item', function( $related_item ) {
|
||||
return array_merge($related_item, $this->get_context_edit($related_item['id']));
|
||||
}, 10, 2 );
|
||||
}
|
||||
|
|
|
@ -75,6 +75,7 @@ class JSON_flat extends Exposer {
|
|||
'items' => $response_items
|
||||
]
|
||||
);
|
||||
$response->set_headers( ['Content-Type: application/json; charset=' . get_option( 'blog_charset' )] );
|
||||
$response->set_data(addslashes($response_data));
|
||||
return $response;
|
||||
}
|
||||
|
|
|
@ -594,7 +594,7 @@ class Items extends Repository {
|
|||
$item_related = new \Tainacan\Entities\Item($items->post);
|
||||
$item_arr = $item_related->_toArray();
|
||||
$item_arr['thumbnail'] = $item_related->get_thumbnail();
|
||||
array_push($prepared_items, apply_filters( 'taiancan_add_related_item', $item_arr ) );
|
||||
array_push($prepared_items, apply_filters( 'tainacan_add_related_item', $item_arr ) );
|
||||
}
|
||||
wp_reset_postdata();
|
||||
}
|
||||
|
|
|
@ -35,8 +35,6 @@ class Theme_Helper {
|
|||
// Redirect to post type archive if no cover page is set
|
||||
add_action('wp', array($this, 'collection_single_redirect'));
|
||||
|
||||
add_action('wp_print_scripts', array($this, 'enqueue_scripts'), 90);
|
||||
|
||||
// make archive for terms work with items
|
||||
add_action('pre_get_posts', array($this, 'tax_archive_pre_get_posts'));
|
||||
|
||||
|
@ -117,57 +115,6 @@ class Theme_Helper {
|
|||
]);
|
||||
}
|
||||
|
||||
public function enqueue_scripts($force = false) {
|
||||
global $TAINACAN_BASE_URL;
|
||||
if ( $force || is_post_type_archive( \Tainacan\Repositories\Repository::get_collections_db_identifiers() ) || tainacan_get_term() || get_query_var('tainacan_repository_archive') == 1 ) {
|
||||
wp_register_script('tainacan-search', $TAINACAN_BASE_URL . '/assets/js/theme_search.js' , ['underscore'] , TAINACAN_VERSION);
|
||||
wp_localize_script('tainacan-search', 'tainacan_plugin', \Tainacan\Admin::get_instance()->get_admin_js_localization_params());
|
||||
}
|
||||
}
|
||||
|
||||
public function enqueue_items_carousel_scripts() {
|
||||
global $post;
|
||||
global $TAINACAN_BASE_URL;
|
||||
global $TAINACAN_VERSION;
|
||||
global $wp_version;
|
||||
|
||||
$settings = [
|
||||
'wp_version' => $wp_version,
|
||||
'root' => esc_url_raw( rest_url() ) . 'tainacan/v2',
|
||||
'nonce' => is_user_logged_in() ? wp_create_nonce( 'wp_rest' ) : false,
|
||||
'base_url' => $TAINACAN_BASE_URL,
|
||||
'admin_url' => admin_url(),
|
||||
'site_url' => site_url(),
|
||||
'theme_items_list_url' => esc_url_raw( get_site_url() ) . '/' . \Tainacan\Theme_Helper::get_instance()->get_items_list_slug()
|
||||
];
|
||||
|
||||
wp_enqueue_script(
|
||||
'carousel-items-list-theme',
|
||||
$TAINACAN_BASE_URL . '/assets/js/block_carousel_items_list_theme.js',
|
||||
array('wp-components')
|
||||
);
|
||||
wp_enqueue_style(
|
||||
'carousel-items-list',
|
||||
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-' . 'carousel-items-list' . '.css',
|
||||
array('tainacan-blocks-common-styles'),
|
||||
$TAINACAN_VERSION
|
||||
);
|
||||
wp_set_script_translations('carousel-items-list-theme', 'tainacan');
|
||||
wp_localize_script('carousel-items-list-theme', 'tainacan_blocks', $settings);
|
||||
}
|
||||
|
||||
public function enqueue_related_items_carousel_scripts() {
|
||||
global $TAINACAN_BASE_URL;
|
||||
global $TAINACAN_VERSION;
|
||||
|
||||
wp_enqueue_style(
|
||||
'carousel-related-items',
|
||||
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-' . 'carousel-related-items' . '.css',
|
||||
array('tainacan-blocks-common-styles'),
|
||||
$TAINACAN_VERSION
|
||||
);
|
||||
}
|
||||
|
||||
public function is_post_an_item(\WP_Post $post) {
|
||||
$post_type = $post->post_type;
|
||||
$prefix = substr( $post_type, 0, strlen( Entities\Collection::$db_identifier_prefix ) );
|
||||
|
@ -428,11 +375,8 @@ class Theme_Helper {
|
|||
}
|
||||
|
||||
wp_enqueue_media();
|
||||
wp_enqueue_script('jcrop');
|
||||
wp_enqueue_script('tainacan-item-submission', $TAINACAN_BASE_URL . '/assets/js/item_submission.js' , ['underscore', 'jcrop', 'media-editor', 'media-views', 'customize-controls'] , TAINACAN_VERSION);
|
||||
wp_localize_script('tainacan-item-submission', 'tainacan_plugin', \Tainacan\Admin::get_instance()->get_admin_js_localization_params());
|
||||
|
||||
return "<div id='tainacan-item-submission-form' $props ></div>";
|
||||
return "<div data-module='item-submission-form' id='tainacan-item-submission-form' $props ></div>";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -522,9 +466,7 @@ class Theme_Helper {
|
|||
}
|
||||
}
|
||||
|
||||
$this->enqueue_scripts($force_enqueue);
|
||||
|
||||
return "<div id='tainacan-items-page' $props ></div>";
|
||||
return "<div data-module='faceted-search' id='tainacan-items-page' $props ></div>";
|
||||
}
|
||||
|
||||
function get_items_list_slug() {
|
||||
|
@ -937,9 +879,7 @@ class Theme_Helper {
|
|||
$props .= (str_replace('_', '-', $key) . "='" . $value . "' ");
|
||||
}
|
||||
|
||||
$this->enqueue_items_carousel_scripts();
|
||||
|
||||
return "<div id='tainacan-items-carousel-shortcode' $props ></div>";
|
||||
return "<div data-module='carousel-items-list' id='tainacan-items-carousel-shortcode' $props ></div>";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -959,7 +899,9 @@ class Theme_Helper {
|
|||
* @return string The HTML div to be used for rendering the related items vue component
|
||||
*/
|
||||
public function get_tainacan_related_items_carousel($args = []) {
|
||||
|
||||
global $TAINACAN_BASE_URL;
|
||||
global $TAINACAN_VERSION;
|
||||
|
||||
$defaults = array(
|
||||
'class_name' => '',
|
||||
'collection_heading_class_name' => '',
|
||||
|
@ -980,11 +922,8 @@ class Theme_Helper {
|
|||
if (!count($related_items))
|
||||
return;
|
||||
|
||||
// Enqueues necessary CSS
|
||||
$this->enqueue_related_items_carousel_scripts();
|
||||
|
||||
// Always pass the default class;
|
||||
$output = '<div class="' . $args['class_name'] . ' wp-block-tainacan-carousel-related-items' . '">';
|
||||
$output = '<div data-module="carousel-related-items" class="' . $args['class_name'] . ' wp-block-tainacan-carousel-related-items' . '">';
|
||||
|
||||
foreach($related_items as $collection_id => $related_group) {
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
Contributors: andrebenedito, daltonmartins, fabianobn, jacsonp, leogermani, weryques, wetah, eduardohumberto, ravipassos, jessicafpx, marinagiolo, omarceloavila, vnmedeiros, tainacan, r-guimaraes, suelanesilva, ccaio, alanargomes, ateneagarcia123, rodrigo0freire, clarandreozzi
|
||||
Tags: museums, libraries, archives, GLAM, collections, repository
|
||||
Requires at least: 5.0
|
||||
Tested up to: 5.7
|
||||
Tested up to: 5.8
|
||||
Requires PHP: 5.6
|
||||
Stable tag: 0.18.3
|
||||
Stable tag: 0.18.4
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
|
|
|
@ -4,13 +4,17 @@ Plugin Name: Tainacan
|
|||
Plugin URI: https://tainacan.org/
|
||||
Description: Open source, powerful and flexible repository platform for WordPress. Manage and publish you digital collections as easily as publishing a post to your blog, while having all the tools of a professional repository platform.
|
||||
Author: Tainacan.org
|
||||
Version: 0.18.3
|
||||
Version: 0.18.4
|
||||
Requires at least: 5.0
|
||||
Tested up to: 5.8
|
||||
Requires PHP: 5.6
|
||||
Stable tag: 0.18.4
|
||||
Text Domain: tainacan
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*/
|
||||
|
||||
const TAINACAN_VERSION = '0.18.3';
|
||||
const TAINACAN_VERSION = '0.18.4';
|
||||
|
||||
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
||||
$TAINACAN_BASE_URL = plugins_url('', __FILE__);
|
||||
|
|
|
@ -1750,8 +1750,11 @@ export default {
|
|||
.sticky-container {
|
||||
position: relative;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
top: -25px;
|
||||
margin: 3px 0;
|
||||
max-height: calc(100vh - 202px);
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 769px) {
|
||||
|
|
|
@ -89,20 +89,25 @@
|
|||
mounted() {
|
||||
if (!this.isUsingElasticSearch && !this.filtersAsModal)
|
||||
this.loadOptions();
|
||||
|
||||
this.$eventBusSearch.$on('has-to-reload-facets', (shouldReload) => {
|
||||
if ( !this.isUsingElasticSearch && shouldReload )
|
||||
this.loadOptions();
|
||||
});
|
||||
},
|
||||
created() {
|
||||
this.$eventBusSearch.$on('has-to-reload-facets', this.reloadOptions);
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('has-to-reload-facets', this.reloadOptions);
|
||||
},
|
||||
methods: {
|
||||
reloadOptions(shouldReload) {
|
||||
if ( !this.isUsingElasticSearch && shouldReload )
|
||||
this.loadOptions();
|
||||
},
|
||||
loadOptions() {
|
||||
let promise = null;
|
||||
|
||||
// Cancels previous Request
|
||||
if (this.getOptionsValuesCancel != undefined)
|
||||
this.getOptionsValuesCancel.cancel('Facet search Canceled.');
|
||||
|
||||
|
||||
if ( this.metadatumType === 'Tainacan\\Metadata_Types\\Relationship' || this.metadatumType === 'Tainacan\\Metadata_Types\\Control' )
|
||||
promise = this.getValuesRelationship({
|
||||
search: null,
|
||||
|
|
|
@ -47,14 +47,19 @@
|
|||
},
|
||||
mounted() {
|
||||
if (!this.isUsingElasticSearch)
|
||||
this.loadOptions();
|
||||
|
||||
this.$eventBusSearch.$on('has-to-reload-facets', (shouldReload) => {
|
||||
if ( !this.isUsingElasticSearch && shouldReload )
|
||||
this.loadOptions();
|
||||
});
|
||||
this.loadOptions();
|
||||
},
|
||||
created() {
|
||||
this.$eventBusSearch.$on('has-to-reload-facets', this.reloadOptions);
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('has-to-reload-facets', this.reloadOptions);
|
||||
},
|
||||
methods: {
|
||||
reloadOptions(shouldReload) {
|
||||
if ( !this.isUsingElasticSearch && shouldReload )
|
||||
this.loadOptions();
|
||||
},
|
||||
loadOptions(){
|
||||
// Cancels previous Request
|
||||
if (this.getOptionsValuesCancel != undefined)
|
||||
|
|
|
@ -122,26 +122,28 @@
|
|||
this.taxonomyId = this.filter.metadatum.metadata_type_object.options.taxonomy_id;
|
||||
this.taxonomy = this.filter.metadatum.metadata_type_object.options.taxonomy;
|
||||
}
|
||||
this.$eventBusSearch.$on('has-to-reload-facets', this.reloadOptions);
|
||||
},
|
||||
mounted(){
|
||||
if (!this.filtersAsModal)
|
||||
if (!this.isUsingElasticSearch && !this.filtersAsModal)
|
||||
this.loadOptions();
|
||||
|
||||
this.$eventBusSearch.$on('has-to-reload-facets', (shouldReload) => {
|
||||
if ( !this.isUsingElasticSearch && shouldReload )
|
||||
this.loadOptions();
|
||||
});
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
// Cancels previous Request
|
||||
if (this.getOptionsValuesCancel != undefined)
|
||||
this.getOptionsValuesCancel.cancel('Facet search Canceled.');
|
||||
|
||||
this.$eventBusSearch.$off('has-to-reload-facets', this.reloadOptions);
|
||||
},
|
||||
methods: {
|
||||
...mapGetters('search', [
|
||||
'getFacets'
|
||||
]),
|
||||
reloadOptions(shouldReload) {
|
||||
if ( !this.isUsingElasticSearch && shouldReload )
|
||||
this.loadOptions();
|
||||
},
|
||||
loadOptions() {
|
||||
if (!this.isUsingElasticSearch) {
|
||||
let promise = null;
|
||||
|
|
|
@ -310,7 +310,7 @@
|
|||
}
|
||||
},
|
||||
filterByMetadatumName(itemMetadatum) {
|
||||
return itemMetadatum.metadatum.name.toString().toLowerCase().indexOf(this.metadataNameFilterString.toString().toLowerCase()) >= 0;
|
||||
return this.metadataNameFilterString ? (itemMetadatum.metadatum.name.toString().toLowerCase().indexOf(this.metadataNameFilterString.toString().toLowerCase()) >= 0) : true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ class MetadataTypeControlHelper {
|
|||
break;
|
||||
|
||||
default:
|
||||
// What the hell am I doing here?
|
||||
$update_item_metadatum->set_value( $update_item_metadatum->get_value() );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,28 @@ class Control extends Metadata_Type {
|
|||
public function get_value_as_html(\Tainacan\Entities\Item_Metadata_Entity $item_metadata) {
|
||||
$value = $item_metadata->get_value();
|
||||
$control_metadatum = $this->get_option('control_metadatum');
|
||||
return $this->get_control_metadatum_value($value, $control_metadatum, 'html');
|
||||
if (in_array($control_metadatum, ['document_type', 'collection_id', 'has_thumbnail']))
|
||||
return $this->get_control_metadatum_value($value, $control_metadatum, 'html');
|
||||
|
||||
$return = '';
|
||||
if ( $item_metadata->is_multiple() ) {
|
||||
$total = sizeof($value);
|
||||
$count = 0;
|
||||
$prefix = $item_metadata->get_multivalue_prefix();
|
||||
$suffix = $item_metadata->get_multivalue_suffix();
|
||||
$separator = $item_metadata->get_multivalue_separator();
|
||||
foreach ($value as $v) {
|
||||
$return .= $prefix;
|
||||
$return .= (string) $v;
|
||||
$return .= $suffix;
|
||||
$count ++;
|
||||
if ($count < $total)
|
||||
$return .= $separator;
|
||||
}
|
||||
} else {
|
||||
$return = (string) $value;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,11 +45,11 @@ class Metadata_Type_Helper {
|
|||
|
||||
// the priority should see less than on function
|
||||
// `load_admin_page()` of class `Admin` in file /src/views/class-tainacan-admin.php
|
||||
add_action( 'admin_enqueue_scripts', array( &$this, 'register_metadata_type_compoment' ), 80 );
|
||||
add_action( 'admin_enqueue_scripts', array( &$this, 'register_metadata_type_component' ), 80 );
|
||||
do_action('tainacan-register-metadata-type', $this);
|
||||
}
|
||||
|
||||
public function register_metadata_type_compoment() {
|
||||
public function register_metadata_type_component() {
|
||||
foreach($this->registered_metadata_type as $handle => $component) {
|
||||
wp_enqueue_script($handle, $component['script_path']);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
<template>
|
||||
<section
|
||||
:listen="setError">
|
||||
<section>
|
||||
<!-- <b-field
|
||||
:addons="false">
|
||||
<label class="label is-inline">
|
||||
{{ $i18n.getHelperTitle('tainacan-selectbox', 'options_separator') }}
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('tainacan-selectbox', 'options_separator')"
|
||||
:message="$i18n.getHelperMessage('tainacan-selectbox', 'options_separator')"/>
|
||||
</label>
|
||||
|
||||
</b-field> -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:listen="setError"
|
||||
:type="optionType"
|
||||
:message="optionMessage">
|
||||
<label class="label is-inline">
|
||||
|
@ -11,15 +21,31 @@
|
|||
:title="$i18n.getHelperTitle('tainacan-selectbox', 'options')"
|
||||
:message="$i18n.getHelperMessage('tainacan-selectbox', 'options')"/>
|
||||
</label>
|
||||
|
||||
<b-taginput
|
||||
v-model="options"
|
||||
@input="emitValues()"
|
||||
@focus="clear()"
|
||||
attached
|
||||
:confirm-keys="optionsSeparator"
|
||||
:on-paste-separators="optionsSeparator"
|
||||
:remove-on-keys="[]"
|
||||
:aria-close-label="$i18n.get('remove_value')"
|
||||
:class="{'has-selected': options != undefined && options != []}"
|
||||
:placeholder="$i18n.get('new') + ', ...'"/>
|
||||
:placeholder="$i18n.get('new') + ', ...'" />
|
||||
<div class="separator-options">
|
||||
<label class="label is-inline">{{ $i18n.getHelperTitle('tainacan-selectbox', 'options_separator') }}</label>
|
||||
<b-checkbox
|
||||
v-for="separator of ['Enter', 'Tab', ',', ';', '|']"
|
||||
:key="separator"
|
||||
name="metadata_type_selectbox[options_separator]"
|
||||
@input="emitValues()"
|
||||
v-model="optionsSeparator"
|
||||
:native-value="separator"
|
||||
:disabled="separator == 'Enter'">
|
||||
<kbd>{{ separator }}</kbd>
|
||||
</b-checkbox>
|
||||
</div>
|
||||
</b-field>
|
||||
</section>
|
||||
</template>
|
||||
|
@ -36,6 +62,7 @@
|
|||
optionType: '',
|
||||
optionMessage: '',
|
||||
options: [],
|
||||
optionsSeparator: [",", "Tab", "Enter"]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -49,8 +76,9 @@
|
|||
}
|
||||
},
|
||||
created(){
|
||||
if( this.value ) {
|
||||
if ( this.value ) {
|
||||
this.options = ( this.value.options ) ? this.value.options.split('\n') : [];
|
||||
this.optionsSeparator = ( this.value.options_separator ) ? JSON.parse(this.value.options_separator) : [",", "Tab", "Enter"];
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -58,9 +86,10 @@
|
|||
this.optionType = '';
|
||||
this.optionMessage = '';
|
||||
},
|
||||
emitValues(){
|
||||
this.$emit('input',{
|
||||
options: ( this.options.length > 0 ) ? this.options.join('\n') : ''
|
||||
emitValues() {
|
||||
this.$emit('input', {
|
||||
options: ( this.options.length > 0 ) ? this.options.join('\n') : '',
|
||||
options_separator: JSON.stringify(this.optionsSeparator)
|
||||
})
|
||||
},
|
||||
setErrorsAttributes( type, message ){
|
||||
|
@ -78,4 +107,24 @@
|
|||
.help-wrapper {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
.separator-options {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 4px 10px 1px;
|
||||
background: #f9f9f9;
|
||||
border: 1px solid var(--tainacan-gray1, #f2f2f2);
|
||||
border-bottom-right-radius: 2px;
|
||||
border-bottom-left-radius: 2px;
|
||||
}
|
||||
.separator-options .b-checkbox {
|
||||
width: auto;
|
||||
margin-right: 0.75em;
|
||||
}
|
||||
.separator-options>label {
|
||||
opacity: 0.875;
|
||||
font-size: 0.75em;
|
||||
margin-right: 1em;
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
|
@ -35,9 +35,13 @@ class Selectbox extends Metadata_Type {
|
|||
*/
|
||||
public function get_form_labels(){
|
||||
return [
|
||||
'options_separator' => [
|
||||
'title' => __( 'Options separator', 'tainacan' ),
|
||||
'description' => __( 'Character to separate options in the text input bellow.', 'tainacan' ),
|
||||
],
|
||||
'options' => [
|
||||
'title' => __( 'Options', 'tainacan' ),
|
||||
'description' => __( 'Creates options for what is selected. Hit <enter> to add a new one.', 'tainacan' ),
|
||||
'description' => __( 'Creates options for what is selected. Type the "options separator" character to add a new one.', 'tainacan' ),
|
||||
]
|
||||
];
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
},
|
||||
created() {
|
||||
// These values are set to allow the usage of the getValuesPlainText function from the DynamicFilterTypeMixin
|
||||
this.currentCollectionId = this.$route.params.collectionId;
|
||||
this.currentCollectionId = this.itemMetadatum && this.itemMetadatum.metadatum && this.itemMetadatum.metadatum.collection_id ? this.itemMetadatum.metadatum.collection_id : null;
|
||||
this.filter = { collection_id: this.currentCollectionId };
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -150,12 +150,14 @@ UserPrefsPlugin.install = function (Vue, options = {}) {
|
|||
if (tainacan_plugin.user_prefs == undefined || tainacan_plugin.user_prefs == '') {
|
||||
let data = {'meta': {'tainacan_prefs': JSON.stringify(this.tainacanPrefs)} };
|
||||
|
||||
wpApi.post('/users/me/', qs.stringify(data))
|
||||
.then( updatedRes => {
|
||||
let prefs = JSON.parse(updatedRes.data.meta['tainacan_prefs']);
|
||||
this.tainacanPrefs = prefs;
|
||||
})
|
||||
.catch( () => console.log("Request to /users/me failed. Maybe you're not logged in.") );
|
||||
if (tainacan_plugin.nonce) {
|
||||
wpApi.post('/users/me/', qs.stringify(data))
|
||||
.then( updatedRes => {
|
||||
let prefs = JSON.parse(updatedRes.data.meta['tainacan_prefs']);
|
||||
this.tainacanPrefs = prefs;
|
||||
})
|
||||
.catch( () => console.log("Request to /users/me failed. Maybe you're not logged in.") );
|
||||
}
|
||||
} else {
|
||||
let prefs = JSON.parse(tainacan_plugin.user_prefs);
|
||||
this.tainacanPrefs = prefs;
|
||||
|
@ -169,23 +171,31 @@ UserPrefsPlugin.install = function (Vue, options = {}) {
|
|||
|
||||
let data = {'meta': {'tainacan_prefs': JSON.stringify(this.tainacanPrefs)} };
|
||||
|
||||
return new Promise(( resolve, reject ) => {
|
||||
wpApi.post('/users/me/', qs.stringify(data))
|
||||
.then( res => {
|
||||
let prefs = JSON.parse(res.data.meta['tainacan_prefs']);
|
||||
this.tainacanPrefs[key] = prefs[key];
|
||||
if (prefs[key]) {
|
||||
resolve( prefs[key] );
|
||||
} else {
|
||||
this.tainacanPrefs[key] = value;
|
||||
}
|
||||
})
|
||||
.catch( () => console.log("Request to /users/me failed. Maybe you're not logged in.") );
|
||||
});
|
||||
if (tainacan_plugin.nonce) {
|
||||
return new Promise(( resolve, reject ) => {
|
||||
wpApi.post('/users/me/', qs.stringify(data))
|
||||
.then( res => {
|
||||
let prefs = JSON.parse(res.data.meta['tainacan_prefs']);
|
||||
this.tainacanPrefs[key] = prefs[key];
|
||||
if (prefs[key]) {
|
||||
resolve( prefs[key] );
|
||||
} else {
|
||||
this.tainacanPrefs[key] = value;
|
||||
}
|
||||
})
|
||||
.catch( () => console.log("Request to /users/me failed. Maybe you're not logged in.") );
|
||||
});
|
||||
} else {
|
||||
return new Promise(() => {})
|
||||
.then( () => {
|
||||
resolve(value);
|
||||
});
|
||||
}
|
||||
},
|
||||
clean() {
|
||||
let data = {'meta': {'tainacan_prefs': ''} };
|
||||
wpApi.post('/users/me/', qs.stringify(data))
|
||||
if (tainacan_plugin.nonce)
|
||||
wpApi.post('/users/me/', qs.stringify(data));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export default {
|
||||
|
||||
// AttachmentControl: requires upload of new files and accepts multiple files
|
||||
attachmentControl: wp.customize.MediaControl.extend({
|
||||
|
||||
/**
|
||||
|
@ -189,6 +189,7 @@ export default {
|
|||
}
|
||||
|
||||
}),
|
||||
|
||||
// CroppedImageControl, with presets for header dimensions
|
||||
headerImageControl: wp.customize.CroppedImageControl.extend({
|
||||
|
||||
|
@ -286,6 +287,7 @@ export default {
|
|||
}
|
||||
|
||||
}),
|
||||
|
||||
// DocumentFileControl: similar to attachment, but used for items where the documents is of type file
|
||||
documentFileControl: wp.customize.MediaControl.extend({
|
||||
/**
|
||||
|
@ -294,8 +296,11 @@ export default {
|
|||
initFrame: function() {
|
||||
|
||||
wp.media.view.settings.post = {
|
||||
id: this.params.relatedPostId
|
||||
id: parseInt(this.params.relatedPostId),
|
||||
wp_customize: 'off'
|
||||
}
|
||||
wp.media.model.settings.post.nonce = this.params.nonce;
|
||||
wp.media.model.settings.post.id = parseInt(this.params.relatedPostId);
|
||||
|
||||
this.frame = wp.media({
|
||||
button: {
|
||||
|
@ -305,11 +310,18 @@ export default {
|
|||
states: [
|
||||
new wp.media.controller.Library({
|
||||
title: this.params.button_labels.frame_title,
|
||||
library: wp.media.query({
|
||||
uploadedTo: null
|
||||
library: wp.media.query({
|
||||
uploadedTo: wp.media.view.settings.post.id,
|
||||
orderby: 'menuOrder',
|
||||
order: 'ASC',
|
||||
posts_per_page: -1,
|
||||
query: true
|
||||
}),
|
||||
autoSelect: true,
|
||||
multiple: false,
|
||||
date: false,
|
||||
sortable: true,
|
||||
filterable: 'unattached',
|
||||
uploadedTo: this.params.relatedPostId
|
||||
})
|
||||
]
|
||||
|
|
|
@ -601,8 +601,11 @@
|
|||
.sticky-container {
|
||||
position: relative;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
top: -25px;
|
||||
margin: 3px 0;
|
||||
max-height: calc(100vh - 202px);
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 769px) {
|
||||
|
|
|
@ -92,4 +92,27 @@ button.link-style:active {
|
|||
font-size: 0.875em !important;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
}
|
||||
kbd {
|
||||
padding: 0.25rem 0.5rem 0.25rem 0.35rem;
|
||||
background: radial-gradient(var(--tainacan-white, #ffffff), var(--tainacan-gray1, #f2f2f2) );
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
top: -0.15rem;
|
||||
font-size: 0.65rem;
|
||||
border-top-width: 1px;
|
||||
border-left-width: 2px;
|
||||
border-right-width: 3px;
|
||||
border-bottom-width: 4px;
|
||||
border-radius: 4px;
|
||||
border-style: solid;
|
||||
border-color: var(--tainacan-gray2, #dbdbdb);
|
||||
border-bottom-color: var(--tainacan-gray3, #cbcbcb);
|
||||
transition: top 0.1s ease, background 0.1s ease, border-bottom-width 0.1s ease;
|
||||
}
|
||||
kbd:hover,
|
||||
kbd:focus {
|
||||
background: radial-gradient(var(--tainacan-gray1, #f2f2f2), var(--tainacan-gray1, #f2f2f2) );
|
||||
top: 0rem;
|
||||
border-bottom-width: 3px;
|
||||
}
|
|
@ -33,6 +33,7 @@
|
|||
min-width: 6em;
|
||||
border: none;
|
||||
z-index: 999991;
|
||||
background-color: var(--tainacan-input-background-color);
|
||||
|
||||
.dropdown-content {
|
||||
padding: 0px 0px 1px 0px;
|
||||
|
|
|
@ -176,9 +176,6 @@
|
|||
}
|
||||
|
||||
// WordPress Media Modal customization
|
||||
.wp-core-ui {
|
||||
a:focus{ box-shadow: none; }
|
||||
}
|
||||
.media-modal-backdrop {
|
||||
z-index: 9999999 !important;
|
||||
}
|
||||
|
|
|
@ -202,6 +202,11 @@
|
|||
-webkit-column-break-inside: avoid;
|
||||
page-break-inside: avoid;
|
||||
break-inside: avoid;
|
||||
clear: none;
|
||||
|
||||
&::after {
|
||||
clear: none;
|
||||
}
|
||||
}
|
||||
|
||||
.metadata-value {
|
||||
|
|
|
@ -158,6 +158,10 @@
|
|||
font-weight: 700;
|
||||
color: var(--tainacan-info-color);
|
||||
clear: none;
|
||||
|
||||
&::after {
|
||||
clear: none;
|
||||
}
|
||||
}
|
||||
|
||||
.metadata-value {
|
||||
|
|
|
@ -112,7 +112,6 @@ class Admin {
|
|||
function add_theme_files() {
|
||||
global $TAINACAN_BASE_URL;
|
||||
|
||||
// wp_enqueue_style( 'style', $TAINACAN_BASE_URL . '/assets/css/materialdesignicons.css' );
|
||||
wp_enqueue_style( 'tainacan-fonts', $TAINACAN_BASE_URL . '/assets/css/tainacanicons.css', [], TAINACAN_VERSION );
|
||||
wp_enqueue_style( 'roboto-fonts', 'https://fonts.googleapis.com/css?family=Roboto:400,400i,500,500i,700,700i', [], TAINACAN_VERSION );
|
||||
wp_enqueue_script('underscore');
|
||||
|
|
|
@ -2,20 +2,23 @@
|
|||
|
||||
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
||||
|
||||
// Slugs and options for the 'generic' Tainacan Icons.
|
||||
// Slugs and options for the Tainacan Blocks.
|
||||
const TAINACAN_BLOCKS = [
|
||||
'items-list' => [],
|
||||
'collections-list' => [],
|
||||
'search-bar' => [ 'has_theme_script' => true ],
|
||||
'facets-list' => [ 'has_theme_script' => true ],
|
||||
'dynamic-items-list' => [ 'has_theme_script' => true ],
|
||||
'carousel-items-list' => [ 'has_theme_script' => true ],
|
||||
'carousel-terms-list' => [ 'has_theme_script' => true ],
|
||||
'carousel-collections-list' => [ 'has_theme_script' => true ],
|
||||
'search-bar' => [],
|
||||
'facets-list' => [],
|
||||
'dynamic-items-list' => [],
|
||||
'carousel-items-list' => [],
|
||||
'carousel-terms-list' => [],
|
||||
'carousel-collections-list' => [],
|
||||
'carousel-related-items' => [],
|
||||
'terms-list' => [ 'extra_editor_script_deps' => array('undescore') ],
|
||||
'terms-list' => [],
|
||||
'faceted-search' => [],
|
||||
'item-submission-form' => []
|
||||
];
|
||||
|
||||
// Lets do this!
|
||||
tainacan_blocks_initialize();
|
||||
|
||||
/**
|
||||
|
@ -24,131 +27,28 @@ tainacan_blocks_initialize();
|
|||
function tainacan_blocks_initialize() {
|
||||
global $wp_version;
|
||||
|
||||
if (is_plugin_active('gutenberg/gutenberg.php') || $wp_version >= '5') {
|
||||
add_filter('block_categories', 'tainacan_blocks_register_categories', 10, 2);
|
||||
add_action('init', 'tainacan_blocks_add_plugin_settings', 90);
|
||||
add_action('init', 'tainacan_blocks_add_plugin_admin_settings', 90);
|
||||
add_action('init', 'register_tainacan_blocks_add_gutenberg_blocks');
|
||||
add_action('wp_enqueue_scripts', 'unregister_tainacan_blocks');
|
||||
add_action('admin_enqueue_scripts', 'unregister_tainacan_blocks');
|
||||
if (is_plugin_active('gutenberg/gutenberg.php') || $wp_version >= '5') {
|
||||
|
||||
// Via Gutenberg filers, we create the Tainacan category
|
||||
if ( class_exists('WP_Block_Editor_Context') ) { // Introduced WP 5.8
|
||||
add_filter('block_categories_all', 'tainacan_blocks_register_categories', 10, 2);
|
||||
} else {
|
||||
add_filter('block_categories', 'tainacan_blocks_register_categories', 10, 2);
|
||||
}
|
||||
|
||||
// On the theme side, all we need is the common scripts,
|
||||
// that handle dynamically the imports using conditioner.js
|
||||
add_action('init', 'tainacan_blocks_add_common_theme_scripts', 90);
|
||||
|
||||
// On the admin side, we need the blocks registered and their assets (editor-side)
|
||||
add_action('admin_init', 'tainacan_blocks_register_and_enqueue_all_blocks');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the routines responsible for Registering the global style, category and
|
||||
* both 'generic' and 'special' blocks
|
||||
* Registers the Tainacan category on the blocks inserter
|
||||
*/
|
||||
function register_tainacan_blocks_add_gutenberg_blocks() {
|
||||
tainacan_blocks_get_common_styles();
|
||||
tainacan_blocks_register_category_icon();
|
||||
|
||||
foreach(TAINACAN_BLOCKS as $block_slug => $block_options) {
|
||||
tainacan_blocks_register_block($block_slug, $block_options);
|
||||
}
|
||||
tainacan_blocks_register_tainacan_item_submission_form();
|
||||
tainacan_blocks_register_tainacan_faceted_search();
|
||||
}
|
||||
|
||||
/**
|
||||
* Un/Deregisters scripts and styles that are not necessary accordind to the current page
|
||||
*/
|
||||
function unregister_tainacan_blocks() {
|
||||
global $post;
|
||||
|
||||
// If we are outside the block editor, there are assets not necessary, so lets deregister them!
|
||||
if ( !is_admin() ) {
|
||||
|
||||
// First, handle the generic blocks
|
||||
foreach(TAINACAN_BLOCKS as $block_slug => $block_options) {
|
||||
// No need for any of the editor-side scripts outside the block editor
|
||||
wp_deregister_script($block_slug);
|
||||
|
||||
// If there is no instance of this block on this page, no need for styles and theme side scripts as well
|
||||
if ( !has_block('tainacan/' . $block_slug) || !is_singular() ) {
|
||||
wp_deregister_style($block_slug);
|
||||
|
||||
if ( isset($block_options['has_theme_script']) && $block_options['has_theme_script'] )
|
||||
wp_deregister_script($block_slug . '-theme');
|
||||
}
|
||||
}
|
||||
|
||||
// No need for any editor side script of the special blocks
|
||||
wp_deregister_script('faceted-search');
|
||||
wp_deregister_style('item-submission-form');
|
||||
|
||||
// If there is no faceted search block, no need for its styles and theme side scripts
|
||||
if ( !has_block('tainacan/faceted-search') || !is_singular() ) {
|
||||
wp_deregister_style('faceted-search');
|
||||
wp_deregister_script('tainacan-search');
|
||||
}
|
||||
|
||||
// If there is no item submission block, no need for its styles and theme side scripts
|
||||
if ( !has_block('tainacan/item-submission-form') || !is_singular() ) {
|
||||
wp_deregister_style('item-submission-form');
|
||||
wp_deregister_script('tainacan-item-submission');
|
||||
wp_deregister_script('tainacan-google-recaptcha-script');
|
||||
}
|
||||
|
||||
// No need for category assets outside the block editor
|
||||
wp_deregister_script('tainacan-blocks-register-category-icon');
|
||||
wp_deregister_style('tainacan-blocks-register-category-icon');
|
||||
|
||||
// If, however we are in the editor side, then no need to load theme side scripts!
|
||||
} else {
|
||||
|
||||
// First, handle the generic blocks
|
||||
foreach(TAINACAN_BLOCKS as $block_slug => $block_options) {
|
||||
if ( isset($block_options['has_theme_script']) && $block_options['has_theme_script'] )
|
||||
wp_deregister_script($block_slug . '-theme');
|
||||
}
|
||||
|
||||
// Then the special ones
|
||||
wp_deregister_script('tainacan-search');
|
||||
wp_deregister_script('tainacan-item-submission');
|
||||
wp_deregister_script('tainacan-google-recaptcha-script');
|
||||
}
|
||||
|
||||
/* Now, lets check if the blocks had been removed by the filter */
|
||||
if (!$post) return;
|
||||
|
||||
$not_allowed = apply_filters('posts-names-to-unregister-tainacan-blocks', []);
|
||||
$current_page = $post->post_name;
|
||||
|
||||
if ( in_array($current_page, $not_allowed) ) {
|
||||
foreach(TAINACAN_BLOCKS as $block_slug => $block_options) {
|
||||
wp_deregister_script($block_slug);
|
||||
wp_deregister_style($block_slug);
|
||||
|
||||
if ( isset($block_options['has_theme_script']) && $block_options['has_theme_script'] )
|
||||
wp_deregister_script($block_slug . '-theme');
|
||||
|
||||
if (function_exists('unregister_block_type'))
|
||||
unregister_block_type('tainacan/' . $block_slug);
|
||||
}
|
||||
|
||||
wp_deregister_script('faceted-search');
|
||||
wp_deregister_script('tainacan-search');
|
||||
wp_deregister_script('item-submission-form');
|
||||
wp_deregister_script('tainacan-google-recaptcha-script');
|
||||
wp_deregister_script('tainacan-blocks-register-category-icon');
|
||||
|
||||
wp_deregister_style('faceted-search');
|
||||
wp_deregister_style('item-submission-form');
|
||||
wp_deregister_style('tainacan-blocks-common-styles');
|
||||
wp_deregister_style('tainacan-blocks-register-category-icon');
|
||||
|
||||
if (function_exists('unregister_block_type')) {
|
||||
unregister_block_type('tainacan/faceted-search');
|
||||
unregister_block_type('tainacan/item-submission-form');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the Taiancan category on the blocks inserter
|
||||
*/
|
||||
function tainacan_blocks_register_categories($categories, $post){
|
||||
|
||||
function tainacan_blocks_register_categories($categories, $editor_context) {
|
||||
return array_merge(
|
||||
$categories,
|
||||
array(
|
||||
|
@ -160,24 +60,42 @@ function tainacan_blocks_register_categories($categories, $post){
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the routines responsible for Registering the global style, category and
|
||||
* both 'generic' and 'special' blocks
|
||||
*/
|
||||
function tainacan_blocks_register_and_enqueue_all_blocks() {
|
||||
tainacan_blocks_get_category_icon_script();
|
||||
tainacan_blocks_get_common_editor_styles();
|
||||
|
||||
foreach(TAINACAN_BLOCKS as $block_slug => $block_options) {
|
||||
tainacan_blocks_register_block($block_slug, $block_options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a 'generic' Tainacan Block, according to the TAINACAN_BLOCKs array
|
||||
*
|
||||
* * @param array $options {
|
||||
* Optional. Array of arguments.
|
||||
* @type boolean $has_theme_script If true, informs that a theme-specific script must be registered
|
||||
* @type array $extra_editor_script_deps Array of strings containing script dependencies of the editor side script
|
||||
* }
|
||||
*/
|
||||
function tainacan_blocks_register_block($block_slug, $options = []) {
|
||||
global $TAINACAN_BASE_URL;
|
||||
global $TAINACAN_VERSION;
|
||||
global $wp_version;
|
||||
|
||||
// Creates Register params based on registered scripts and styles
|
||||
$register_params = [];
|
||||
|
||||
// Defines dependencies for editor script
|
||||
$editor_script_deps = array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor');
|
||||
$editor_script_deps = array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-components');
|
||||
if ( version_compare( $wp_version, '5.2', '<') )
|
||||
$editor_script_deps[] = 'wp-editor';
|
||||
else
|
||||
$editor_script_deps[] = 'wp-block-editor';
|
||||
|
||||
if ( isset($options['extra_editor_script_deps']) )
|
||||
array_merge($editor_script_deps, $options['extra_editor_script_deps']);
|
||||
|
||||
|
@ -191,130 +109,42 @@ function tainacan_blocks_register_block($block_slug, $options = []) {
|
|||
wp_set_script_translations($block_slug, 'tainacan');
|
||||
$register_params['editor_script'] = $block_slug;
|
||||
|
||||
// Registers Theme-side Script, if necessary
|
||||
if ( isset($options['has_theme_script']) && $options['has_theme_script'] ) {
|
||||
wp_enqueue_script(
|
||||
$block_slug . '-theme',
|
||||
$TAINACAN_BASE_URL . '/assets/js/block_' . str_replace('-', '_' , $block_slug) . '_theme.js',
|
||||
array('wp-i18n'),
|
||||
$TAINACAN_VERSION
|
||||
);
|
||||
wp_set_script_translations($block_slug . '-theme', 'tainacan');
|
||||
$register_params['script'] = $block_slug;
|
||||
}
|
||||
|
||||
// Registers style (works for both editor and theme side)
|
||||
// Registers style
|
||||
wp_register_style(
|
||||
$block_slug,
|
||||
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-' . $block_slug . '.css',
|
||||
array('wp-edit-blocks', 'tainacan-blocks-common-styles'),
|
||||
array('tainacan-blocks-common-styles'),
|
||||
$TAINACAN_VERSION
|
||||
);
|
||||
$register_params['style'] = $block_slug;
|
||||
|
||||
// Registers the new block
|
||||
if (function_exists('register_block_type'))
|
||||
register_block_type( 'tainacan/' . $block_slug, $register_params );
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the 'special' Tainacan Block for the Faceted Search (the complete items list)
|
||||
*/
|
||||
function tainacan_blocks_register_tainacan_faceted_search(){
|
||||
global $TAINACAN_BASE_URL;
|
||||
global $TAINACAN_VERSION;
|
||||
|
||||
// Theme side script
|
||||
wp_register_script(
|
||||
'tainacan-search',
|
||||
$TAINACAN_BASE_URL . '/assets/js/theme_search.js',
|
||||
['underscore'],
|
||||
$TAINACAN_VERSION
|
||||
);
|
||||
|
||||
// Editor side script
|
||||
wp_register_script(
|
||||
'faceted-search',
|
||||
$TAINACAN_BASE_URL . '/assets/js/block_faceted_search.js',
|
||||
array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor'),
|
||||
$TAINACAN_VERSION
|
||||
);
|
||||
wp_set_script_translations('faceted-search', 'tainacan');
|
||||
|
||||
// Editor and theme side css
|
||||
wp_register_style(
|
||||
'faceted-search',
|
||||
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-faceted-search.css',
|
||||
array('wp-edit-blocks', 'tainacan-blocks-common-styles'),
|
||||
$TAINACAN_VERSION
|
||||
);
|
||||
|
||||
// Registers new block
|
||||
if (function_exists('register_block_type')) {
|
||||
register_block_type( 'tainacan/faceted-search', array(
|
||||
'editor_script' => 'faceted-search',
|
||||
'style' => 'faceted-search',
|
||||
'script' => 'tainacan-search'
|
||||
) );
|
||||
if ( version_compare( $wp_version, '5.8-RC', '>=') )
|
||||
register_block_type( __DIR__ . '/tainacan-blocks/' . $block_slug );
|
||||
else
|
||||
register_block_type( 'tainacan/' . $block_slug, $register_params );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the 'special' Tainacan Block for the Items Submission
|
||||
* Enqueues the global editor styles necessary for the majority of the blocks
|
||||
*/
|
||||
function tainacan_blocks_register_tainacan_item_submission_form() {
|
||||
function tainacan_blocks_get_common_editor_styles() {
|
||||
global $TAINACAN_BASE_URL;
|
||||
global $TAINACAN_VERSION;
|
||||
|
||||
// Theme side script
|
||||
wp_register_script(
|
||||
'tainacan-item-submission',
|
||||
$TAINACAN_BASE_URL . '/assets/js/item_submission.js',
|
||||
['underscore'],
|
||||
wp_enqueue_style(
|
||||
'tainacan-blocks-common-styles',
|
||||
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-common-styles.css',
|
||||
array(),
|
||||
$TAINACAN_VERSION
|
||||
);
|
||||
|
||||
// Editor side script
|
||||
wp_register_script(
|
||||
'item-submission-form',
|
||||
$TAINACAN_BASE_URL . '/assets/js/block_item_submission_form.js',
|
||||
array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor'),
|
||||
$TAINACAN_VERSION
|
||||
);
|
||||
|
||||
// Registers extra script for Google ReCAPTCHA
|
||||
wp_register_script(
|
||||
'tainacan-google-recaptcha-script',
|
||||
'https://www.google.com/recaptcha/api.js',
|
||||
[], false, true
|
||||
);
|
||||
wp_enqueue_script('tainacan-google-recaptcha-script');
|
||||
|
||||
// Registers extra metadata type forms
|
||||
$theme_helper = \Tainacan\Metadata_Types\Metadata_Type_Helper::get_instance();
|
||||
if (isset($theme_helper))
|
||||
$theme_helper->register_metadata_type_compoment();
|
||||
|
||||
// Editor and Theme side style
|
||||
wp_register_style(
|
||||
'item-submission-form',
|
||||
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-item-submission-form.css',
|
||||
array('wp-edit-blocks', 'tainacan-blocks-common-styles'),
|
||||
$TAINACAN_VERSION
|
||||
);
|
||||
|
||||
// Registers new block
|
||||
if (function_exists('register_block_type')) {
|
||||
register_block_type( 'tainacan/item-submission-form', array(
|
||||
'editor_script' => 'item-submission-form',
|
||||
'style' => 'item-submission-form',
|
||||
'script' => 'tainacan-item-submission'
|
||||
) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the global 'tainacan_blocks' that contain some info from PHP necessary
|
||||
* Generates the global 'tainacan_blocks' that contains some info from PHP necessary
|
||||
* to the blocks scripts in JS
|
||||
*/
|
||||
function tainacan_blocks_get_plugin_js_settings(){
|
||||
|
@ -335,55 +165,54 @@ function tainacan_blocks_get_plugin_js_settings(){
|
|||
}
|
||||
|
||||
/**
|
||||
* Makes the global 'tainacan_blocks' available to the blocks scripts
|
||||
* Efectivelly enqueues the common js and passes the necessary global variables
|
||||
*/
|
||||
function tainacan_blocks_add_plugin_settings() {
|
||||
$settings = tainacan_blocks_get_plugin_js_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
|
||||
wp_localize_script( 'faceted-search', 'tainacan_blocks', $settings );
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the global 'tainacan_plugin' available to some spacial blocks that need it
|
||||
*/
|
||||
function tainacan_blocks_add_plugin_admin_settings() {
|
||||
|
||||
// The faceded search block uses a different settings object, the same used on the theme items list
|
||||
wp_localize_script( 'tainacan-search', 'tainacan_plugin', \Tainacan\Admin::get_instance()->get_admin_js_localization_params() );
|
||||
wp_localize_script( 'faceted-search', 'tainacan_plugin', \Tainacan\Admin::get_instance()->get_admin_js_localization_params() );
|
||||
|
||||
// The item submission search block uses a different settings object, the same used on the item submission component
|
||||
wp_localize_script( 'tainacan-item-submission', 'tainacan_plugin', \Tainacan\Admin::get_instance()->get_admin_js_localization_params() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues the global styles necessary for the majority of the blocks
|
||||
*/
|
||||
function tainacan_blocks_get_common_styles() {
|
||||
function tainacan_blocks_add_common_theme_scripts() {
|
||||
global $TAINACAN_BASE_URL;
|
||||
global $TAINACAN_VERSION;
|
||||
|
||||
wp_enqueue_style(
|
||||
'tainacan-blocks-common-styles',
|
||||
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-common-styles.css',
|
||||
array('wp-edit-blocks'),
|
||||
wp_enqueue_script(
|
||||
'tainacan-blocks-common-theme-scripts',
|
||||
$TAINACAN_BASE_URL . '/assets/js/tainacan_blocks_common_theme_scripts.js',
|
||||
array('wp-i18n'),
|
||||
$TAINACAN_VERSION
|
||||
);
|
||||
|
||||
$block_settings = tainacan_blocks_get_plugin_js_settings();
|
||||
$plugin_settings = \Tainacan\Admin::get_instance()->get_admin_js_localization_params();
|
||||
|
||||
wp_localize_script( 'tainacan-blocks-common-theme-scripts', 'tainacan_blocks', $block_settings);
|
||||
wp_localize_script( 'tainacan-blocks-common-theme-scripts', 'tainacan_plugin', $plugin_settings);
|
||||
|
||||
// Necessary while we don't have a better way to do this only
|
||||
// when item submission block is present
|
||||
tainacan_blocks_add_extra_item_submission_assets();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the extra scripts necessary for item submission block,
|
||||
* even on theme side :/
|
||||
*/
|
||||
function tainacan_blocks_add_extra_item_submission_assets() {
|
||||
|
||||
// Registers extra script for Google ReCAPTCHA
|
||||
wp_register_script(
|
||||
'tainacan-google-recaptcha-script',
|
||||
'https://www.google.com/recaptcha/api.js',
|
||||
[], false, true
|
||||
);
|
||||
wp_enqueue_script('tainacan-google-recaptcha-script');
|
||||
|
||||
// Registers extra metadata type forms
|
||||
$theme_helper = \Tainacan\Metadata_Types\Metadata_Type_Helper::get_instance();
|
||||
if (isset($theme_helper))
|
||||
$theme_helper->register_metadata_type_component();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the script that inserts the Tainacan icon on the blocks category
|
||||
*/
|
||||
function tainacan_blocks_register_category_icon() {
|
||||
function tainacan_blocks_get_category_icon_script() {
|
||||
global $TAINACAN_BASE_URL;
|
||||
global $TAINACAN_VERSION;
|
||||
|
||||
|
@ -393,4 +222,4 @@ function tainacan_blocks_register_category_icon() {
|
|||
array('wp-blocks'),
|
||||
$TAINACAN_VERSION
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,6 +126,10 @@
|
|||
}
|
||||
.components-base-control__field {
|
||||
flex-wrap: wrap;
|
||||
|
||||
.components-select-control {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
label.components-base-control__label {
|
||||
font-weight: 500;
|
||||
|
@ -164,25 +168,20 @@
|
|||
overflow: hidden;
|
||||
padding-left: 1px;
|
||||
}
|
||||
|
||||
svg.components-checkbox-control__checked {
|
||||
fill: black;
|
||||
}
|
||||
|
||||
.modal-checkbox-list-item,
|
||||
.components-radio-control__option {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
|
||||
img {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
label {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
display: inline-block;
|
||||
max-width: 85%;
|
||||
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
const { registerBlockType } = wp.blocks;
|
||||
const { __ } = wp.i18n;
|
||||
|
||||
// Converts non-localized block metadata info to localized ones, for WP versions older than 5.8
|
||||
function tainacanBlocksLocalizeMetadata(metadata) {
|
||||
|
||||
for (let metadatumKey in metadata) {
|
||||
if (metadatumKey == 'title' || metadatumKey == 'description') {
|
||||
metadata[metadatumKey] = __(metadata[metadatumKey], 'tainacan');
|
||||
} else if (metadatumKey == 'keywords') {
|
||||
metadata[metadatumKey].forEach(keyword => {
|
||||
keyword = __(keyword, 'tainacan');
|
||||
});
|
||||
} else if (metadatumKey == 'styles') {
|
||||
metadata[metadatumKey].forEach(style => {
|
||||
style.label = __(style.label, 'tainacan');
|
||||
});
|
||||
}
|
||||
}
|
||||
return metadata;
|
||||
}
|
||||
|
||||
// Register the block type according to WP version
|
||||
export default function({ metadata, icon, edit, save, deprecated }) {
|
||||
|
||||
const currentWPVersion = (typeof tainacan_blocks != 'undefined') ? tainacan_blocks.wp_version : tainacan_plugin.wp_version;
|
||||
if (currentWPVersion >= '5.8-RC') {
|
||||
|
||||
// Registers block type using new strategy from WP 5.8
|
||||
registerBlockType( metadata, {
|
||||
icon: {
|
||||
src: icon,
|
||||
foreground: '#298596',
|
||||
},
|
||||
edit,
|
||||
save,
|
||||
deprecated
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
// Converts this array to a valid array previous to WP 5.8
|
||||
registerBlockType( metadata.name, {
|
||||
...tainacanBlocksLocalizeMetadata(metadata),
|
||||
icon: {
|
||||
src: icon,
|
||||
foreground: '#298596',
|
||||
},
|
||||
edit,
|
||||
save,
|
||||
deprecated
|
||||
});
|
||||
}
|
||||
};
|
|
@ -2,10 +2,12 @@ const { Button, Toolbar, ToolbarGroup, ToolbarButton } = wp.components;
|
|||
|
||||
export default function TainacanBlocksCompatToolbar({ label, icon, onClick, onClickParams, controls }) {
|
||||
|
||||
const currentWPVersion = (typeof tainacan_blocks != 'undefined') ? currentWPVersion : tainacan_plugin.wp_version;
|
||||
|
||||
if (controls !== undefined)
|
||||
return tainacan_blocks.wp_version < '5.4' ? <Toolbar controls={ controls } /> : <ToolbarGroup controls={ controls } />
|
||||
return currentWPVersion < '5.4' ? <Toolbar controls={ controls } /> : <ToolbarGroup controls={ controls } />
|
||||
else
|
||||
return tainacan_blocks.wp_version < '5.4' ?
|
||||
return currentWPVersion < '5.4' ?
|
||||
<Button style={{ whiteSpace: 'nowrap', backgroundColor: '#fff', alignItems: 'center', borderTop: '1px solid #b5bcc2', borderBottom: '1px solid #b5bcc2' }} onClick={ () => onClick(onClickParams) }>
|
||||
<p style={{ margin: 0 }}>
|
||||
{ icon }
|
||||
|
@ -14,7 +16,7 @@ export default function TainacanBlocksCompatToolbar({ label, icon, onClick, onCl
|
|||
</Button>
|
||||
:
|
||||
<ToolbarGroup>
|
||||
{ tainacan_blocks.wp_version < '5.5' ?
|
||||
{ currentWPVersion < '5.5' ?
|
||||
<Button style={{ whiteSpace: 'nowrap' }} onClick={ () => onClick(onClickParams) }>
|
||||
<p>
|
||||
{ icon }
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
import Swiper from 'swiper';
|
||||
import 'swiper/css/swiper.min.css';
|
||||
|
||||
export default Swiper;
|
|
@ -0,0 +1,106 @@
|
|||
{
|
||||
"name": "tainacan/carousel-collections-list",
|
||||
"title": "Tainacan Collections Carousel",
|
||||
"category": "tainacan-blocks",
|
||||
"keywords": [ "collections", "carousel", "slider" ],
|
||||
"description": "List collections on a Carousel, displaying either its thumbnail or a preview of its items.",
|
||||
"textdomain": "tainacan",
|
||||
"supports": {
|
||||
"align": ["full", "wide"],
|
||||
"html": false,
|
||||
"multiple": true,
|
||||
"typography": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"attributes": {
|
||||
"content": "preview"
|
||||
}
|
||||
},
|
||||
"attributes": {
|
||||
"content": {
|
||||
"type": "array",
|
||||
"source": "children",
|
||||
"selector": "div"
|
||||
},
|
||||
"collections": {
|
||||
"type": "Array",
|
||||
"default": []
|
||||
},
|
||||
"isModalOpen": {
|
||||
"type": "Boolean",
|
||||
"default": false
|
||||
},
|
||||
"selectedCollections": {
|
||||
"type": "Array",
|
||||
"default": []
|
||||
},
|
||||
"itemsRequestSource": {
|
||||
"type": "String",
|
||||
"default": false
|
||||
},
|
||||
"maxCollectionsNumber": {
|
||||
"type": "Number",
|
||||
"value": false
|
||||
},
|
||||
"maxCollectionsPerScreen": {
|
||||
"type": "Number",
|
||||
"value": 6
|
||||
},
|
||||
"isLoading": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"isLoadingCollection": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"arrowsPosition": {
|
||||
"type": "String",
|
||||
"value": "around"
|
||||
},
|
||||
"largeArrows": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"autoPlay": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"autoPlaySpeed": {
|
||||
"type": "Number",
|
||||
"value": 3
|
||||
},
|
||||
"loopSlides": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"hideName": {
|
||||
"type": "Boolean",
|
||||
"value": true
|
||||
},
|
||||
"showCollectionThumbnail": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"cropImagesToSquare": {
|
||||
"type": "Boolean",
|
||||
"value": true
|
||||
},
|
||||
"blockId": {
|
||||
"type": "String",
|
||||
"default": ""
|
||||
},
|
||||
"collectionBackgroundColor": {
|
||||
"type": "String",
|
||||
"default": "#454647"
|
||||
},
|
||||
"collectionTextColor": {
|
||||
"type": "String",
|
||||
"default": "#ffffff"
|
||||
}
|
||||
},
|
||||
"editorScript": "carousel-collections-list",
|
||||
"editorStyle": "carousel-collections-list"
|
||||
}
|
|
@ -1,4 +1,135 @@
|
|||
export default [
|
||||
/* Deprecated on Tainacan 0.18.4, due to new block.json strategy */
|
||||
{
|
||||
attributes: {
|
||||
content: {
|
||||
type: 'array',
|
||||
source: 'children',
|
||||
selector: 'div'
|
||||
},
|
||||
collections: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
isModalOpen: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
selectedCollections: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
itemsRequestSource: {
|
||||
type: String,
|
||||
default: undefined
|
||||
},
|
||||
maxCollectionsNumber: {
|
||||
type: Number,
|
||||
value: undefined
|
||||
},
|
||||
maxCollectionsPerScreen: {
|
||||
type: Number,
|
||||
value: 6
|
||||
},
|
||||
isLoading: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
isLoadingCollection: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
arrowsPosition: {
|
||||
type: String,
|
||||
value: 'search'
|
||||
},
|
||||
largeArrows: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
autoPlay: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
autoPlaySpeed: {
|
||||
type: Number,
|
||||
value: 3
|
||||
},
|
||||
loopSlides: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
hideName: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
showCollectionThumbnail: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
cropImagesToSquare: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
collection: {
|
||||
type: Object,
|
||||
value: undefined
|
||||
},
|
||||
blockId: {
|
||||
type: String,
|
||||
default: undefined
|
||||
},
|
||||
collectionBackgroundColor: {
|
||||
type: String,
|
||||
default: "#454647"
|
||||
},
|
||||
collectionTextColor: {
|
||||
type: String,
|
||||
default: "#ffffff"
|
||||
}
|
||||
},
|
||||
supports: {
|
||||
align: ['full', 'wide'],
|
||||
html: false,
|
||||
multiple: true,
|
||||
fontSize: true
|
||||
},
|
||||
save({ attributes, className }){
|
||||
const {
|
||||
content,
|
||||
blockId,
|
||||
selectedCollections,
|
||||
arrowsPosition,
|
||||
largeArrows,
|
||||
cropImagesToSquare,
|
||||
maxCollectionsPerScreen,
|
||||
maxCollectionsNumber,
|
||||
autoPlay,
|
||||
autoPlaySpeed,
|
||||
loopSlides,
|
||||
hideName,
|
||||
showCollectionThumbnail
|
||||
} = attributes;
|
||||
return <div
|
||||
className={ className }
|
||||
selected-collections={ JSON.stringify(selectedCollections.map((collection) => { return collection.id })) }
|
||||
arrows-position={ arrowsPosition }
|
||||
auto-play={ '' + autoPlay }
|
||||
auto-play-speed={ autoPlaySpeed }
|
||||
loop-slides={ '' + loopSlides }
|
||||
hide-name={ '' + hideName }
|
||||
large-arrows={ '' + largeArrows }
|
||||
crop-images-to-square={ '' + cropImagesToSquare }
|
||||
max-collections-number={ maxCollectionsNumber }
|
||||
max-collections-per-screen={ maxCollectionsPerScreen }
|
||||
tainacan-api-root={ tainacan_blocks.root }
|
||||
tainacan-base-url={ tainacan_blocks.base_url }
|
||||
show-collection-thumbnail={ '' + showCollectionThumbnail }
|
||||
id={ 'wp-block-tainacan-carousel-collections-list_' + blockId }>
|
||||
{ content }
|
||||
</div>
|
||||
}
|
||||
},
|
||||
/* Deprecated on Tainacan 0.17.2, due to the introduction of support: fontSize */
|
||||
{
|
||||
attributes: {
|
|
@ -0,0 +1,449 @@
|
|||
const { RangeControl, Spinner, Button, BaseControl, ToggleControl, SelectControl, Placeholder, IconButton, PanelBody } = wp.components;
|
||||
|
||||
const { InspectorControls, BlockControls } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
|
||||
const { __ } = wp.i18n;
|
||||
|
||||
import CarouselCollectionsModal from './carousel-collections-modal.js';
|
||||
import tainacan from '../../js/axios.js';
|
||||
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 'swiper/css/swiper.min.css';
|
||||
|
||||
export default function ({ attributes, setAttributes, className, isSelected, clientId }) {
|
||||
let {
|
||||
collections,
|
||||
content,
|
||||
isModalOpen,
|
||||
itemsRequestSource,
|
||||
selectedCollections,
|
||||
largeArrows,
|
||||
cropImagesToSquare,
|
||||
maxCollectionsPerScreen,
|
||||
isLoading,
|
||||
arrowsPosition,
|
||||
autoPlay,
|
||||
autoPlaySpeed,
|
||||
loopSlides,
|
||||
hideName,
|
||||
showCollectionThumbnail
|
||||
} = attributes;
|
||||
|
||||
// Obtains block's client id to render it on save function
|
||||
setAttributes({ blockId: clientId });
|
||||
|
||||
// Sets some defaults that were not working
|
||||
if (maxCollectionsPerScreen === undefined) {
|
||||
maxCollectionsPerScreen = 6;
|
||||
setAttributes({ maxCollectionsPerScreen: maxCollectionsPerScreen });
|
||||
}
|
||||
if (cropImagesToSquare === undefined) {
|
||||
cropImagesToSquare = true;
|
||||
setAttributes({ cropImagesToSquare: cropImagesToSquare });
|
||||
}
|
||||
|
||||
const thumbHelper = ThumbnailHelperFunctions();
|
||||
|
||||
function prepareItem(collection, collectionItems) {
|
||||
return (
|
||||
<li
|
||||
key={ collection.id }
|
||||
className={ 'collection-list-item ' + (!showCollectionThumbnail ? 'collection-list-item-grid ' : '') + (maxCollectionsPerScreen ? ' max-collections-per-screen-' + maxCollectionsPerScreen : '') }>
|
||||
{ tainacan_blocks.wp_version < '5.4' ?
|
||||
<IconButton
|
||||
onClick={ () => removeItemOfId(collection.id) }
|
||||
icon="no-alt"
|
||||
label={__('Remove', 'tainacan')}/>
|
||||
:
|
||||
<Button
|
||||
onClick={ () => removeItemOfId(collection.id) }
|
||||
icon="no-alt"
|
||||
label={__('Remove', 'tainacan')}/>
|
||||
}
|
||||
<a
|
||||
id={ isNaN(collection.id) ? collection.id : 'collection-id-' + collection.id }
|
||||
href={ collection.url }
|
||||
target="_blank">
|
||||
{ !showCollectionThumbnail ?
|
||||
<div class="collection-items-grid">
|
||||
<img
|
||||
src={ collectionItems[0] ? thumbHelper.getSrc(collectionItems[0]['thumbnail'], 'tainacan-medium', collectionItems[0]['document_mimetype']) :`${tainacan_blocks.base_url}/assets/images/placeholder_square.png` }
|
||||
srcSet={ collectionItems[0] ? thumbHelper.getSrcSet(collectionItems[0]['thumbnail'], 'tainacan-medium', collectionItems[0]['document_mimetype']) :`${tainacan_blocks.base_url}/assets/images/placeholder_square.png` }
|
||||
alt={ collectionItems[0] && collectionItems[0].thumbnail_alt ? collectionItems[0].thumbnail_alt : (collectionItems[0] && collectionItems[0].name ? collectionItems[0].name : __( 'Thumbnail', 'tainacan' )) } />
|
||||
<img
|
||||
src={ collectionItems[1] ? thumbHelper.getSrc(collectionItems[1]['thumbnail'], 'tainacan-medium', collectionItems[1]['document_mimetype']) :`${tainacan_blocks.base_url}/assets/images/placeholder_square.png` }
|
||||
srcSet={ collectionItems[1] ? thumbHelper.getSrcSet(collectionItems[1]['thumbnail'], 'tainacan-medium', collectionItems[1]['document_mimetype']) :`${tainacan_blocks.base_url}/assets/images/placeholder_square.png` }
|
||||
alt={ collectionItems[1] && collectionItems[1].thumbnail_alt ? collectionItems[1].thumbnail_alt : (collectionItems[1] && collectionItems[1].name ? collectionItems[1].name : __( 'Thumbnail', 'tainacan' )) } />
|
||||
<img
|
||||
src={ collectionItems[2] ? thumbHelper.getSrc(collectionItems[2]['thumbnail'], 'tainacan-medium', collectionItems[2]['document_mimetype']) :`${tainacan_blocks.base_url}/assets/images/placeholder_square.png` }
|
||||
srcSet={ collectionItems[2] ? thumbHelper.getSrcSet(collectionItems[2]['thumbnail'], 'tainacan-medium', collectionItems[2]['document_mimetype']) :`${tainacan_blocks.base_url}/assets/images/placeholder_square.png` }
|
||||
alt={ collectionItems[2] && collectionItems[2].thumbnail_alt ? collectionItems[2].thumbnail_alt : (collectionItems[2] && collectionItems[2].name ? collectionItems[2].name : __( 'Thumbnail', 'tainacan' )) } />
|
||||
</div>
|
||||
:
|
||||
<img
|
||||
src={
|
||||
collection.thumbnail && collection.thumbnail[maxCollectionsPerScreen > 4 ? (!cropImagesToSquare ? 'tainacan-medium-full' : 'tainacan-medium') : 'full'][0] && collection.thumbnail[maxCollectionsPerScreen > 4 ? (!cropImagesToSquare ? 'tainacan-medium-full' : 'tainacan-medium') : 'full'][0]
|
||||
?
|
||||
collection.thumbnail[maxCollectionsPerScreen > 4 ? (!cropImagesToSquare ? 'tainacan-medium-full' : 'tainacan-medium') : 'full'][0]
|
||||
:
|
||||
(collection.thumbnail && collection.thumbnail['thumbnail'][0] && collection.thumbnail['thumbnail'][0]
|
||||
?
|
||||
collection.thumbnail['thumbnail'][0]
|
||||
:
|
||||
`${tainacan_blocks.base_url}/assets/images/placeholder_square.png`)
|
||||
}
|
||||
alt={ collection.name ? collection.name : __( 'Thumbnail', 'tainacan' ) }/>
|
||||
}
|
||||
{ !hideName ? <span>{ collection.name ? collection.name : '' }</span> : null }
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
function setContent(){
|
||||
isLoading = true;
|
||||
|
||||
setAttributes({
|
||||
isLoading: isLoading
|
||||
});
|
||||
|
||||
if (itemsRequestSource != undefined && typeof itemsRequestSource == 'function')
|
||||
itemsRequestSource.cancel('Previous collections search canceled.');
|
||||
|
||||
itemsRequestSource = axios.CancelToken.source();
|
||||
|
||||
collections = [];
|
||||
|
||||
let endpoint = '/collections?'+ qs.stringify({ postin: selectedCollections.map((collection) => { return collection.id }), perpage: selectedCollections.length }) + '&fetch_only=name,url,thumbnail';
|
||||
tainacan.get(endpoint, { cancelToken: itemsRequestSource.token })
|
||||
.then(response => {
|
||||
|
||||
if (showCollectionThumbnail) {
|
||||
for (let collection of response.data) {
|
||||
collections.push(prepareItem(collection));
|
||||
}
|
||||
setAttributes({
|
||||
content: <div></div>,
|
||||
collections: collections,
|
||||
isLoading: false,
|
||||
itemsRequestSource: itemsRequestSource
|
||||
});
|
||||
} else {
|
||||
let promises = [];
|
||||
for (let collection of response.data) {
|
||||
promises.push(
|
||||
tainacan.get('/collection/' + collection.id + '/items?perpage=3&fetch_only=name,url,thumbnail')
|
||||
.then(response => { return({ collection: collection, collectionItems: response.data.items }) })
|
||||
.catch((error) => console.log(error))
|
||||
);
|
||||
}
|
||||
axios.all(promises).then((results) => {
|
||||
for (let result of results) {
|
||||
collections.push(prepareItem(result.collection, result.collectionItems));
|
||||
}
|
||||
setAttributes({
|
||||
content: <div></div>,
|
||||
collections: collections,
|
||||
isLoading: false,
|
||||
itemsRequestSource: itemsRequestSource
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function openCarouselModal() {
|
||||
isModalOpen = true;
|
||||
setAttributes( {
|
||||
isModalOpen: isModalOpen
|
||||
} );
|
||||
}
|
||||
|
||||
function removeItemOfId(itemId) {
|
||||
|
||||
let existingItemIndex = collections.findIndex((existingItem) => existingItem.key == itemId);
|
||||
if (existingItemIndex >= 0)
|
||||
collections.splice(existingItemIndex, 1);
|
||||
|
||||
let existingSelectedItemIndex = selectedCollections.findIndex((existingSelectedItem) => existingSelectedItem.id == itemId);
|
||||
if (existingSelectedItemIndex >= 0)
|
||||
selectedCollections.splice(existingSelectedItemIndex, 1);
|
||||
|
||||
setAttributes({
|
||||
selectedCollections: selectedCollections,
|
||||
collections: collections,
|
||||
content: <div></div>
|
||||
});
|
||||
}
|
||||
|
||||
// Executed only on the first load of page
|
||||
if(content && content.length && content[0].type)
|
||||
setContent();
|
||||
|
||||
return content == 'preview' ?
|
||||
<div className={className}>
|
||||
<img
|
||||
width="100%"
|
||||
src={ `${tainacan_blocks.base_url}/assets/images/carousel-collections-list.png` } />
|
||||
</div>
|
||||
: (
|
||||
<div className={className}>
|
||||
|
||||
{ collections.length ?
|
||||
<BlockControls>
|
||||
{
|
||||
TainacanBlocksCompatToolbar({
|
||||
label: __('Add more collections', 'tainacan'),
|
||||
icon: <svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 -2 24 24"
|
||||
height="24px"
|
||||
width="24px">
|
||||
<path d="M18,17v2H12a5.65,5.65,0,0,0-.36-2ZM2,7v7.57a5.74,5.74,0,0,1,2-1.2V7ZM20,6H15L13,4H8A2,2,0,0,0,6,6v7a6,6,0,0,1,5.19,3H20a2,2,0,0,0,2-2V8A2,2,0,0,0,20,6ZM7,16.05v6.06l3.06-3.06ZM5,22.11V16.05L1.94,19.11Z"/>
|
||||
</svg>,
|
||||
onClick: openCarouselModal
|
||||
})
|
||||
}
|
||||
</BlockControls>
|
||||
: null }
|
||||
|
||||
<div>
|
||||
<InspectorControls>
|
||||
|
||||
<PanelBody
|
||||
title={__('Carousel', 'tainacan')}
|
||||
initialOpen={ true }
|
||||
>
|
||||
<BaseControl
|
||||
id="collection-carousel-view-modes"
|
||||
label={ __('Collection layout', 'tainacan')}>
|
||||
<div className="collection-carousel-view-modes">
|
||||
<button
|
||||
onClick={ () => {
|
||||
showCollectionThumbnail = false;
|
||||
setAttributes({ showCollectionThumbnail: showCollectionThumbnail });
|
||||
setContent();
|
||||
}
|
||||
}
|
||||
className={'collection-carousel-view-mode-grid' + (showCollectionThumbnail ? '' : ' is-active')}>
|
||||
<div>
|
||||
<div />
|
||||
<div />
|
||||
<div />
|
||||
</div>
|
||||
<label>{ __('Items\'s grid', 'tainacan') }</label>
|
||||
</button>
|
||||
<button
|
||||
onClick={ () => {
|
||||
showCollectionThumbnail = true;
|
||||
setAttributes({ showCollectionThumbnail: showCollectionThumbnail });
|
||||
setContent();
|
||||
}
|
||||
}
|
||||
className={'collection-carousel-view-mode-thumbnail' + (showCollectionThumbnail ? ' is-active' : '')}>
|
||||
<div />
|
||||
<label>{ __('Thumbnail', 'tainacan') }</label>
|
||||
</button>
|
||||
</div>
|
||||
</BaseControl>
|
||||
<RangeControl
|
||||
label={ __('Maximum collections per slide on a wide screen', 'tainacan') }
|
||||
help={ (showCollectionThumbnail && maxCollectionsPerScreen <= 4) ? __('Warning: with such a small number of collections per slide, the image size is greater, thus the cropped version of the thumbnail won\'t be used.', 'tainacan') : null }
|
||||
value={ maxCollectionsPerScreen ? maxCollectionsPerScreen : 6 }
|
||||
onChange={ ( aMaxCollectionsPerScreen ) => {
|
||||
maxCollectionsPerScreen = aMaxCollectionsPerScreen;
|
||||
setAttributes( { maxCollectionsPerScreen: aMaxCollectionsPerScreen } );
|
||||
setContent();
|
||||
}}
|
||||
min={ 1 }
|
||||
max={ 9 }
|
||||
/>
|
||||
{ showCollectionThumbnail ?
|
||||
<ToggleControl
|
||||
label={__('Crop Images', 'tainacan')}
|
||||
help={ cropImagesToSquare && maxCollectionsPerScreen > 4 ? __('Do not use square cropeed version of the collection thumbnail.', 'tainacan') : __('Toggle to use square cropped version of the collection thumbnail.', 'tainacan') }
|
||||
checked={ cropImagesToSquare && maxCollectionsPerScreen > 4 }
|
||||
onChange={ ( isChecked ) => {
|
||||
cropImagesToSquare = isChecked;
|
||||
setAttributes({ cropImagesToSquare: cropImagesToSquare });
|
||||
setContent();
|
||||
}
|
||||
}
|
||||
/>
|
||||
: null }
|
||||
<ToggleControl
|
||||
label={__('Hide name', 'tainacan')}
|
||||
help={ !hideName ? __('Toggle to hide collection\'s name', 'tainacan') : __('Do not hide collection\'s name', 'tainacan')}
|
||||
checked={ hideName }
|
||||
onChange={ ( isChecked ) => {
|
||||
hideName = isChecked;
|
||||
setAttributes({ hideName: hideName });
|
||||
setContent();
|
||||
}
|
||||
}
|
||||
/>
|
||||
<ToggleControl
|
||||
label={__('Loop slides', 'tainacan')}
|
||||
help={ !loopSlides ? __('Toggle to make slides loop from first to last', 'tainacan') : __('Do not loop slides from first to last', 'tainacan')}
|
||||
checked={ loopSlides }
|
||||
onChange={ ( isChecked ) => {
|
||||
loopSlides = isChecked;
|
||||
setAttributes({ loopSlides: loopSlides });
|
||||
}
|
||||
}
|
||||
/>
|
||||
<ToggleControl
|
||||
label={__('Auto play', 'tainacan')}
|
||||
help={ !autoPlay ? __('Toggle to automatically slide to next collection', 'tainacan') : __('Do not automatically slide to next collection', 'tainacan')}
|
||||
checked={ autoPlay }
|
||||
onChange={ ( isChecked ) => {
|
||||
autoPlay = isChecked;
|
||||
setAttributes({ autoPlay: autoPlay });
|
||||
}
|
||||
}
|
||||
/>
|
||||
{
|
||||
autoPlay ?
|
||||
<RangeControl
|
||||
label={__('Seconds before translating to next', 'tainacan')}
|
||||
value={ autoPlaySpeed ? autoPlaySpeed : 3 }
|
||||
onChange={ ( aAutoPlaySpeed ) => {
|
||||
autoPlaySpeed = aAutoPlaySpeed;
|
||||
setAttributes( { autoPlaySpeed: aAutoPlaySpeed } )
|
||||
}}
|
||||
min={ 1 }
|
||||
max={ 5 }
|
||||
/>
|
||||
: null
|
||||
}
|
||||
<SelectControl
|
||||
label={__('Arrows', 'tainacan')}
|
||||
value={ arrowsPosition }
|
||||
options={ [
|
||||
{ label: __('Around', 'tainacan'), value: 'around' },
|
||||
{ label: __('Left', 'tainacan'), value: 'left' },
|
||||
{ label: __('Right', 'tainacan'), value: 'right' }
|
||||
] }
|
||||
onChange={ ( aPosition ) => {
|
||||
arrowsPosition = aPosition;
|
||||
|
||||
setAttributes({ arrowsPosition: arrowsPosition });
|
||||
}}/>
|
||||
<ToggleControl
|
||||
label={__('Large arrows', 'tainacan')}
|
||||
help={ !largeArrows ? __('Toggle to display arrows bigger than the default size.', 'tainacan') : __('Do not show arrows bigger than the default size.', 'tainacan')}
|
||||
checked={ largeArrows }
|
||||
onChange={ ( isChecked ) => {
|
||||
largeArrows = isChecked;
|
||||
setAttributes({ largeArrows: largeArrows });
|
||||
}
|
||||
}
|
||||
/>
|
||||
</PanelBody>
|
||||
</InspectorControls>
|
||||
</div>
|
||||
|
||||
{ isSelected ?
|
||||
(
|
||||
<div>
|
||||
{ isModalOpen ?
|
||||
<CarouselCollectionsModal
|
||||
selectedCollectionsObject={ selectedCollections }
|
||||
onApplySelection={ (aSelectionOfCollections) => {
|
||||
selectedCollections = aSelectionOfCollections;
|
||||
setAttributes({
|
||||
selectedCollections: aSelectionOfCollections,
|
||||
isModalOpen: false
|
||||
});
|
||||
setContent();
|
||||
}}
|
||||
onCancelSelection={ () => setAttributes({ isModalOpen: false }) }/>
|
||||
: null
|
||||
}
|
||||
|
||||
</div>
|
||||
) : null
|
||||
}
|
||||
|
||||
{ !collections.length && !isLoading ? (
|
||||
<Placeholder
|
||||
className="tainacan-block-placeholder"
|
||||
icon={(
|
||||
<img
|
||||
width={148}
|
||||
src={ `${tainacan_blocks.base_url}/assets/images/tainacan_logo_header.svg` }
|
||||
alt="Tainacan Logo"/>
|
||||
)}>
|
||||
<p>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
height="24px"
|
||||
width="24px">
|
||||
<path d="M18,17v2H12a5.65,5.65,0,0,0-.36-2ZM2,7v7.57a5.74,5.74,0,0,1,2-1.2V7ZM20,6H15L13,4H8A2,2,0,0,0,6,6v7a6,6,0,0,1,5.19,3H20a2,2,0,0,0,2-2V8A2,2,0,0,0,20,6ZM7,16.05v6.06l3.06-3.06ZM5,22.11V16.05L1.94,19.11Z"/>
|
||||
</svg>
|
||||
{__('List collections on a Carousel, showing their thumbnails or a preview of items.', 'tainacan')}
|
||||
</p>
|
||||
<Button
|
||||
isPrimary
|
||||
type="button"
|
||||
onClick={ () => openCarouselModal() }>
|
||||
{__('Select Collections', 'tainacan')}
|
||||
</Button>
|
||||
</Placeholder>
|
||||
) : null
|
||||
}
|
||||
|
||||
{ isLoading ?
|
||||
<div class="spinner-container">
|
||||
<Spinner />
|
||||
</div> :
|
||||
<div>
|
||||
{ isSelected && collections.length ?
|
||||
<div class="preview-warning">{__('Warning: this is just a demonstration. To see the carousel in action, either preview or publish your post.', 'tainacan')}</div>
|
||||
: null
|
||||
}
|
||||
{ collections.length ? (
|
||||
<div
|
||||
className={'collections-list-edit-container ' + (arrowsPosition ? 'has-arrows-' + arrowsPosition : '') + (largeArrows ? ' has-large-arrows' : '') }>
|
||||
<button
|
||||
class="swiper-button-prev"
|
||||
slot="button-prev"
|
||||
style={{ cursor: 'not-allowed' }}>
|
||||
<svg
|
||||
width={ largeArrows ? 60 : 42 }
|
||||
height={ largeArrows ? 60 : 42 }
|
||||
viewBox="0 0 24 24">
|
||||
<path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
|
||||
<path
|
||||
d="M0 0h24v24H0z"
|
||||
fill="none"/>
|
||||
</svg>
|
||||
</button>
|
||||
<ul className={'collections-list-edit'}>
|
||||
{ collections }
|
||||
</ul>
|
||||
<button
|
||||
class="swiper-button-next"
|
||||
slot="button-next"
|
||||
style={{ cursor: 'not-allowed' }}>
|
||||
<svg
|
||||
width={ largeArrows ? 60 : 42 }
|
||||
height={ largeArrows ? 60 : 42 }
|
||||
viewBox="0 0 24 24">
|
||||
<path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/>
|
||||
<path
|
||||
d="M0 0h24v24H0z"
|
||||
fill="none"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
):null
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
const { SVG, Path } = wp.components;
|
||||
|
||||
export default (
|
||||
<SVG xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' height='24px' width='24px'>
|
||||
<Path d='M18,17v2H12a5.65,5.65,0,0,0-.36-2ZM2,7v7.57a5.74,5.74,0,0,1,2-1.2V7ZM20,6H15L13,4H8A2,2,0,0,0,6,6v7a6,6,0,0,1,5.19,3H20a2,2,0,0,0,2-2V8A2,2,0,0,0,20,6ZM7,16.05v6.06l3.06-3.06ZM5,22.11V16.05L1.94,19.11Z'/>
|
||||
</SVG>
|
||||
);
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
import tainacanRegisterBlockType from '../../js/tainacan-blocks-compat-register.js';
|
||||
|
||||
import metadata from './block.json';
|
||||
import icon from './icon.js';
|
||||
import edit from './edit.js';
|
||||
import save from './save.js';
|
||||
import deprecated from './deprecated.js';
|
||||
|
||||
tainacanRegisterBlockType({
|
||||
metadata,
|
||||
icon,
|
||||
edit,
|
||||
save,
|
||||
deprecated
|
||||
});
|
|
@ -0,0 +1,36 @@
|
|||
export default function ({ attributes, className }) {
|
||||
const {
|
||||
content,
|
||||
blockId,
|
||||
selectedCollections,
|
||||
arrowsPosition,
|
||||
largeArrows,
|
||||
cropImagesToSquare,
|
||||
maxCollectionsPerScreen,
|
||||
maxCollectionsNumber,
|
||||
autoPlay,
|
||||
autoPlaySpeed,
|
||||
loopSlides,
|
||||
hideName,
|
||||
showCollectionThumbnail
|
||||
} = attributes;
|
||||
return <div
|
||||
data-module="carousel-collections-list"
|
||||
className={ className }
|
||||
selected-collections={ JSON.stringify(selectedCollections.map((collection) => { return collection.id })) }
|
||||
arrows-position={ arrowsPosition }
|
||||
auto-play={ '' + autoPlay }
|
||||
auto-play-speed={ autoPlaySpeed }
|
||||
loop-slides={ '' + loopSlides }
|
||||
hide-name={ '' + hideName }
|
||||
large-arrows={ '' + largeArrows }
|
||||
crop-images-to-square={ '' + cropImagesToSquare }
|
||||
max-collections-number={ maxCollectionsNumber }
|
||||
max-collections-per-screen={ maxCollectionsPerScreen }
|
||||
tainacan-api-root={ tainacan_blocks.root }
|
||||
tainacan-base-url={ tainacan_blocks.base_url }
|
||||
show-collection-thumbnail={ '' + showCollectionThumbnail }
|
||||
id={ 'wp-block-tainacan-carousel-collections-list_' + blockId }>
|
||||
{ content }
|
||||
</div>
|
||||
};
|
|
@ -173,6 +173,7 @@
|
|||
&>*:first-of-type {
|
||||
flex-basis: 100%;
|
||||
@include grid-child(1, 3, 1, 3);
|
||||
padding-bottom: 100% !important;
|
||||
}
|
||||
|
||||
&>* {
|
||||
|
@ -201,6 +202,7 @@
|
|||
top: calc(50% - 42px);
|
||||
bottom: initial;
|
||||
background: none;
|
||||
background-color: transparent !important;
|
||||
border: none;
|
||||
width: 42px;
|
||||
height: 42px;
|
|
@ -0,0 +1,102 @@
|
|||
import Vue from 'vue';
|
||||
import CarouselCollectionsListTheme from './theme.vue';
|
||||
import { ThumbnailHelperPlugin } from '../../../admin/js/utilities.js';
|
||||
import VueBlurHash from 'vue-blurhash';
|
||||
|
||||
export default (element) => {
|
||||
|
||||
// Vue Dev Tools!
|
||||
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development';
|
||||
|
||||
function renderTainacanCollectionsCarouselBlocks() {
|
||||
|
||||
// Gets all divs with content created by our block;
|
||||
let blocksElements = element ? [ element ] : document.getElementsByClassName('wp-block-tainacan-carousel-collections-list');
|
||||
|
||||
if (blocksElements) {
|
||||
let blocks = Object.values(blocksElements);
|
||||
|
||||
// Checks if this carousel isn't already mounted
|
||||
blocks = blocks.filter((block) => block.classList && !block.classList.contains('has-mounted'));
|
||||
const blockIds = Object.values(blocks).map((block) => block.id);
|
||||
|
||||
// Creates a new Vue Instance to manage each block isolatelly
|
||||
for (let blockId of blockIds) {
|
||||
|
||||
// Configure Vue logic before passing it to constructor:
|
||||
let vueOptions = {
|
||||
data: {
|
||||
selectedItem: [],
|
||||
maxItemsNumber: 12,
|
||||
arrowsPosition: 'around',
|
||||
autoPlay: false,
|
||||
autoPlaySpeed: 3,
|
||||
largeArrows: false,
|
||||
maxCollectionsPerScreen: 6,
|
||||
cropImagesToSquare: true,
|
||||
loopSlides: false,
|
||||
hideName: true,
|
||||
showCollectionThumbnail: false,
|
||||
tainacanApiRoot: '',
|
||||
tainacanBaseUrl: '',
|
||||
className: ''
|
||||
},
|
||||
render(h){
|
||||
return h(CarouselCollectionsListTheme, {
|
||||
props: {
|
||||
blockId: blockId,
|
||||
selectedCollections: this.selectedCollections,
|
||||
maxItemsNumber: this.maxItemsNumber,
|
||||
arrowsPosition: this.arrowsPosition,
|
||||
autoPlay: this.autoPlay,
|
||||
autoPlaySpeed: this.autoPlaySpeed,
|
||||
loopSlides: this.loopSlides,
|
||||
largeArrows: this.largeArrows,
|
||||
cropImagesToSquare: this.cropImagesToSquare,
|
||||
maxCollectionsPerScreen: this.maxCollectionsPerScreen,
|
||||
hideName: this.hideName,
|
||||
showCollectionThumbnail: this.showCollectionThumbnail,
|
||||
tainacanApiRoot: this.tainacanApiRoot,
|
||||
tainacanBaseUrl: this.tainacanBaseUrl,
|
||||
className: this.className,
|
||||
}
|
||||
});
|
||||
},
|
||||
beforeMount () {
|
||||
this.className = this.$el.attributes.class != undefined ? this.$el.attributes.class.value : undefined;
|
||||
this.selectedCollections = this.$el.attributes['selected-collections'] != undefined ? JSON.parse(this.$el.attributes['selected-collections'].value) : undefined;
|
||||
this.maxItemsNumber = this.$el.attributes['max-collections-number'] != undefined ? this.$el.attributes['max-collections-number'].value : undefined;
|
||||
this.maxCollectionsPerScreen = this.$el.attributes['max-collections-per-screen'] != undefined ? this.$el.attributes['max-collections-per-screen'].value : 6;
|
||||
this.arrowsPosition = this.$el.attributes['arrows-position'] != undefined ? this.$el.attributes['arrows-position'].value : undefined;
|
||||
this.autoPlay = this.$el.attributes['auto-play'] != undefined ? this.$el.attributes['auto-play'].value == 'true' : false;
|
||||
this.largeArrows = this.$el.attributes['large-arrows'] != undefined ? this.$el.attributes['large-arrows'].value == 'true' : false;
|
||||
this.autoPlaySpeed = this.$el.attributes['auto-play-speed'] != undefined ? this.$el.attributes['auto-play-speed'].value : 3;
|
||||
this.loopSlides = this.$el.attributes['loop-slides'] != undefined ? this.$el.attributes['loop-slides'].value == 'true' : false;
|
||||
this.cropImagesToSquare = this.$el.attributes['crop-images-to-square'] != undefined ? this.$el.attributes['crop-images-to-square'].value == 'true' : false;
|
||||
this.hideName = this.$el.attributes['hide-name'] != undefined ? this.$el.attributes['hide-name'].value == 'true' : false;
|
||||
this.showCollectionThumbnail = this.$el.attributes['show-collection-thumbnail'] != undefined ? this.$el.attributes['show-collection-thumbnail'].value == 'true' : false;
|
||||
this.tainacanApiRoot = this.$el.attributes['tainacan-api-root'] != undefined ? this.$el.attributes['tainacan-api-root'].value : undefined;
|
||||
this.tainacanBaseUrl = this.$el.attributes['tainacan-base-url'] != undefined ? this.$el.attributes['tainacan-base-url'].value : undefined;
|
||||
},
|
||||
methods: {
|
||||
__(text, domain) {
|
||||
return wp.i18n.__(text, domain);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Vue.use(VueBlurHash);
|
||||
Vue.use(ThumbnailHelperPlugin);
|
||||
new Vue( Object.assign({ el: '#' + blockId }, vueOptions) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This is rendered on the theme side.
|
||||
renderTainacanCollectionsCarouselBlocks();
|
||||
|
||||
// Also if a theme or plugin requested a reset...
|
||||
document.addEventListener("TainacanReloadCarouselCollectionsListBlock", () => {
|
||||
renderTainacanCollectionsCarouselBlocks();
|
||||
});
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div :class="className">
|
||||
<div :class="className + ' has-mounted'">
|
||||
<div v-if="!isLoading">
|
||||
<div
|
||||
:class="'tainacan-carousel ' + (arrowsPosition ? ' has-arrows-' + arrowsPosition : '') + (largeArrows ? ' has-large-arrows' : '') "
|
||||
|
@ -316,6 +316,6 @@ export default {
|
|||
|
||||
<style lang="scss">
|
||||
|
||||
@import './carousel-collections-list.scss';
|
||||
@import './style.scss';
|
||||
|
||||
</style>
|
|
@ -0,0 +1,126 @@
|
|||
{
|
||||
"name": "tainacan/carousel-items-list",
|
||||
"title": "Tainacan Collection's Items Carousel",
|
||||
"category": "tainacan-blocks",
|
||||
"keywords": [ "items", "carousel", "slider" ],
|
||||
"description": "List items on a Carousel, using search or item selection.",
|
||||
"textdomain": "tainacan",
|
||||
"example": {
|
||||
"attributes": {
|
||||
"content": "preview"
|
||||
}
|
||||
},
|
||||
"attributes": {
|
||||
"content": {
|
||||
"type": "array",
|
||||
"source": "children",
|
||||
"selector": "div"
|
||||
},
|
||||
"collectionId": {
|
||||
"type": "String",
|
||||
"default": ""
|
||||
},
|
||||
"items": {
|
||||
"type": "Array",
|
||||
"default": []
|
||||
},
|
||||
"isModalOpen": {
|
||||
"type": "Boolean",
|
||||
"default": false
|
||||
},
|
||||
"searchURL": {
|
||||
"type": "String",
|
||||
"default": ""
|
||||
},
|
||||
"selectedItems": {
|
||||
"type": "Array",
|
||||
"default": []
|
||||
},
|
||||
"itemsRequestSource": {
|
||||
"type": "String",
|
||||
"default": ""
|
||||
},
|
||||
"maxItemsNumber": {
|
||||
"type": "Number",
|
||||
"value": 12
|
||||
},
|
||||
"maxItemsPerScreen": {
|
||||
"type": "Number",
|
||||
"value": 7
|
||||
},
|
||||
"isLoading": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"isLoadingCollection": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"loadStrategy": {
|
||||
"type": "String",
|
||||
"value": "search"
|
||||
},
|
||||
"arrowsPosition": {
|
||||
"type": "String",
|
||||
"value": "around"
|
||||
},
|
||||
"largeArrows": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"autoPlay": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"autoPlaySpeed": {
|
||||
"type": "Number",
|
||||
"value": 3
|
||||
},
|
||||
"loopSlides": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"hideTitle": {
|
||||
"type": "Boolean",
|
||||
"value": true
|
||||
},
|
||||
"showCollectionHeader": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"showCollectionLabel": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"cropImagesToSquare": {
|
||||
"type": "Boolean",
|
||||
"value": true
|
||||
},
|
||||
"collection": {
|
||||
"type": "Object",
|
||||
"value": {}
|
||||
},
|
||||
"blockId": {
|
||||
"type": "String",
|
||||
"default": ""
|
||||
},
|
||||
"collectionBackgroundColor": {
|
||||
"type": "String",
|
||||
"default": "#454647"
|
||||
},
|
||||
"collectionTextColor": {
|
||||
"type": "String",
|
||||
"default": "#ffffff"
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"align": ["full", "wide"],
|
||||
"html": false,
|
||||
"multiple": true,
|
||||
"typography": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"editorScript": "carousel-items-list",
|
||||
"editorStyle": "carousel-items-list"
|
||||
}
|
|
@ -44,7 +44,7 @@ export default class CarouselItemsModal extends React.Component {
|
|||
collectionId: this.props.existingCollectionId
|
||||
});
|
||||
|
||||
if (this.props.existingCollectionId != null && this.props.existingCollectionId != undefined) {
|
||||
if (this.props.existingCollectionId) {
|
||||
this.fetchCollection(this.props.existingCollectionId);
|
||||
this.setState({
|
||||
searchURL: this.props.existingSearchURL ? this.props.existingSearchURL : tainacan_blocks.admin_url + 'admin.php?page=tainacan_admin#/collections/'+ this.props.existingCollectionId + (this.props.loadStrategy == 'search' ? '/items/?iframemode=true&readmode=true&status=publish' : '/items/?iframemode=true&status=publish') });
|
||||
|
@ -116,7 +116,6 @@ export default class CarouselItemsModal extends React.Component {
|
|||
collectionId: selectedCollectionId,
|
||||
searchURL: tainacan_blocks.admin_url + 'admin.php?page=tainacan_admin#/collections/' + selectedCollectionId + (this.props.loadStrategy == 'search' ? '/items/?iframemode=true&readmode=true&status=publish' : '/items/?iframemode=true&status=publish')
|
||||
});
|
||||
|
||||
this.props.onSelectCollection(selectedCollectionId);
|
||||
this.fetchCollection(selectedCollectionId);
|
||||
}
|
||||
|
@ -201,7 +200,7 @@ export default class CarouselItemsModal extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
return this.state.collectionId != null && this.state.collectionId != undefined ? (
|
||||
return this.state.collectionId ? (
|
||||
// Items modal
|
||||
<Modal
|
||||
className="wp-block-tainacan-modal dynamic-modal"
|
|
@ -1,4 +1,164 @@
|
|||
export default [
|
||||
/* Deprecated on Version 0.18.4 due to compatibility with WP 5.8 */
|
||||
{
|
||||
attributes: {
|
||||
content: {
|
||||
type: 'array',
|
||||
source: 'children',
|
||||
selector: 'div'
|
||||
},
|
||||
collectionId: {
|
||||
type: String,
|
||||
default: undefined
|
||||
},
|
||||
items: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
isModalOpen: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
searchURL: {
|
||||
type: String,
|
||||
default: undefined
|
||||
},
|
||||
selectedItems: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
itemsRequestSource: {
|
||||
type: String,
|
||||
default: undefined
|
||||
},
|
||||
maxItemsNumber: {
|
||||
type: Number,
|
||||
value: undefined
|
||||
},
|
||||
maxItemsPerScreen: {
|
||||
type: Number,
|
||||
value: 7
|
||||
},
|
||||
isLoading: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
isLoadingCollection: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
loadStrategy: {
|
||||
type: String,
|
||||
value: 'search'
|
||||
},
|
||||
arrowsPosition: {
|
||||
type: String,
|
||||
value: 'search'
|
||||
},
|
||||
largeArrows: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
autoPlay: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
autoPlaySpeed: {
|
||||
type: Number,
|
||||
value: 3
|
||||
},
|
||||
loopSlides: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
hideTitle: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
showCollectionHeader: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
showCollectionLabel: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
cropImagesToSquare: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
collection: {
|
||||
type: Object,
|
||||
value: undefined
|
||||
},
|
||||
blockId: {
|
||||
type: String,
|
||||
default: undefined
|
||||
},
|
||||
collectionBackgroundColor: {
|
||||
type: String,
|
||||
default: "#454647"
|
||||
},
|
||||
collectionTextColor: {
|
||||
type: String,
|
||||
default: "#ffffff"
|
||||
}
|
||||
},
|
||||
supports: {
|
||||
align: ['full', 'wide'],
|
||||
html: false,
|
||||
multiple: true,
|
||||
fontSize: true
|
||||
},
|
||||
save({ attributes, className }){
|
||||
const {
|
||||
content,
|
||||
blockId,
|
||||
collectionId,
|
||||
searchURL,
|
||||
selectedItems,
|
||||
arrowsPosition,
|
||||
largeArrows,
|
||||
loadStrategy,
|
||||
maxItemsNumber,
|
||||
maxItemsPerScreen,
|
||||
autoPlay,
|
||||
autoPlaySpeed,
|
||||
loopSlides,
|
||||
hideTitle,
|
||||
cropImagesToSquare,
|
||||
showCollectionHeader,
|
||||
showCollectionLabel,
|
||||
collectionBackgroundColor,
|
||||
collectionTextColor
|
||||
} = attributes;
|
||||
|
||||
return <div
|
||||
className={ className }
|
||||
search-url={ searchURL }
|
||||
selected-items={ JSON.stringify(selectedItems) }
|
||||
arrows-position={ arrowsPosition }
|
||||
load-strategy={ loadStrategy }
|
||||
collection-id={ collectionId }
|
||||
auto-play={ '' + autoPlay }
|
||||
auto-play-speed={ autoPlaySpeed }
|
||||
loop-slides={ '' + loopSlides }
|
||||
hide-title={ '' + hideTitle }
|
||||
large-arrows={ '' + largeArrows }
|
||||
crop-images-to-square={ '' + cropImagesToSquare }
|
||||
show-collection-header={ '' + showCollectionHeader }
|
||||
show-collection-label={ '' + showCollectionLabel }
|
||||
collection-background-color={ collectionBackgroundColor }
|
||||
collection-text-color={ collectionTextColor }
|
||||
max-items-number={ maxItemsNumber }
|
||||
max-items-per-screen={ maxItemsPerScreen }
|
||||
tainacan-api-root={ tainacan_blocks.root }
|
||||
tainacan-base-url={ tainacan_blocks.base_url }
|
||||
id={ 'wp-block-tainacan-carousel-items-list_' + blockId }>
|
||||
{ content }
|
||||
</div>
|
||||
}
|
||||
},
|
||||
/* Deprecated on Tainacan 0.17.2, due to the introduction of support: fontSize */
|
||||
{
|
||||
attributes: {
|
|
@ -0,0 +1,672 @@
|
|||
const { __ } = wp.i18n;
|
||||
|
||||
const { RangeControl, Spinner, Button, ToggleControl, SelectControl, Placeholder, IconButton, ColorPicker, ColorPalette, BaseControl, PanelBody } = wp.components;
|
||||
|
||||
const { InspectorControls, BlockControls } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
|
||||
import CarouselItemsModal from './carousel-items-modal.js';
|
||||
import tainacan from '../../js/axios.js';
|
||||
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 'swiper/css/swiper.min.css';
|
||||
|
||||
|
||||
export default function({ attributes, setAttributes, className, isSelected, clientId }){
|
||||
let {
|
||||
items,
|
||||
content,
|
||||
collectionId,
|
||||
isModalOpen,
|
||||
searchURL,
|
||||
itemsRequestSource,
|
||||
maxItemsNumber,
|
||||
maxItemsPerScreen,
|
||||
selectedItems,
|
||||
isLoading,
|
||||
loadStrategy,
|
||||
arrowsPosition,
|
||||
largeArrows,
|
||||
autoPlay,
|
||||
autoPlaySpeed,
|
||||
loopSlides,
|
||||
hideTitle,
|
||||
cropImagesToSquare,
|
||||
showCollectionHeader,
|
||||
showCollectionLabel,
|
||||
isLoadingCollection,
|
||||
collection,
|
||||
collectionBackgroundColor,
|
||||
collectionTextColor
|
||||
} = attributes;
|
||||
|
||||
// Obtains block's client id to render it on save function
|
||||
setAttributes({ blockId: clientId });
|
||||
const thumbHelper = ThumbnailHelperFunctions();
|
||||
|
||||
// Sets some defaults that were not working
|
||||
if (maxItemsPerScreen === undefined) {
|
||||
maxItemsPerScreen = 7;
|
||||
setAttributes({ maxItemsPerScreen: maxItemsPerScreen });
|
||||
}
|
||||
if (cropImagesToSquare === undefined) {
|
||||
cropImagesToSquare = true;
|
||||
setAttributes({ cropImagesToSquare: cropImagesToSquare });
|
||||
}
|
||||
|
||||
function prepareItem(item) {
|
||||
return (
|
||||
<li
|
||||
key={ item.id }
|
||||
className={ 'item-list-item ' + (maxItemsPerScreen ? 'max-itens-per-screen-' + maxItemsPerScreen : '') }>
|
||||
{ loadStrategy == 'selection' ?
|
||||
( tainacan_blocks.wp_version < '5.4' ?
|
||||
<IconButton
|
||||
onClick={ () => removeItemOfId(item.id) }
|
||||
icon="no-alt"
|
||||
label={__('Remove', 'tainacan')}/>
|
||||
:
|
||||
<Button
|
||||
onClick={ () => removeItemOfId(item.id) }
|
||||
icon="no-alt"
|
||||
label={__('Remove', 'tainacan')}/>
|
||||
)
|
||||
:null
|
||||
}
|
||||
<a
|
||||
id={ isNaN(item.id) ? item.id : 'item-id-' + item.id }
|
||||
href={ item.url }
|
||||
target="_blank">
|
||||
<img
|
||||
src={ thumbHelper.getSrc(item['thumbnail'], (maxItemsPerScreen > 4 ? (!cropImagesToSquare ? 'tainacan-medium-full' : 'tainacan-medium') : 'large'), item['document_mimetype']) }
|
||||
srcSet={ thumbHelper.getSrcSet(item['thumbnail'], (maxItemsPerScreen > 4 ? (!cropImagesToSquare ? 'tainacan-medium-full' : 'tainacan-medium') : 'large'), item['document_mimetype']) }
|
||||
alt={ item.thumbnail_alt ? item.thumbnail_alt : (item && item.title ? item.title : __( 'Thumbnail', 'tainacan' )) }/>
|
||||
{ !hideTitle ? <span>{ item.title ? item.title : '' }</span> : null }
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
function setContent() {
|
||||
isLoading = true;
|
||||
|
||||
setAttributes({
|
||||
isLoading: isLoading
|
||||
});
|
||||
|
||||
items = [];
|
||||
|
||||
if (loadStrategy == 'parent') {
|
||||
|
||||
for (let item of selectedItems)
|
||||
items.push(prepareItem(item));
|
||||
|
||||
setAttributes({
|
||||
content: <div></div>,
|
||||
items: items,
|
||||
isLoading: false
|
||||
});
|
||||
|
||||
} else if (loadStrategy == 'selection') {
|
||||
|
||||
if (itemsRequestSource != undefined && typeof itemsRequestSource == 'function')
|
||||
itemsRequestSource.cancel('Previous items search canceled.');
|
||||
|
||||
itemsRequestSource = axios.CancelToken.source();
|
||||
|
||||
let endpoint = '/collection/' + collectionId + '/items?'+ qs.stringify({ postin: selectedItems, perpage: selectedItems.length }) + '&fetch_only=title,url,thumbnail';
|
||||
|
||||
tainacan.get(endpoint, { cancelToken: itemsRequestSource.token })
|
||||
.then(response => {
|
||||
|
||||
for (let item of response.data.items)
|
||||
items.push(prepareItem(item));
|
||||
|
||||
setAttributes({
|
||||
content: <div></div>,
|
||||
items: items,
|
||||
isLoading: false,
|
||||
itemsRequestSource: itemsRequestSource
|
||||
});
|
||||
});
|
||||
} else {
|
||||
|
||||
let endpoint = '/collection' + searchURL.split('#')[1].split('/collections')[1];
|
||||
let query = endpoint.split('?')[1];
|
||||
let queryObject = qs.parse(query);
|
||||
|
||||
if (itemsRequestSource != undefined && typeof itemsRequestSource == 'function')
|
||||
itemsRequestSource.cancel('Previous items search canceled.');
|
||||
|
||||
itemsRequestSource = axios.CancelToken.source();
|
||||
|
||||
// Set up max items to be shown
|
||||
if (maxItemsNumber != undefined && maxItemsNumber > 0)
|
||||
queryObject.perpage = maxItemsNumber;
|
||||
else if (queryObject.perpage != undefined && queryObject.perpage > 0)
|
||||
setAttributes({ maxItemsNumber: queryObject.perpage });
|
||||
else {
|
||||
queryObject.perpage = 12;
|
||||
setAttributes({ maxItemsNumber: 12 });
|
||||
}
|
||||
|
||||
// Remove unecessary queries
|
||||
delete queryObject.readmode;
|
||||
delete queryObject.iframemode;
|
||||
delete queryObject.admin_view_mode;
|
||||
delete queryObject.fetch_only_meta;
|
||||
|
||||
endpoint = endpoint.split('?')[0] + '?' + qs.stringify(queryObject) + '&fetch_only=title,url,thumbnail';
|
||||
|
||||
tainacan.get(endpoint, { cancelToken: itemsRequestSource.token })
|
||||
.then(response => {
|
||||
|
||||
for (let item of response.data.items)
|
||||
items.push(prepareItem(item));
|
||||
|
||||
setAttributes({
|
||||
content: <div></div>,
|
||||
items: items,
|
||||
isLoading: false,
|
||||
itemsRequestSource: itemsRequestSource
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function fetchCollectionForHeader() {
|
||||
if (showCollectionHeader) {
|
||||
|
||||
isLoadingCollection = true;
|
||||
setAttributes({
|
||||
isLoadingCollection: isLoadingCollection
|
||||
});
|
||||
|
||||
tainacan.get('/collections/' + collectionId + '?fetch_only=name,thumbnail,header_image')
|
||||
.then(response => {
|
||||
collection = response.data;
|
||||
isLoadingCollection = false;
|
||||
|
||||
if (collection.tainacan_theme_collection_background_color)
|
||||
collectionBackgroundColor = collection.tainacan_theme_collection_background_color;
|
||||
else
|
||||
collectionBackgroundColor = '#454647';
|
||||
|
||||
if (collection.tainacan_theme_collection_color)
|
||||
collectionTextColor = collection.tainacan_theme_collection_color;
|
||||
else
|
||||
collectionTextColor = '#ffffff';
|
||||
|
||||
setAttributes({
|
||||
content: <div></div>,
|
||||
collection: collection,
|
||||
isLoadingCollection: isLoadingCollection,
|
||||
collectionBackgroundColor: collectionBackgroundColor,
|
||||
collectionTextColor: collectionTextColor
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function openCarouseltemsModal(aLoadStrategy) {
|
||||
loadStrategy = aLoadStrategy;
|
||||
isModalOpen = true;
|
||||
setAttributes( {
|
||||
isModalOpen: isModalOpen,
|
||||
loadStrategy: loadStrategy
|
||||
} );
|
||||
}
|
||||
|
||||
function removeItemOfId(itemId) {
|
||||
|
||||
let existingItemIndex = items.findIndex((existingItem) => existingItem.key == itemId);
|
||||
if (existingItemIndex >= 0)
|
||||
items.splice(existingItemIndex, 1);
|
||||
|
||||
let existingSelectedItemIndex = selectedItems.findIndex((existingSelectedItem) => existingSelectedItem == itemId);
|
||||
if (existingSelectedItemIndex >= 0)
|
||||
selectedItems.splice(existingSelectedItemIndex, 1);
|
||||
|
||||
setAttributes({
|
||||
selectedItems: selectedItems,
|
||||
items: items,
|
||||
content: <div></div>
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Executed only on the first load of page
|
||||
if(content && content.length && content[0].type)
|
||||
setContent();
|
||||
|
||||
return content == 'preview' ?
|
||||
<div className={className}>
|
||||
<img
|
||||
width="100%"
|
||||
src={ `${tainacan_blocks.base_url}/assets/images/carousel-items-list.png` } />
|
||||
</div>
|
||||
: (
|
||||
<div className={className}>
|
||||
|
||||
{ items.length ?
|
||||
<BlockControls>
|
||||
{ loadStrategy != 'parent' ?
|
||||
(
|
||||
loadStrategy != 'search' ?
|
||||
TainacanBlocksCompatToolbar({
|
||||
label: __('Add more items', 'tainacan'),
|
||||
icon: <svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
height="24px"
|
||||
width="24px">
|
||||
<path d="M16,6H12a2,2,0,0,0-2,2v6.52A6,6,0,0,1,12,19a6,6,0,0,1-.73,2.88A1.92,1.92,0,0,0,12,22h8a2,2,0,0,0,2-2V12Zm-1,6V7.5L19.51,12ZM15,2V4H8v9.33A5.8,5.8,0,0,0,6,13V4A2,2,0,0,1,8,2ZM10.09,19.05,7,22.11V16.05L8,17l2,2ZM5,16.05v6.06L2,19.11Z"/>
|
||||
</svg>,
|
||||
onClick: openCarouseltemsModal,
|
||||
onClickParams: 'selection'
|
||||
})
|
||||
:
|
||||
TainacanBlocksCompatToolbar({
|
||||
label: __('Configure a search', 'tainacan'),
|
||||
icon: <svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
height="24px"
|
||||
width="24px">
|
||||
<path d="M16,6H12a2,2,0,0,0-2,2v6.52A6,6,0,0,1,12,19a6,6,0,0,1-.73,2.88A1.92,1.92,0,0,0,12,22h8a2,2,0,0,0,2-2V12Zm-1,6V7.5L19.51,12ZM15,2V4H8v9.33A5.8,5.8,0,0,0,6,13V4A2,2,0,0,1,8,2ZM10.09,19.05,7,22.11V16.05L8,17l2,2ZM5,16.05v6.06L2,19.11Z"/>
|
||||
</svg>,
|
||||
onClick: openCarouseltemsModal,
|
||||
onClickParams: 'search'
|
||||
})
|
||||
) : null
|
||||
}
|
||||
</BlockControls>
|
||||
: null }
|
||||
<div>
|
||||
<InspectorControls>
|
||||
|
||||
<PanelBody
|
||||
title={__('Collection header', 'tainacan')}
|
||||
initialOpen={ false }
|
||||
>
|
||||
<ToggleControl
|
||||
label={__('Display header', 'tainacan')}
|
||||
help={ !showCollectionHeader ? __('Toggle to show collection header', 'tainacan') : __('Do not show collection header', 'tainacan')}
|
||||
checked={ showCollectionHeader }
|
||||
onChange={ ( isChecked ) => {
|
||||
showCollectionHeader = isChecked;
|
||||
if (isChecked) fetchCollectionForHeader();
|
||||
setAttributes({ showCollectionHeader: showCollectionHeader });
|
||||
}
|
||||
}
|
||||
/>
|
||||
{ showCollectionHeader ?
|
||||
<div style={{ margin: '6px' }}>
|
||||
|
||||
<ToggleControl
|
||||
label={__('Display "Collection" label', 'tainacan')}
|
||||
help={ !showCollectionLabel ? __('Toggle to show "Collection" label above header', 'tainacan') : __('Do not show "Collection" label', 'tainacan')}
|
||||
checked={ showCollectionLabel }
|
||||
onChange={ ( isChecked ) => {
|
||||
showCollectionLabel = isChecked;
|
||||
setAttributes({ showCollectionLabel: showCollectionLabel });
|
||||
}
|
||||
}
|
||||
/>
|
||||
|
||||
<BaseControl
|
||||
id="colorpicker"
|
||||
label={ __('Background color', 'tainacan')}>
|
||||
<ColorPicker
|
||||
color={ collectionBackgroundColor }
|
||||
onChangeComplete={ ( value ) => {
|
||||
collectionBackgroundColor = value.hex;
|
||||
setAttributes({ collectionBackgroundColor: collectionBackgroundColor })
|
||||
}}
|
||||
disableAlpha
|
||||
/>
|
||||
</BaseControl>
|
||||
|
||||
<BaseControl
|
||||
id="colorpallete"
|
||||
label={ __('Collection name color', 'tainacan')}>
|
||||
<ColorPalette
|
||||
colors={ [{ name: __('Black', 'tainacan'), color: '#000000'}, { name: __('White', 'tainacan'), color: '#ffffff'} ] }
|
||||
value={ collectionTextColor }
|
||||
onChange={ ( color ) => {
|
||||
collectionTextColor = color;
|
||||
setAttributes({ collectionTextColor: collectionTextColor })
|
||||
}}
|
||||
/>
|
||||
</BaseControl>
|
||||
</div>
|
||||
: null
|
||||
}
|
||||
</PanelBody>
|
||||
|
||||
<PanelBody
|
||||
title={__('Carousel', 'tainacan')}
|
||||
initialOpen={ true }
|
||||
>
|
||||
<div>
|
||||
{
|
||||
loadStrategy != 'parent' ?
|
||||
<RangeControl
|
||||
label={ __('Maximum items per slide on a wide screen', 'tainacan') }
|
||||
help={ maxItemsPerScreen <= 4 ? __('Warning: with such a small number of items per slide, the image size is greater, thus the cropped version of the thumbnail won\'t be used.', 'tainacan') : null }
|
||||
value={ maxItemsPerScreen ? maxItemsPerScreen : 7 }
|
||||
onChange={ ( aMaxItemsPerScreen ) => {
|
||||
maxItemsPerScreen = aMaxItemsPerScreen;
|
||||
setAttributes( { maxItemsPerScreen: aMaxItemsPerScreen } );
|
||||
setContent();
|
||||
}}
|
||||
min={ 1 }
|
||||
max={ 9 }
|
||||
/>
|
||||
: null
|
||||
}
|
||||
<ToggleControl
|
||||
label={__('Crop Images', 'tainacan')}
|
||||
help={ cropImagesToSquare && maxItemsPerScreen > 4 ? __('Do not use square cropeed version of the item thumbnail.', 'tainacan') : __('Toggle to use square cropped version of the item thumbnail.', 'tainacan') }
|
||||
checked={ cropImagesToSquare && maxItemsPerScreen > 4 }
|
||||
onChange={ ( isChecked ) => {
|
||||
cropImagesToSquare = isChecked;
|
||||
setAttributes({ cropImagesToSquare: cropImagesToSquare });
|
||||
setContent();
|
||||
}
|
||||
}
|
||||
/>
|
||||
<ToggleControl
|
||||
label={__('Hide title', 'tainacan')}
|
||||
help={ !hideTitle ? __('Toggle to hide item\'s title', 'tainacan') : __('Do not hide item\'s title', 'tainacan')}
|
||||
checked={ hideTitle }
|
||||
onChange={ ( isChecked ) => {
|
||||
hideTitle = isChecked;
|
||||
setAttributes({ hideTitle: hideTitle });
|
||||
setContent();
|
||||
}
|
||||
}
|
||||
/>
|
||||
<ToggleControl
|
||||
label={__('Loop slides', 'tainacan')}
|
||||
help={ !loopSlides ? __('Toggle to make slides loop from first to last', 'tainacan') : __('Do not loop slides from first to last', 'tainacan')}
|
||||
checked={ loopSlides }
|
||||
onChange={ ( isChecked ) => {
|
||||
loopSlides = isChecked;
|
||||
setAttributes({ loopSlides: loopSlides });
|
||||
}
|
||||
}
|
||||
/>
|
||||
<ToggleControl
|
||||
label={__('Auto play', 'tainacan')}
|
||||
help={ !autoPlay ? __('Toggle to automatically slide to the next item', 'tainacan') : __('Do not automatically slide to the next item', 'tainacan')}
|
||||
checked={ autoPlay }
|
||||
onChange={ ( isChecked ) => {
|
||||
autoPlay = isChecked;
|
||||
setAttributes({ autoPlay: autoPlay });
|
||||
}
|
||||
}
|
||||
/>
|
||||
{
|
||||
autoPlay ?
|
||||
<RangeControl
|
||||
label={__('Seconds before sliding to the next', 'tainacan')}
|
||||
value={ autoPlaySpeed }
|
||||
onChange={ ( aAutoPlaySpeed ) => {
|
||||
autoPlaySpeed = aAutoPlaySpeed;
|
||||
setAttributes( { autoPlaySpeed: aAutoPlaySpeed } )
|
||||
}}
|
||||
min={ 1 }
|
||||
max={ 5 }
|
||||
/>
|
||||
: null
|
||||
}
|
||||
<SelectControl
|
||||
label={__('Arrows', 'tainacan')}
|
||||
value={ arrowsPosition }
|
||||
options={ [
|
||||
{ label: __('Around', 'tainacan'), value: 'around' },
|
||||
{ label: __('Left', 'tainacan'), value: 'left' },
|
||||
{ label: __('Right', 'tainacan'), value: 'right' }
|
||||
] }
|
||||
onChange={ ( aPosition ) => {
|
||||
arrowsPosition = aPosition;
|
||||
|
||||
setAttributes({ arrowsPosition: arrowsPosition });
|
||||
}}/>
|
||||
<ToggleControl
|
||||
label={__('Large arrows', 'tainacan')}
|
||||
help={ !largeArrows ? __('Toggle to display arrows bigger than the default size.', 'tainacan') : __('Do not show arrows bigger than the default size.', 'tainacan')}
|
||||
checked={ largeArrows }
|
||||
onChange={ ( isChecked ) => {
|
||||
largeArrows = isChecked;
|
||||
setAttributes({ largeArrows: largeArrows });
|
||||
}
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</PanelBody>
|
||||
|
||||
{ loadStrategy == 'search' ?
|
||||
<PanelBody
|
||||
title={__('Item\'s Search', 'tainacan')}
|
||||
initialOpen={ true }
|
||||
>
|
||||
<div>
|
||||
<RangeControl
|
||||
label={__('Maximum number of items to load', 'tainacan')}
|
||||
value={ maxItemsNumber }
|
||||
onChange={ ( aMaxItemsNumber ) => {
|
||||
maxItemsNumber = aMaxItemsNumber;
|
||||
setAttributes( { maxItemsNumber: aMaxItemsNumber } )
|
||||
setContent();
|
||||
}}
|
||||
min={ 1 }
|
||||
max={ 96 }
|
||||
/>
|
||||
</div>
|
||||
</PanelBody>
|
||||
:null
|
||||
}
|
||||
</InspectorControls>
|
||||
</div>
|
||||
|
||||
{ isSelected ?
|
||||
(
|
||||
<div>
|
||||
{ isModalOpen ?
|
||||
<CarouselItemsModal
|
||||
loadStrategy={ loadStrategy }
|
||||
existingCollectionId={ collectionId }
|
||||
existingSearchURL={ loadStrategy == 'search' ? searchURL : false }
|
||||
onSelectCollection={ (selectedCollectionId) => {
|
||||
if (collectionId != selectedCollectionId) {
|
||||
items = [];
|
||||
selectedItems = [];
|
||||
}
|
||||
collectionId = selectedCollectionId;
|
||||
setAttributes({
|
||||
collectionId: collectionId,
|
||||
items: items,
|
||||
selectedItems: selectedItems
|
||||
});
|
||||
}}
|
||||
onApplySearchURL={ (aSearchURL) => {
|
||||
searchURL = aSearchURL;
|
||||
loadStrategy = 'search';
|
||||
setAttributes({
|
||||
searchURL: searchURL,
|
||||
loadStrategy: loadStrategy,
|
||||
isModalOpen: false
|
||||
});
|
||||
setContent();
|
||||
}}
|
||||
onApplySelectedItems={ (aSelectionOfItems) => {
|
||||
selectedItems = selectedItems.concat(aSelectionOfItems);
|
||||
loadStrategy = 'selection';
|
||||
setAttributes({
|
||||
selectedItems: selectedItems,
|
||||
loadStrategy: loadStrategy,
|
||||
isModalOpen: false
|
||||
});
|
||||
setContent();
|
||||
}}
|
||||
onCancelSelection={ () => setAttributes({ isModalOpen: false }) }/>
|
||||
: null
|
||||
}
|
||||
|
||||
</div>
|
||||
) : null
|
||||
}
|
||||
|
||||
{
|
||||
showCollectionHeader ?
|
||||
|
||||
<div> {
|
||||
isLoadingCollection ?
|
||||
<div class="spinner-container">
|
||||
<Spinner />
|
||||
</div>
|
||||
:
|
||||
<a
|
||||
href={ collection.url ? collection.url : '' }
|
||||
target="_blank"
|
||||
class="carousel-items-collection-header">
|
||||
<div
|
||||
style={{
|
||||
backgroundColor: collectionBackgroundColor ? collectionBackgroundColor : '',
|
||||
paddingRight: collection && collection.thumbnail && (collection.thumbnail['tainacan-medium'] || collection.thumbnail['medium']) ? '' : '20px',
|
||||
paddingTop: (!collection || !collection.thumbnail || (!collection.thumbnail['tainacan-medium'] && !collection.thumbnail['medium'])) ? '1rem' : '',
|
||||
width: collection && collection.header_image ? '' : '100%'
|
||||
}}
|
||||
className={
|
||||
'collection-name ' +
|
||||
((!collection || !collection.thumbnail || (!collection.thumbnail['tainacan-medium'] && !collection.thumbnail['medium'])) && (!collection || !collection.header_image) ? 'only-collection-name' : '')
|
||||
}>
|
||||
<h3 style={{ color: collectionTextColor ? collectionTextColor : '' }}>
|
||||
{ showCollectionLabel ? <span class="label">{ __('Collection', 'tainacan') }<br/></span> : null }
|
||||
{ collection && collection.name ? collection.name : '' }
|
||||
</h3>
|
||||
</div>
|
||||
{
|
||||
collection && collection.thumbnail && (collection.thumbnail['tainacan-medium'] || collection.thumbnail['medium']) ?
|
||||
<div
|
||||
class="collection-thumbnail"
|
||||
style={{
|
||||
backgroundImage: 'url(' + (collection.thumbnail['tainacan-medium'] != undefined ? (collection.thumbnail['tainacan-medium'][0]) : (collection.thumbnail['medium'][0])) + ')',
|
||||
}}/>
|
||||
: null
|
||||
}
|
||||
<div
|
||||
class="collection-header-image"
|
||||
style={{
|
||||
backgroundImage: collection.header_image ? 'url(' + collection.header_image + ')' : '',
|
||||
minHeight: collection && collection.header_image ? '' : '80px',
|
||||
display: !(collection && collection.thumbnail && (collection.thumbnail['tainacan-medium'] || collection.thumbnail['medium'])) ? collection && collection.header_image ? '' : 'none' : ''
|
||||
}}/>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
: null
|
||||
}
|
||||
{ !items.length && !isLoading ? (
|
||||
<Placeholder
|
||||
className="tainacan-block-placeholder"
|
||||
icon={(
|
||||
<img
|
||||
width={148}
|
||||
src={ `${tainacan_blocks.base_url}/assets/images/tainacan_logo_header.svg` }
|
||||
alt="Tainacan Logo"/>
|
||||
)}>
|
||||
<p>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
height="24px"
|
||||
width="24px">
|
||||
<path d="M16,6H12a2,2,0,0,0-2,2v6.52A6,6,0,0,1,12,19a6,6,0,0,1-.73,2.88A1.92,1.92,0,0,0,12,22h8a2,2,0,0,0,2-2V12Zm-1,6V7.5L19.51,12ZM15,2V4H8v9.33A5.8,5.8,0,0,0,6,13V4A2,2,0,0,1,8,2ZM10.09,19.05,7,22.11V16.05L8,17l2,2ZM5,16.05v6.06L2,19.11Z"/>
|
||||
</svg>
|
||||
{__('List items on a Carousel, using search or item selection.', 'tainacan')}
|
||||
</p>
|
||||
{
|
||||
loadStrategy != 'parent' ?
|
||||
<div>
|
||||
<Button
|
||||
isPrimary
|
||||
type="button"
|
||||
onClick={ () => openCarouseltemsModal('selection') }>
|
||||
{__('Select Items', 'tainacan')}
|
||||
</Button>
|
||||
<p style={{ margin: '0 12px' }}>{__('or', 'tainacan')}</p>
|
||||
<Button
|
||||
isPrimary
|
||||
type="button"
|
||||
onClick={ () => openCarouseltemsModal('search') }>
|
||||
{__('Configure a search', 'tainacan')}
|
||||
</Button>
|
||||
</div>
|
||||
: null
|
||||
}
|
||||
</Placeholder>
|
||||
) : null
|
||||
}
|
||||
|
||||
{ isLoading ?
|
||||
<div class="spinner-container">
|
||||
<Spinner />
|
||||
</div> :
|
||||
<div>
|
||||
{ isSelected && items.length ?
|
||||
<div class="preview-warning">{__('Warning: this is just a demonstration. To see the carousel in action, either preview or publish your post.', 'tainacan')}</div>
|
||||
: null
|
||||
}
|
||||
{ items.length ? (
|
||||
|
||||
<div
|
||||
className={'items-list-edit-container ' + (arrowsPosition ? ' has-arrows-' + arrowsPosition : '') + (largeArrows ? ' has-large-arrows' : '') }>
|
||||
<button
|
||||
class="swiper-button-prev"
|
||||
slot="button-prev"
|
||||
style={{ cursor: 'not-allowed' }}>
|
||||
<svg
|
||||
width={ largeArrows ? 60 : 42 }
|
||||
height={ largeArrows ? 60 : 42 }
|
||||
viewBox="0 0 24 24">
|
||||
<path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
|
||||
<path
|
||||
d="M0 0h24v24H0z"
|
||||
fill="none"/>
|
||||
</svg>
|
||||
</button>
|
||||
<ul
|
||||
style={{
|
||||
marginTop: showCollectionHeader ? '1.5rem' : '0px'
|
||||
}}
|
||||
className={ 'items-list-edit' }>
|
||||
{ items }
|
||||
</ul>
|
||||
<button
|
||||
class="swiper-button-next"
|
||||
slot="button-next"
|
||||
style={{ cursor: 'not-allowed' }}>
|
||||
<svg
|
||||
width={ largeArrows ? 60 : 42 }
|
||||
height={ largeArrows ? 60 : 42 }
|
||||
viewBox="0 0 24 24">
|
||||
<path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/>
|
||||
<path
|
||||
d="M0 0h24v24H0z"
|
||||
fill="none"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
):null
|
||||
}
|
||||
</div>
|
||||
|
||||
}
|
||||
|
||||
</div>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,12 @@
|
|||
const { SVG, Path } = wp.components;
|
||||
|
||||
export default (
|
||||
<SVG
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
height="24px"
|
||||
width="24px">
|
||||
<Path
|
||||
d="M16,6H12a2,2,0,0,0-2,2v6.52A6,6,0,0,1,12,19a6,6,0,0,1-.73,2.88A1.92,1.92,0,0,0,12,22h8a2,2,0,0,0,2-2V12Zm-1,6V7.5L19.51,12ZM15,2V4H8v9.33A5.8,5.8,0,0,0,6,13V4A2,2,0,0,1,8,2ZM10.09,19.05,7,22.11V16.05L8,17l2,2ZM5,16.05v6.06L2,19.11Z"/>
|
||||
</SVG>
|
||||
);
|
|
@ -0,0 +1,15 @@
|
|||
import tainacanRegisterBlockType from '../../js/tainacan-blocks-compat-register.js';
|
||||
|
||||
import metadata from './block.json';
|
||||
import icon from './icon.js';
|
||||
import edit from './edit.js';
|
||||
import save from './save.js';
|
||||
import deprecated from './deprecated.js';
|
||||
|
||||
tainacanRegisterBlockType({
|
||||
metadata,
|
||||
icon,
|
||||
edit,
|
||||
save,
|
||||
deprecated
|
||||
});
|
|
@ -0,0 +1,49 @@
|
|||
export default function ({ attributes, className }) {
|
||||
const {
|
||||
content,
|
||||
blockId,
|
||||
collectionId,
|
||||
searchURL,
|
||||
selectedItems,
|
||||
arrowsPosition,
|
||||
largeArrows,
|
||||
loadStrategy,
|
||||
maxItemsNumber,
|
||||
maxItemsPerScreen,
|
||||
autoPlay,
|
||||
autoPlaySpeed,
|
||||
loopSlides,
|
||||
hideTitle,
|
||||
cropImagesToSquare,
|
||||
showCollectionHeader,
|
||||
showCollectionLabel,
|
||||
collectionBackgroundColor,
|
||||
collectionTextColor
|
||||
} = attributes;
|
||||
|
||||
return <div
|
||||
data-module="carousel-items-list"
|
||||
className={ className }
|
||||
search-url={ searchURL }
|
||||
selected-items={ JSON.stringify(selectedItems) }
|
||||
arrows-position={ arrowsPosition }
|
||||
load-strategy={ loadStrategy }
|
||||
collection-id={ collectionId }
|
||||
auto-play={ '' + autoPlay }
|
||||
auto-play-speed={ autoPlaySpeed }
|
||||
loop-slides={ '' + loopSlides }
|
||||
hide-title={ '' + hideTitle }
|
||||
large-arrows={ '' + largeArrows }
|
||||
crop-images-to-square={ '' + cropImagesToSquare }
|
||||
show-collection-header={ '' + showCollectionHeader }
|
||||
show-collection-label={ '' + showCollectionLabel }
|
||||
collection-background-color={ collectionBackgroundColor }
|
||||
collection-text-color={ collectionTextColor }
|
||||
max-items-number={ maxItemsNumber }
|
||||
max-items-per-screen={ maxItemsPerScreen }
|
||||
tainacan-api-root={ tainacan_blocks.root }
|
||||
tainacan-base-url={ tainacan_blocks.base_url }
|
||||
id={ 'wp-block-tainacan-carousel-items-list_' + blockId }>
|
||||
{ content }
|
||||
</div>
|
||||
};
|
|
@ -184,6 +184,7 @@
|
|||
top: calc(50% - 42px);
|
||||
bottom: initial;
|
||||
background: none;
|
||||
background-color: transparent !important;
|
||||
border: none;
|
||||
width: 42px;
|
||||
height: 42px;
|
|
@ -0,0 +1,120 @@
|
|||
|
||||
import Vue from 'vue';
|
||||
import CarouselItemsListTheme from './theme.vue';
|
||||
import { ThumbnailHelperPlugin } from '../../../admin/js/utilities.js';
|
||||
import VueBlurHash from 'vue-blurhash';
|
||||
|
||||
export default (element) => {
|
||||
|
||||
// Vue Dev Tools!
|
||||
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development';
|
||||
|
||||
function renderTainacanItemCarouselBlocks() {
|
||||
|
||||
// Gets all divs with content created by our block;
|
||||
let blocksElements = element ? [ element ] : document.getElementsByClassName('wp-block-tainacan-carousel-items-list');
|
||||
|
||||
if (blocksElements) {
|
||||
let blocks = Object.values(blocksElements);
|
||||
|
||||
// Checks if this carousel isn't already mounted
|
||||
blocks = blocks.filter((block) => block.classList && !block.classList.contains('has-mounted'));
|
||||
const blockIds = blocks.map((block) => block.id);
|
||||
|
||||
// Creates a new Vue Instance to manage each block isolatelly
|
||||
for (let blockId of blockIds) {
|
||||
// Configure Vue logic before passing it to constructor:
|
||||
let vueOptions = {
|
||||
data: {
|
||||
collectionId: '',
|
||||
searchURL: '',
|
||||
selectedItems: [],
|
||||
loadStrategy: 'search',
|
||||
maxItemsNumber: 12,
|
||||
maxItemsPerScreen: 7,
|
||||
arrowsPosition: 'around',
|
||||
largeArrows: false,
|
||||
autoPlay: false,
|
||||
autoPlaySpeed: 3,
|
||||
loopSlides: false,
|
||||
hideTitle: true,
|
||||
cropImagesToSquare: true,
|
||||
showCollectionHeader: false,
|
||||
showCollectionLabel: false,
|
||||
collectionBackgroundColor: '#454647',
|
||||
collectionTextColor: '#ffffff',
|
||||
tainacanApiRoot: '',
|
||||
tainacanBaseUrl: '',
|
||||
className: ''
|
||||
},
|
||||
render(h){
|
||||
return h(CarouselItemsListTheme, {
|
||||
props: {
|
||||
blockId: blockId,
|
||||
collectionId: this.collectionId,
|
||||
searchURL: this.searchURL,
|
||||
selectedItems: this.selectedItems,
|
||||
loadStrategy: this.loadStrategy,
|
||||
maxItemsNumber: this.maxItemsNumber,
|
||||
maxItemsPerScreen: this.maxItemsPerScreen,
|
||||
arrowsPosition: this.arrowsPosition,
|
||||
largeArrows: this.largeArrows,
|
||||
autoPlay: this.autoPlay,
|
||||
autoPlaySpeed: this.autoPlaySpeed,
|
||||
loopSlides: this.loopSlides,
|
||||
hideTitle: this.hideTitle,
|
||||
cropImagesToSquare: this.cropImagesToSquare,
|
||||
showCollectionHeader: this.showCollectionHeader,
|
||||
showCollectionLabel: this.showCollectionLabel,
|
||||
collectionBackgroundColor: this.collectionBackgroundColor,
|
||||
collectionTextColor: this.collectionTextColor,
|
||||
tainacanApiRoot: this.tainacanApiRoot,
|
||||
tainacanBaseUrl: this.tainacanBaseUrl,
|
||||
className: this.className
|
||||
}
|
||||
});
|
||||
},
|
||||
beforeMount () {
|
||||
this.className = this.$el.attributes.class != undefined ? this.$el.attributes.class.value : undefined;
|
||||
this.searchURL = this.$el.attributes['search-url'] != undefined ? this.$el.attributes['search-url'].value : undefined;
|
||||
this.selectedItems = this.$el.attributes['selected-items'] != undefined ? JSON.parse(this.$el.attributes['selected-items'].value) : undefined;
|
||||
this.loadStrategy = this.$el.attributes['load-strategy'] != undefined ? this.$el.attributes['load-strategy'].value : undefined;
|
||||
this.collectionId = this.$el.attributes['collection-id'] != undefined ? this.$el.attributes['collection-id'].value : undefined;
|
||||
this.maxItemsNumber = this.$el.attributes['max-items-number'] != undefined ? this.$el.attributes['max-items-number'].value : undefined;
|
||||
this.maxItemsPerScreen = this.$el.attributes['max-items-per-screen'] != undefined ? this.$el.attributes['max-items-per-screen'].value : 7;
|
||||
this.arrowsPosition = this.$el.attributes['arrows-position'] != undefined ? this.$el.attributes['arrows-position'].value : undefined;
|
||||
this.largeArrows = this.$el.attributes['large-arrows'] != undefined ? this.$el.attributes['large-arrows'].value == 'true' : false;
|
||||
this.autoPlay = this.$el.attributes['auto-play'] != undefined ? this.$el.attributes['auto-play'].value == 'true' : false;
|
||||
this.autoPlaySpeed = this.$el.attributes['auto-play-speed'] != undefined ? this.$el.attributes['auto-play-speed'].value : 3;
|
||||
this.loopSlides = this.$el.attributes['loop-slides'] != undefined ? this.$el.attributes['loop-slides'].value == 'true' : false;
|
||||
this.hideTitle = this.$el.attributes['hide-title'] != undefined ? this.$el.attributes['hide-title'].value == 'true' : false;
|
||||
this.cropImagesToSquare = this.$el.attributes['crop-images-to-square'] != undefined ? this.$el.attributes['crop-images-to-square'].value == 'true' : true;
|
||||
this.showCollectionHeader = this.$el.attributes['show-collection-header'] != undefined ? this.$el.attributes['show-collection-header'].value == 'true' : false;
|
||||
this.showCollectionLabel = this.$el.attributes['show-collection-label'] != undefined ? this.$el.attributes['show-collection-label'].value == 'true' : false;
|
||||
this.collectionBackgroundColor = this.$el.attributes['collection-background-color'] != undefined ? this.$el.attributes['collection-background-color'].value : undefined;
|
||||
this.collectionTextColor = this.$el.attributes['collection-text-color'] != undefined ? this.$el.attributes['collection-text-color'].value : undefined;
|
||||
this.tainacanApiRoot = this.$el.attributes['tainacan-api-root'] != undefined ? this.$el.attributes['tainacan-api-root'].value : undefined;
|
||||
this.tainacanBaseUrl = this.$el.attributes['tainacan-base-url'] != undefined ? this.$el.attributes['tainacan-base-url'].value : undefined;
|
||||
},
|
||||
methods: {
|
||||
__(text, domain) {
|
||||
return wp.i18n.__(text, domain);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Vue.use(ThumbnailHelperPlugin);
|
||||
Vue.use(VueBlurHash);
|
||||
new Vue( Object.assign({ el: '#' + blockId }, vueOptions) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This is rendered on the theme side.
|
||||
renderTainacanItemCarouselBlocks();
|
||||
|
||||
// Also if a theme or plugin requested a reset...
|
||||
document.addEventListener("TainacanReloadCarouselItemsListBlock", () => {
|
||||
renderTainacanItemCarouselBlocks();
|
||||
});
|
||||
};
|
|
@ -377,6 +377,6 @@ export default {
|
|||
|
||||
<style lang="scss">
|
||||
|
||||
@import './carousel-items-list.scss';
|
||||
@import './style.scss';
|
||||
|
||||
</style>
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"name": "tainacan/carousel-related-items",
|
||||
"title": "Tainacan Related Items Carousel",
|
||||
"category": "tainacan-blocks",
|
||||
"keywords": [ "items", "carousel", "slider", "relationship" ],
|
||||
"description": "A set of carousels to list items related to a certain item via relationship metadata.",
|
||||
"textdomain": "tainacan",
|
||||
"example": {
|
||||
"attributes": {
|
||||
"content": "preview"
|
||||
}
|
||||
},
|
||||
"parent": [],
|
||||
"attributes": {
|
||||
"content": {
|
||||
"type": "Array",
|
||||
"source": "children",
|
||||
"selector": "div"
|
||||
},
|
||||
"collectionId": {
|
||||
"type": "String",
|
||||
"default": ""
|
||||
},
|
||||
"itemId": {
|
||||
"type": "String",
|
||||
"default": ""
|
||||
},
|
||||
"isModalOpen": {
|
||||
"type": "Boolean",
|
||||
"default": false
|
||||
},
|
||||
"relatedItems": {
|
||||
"type": "Array",
|
||||
"default": []
|
||||
},
|
||||
"relatedItemsTemplate": {
|
||||
"type": "Array",
|
||||
"default": []
|
||||
},
|
||||
"itemRequestSource": {
|
||||
"type": "String",
|
||||
"default": ""
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"align": ["full", "wide"],
|
||||
"html": false,
|
||||
"multiple": true
|
||||
},
|
||||
"editorScript": "carousel-related-items",
|
||||
"editorStyle": "carousel-related-items"
|
||||
}
|
|
@ -45,7 +45,7 @@ export default class CarouselRelatedItemsModal extends React.Component {
|
|||
itemId: this.props.existingItemId
|
||||
});
|
||||
|
||||
if (this.props.existingCollectionId != null && this.props.existingCollectionId != undefined) {
|
||||
if (this.props.existingCollectionId) {
|
||||
this.fetchCollection(this.props.existingCollectionId);
|
||||
this.setState({
|
||||
searchURL: tainacan_blocks.admin_url + 'admin.php?page=tainacan_admin#/collections/'+ this.props.existingCollectionId + '/items/?singleselectionmode=true&iframemode=true&status=publish'
|
||||
|
@ -196,7 +196,7 @@ export default class CarouselRelatedItemsModal extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
return this.state.collectionId != null && this.state.collectionId != undefined ? (
|
||||
return this.state.collectionId ? (
|
||||
// Items modal
|
||||
<Modal
|
||||
className="wp-block-tainacan-modal dynamic-modal"
|
|
@ -0,0 +1,222 @@
|
|||
const { __ } = wp.i18n;
|
||||
|
||||
const { Spinner, Button, Placeholder } = wp.components;
|
||||
|
||||
const { InnerBlocks} = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
|
||||
import CarouselRelatedItemsModal from './carousel-related-items-modal.js';
|
||||
import tainacan from '../../js/axios.js';
|
||||
import axios from 'axios';
|
||||
|
||||
export default function ({ attributes, setAttributes, className, isSelected }) {
|
||||
|
||||
let {
|
||||
content,
|
||||
collectionId,
|
||||
itemId,
|
||||
isModalOpen,
|
||||
relatedItems,
|
||||
isLoading,
|
||||
itemRequestSource,
|
||||
relatedItemsTemplate
|
||||
} = attributes;
|
||||
|
||||
|
||||
function setContent(){
|
||||
isLoading = true;
|
||||
|
||||
setAttributes({
|
||||
isLoading: isLoading
|
||||
});
|
||||
|
||||
if (itemRequestSource != undefined && typeof itemRequestSource == 'function')
|
||||
itemRequestSource.cancel('Previous items search canceled.');
|
||||
|
||||
itemRequestSource = axios.CancelToken.source();
|
||||
|
||||
let endpoint = '/items/'+ itemId + '?fetch_only=related_items';
|
||||
|
||||
tainacan.get(endpoint, { cancelToken: itemRequestSource.token })
|
||||
.then(response => {
|
||||
|
||||
relatedItems = response.data && response.data.related_items ? Object.values(response.data.related_items) : [];
|
||||
|
||||
setAttributes({
|
||||
relatedItems: relatedItems,
|
||||
isLoading: false,
|
||||
itemRequestSource: itemRequestSource
|
||||
});
|
||||
getRelatedItemsTemplates();
|
||||
});
|
||||
}
|
||||
|
||||
function openRelatedItemsModal() {
|
||||
isModalOpen = true;
|
||||
setAttributes( {
|
||||
isModalOpen: isModalOpen
|
||||
} );
|
||||
}
|
||||
|
||||
function getRelatedItemsTemplates() {
|
||||
relatedItemsTemplate = [];
|
||||
relatedItems.forEach((collection) => {
|
||||
|
||||
if (collection.total_items) {
|
||||
relatedItemsTemplate.push([
|
||||
'core/group',
|
||||
{},
|
||||
[
|
||||
[
|
||||
'core/heading',
|
||||
{
|
||||
placeholder: __( 'Collection name', 'tainacan' ),
|
||||
content: collection.collection_name
|
||||
}
|
||||
],
|
||||
[
|
||||
'core/paragraph',
|
||||
{
|
||||
placeholder: __( 'Relationship metadadum name', 'tainacan' ),
|
||||
content: collection.metadata_name
|
||||
}
|
||||
],
|
||||
[
|
||||
'tainacan/carousel-items-list',
|
||||
{
|
||||
content: [{ type: 'innerblock' }],
|
||||
selectedItems: collection.items,
|
||||
loadStrategy: 'parent',
|
||||
collectionId: collection.collection_id
|
||||
}
|
||||
],
|
||||
[
|
||||
'core/buttons',
|
||||
{},
|
||||
[
|
||||
[
|
||||
'core/button',
|
||||
{
|
||||
text: __( 'View all related items', 'tainacan' ),
|
||||
url: collection.collection_slug ? (collection.collection_slug + '?metaquery[0][key]=' + collection.metadata_id + '&metaquery[0][value][0]=' + itemId + '&metaquery[0][compare]=IN') : ''
|
||||
}
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'core/spacer',
|
||||
{ height: 30 }
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
});
|
||||
setAttributes({ relatedItemsTemplate: relatedItemsTemplate});
|
||||
}
|
||||
|
||||
// Executed only on the first load of page
|
||||
if(content && content.length && content[0].type)
|
||||
setContent();
|
||||
|
||||
return content == 'preview' ?
|
||||
<div className={className}>
|
||||
<img
|
||||
width="100%"
|
||||
src={ `${tainacan_blocks.base_url}/assets/images/related-carousel-items.png` } />
|
||||
</div>
|
||||
: (
|
||||
<div className={className}>
|
||||
|
||||
{ isSelected ?
|
||||
(
|
||||
<div>
|
||||
{ isModalOpen ?
|
||||
<CarouselRelatedItemsModal
|
||||
existingCollectionId={ collectionId }
|
||||
existingItemId={ itemId }
|
||||
onSelectCollection={ (selectedCollectionId) => {
|
||||
if (collectionId != selectedCollectionId)
|
||||
relatedItems = [];
|
||||
|
||||
collectionId = selectedCollectionId;
|
||||
setAttributes({
|
||||
collectionId: collectionId,
|
||||
relatedItems: relatedItems
|
||||
});
|
||||
}}
|
||||
onApplyRelatedItem={ (selectedItemId) => {
|
||||
if (itemId != selectedItemId) {
|
||||
relatedItems = [];
|
||||
relatedItemsTemplate = [];
|
||||
}
|
||||
|
||||
itemId = selectedItemId;
|
||||
setAttributes({
|
||||
itemId: itemId,
|
||||
relatedItems: relatedItems,
|
||||
relatedItemsTemplate: relatedItemsTemplate,
|
||||
isModalOpen: false
|
||||
});
|
||||
setContent();
|
||||
}}
|
||||
onCancelSelection={ () => setAttributes({ isModalOpen: false }) }/>
|
||||
: null
|
||||
}
|
||||
|
||||
</div>
|
||||
) : null
|
||||
}
|
||||
|
||||
{ !relatedItems.length && !isLoading ? (
|
||||
<Placeholder
|
||||
className="tainacan-block-placeholder"
|
||||
icon={(
|
||||
<img
|
||||
width={148}
|
||||
src={ `${tainacan_blocks.base_url}/assets/images/tainacan_logo_header.svg` }
|
||||
alt="Tainacan Logo"/>
|
||||
)}>
|
||||
<p>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
height="24px"
|
||||
width="24px">
|
||||
<path d="M16,6H12a2,2,0,0,0-2,2v6.52A6,6,0,0,1,12,19a6,6,0,0,1-.73,2.88A1.92,1.92,0,0,0,12,22h8a2,2,0,0,0,2-2V12Zm-1,6V7.5L19.51,12ZM15,2V4H8v9.33A5.8,5.8,0,0,0,6,13V4A2,2,0,0,1,8,2ZM10.09,19.05,7,22.11V16.05L8,17l2,2ZM5,16.05v6.06L2,19.11Z"/>
|
||||
</svg>
|
||||
{__('Select an item to create a set of carousels with items related to it via relationship metadata.', 'tainacan')}
|
||||
</p>
|
||||
<Button
|
||||
isPrimary
|
||||
type="button"
|
||||
onClick={ () => openRelatedItemsModal() }>
|
||||
{__('Select Item', 'tainacan')}
|
||||
</Button>
|
||||
</Placeholder>
|
||||
) : null
|
||||
}
|
||||
|
||||
{ isLoading ?
|
||||
<div class="spinner-container">
|
||||
<Spinner />
|
||||
</div> :
|
||||
<div>
|
||||
{ relatedItems.length ? (
|
||||
|
||||
<div className={ 'carousel-related-items-edit-container' }>
|
||||
<InnerBlocks
|
||||
allowedBlocks={[
|
||||
'core/heading',
|
||||
'core/paragraph',
|
||||
'tainacan/carousel-items-list',
|
||||
'core/buttons'
|
||||
]}
|
||||
template={ relatedItemsTemplate } />
|
||||
</div>
|
||||
) : null
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,13 @@
|
|||
const { SVG, Path } = wp.components;
|
||||
|
||||
export default (
|
||||
<SVG
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
height="24px"
|
||||
width="24px">
|
||||
<Path
|
||||
d="M16,6H12a2,2,0,0,0-2,2v6.52A6,6,0,0,1,12,19a6,6,0,0,1-.73,2.88A1.92,1.92,0,0,0,12,22h8a2,2,0,0,0,2-2V12Zm-1,6V7.5L19.51,12ZM15,2V4H8v9.33A5.8,5.8,0,0,0,6,13V4A2,2,0,0,1,8,2ZM10.09,19.05,7,22.11V16.05L8,17l2,2ZM5,16.05v6.06L2,19.11Z"/>
|
||||
</SVG>
|
||||
);
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
import tainacanRegisterBlockType from '../../js/tainacan-blocks-compat-register.js';
|
||||
|
||||
import metadata from './block.json';
|
||||
import icon from './icon.js';
|
||||
import edit from './edit.js';
|
||||
import save from './save.js';
|
||||
import deprecated from './deprecated.js';
|
||||
|
||||
tainacanRegisterBlockType({
|
||||
metadata,
|
||||
icon,
|
||||
edit,
|
||||
save,
|
||||
deprecated
|
||||
});
|
|
@ -0,0 +1,5 @@
|
|||
const { InnerBlocks} = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
|
||||
export default function({ className }) {
|
||||
return <div data-module="carousel-related-items" className={ className }><InnerBlocks.Content /></div>
|
||||
};
|
|
@ -0,0 +1,3 @@
|
|||
import './style.scss';
|
||||
|
||||
export default () => {}
|
|
@ -0,0 +1,110 @@
|
|||
{
|
||||
"name": "tainacan/carousel-terms-list",
|
||||
"title": "Tainacan Terms Carousel",
|
||||
"category": "tainacan-blocks",
|
||||
"keywords": [ "carousel", "slider", "taxonomy" ],
|
||||
"description": "List terms on a Carousel, showing their thumbnails or a preview of items.",
|
||||
"textdomain": "tainacan",
|
||||
"example": {
|
||||
"attributes": {
|
||||
"content": "preview"
|
||||
}
|
||||
},
|
||||
"attributes": {
|
||||
"content": {
|
||||
"type": "Array",
|
||||
"source": "children",
|
||||
"selector": "div"
|
||||
},
|
||||
"terms": {
|
||||
"type": "Array",
|
||||
"default": []
|
||||
},
|
||||
"isModalOpen": {
|
||||
"type": "Boolean",
|
||||
"default": false
|
||||
},
|
||||
"selectedTerms": {
|
||||
"type": "Array",
|
||||
"default": []
|
||||
},
|
||||
"itemsRequestSource": {
|
||||
"type": "String",
|
||||
"default": ""
|
||||
},
|
||||
"maxTermsNumber": {
|
||||
"type": "Number",
|
||||
"value": 12
|
||||
},
|
||||
"maxTermsPerScreen": {
|
||||
"type": "Number",
|
||||
"value": 6
|
||||
},
|
||||
"isLoading": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"isLoadingTerm": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"arrowsPosition": {
|
||||
"type": "String",
|
||||
"value": "around"
|
||||
},
|
||||
"largeArrows": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"autoPlay": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"autoPlaySpeed": {
|
||||
"type": "Number",
|
||||
"value": 3
|
||||
},
|
||||
"loopSlides": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"hideName": {
|
||||
"type": "Boolean",
|
||||
"value": true
|
||||
},
|
||||
"showTermThumbnail": {
|
||||
"type": "Boolean",
|
||||
"value": false
|
||||
},
|
||||
"term": {
|
||||
"type": "Object",
|
||||
"value": {}
|
||||
},
|
||||
"blockId": {
|
||||
"type": "String",
|
||||
"default": ""
|
||||
},
|
||||
"termBackgroundColor": {
|
||||
"type": "String",
|
||||
"default": "#454647"
|
||||
},
|
||||
"termTextColor": {
|
||||
"type": "String",
|
||||
"default": "#ffffff"
|
||||
},
|
||||
"taxonomyId": {
|
||||
"type": "String",
|
||||
"default": ""
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"align": ["full", "wide"],
|
||||
"html": false,
|
||||
"multiple": true,
|
||||
"typography": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"editorScript": "carousel-terms-list",
|
||||
"editorStyle": "carousel-terms-list"
|
||||
}
|
|
@ -1,4 +1,135 @@
|
|||
export default [
|
||||
/* Deprecated on Tainacan 0.18.4 due to the new block.json strategy */
|
||||
{
|
||||
attributes: {
|
||||
content: {
|
||||
type: 'array',
|
||||
source: 'children',
|
||||
selector: 'div'
|
||||
},
|
||||
terms: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
isModalOpen: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
selectedTerms: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
itemsRequestSource: {
|
||||
type: String,
|
||||
default: undefined
|
||||
},
|
||||
maxTermsNumber: {
|
||||
type: Number,
|
||||
value: undefined
|
||||
},
|
||||
maxTermsPerScreen: {
|
||||
type: Number,
|
||||
value: 6
|
||||
},
|
||||
isLoading: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
isLoadingTerm: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
arrowsPosition: {
|
||||
type: String,
|
||||
value: 'search'
|
||||
},
|
||||
largeArrows: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
autoPlay: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
autoPlaySpeed: {
|
||||
type: Number,
|
||||
value: 3
|
||||
},
|
||||
loopSlides: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
hideName: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
showTermThumbnail: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
term: {
|
||||
type: Object,
|
||||
value: undefined
|
||||
},
|
||||
blockId: {
|
||||
type: String,
|
||||
default: undefined
|
||||
},
|
||||
termBackgroundColor: {
|
||||
type: String,
|
||||
default: "#454647"
|
||||
},
|
||||
termTextColor: {
|
||||
type: String,
|
||||
default: "#ffffff"
|
||||
},
|
||||
taxonomyId: {
|
||||
type: String,
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
supports: {
|
||||
align: ['full', 'wide'],
|
||||
html: false,
|
||||
multiple: true,
|
||||
fontSize: true
|
||||
},
|
||||
save({ attributes, className }){
|
||||
const {
|
||||
content,
|
||||
blockId,
|
||||
selectedTerms,
|
||||
arrowsPosition,
|
||||
largeArrows,
|
||||
maxTermsPerScreen,
|
||||
maxTermsNumber,
|
||||
autoPlay,
|
||||
autoPlaySpeed,
|
||||
loopSlides,
|
||||
hideName,
|
||||
showTermThumbnail,
|
||||
taxonomyId
|
||||
} = attributes;
|
||||
return <div
|
||||
className={ className }
|
||||
selected-terms={ JSON.stringify(selectedTerms.map((term) => { return term.id; })) }
|
||||
arrows-position={ arrowsPosition }
|
||||
auto-play={ '' + autoPlay }
|
||||
auto-play-speed={ autoPlaySpeed }
|
||||
loop-slides={ '' + loopSlides }
|
||||
hide-name={ '' + hideName }
|
||||
large-arrows={ '' + largeArrows }
|
||||
max-terms-number={ maxTermsNumber }
|
||||
max-terms-per-screen={ maxTermsPerScreen }
|
||||
taxonomy-id={ taxonomyId }
|
||||
tainacan-api-root={ tainacan_blocks.root }
|
||||
tainacan-base-url={ tainacan_blocks.base_url }
|
||||
show-term-thumbnail={ '' + showTermThumbnail }
|
||||
id={ 'wp-block-tainacan-carousel-terms-list_' + blockId }>
|
||||
{ content }
|
||||
</div>
|
||||
}
|
||||
},
|
||||
/* Deprecated on Tainacan 0.17.2, due to the introduction of support: fontSize */
|
||||
{
|
||||
attributes: {
|
|
@ -0,0 +1,429 @@
|
|||
const { __ } = wp.i18n;
|
||||
|
||||
const { RangeControl, Spinner, Button, BaseControl, ToggleControl, SelectControl, Placeholder, IconButton, PanelBody } = wp.components;
|
||||
|
||||
const { InspectorControls, BlockControls } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
|
||||
import TermsModal from '../terms-list/terms-modal.js';
|
||||
import tainacan from '../../js/axios.js';
|
||||
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 'swiper/css/swiper.min.css';
|
||||
|
||||
export default function({ attributes, setAttributes, className, isSelected, clientId }){
|
||||
let {
|
||||
terms,
|
||||
content,
|
||||
isModalOpen,
|
||||
itemsRequestSource,
|
||||
selectedTerms,
|
||||
isLoading,
|
||||
largeArrows,
|
||||
maxTermsPerScreen,
|
||||
arrowsPosition,
|
||||
autoPlay,
|
||||
autoPlaySpeed,
|
||||
loopSlides,
|
||||
hideName,
|
||||
showTermThumbnail,
|
||||
taxonomyId
|
||||
} = attributes;
|
||||
|
||||
// Obtains block's client id to render it on save function
|
||||
setAttributes({ blockId: clientId });
|
||||
|
||||
// Sets some defaults that were not working
|
||||
if (maxTermsPerScreen === undefined) {
|
||||
maxTermsPerScreen = 6;
|
||||
setAttributes({ maxTermsPerScreen: maxTermsPerScreen });
|
||||
}
|
||||
|
||||
const thumbHelper = ThumbnailHelperFunctions();
|
||||
|
||||
function prepareItem(term, termItems) {
|
||||
return (
|
||||
<li
|
||||
key={ term.id }
|
||||
className={ 'term-list-item ' + (!showTermThumbnail ? 'term-list-item-grid ' : '') + (maxTermsPerScreen ? ' max-terms-per-screen-' + maxTermsPerScreen : '') }>
|
||||
{ tainacan_blocks.wp_version < '5.4' ?
|
||||
<IconButton
|
||||
onClick={ () => removeItemOfId(term.id) }
|
||||
icon="no-alt"
|
||||
label={__('Remove', 'tainacan')}/>
|
||||
:
|
||||
<Button
|
||||
onClick={ () => removeItemOfId(term.id) }
|
||||
icon="no-alt"
|
||||
label={__('Remove', 'tainacan')}/>
|
||||
}
|
||||
<a
|
||||
id={ isNaN(term.id) ? term.id : 'term-id-' + term.id }
|
||||
href={ term.url }
|
||||
target="_blank">
|
||||
{ !showTermThumbnail ?
|
||||
<div class="term-items-grid">
|
||||
<img
|
||||
src={ termItems[0] ? thumbHelper.getSrc(termItems[0]['thumbnail'], 'tainacan-medium', termItems[0]['document_mimetype']) :`${tainacan_blocks.base_url}/assets/images/placeholder_square.png` }
|
||||
srcSet={ termItems[0] ? thumbHelper.getSrcSet(termItems[0]['thumbnail'], 'tainacan-medium', termItems[0]['document_mimetype']) :`${tainacan_blocks.base_url}/assets/images/placeholder_square.png` }
|
||||
alt={ termItems[0] && termItems[0].thumbnail_alt ? termItems[0].thumbnail_alt : (termItems[0] && termItems[0].name ? termItems[0].name : __( 'Thumbnail', 'tainacan' )) } />
|
||||
<img
|
||||
src={ termItems[1] ? thumbHelper.getSrc(termItems[1]['thumbnail'], 'tainacan-medium', termItems[1]['document_mimetype']) :`${tainacan_blocks.base_url}/assets/images/placeholder_square.png` }
|
||||
srcSet={ termItems[1] ? thumbHelper.getSrcSet(termItems[1]['thumbnail'], 'tainacan-medium', termItems[1]['document_mimetype']) :`${tainacan_blocks.base_url}/assets/images/placeholder_square.png` }
|
||||
alt={ termItems[1] && termItems[1].thumbnail_alt ? termItems[1].thumbnail_alt : (termItems[1] && termItems[1].name ? termItems[1].name : __( 'Thumbnail', 'tainacan' )) } />
|
||||
<img
|
||||
src={ termItems[2] ? thumbHelper.getSrc(termItems[2]['thumbnail'], 'tainacan-medium', termItems[2]['document_mimetype']) :`${tainacan_blocks.base_url}/assets/images/placeholder_square.png` }
|
||||
srcSet={ termItems[2] ? thumbHelper.getSrcSet(termItems[2]['thumbnail'], 'tainacan-medium', termItems[2]['document_mimetype']) :`${tainacan_blocks.base_url}/assets/images/placeholder_square.png` }
|
||||
alt={ termItems[2] && termItems[2].thumbnail_alt ? termItems[2].thumbnail_alt : (termItems[2] && termItems[2].name ? termItems[2].name : __( 'Thumbnail', 'tainacan' )) } />
|
||||
</div>
|
||||
:
|
||||
<img
|
||||
src={ term.header_image ? term.header_image : `${tainacan_blocks.base_url}/assets/images/placeholder_square.png`}
|
||||
alt={ term.name ? term.name : __( 'Thumbnail', 'tainacan' )}/>
|
||||
}
|
||||
{ !hideName ? <span>{ term.name ? term.name : '' }</span> : null }
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
function setContent(){
|
||||
isLoading = true;
|
||||
|
||||
setAttributes({
|
||||
isLoading: isLoading
|
||||
});
|
||||
|
||||
if (itemsRequestSource != undefined && typeof itemsRequestSource == 'function')
|
||||
itemsRequestSource.cancel('Previous terms search canceled.');
|
||||
|
||||
itemsRequestSource = axios.CancelToken.source();
|
||||
|
||||
terms = [];
|
||||
|
||||
let endpoint = '/taxonomy/' + taxonomyId + '/terms/?'+ qs.stringify({ hideempty: 0, include: selectedTerms.map((term) => { return term.id; }) }) + '&order=asc&fetch_only=id,name,url,header_image';
|
||||
tainacan.get(endpoint, { cancelToken: itemsRequestSource.token })
|
||||
.then(response => {
|
||||
|
||||
if (showTermThumbnail) {
|
||||
for (let term of response.data) {
|
||||
terms.push(prepareItem(term));
|
||||
}
|
||||
setAttributes({
|
||||
content: <div></div>,
|
||||
terms: terms,
|
||||
isLoading: false,
|
||||
itemsRequestSource: itemsRequestSource
|
||||
});
|
||||
} else {
|
||||
let promises = [];
|
||||
for (let term of response.data) {
|
||||
promises.push(
|
||||
tainacan.get('/items/?perpage=3&fetch_only=name,url,thumbnail&taxquery[0][taxonomy]=tnc_tax_' + taxonomyId + '&taxquery[0][terms][0]=' + term.id + '&taxquery[0][compare]=IN')
|
||||
.then(response => { return({ term: term, termItems: response.data.items }) })
|
||||
.catch((error) => console.log(error))
|
||||
);
|
||||
}
|
||||
axios.all(promises).then((results) => {
|
||||
for (let result of results) {
|
||||
terms.push(prepareItem(result.term, result.termItems));
|
||||
}
|
||||
setAttributes({
|
||||
content: <div></div>,
|
||||
terms: terms,
|
||||
isLoading: false,
|
||||
itemsRequestSource: itemsRequestSource
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function openCarouselModal() {
|
||||
isModalOpen = true;
|
||||
setAttributes( {
|
||||
isModalOpen: isModalOpen
|
||||
} );
|
||||
}
|
||||
|
||||
function removeItemOfId(itemId) {
|
||||
|
||||
let existingItemIndex = terms.findIndex((existingItem) => existingItem.key == itemId);
|
||||
if (existingItemIndex >= 0)
|
||||
terms.splice(existingItemIndex, 1);
|
||||
|
||||
let existingSelectedItemIndex = selectedTerms.findIndex((existingSelectedItem) => existingSelectedItem.id == itemId);
|
||||
if (existingSelectedItemIndex >= 0)
|
||||
selectedTerms.splice(existingSelectedItemIndex, 1);
|
||||
|
||||
setAttributes({
|
||||
selectedTerms: selectedTerms,
|
||||
terms: terms,
|
||||
content: <div></div>
|
||||
});
|
||||
}
|
||||
|
||||
// Executed only on the first load of page
|
||||
if(content && content.length && content[0].type)
|
||||
setContent();
|
||||
|
||||
return content == 'preview' ?
|
||||
<div className={className}>
|
||||
<img
|
||||
width="100%"
|
||||
src={ `${tainacan_blocks.base_url}/assets/images/carousel-terms-list.png` } />
|
||||
</div>
|
||||
: (
|
||||
<div className={className}>
|
||||
|
||||
{ terms.length ?
|
||||
<BlockControls>
|
||||
{
|
||||
TainacanBlocksCompatToolbar({
|
||||
label: __('Add more terms', 'tainacan'),
|
||||
icon: <svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 -2 24 24"
|
||||
height="24px"
|
||||
width="24px">
|
||||
<path d="M21.43,14.64,19.32,17a2.57,2.57,0,0,1-2,1H12.05a6,6,0,0,0-6-6H6V10.64A2.59,2.59,0,0,1,8.59,8H17.3a2.57,2.57,0,0,1,2,1l2.11,2.38A2.59,2.59,0,0,1,21.43,14.64ZM4,4A2,2,0,0,0,2,6v7.63a5.74,5.74,0,0,1,2-1.2V6H16V4ZM7,15.05v6.06l3.06-3.06ZM5,21.11V15.05L1.94,18.11Z"/>
|
||||
</svg>,
|
||||
onClick: openCarouselModal
|
||||
})
|
||||
}
|
||||
</BlockControls>
|
||||
: null }
|
||||
|
||||
<div>
|
||||
<InspectorControls>
|
||||
|
||||
<PanelBody
|
||||
title={__('Carousel', 'tainacan')}
|
||||
initialOpen={ true }
|
||||
>
|
||||
<BaseControl
|
||||
id="term-carousel-view-modes"
|
||||
label={ __('Term layout', 'tainacan')}>
|
||||
<div className="term-carousel-view-modes">
|
||||
<button
|
||||
onClick={ () => {
|
||||
showTermThumbnail = false;
|
||||
setAttributes({ showTermThumbnail: showTermThumbnail });
|
||||
setContent();
|
||||
}
|
||||
}
|
||||
className={'term-carousel-view-mode-grid' + (showTermThumbnail ? '' : ' is-active')}>
|
||||
<div>
|
||||
<div />
|
||||
<div />
|
||||
<div />
|
||||
</div>
|
||||
<label>{ __('Items\'s grid', 'tainacan') }</label>
|
||||
</button>
|
||||
<button
|
||||
onClick={ () => {
|
||||
showTermThumbnail = true;
|
||||
setAttributes({ showTermThumbnail: showTermThumbnail });
|
||||
setContent();
|
||||
}
|
||||
}
|
||||
className={'term-carousel-view-mode-thumbnail' + (showTermThumbnail ? ' is-active' : '')}>
|
||||
<div />
|
||||
<label>{ __('Thumbnail', 'tainacan') }</label>
|
||||
</button>
|
||||
</div>
|
||||
</BaseControl>
|
||||
<RangeControl
|
||||
label={ __('Maximum terms per slide on a wide screen', 'tainacan') }
|
||||
help={ (showTermThumbnail && maxTermsPerScreen <= 3) ? __('Warning: with such a small number of terms per slide, the image size is greater and might be pixelated.', 'tainacan') : null }
|
||||
value={ maxTermsPerScreen ? maxTermsPerScreen : 6 }
|
||||
onChange={ ( aMaxTermsPerScreen ) => {
|
||||
maxTermsPerScreen = aMaxTermsPerScreen;
|
||||
setAttributes( { maxTermsPerScreen: aMaxTermsPerScreen } );
|
||||
setContent();
|
||||
}}
|
||||
min={ 1 }
|
||||
max={ 9 }
|
||||
/>
|
||||
<ToggleControl
|
||||
label={__('Hide name', 'tainacan')}
|
||||
help={ !hideName ? __('Toggle to hide term\'s name', 'tainacan') : __('Do not hide term\'s name', 'tainacan')}
|
||||
checked={ hideName }
|
||||
onChange={ ( isChecked ) => {
|
||||
hideName = isChecked;
|
||||
setAttributes({ hideName: hideName });
|
||||
setContent();
|
||||
}
|
||||
}
|
||||
/>
|
||||
<ToggleControl
|
||||
label={__('Loop slides', 'tainacan')}
|
||||
help={ !loopSlides ? __('Toggle to make slides loop from first to last', 'tainacan') : __('Do not loop slides from first to last', 'tainacan')}
|
||||
checked={ loopSlides }
|
||||
onChange={ ( isChecked ) => {
|
||||
loopSlides = isChecked;
|
||||
setAttributes({ loopSlides: loopSlides });
|
||||
}
|
||||
}
|
||||
/>
|
||||
<ToggleControl
|
||||
label={__('Auto play', 'tainacan')}
|
||||
help={ !autoPlay ? __('Toggle to automatically slide to next term', 'tainacan') : __('Do not automatically slide to next term', 'tainacan')}
|
||||
checked={ autoPlay }
|
||||
onChange={ ( isChecked ) => {
|
||||
autoPlay = isChecked;
|
||||
setAttributes({ autoPlay: autoPlay });
|
||||
}
|
||||
}
|
||||
/>
|
||||
{
|
||||
autoPlay ?
|
||||
<RangeControl
|
||||
label={__('Seconds before translating to next', 'tainacan')}
|
||||
value={ autoPlaySpeed ? autoPlaySpeed : 3 }
|
||||
onChange={ ( aAutoPlaySpeed ) => {
|
||||
autoPlaySpeed = aAutoPlaySpeed;
|
||||
setAttributes( { autoPlaySpeed: aAutoPlaySpeed } )
|
||||
}}
|
||||
min={ 1 }
|
||||
max={ 5 }
|
||||
/>
|
||||
: null
|
||||
}
|
||||
<SelectControl
|
||||
label={__('Arrows', 'tainacan')}
|
||||
value={ arrowsPosition }
|
||||
options={ [
|
||||
{ label: __('Around', 'tainacan'), value: 'around' },
|
||||
{ label: __('Left', 'tainacan'), value: 'left' },
|
||||
{ label: __('Right', 'tainacan'), value: 'right' }
|
||||
] }
|
||||
onChange={ ( aPosition ) => {
|
||||
arrowsPosition = aPosition;
|
||||
|
||||
setAttributes({ arrowsPosition: arrowsPosition });
|
||||
}}/>
|
||||
<ToggleControl
|
||||
label={__('Large arrows', 'tainacan')}
|
||||
help={ !largeArrows ? __('Toggle to display arrows bigger than the default size.', 'tainacan') : __('Do not show arrows bigger than the default size.', 'tainacan')}
|
||||
checked={ largeArrows }
|
||||
onChange={ ( isChecked ) => {
|
||||
largeArrows = isChecked;
|
||||
setAttributes({ largeArrows: largeArrows });
|
||||
}
|
||||
}
|
||||
/>
|
||||
</PanelBody>
|
||||
</InspectorControls>
|
||||
</div>
|
||||
|
||||
{ isSelected ?
|
||||
(
|
||||
<div>
|
||||
{ isModalOpen ?
|
||||
<TermsModal
|
||||
replaceTermId={ false } // The Terms modal adds `term-id-` string to terms ids. Here we dont' need it
|
||||
existingTaxonomyId={ taxonomyId }
|
||||
selectedTermsObject={ selectedTerms }
|
||||
onSelectTaxonomy={ (selectedTaxonomyId) => {
|
||||
taxonomyId = selectedTaxonomyId;
|
||||
setAttributes({ taxonomyId: taxonomyId });
|
||||
}}
|
||||
onApplySelection={ (aSelectionOfTerms) =>{
|
||||
selectedTerms = aSelectionOfTerms;
|
||||
|
||||
setAttributes({
|
||||
selectedTerms: selectedTerms,
|
||||
isModalOpen: false
|
||||
});
|
||||
setContent();
|
||||
}}
|
||||
onCancelSelection={ () => setAttributes({ isModalOpen: false }) }/>
|
||||
: null
|
||||
}
|
||||
|
||||
</div>
|
||||
) : null
|
||||
}
|
||||
|
||||
{ !terms.length && !isLoading ? (
|
||||
<Placeholder
|
||||
className="tainacan-block-placeholder"
|
||||
icon={(
|
||||
<img
|
||||
width={148}
|
||||
src={ `${tainacan_blocks.base_url}/assets/images/tainacan_logo_header.svg` }
|
||||
alt="Tainacan Logo"/>
|
||||
)}>
|
||||
<p>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
height="24px"
|
||||
width="24px">
|
||||
<path d="M21.43,14.64,19.32,17a2.57,2.57,0,0,1-2,1H12.05a6,6,0,0,0-6-6H6V10.64A2.59,2.59,0,0,1,8.59,8H17.3a2.57,2.57,0,0,1,2,1l2.11,2.38A2.59,2.59,0,0,1,21.43,14.64ZM4,4A2,2,0,0,0,2,6v7.63a5.74,5.74,0,0,1,2-1.2V6H16V4ZM7,15.05v6.06l3.06-3.06ZM5,21.11V15.05L1.94,18.11Z"/>
|
||||
</svg>
|
||||
{__('List terms on a Carousel, showing their thumbnails or a preview of items.', 'tainacan')}
|
||||
</p>
|
||||
<Button
|
||||
isPrimary
|
||||
type="button"
|
||||
onClick={ () => openCarouselModal() }>
|
||||
{__('Select Terms', 'tainacan')}
|
||||
</Button>
|
||||
</Placeholder>
|
||||
) : null
|
||||
}
|
||||
|
||||
{ isLoading ?
|
||||
<div class="spinner-container">
|
||||
<Spinner />
|
||||
</div> :
|
||||
<div>
|
||||
{ isSelected && terms.length ?
|
||||
<div class="preview-warning">{__('Warning: this is just a demonstration. To see the carousel in action, either preview or publish your post.', 'tainacan')}</div>
|
||||
: null
|
||||
}
|
||||
{ terms.length ? (
|
||||
<div
|
||||
className={'terms-list-edit-container ' + (arrowsPosition ? 'has-arrows-' + arrowsPosition : '') + (largeArrows ? ' has-large-arrows' : '') }>
|
||||
<button
|
||||
class="swiper-button-prev"
|
||||
slot="button-prev"
|
||||
style={{ cursor: 'not-allowed' }}>
|
||||
<svg
|
||||
width={ largeArrows ? 60 : 42 }
|
||||
height={ largeArrows ? 60 : 42 }
|
||||
viewBox="0 0 24 24">
|
||||
<path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
|
||||
<path
|
||||
d="M0 0h24v24H0z"
|
||||
fill="none"/>
|
||||
</svg>
|
||||
</button>
|
||||
<ul className={'terms-list-edit'}>
|
||||
{ terms }
|
||||
</ul>
|
||||
<button
|
||||
class="swiper-button-next"
|
||||
slot="button-next"
|
||||
style={{ cursor: 'not-allowed' }}>
|
||||
<svg
|
||||
width={ largeArrows ? 60 : 42 }
|
||||
height={ largeArrows ? 60 : 42 }
|
||||
viewBox="0 0 24 24">
|
||||
<path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/>
|
||||
<path
|
||||
d="M0 0h24v24H0z"
|
||||
fill="none"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
):null
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,14 @@
|
|||
const { SVG, Path } = wp.components;
|
||||
|
||||
export default (
|
||||
<SVG
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
height="24px"
|
||||
width="24px">
|
||||
<Path
|
||||
fill="#298596"
|
||||
d="M21.43,14.64,19.32,17a2.57,2.57,0,0,1-2,1H12.05a6,6,0,0,0-6-6H6V10.64A2.59,2.59,0,0,1,8.59,8H17.3a2.57,2.57,0,0,1,2,1l2.11,2.38A2.59,2.59,0,0,1,21.43,14.64ZM4,4A2,2,0,0,0,2,6v7.63a5.74,5.74,0,0,1,2-1.2V6H16V4ZM7,15.05v6.06l3.06-3.06ZM5,21.11V15.05L1.94,18.11Z"/>
|
||||
</SVG>
|
||||
);
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
import tainacanRegisterBlockType from '../../js/tainacan-blocks-compat-register.js';
|
||||
|
||||
import metadata from './block.json';
|
||||
import icon from './icon.js';
|
||||
import edit from './edit.js';
|
||||
import save from './save.js';
|
||||
import deprecated from './deprecated.js';
|
||||
|
||||
tainacanRegisterBlockType({
|
||||
metadata,
|
||||
icon,
|
||||
edit,
|
||||
save,
|
||||
deprecated
|
||||
});
|
|
@ -0,0 +1,36 @@
|
|||
export default function({ attributes, className }) {
|
||||
const {
|
||||
content,
|
||||
blockId,
|
||||
selectedTerms,
|
||||
arrowsPosition,
|
||||
largeArrows,
|
||||
maxTermsPerScreen,
|
||||
maxTermsNumber,
|
||||
autoPlay,
|
||||
autoPlaySpeed,
|
||||
loopSlides,
|
||||
hideName,
|
||||
showTermThumbnail,
|
||||
taxonomyId
|
||||
} = attributes;
|
||||
return <div
|
||||
data-module="carousel-terms-list"
|
||||
className={ className }
|
||||
selected-terms={ JSON.stringify(selectedTerms.map((term) => { return term.id; })) }
|
||||
arrows-position={ arrowsPosition }
|
||||
auto-play={ '' + autoPlay }
|
||||
auto-play-speed={ autoPlaySpeed }
|
||||
loop-slides={ '' + loopSlides }
|
||||
hide-name={ '' + hideName }
|
||||
large-arrows={ '' + largeArrows }
|
||||
max-terms-number={ maxTermsNumber }
|
||||
max-terms-per-screen={ maxTermsPerScreen }
|
||||
taxonomy-id={ taxonomyId }
|
||||
tainacan-api-root={ tainacan_blocks.root }
|
||||
tainacan-base-url={ tainacan_blocks.base_url }
|
||||
show-term-thumbnail={ '' + showTermThumbnail }
|
||||
id={ 'wp-block-tainacan-carousel-terms-list_' + blockId }>
|
||||
{ content }
|
||||
</div>
|
||||
};
|
|
@ -173,6 +173,7 @@
|
|||
&>*:first-of-type {
|
||||
flex-basis: 100%;
|
||||
@include grid-child(1, 3, 1, 3);
|
||||
padding-bottom: 100% !important;
|
||||
}
|
||||
|
||||
&>* {
|
||||
|
@ -201,6 +202,7 @@
|
|||
top: calc(50% - 42px);
|
||||
bottom: initial;
|
||||
background: none;
|
||||
background-color: transparent !important;
|
||||
border: none;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
|
@ -382,7 +384,9 @@
|
|||
.term-items-grid {
|
||||
@include display-grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
grid-template-rows: 50% 50%;
|
||||
grid-template-rows: 1fr 1fr;
|
||||
grid-gap: 5px;
|
||||
gap: 5px;
|
||||
|
||||
img:first-of-type {
|
||||
flex-basis: 100%;
|
||||
|
@ -391,7 +395,6 @@
|
|||
|
||||
img {
|
||||
flex-basis: 50%;
|
||||
padding: 2px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
import Vue from 'vue';
|
||||
import CarouselTermsListTheme from './theme.vue';
|
||||
import { ThumbnailHelperPlugin } from '../../../admin/js/utilities.js';
|
||||
import VueBlurHash from 'vue-blurhash';
|
||||
|
||||
export default (element) => {
|
||||
|
||||
// Vue Dev Tools!
|
||||
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development';
|
||||
|
||||
function renderTainacanTermsCarouselBlocks() {
|
||||
|
||||
// Gets all divs with content created by our block;
|
||||
let blocksElements = element ? [ element ] : document.getElementsByClassName('wp-block-tainacan-carousel-terms-list');
|
||||
|
||||
if (blocksElements) {
|
||||
let blocks = Object.values(blocksElements);
|
||||
|
||||
// Checks if this carousel isn't already mounted
|
||||
blocks = blocks.filter((block) => block.classList && !block.classList.contains('has-mounted'));
|
||||
const blockIds = Object.values(blocks).map((block) => block.id);
|
||||
|
||||
// Creates a new Vue Instance to manage each block isolatelly
|
||||
for (let blockId of blockIds) {
|
||||
|
||||
// Configure Vue logic before passing it to constructor:
|
||||
let vueOptions = {
|
||||
data: {
|
||||
selectedItem: [],
|
||||
maxItemsNumber: 12,
|
||||
arrowsPosition: 'around',
|
||||
autoPlay: false,
|
||||
autoPlaySpeed: 3,
|
||||
largeArrows: false,
|
||||
maxTermsPerScreen: 6,
|
||||
loopSlides: false,
|
||||
hideName: true,
|
||||
showTermThumbnail: false,
|
||||
tainacanApiRoot: '',
|
||||
tainacanBaseUrl: '',
|
||||
className: '',
|
||||
taxonomyId: ''
|
||||
},
|
||||
render(h){
|
||||
return h(CarouselTermsListTheme, {
|
||||
props: {
|
||||
blockId: blockId,
|
||||
selectedTerms: this.selectedTerms,
|
||||
maxItemsNumber: this.maxItemsNumber,
|
||||
arrowsPosition: this.arrowsPosition,
|
||||
autoPlay: this.autoPlay,
|
||||
autoPlaySpeed: this.autoPlaySpeed,
|
||||
loopSlides: this.loopSlides,
|
||||
largeArrows: this.largeArrows,
|
||||
maxTermsPerScreen: this.maxTermsPerScreen,
|
||||
hideName: this.hideName,
|
||||
showTermThumbnail: this.showTermThumbnail,
|
||||
tainacanApiRoot: this.tainacanApiRoot,
|
||||
tainacanBaseUrl: this.tainacanBaseUrl,
|
||||
className: this.className,
|
||||
taxonomyId: this.taxonomyId
|
||||
}
|
||||
});
|
||||
},
|
||||
beforeMount () {
|
||||
this.className = this.$el.attributes.class != undefined ? this.$el.attributes.class.value : undefined;
|
||||
this.selectedTerms = this.$el.attributes['selected-terms'] != undefined ? JSON.parse(this.$el.attributes['selected-terms'].value) : undefined;
|
||||
this.maxItemsNumber = this.$el.attributes['max-terms-number'] != undefined ? this.$el.attributes['max-terms-number'].value : undefined;
|
||||
this.maxTermsPerScreen = this.$el.attributes['max-terms-per-screen'] != undefined ? this.$el.attributes['max-terms-per-screen'].value : undefined;
|
||||
this.arrowsPosition = this.$el.attributes['arrows-position'] != undefined ? this.$el.attributes['arrows-position'].value : undefined;
|
||||
this.autoPlay = this.$el.attributes['auto-play'] != undefined ? this.$el.attributes['auto-play'].value == 'true' : false;
|
||||
this.autoPlaySpeed = this.$el.attributes['auto-play-speed'] != undefined ? this.$el.attributes['auto-play-speed'].value : 3;
|
||||
this.largeArrows = this.$el.attributes['large-arrows'] != undefined ? this.$el.attributes['large-arrows'].value == 'true' : false;
|
||||
this.loopSlides = this.$el.attributes['loop-slides'] != undefined ? this.$el.attributes['loop-slides'].value == 'true' : false;
|
||||
this.hideName = this.$el.attributes['hide-name'] != undefined ? this.$el.attributes['hide-name'].value == 'true' : false;
|
||||
this.taxonomyId = this.$el.attributes['taxonomy-id'] != undefined ? this.$el.attributes['taxonomy-id'].value : undefined;
|
||||
this.showTermThumbnail = this.$el.attributes['show-term-thumbnail'] != undefined ? this.$el.attributes['show-term-thumbnail'].value == 'true' : false;
|
||||
this.tainacanApiRoot = this.$el.attributes['tainacan-api-root'] != undefined ? this.$el.attributes['tainacan-api-root'].value : undefined;
|
||||
this.tainacanBaseUrl = this.$el.attributes['tainacan-base-url'] != undefined ? this.$el.attributes['tainacan-base-url'].value : undefined;
|
||||
},
|
||||
methods: {
|
||||
__(text, domain) {
|
||||
return wp.i18n.__(text, domain);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Vue.use(VueBlurHash);
|
||||
Vue.use(ThumbnailHelperPlugin);
|
||||
new Vue( Object.assign({ el: '#' + blockId }, vueOptions) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This is rendered on the theme side.
|
||||
renderTainacanTermsCarouselBlocks();
|
||||
|
||||
// Also if a theme or plugin requested a reset...
|
||||
document.addEventListener("TainacanReloadCarouselTermsListBlock", () => {
|
||||
renderTainacanTermsCarouselBlocks();
|
||||
});
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div :class="className">
|
||||
<div :class="className + ' has-mounted'">
|
||||
<div v-if="!isLoading">
|
||||
<div
|
||||
:class="'tainacan-carousel ' + (arrowsPosition ? ' has-arrows-' + arrowsPosition : '') + (largeArrows ? ' has-large-arrows' : '')"
|
||||
|
@ -289,6 +289,6 @@ export default {
|
|||
|
||||
<style lang="scss">
|
||||
|
||||
@import './carousel-terms-list.scss';
|
||||
@import './style.scss';
|
||||
|
||||
</style>
|
|
@ -0,0 +1,93 @@
|
|||
{
|
||||
"name": "tainacan/collections-list",
|
||||
"title": "Tainacan Collections List",
|
||||
"category": "tainacan-blocks",
|
||||
"keywords": [ "Tainacan", "collections", "repository", "tainacan" ],
|
||||
"description": "Expose collections from your Tainacan repository",
|
||||
"textdomain": "tainacan",
|
||||
"example": {
|
||||
"attributes": {
|
||||
"content": "preview"
|
||||
}
|
||||
},
|
||||
"attributes": {
|
||||
"selectedCollectionsObject": {
|
||||
"type": "array",
|
||||
"source": "query",
|
||||
"selector": "a",
|
||||
"query": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"source": "attribute",
|
||||
"attribute": "id"
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"source": "attribute",
|
||||
"attribute": "href"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"source": "text"
|
||||
},
|
||||
"thumbnail": {
|
||||
"source": "query",
|
||||
"selector": "img",
|
||||
"query": {
|
||||
"src": {
|
||||
"source": "attribute",
|
||||
"attribute": "src"
|
||||
},
|
||||
"alt": {
|
||||
"source": "attribute",
|
||||
"attribute": "alt"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"default": []
|
||||
},
|
||||
"content": {
|
||||
"type": "array",
|
||||
"source": "children",
|
||||
"selector": "div"
|
||||
},
|
||||
"query": {
|
||||
"type": "Object",
|
||||
"default": {}
|
||||
},
|
||||
"selectedCollectionsHTML": {
|
||||
"type": "Array",
|
||||
"default": []
|
||||
},
|
||||
"showImage": {
|
||||
"type": "Boolean",
|
||||
"default": true
|
||||
},
|
||||
"showName": {
|
||||
"type": "Boolean",
|
||||
"default": true
|
||||
},
|
||||
"layout": {
|
||||
"type": "String",
|
||||
"default": "grid"
|
||||
},
|
||||
"isModalOpen": {
|
||||
"type": "Boolean",
|
||||
"default": false
|
||||
},
|
||||
"gridMargin": {
|
||||
"type": "Number",
|
||||
"default": 0
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"align": ["full", "wide"],
|
||||
"html": false,
|
||||
"typography": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"editorScript": "collections-list",
|
||||
"editorStyle": "collections-list"
|
||||
}
|
|
@ -1,4 +1,87 @@
|
|||
export default [
|
||||
/* Deprecated in version 0.18.4 due to WP 5.8 support */
|
||||
{
|
||||
attributes: {
|
||||
selectedCollectionsObject: {
|
||||
type: 'array',
|
||||
source: 'query',
|
||||
selector: 'a',
|
||||
query: {
|
||||
id: {
|
||||
type: 'string',
|
||||
source: 'attribute',
|
||||
attribute: 'id'
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
source: 'attribute',
|
||||
attribute: 'href'
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
source: 'text'
|
||||
},
|
||||
thumbnail: {
|
||||
source: 'query',
|
||||
selector: 'img',
|
||||
query: {
|
||||
src: {
|
||||
source: 'attribute',
|
||||
attribute: 'src'
|
||||
},
|
||||
alt: {
|
||||
source: 'attribute',
|
||||
attribute: 'alt'
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
default: []
|
||||
},
|
||||
content: {
|
||||
type: 'array',
|
||||
source: 'children',
|
||||
selector: 'div'
|
||||
},
|
||||
query: {
|
||||
type: Object,
|
||||
default: {}
|
||||
},
|
||||
selectedCollectionsHTML: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
showImage: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showName: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
layout: {
|
||||
type: String,
|
||||
default: 'grid'
|
||||
},
|
||||
isModalOpen: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
gridMargin: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
supports: {
|
||||
align: ['full', 'wide'],
|
||||
html: false,
|
||||
fontSize: true
|
||||
},
|
||||
save({ attributes, className }) {
|
||||
const { content } = attributes;
|
||||
return <div className={ className }>{ content }</div>
|
||||
}
|
||||
},
|
||||
/* Deprecated on Tainacan 0.17.2, due to the introduction of support: fontSize */
|
||||
{
|
||||
attributes: {
|
|
@ -0,0 +1,259 @@
|
|||
const { __ } = wp.i18n;
|
||||
|
||||
const { RangeControl, IconButton, Button, ToggleControl, Placeholder, PanelBody } = wp.components;
|
||||
|
||||
const { InspectorControls, BlockControls } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
|
||||
import TainacanBlocksCompatToolbar from '../../js/tainacan-blocks-compat-toolbar.js';
|
||||
import CollectionsModal from './collections-modal.js';
|
||||
|
||||
export default function({ attributes, setAttributes, className, isSelected }) {
|
||||
let {
|
||||
selectedCollectionsObject,
|
||||
selectedCollectionsHTML,
|
||||
content,
|
||||
showImage,
|
||||
showName,
|
||||
layout,
|
||||
isModalOpen,
|
||||
gridMargin
|
||||
} = attributes;
|
||||
|
||||
function prepareCollection(collection) {
|
||||
return (
|
||||
<li
|
||||
key={ collection.id }
|
||||
className="collection-list-item"
|
||||
style={{ marginBottom: layout == 'grid' ? (showName ? gridMargin + 12 : gridMargin) + 'px' : ''}}>
|
||||
{
|
||||
tainacan_blocks.wp_version < '5.4' ?
|
||||
<IconButton
|
||||
onClick={ () => removeCollectionOfId(collection.id) }
|
||||
icon="no-alt"
|
||||
label={__('Remove', 'tainacan')}/>
|
||||
:
|
||||
<Button
|
||||
onClick={ () => removeCollectionOfId(collection.id) }
|
||||
icon="no-alt"
|
||||
showTooltip={false}
|
||||
label={__('Remove', 'tainacan')} />
|
||||
}
|
||||
<a
|
||||
id={ isNaN(collection.id) ? collection.id : 'collection-id-' + collection.id }
|
||||
href={ collection.url }
|
||||
target="_blank"
|
||||
className={ (!showName ? 'collection-without-name' : '') + ' ' + (!showImage ? 'collection-without-image' : '') }>
|
||||
<img
|
||||
src={ collection.thumbnail && collection.thumbnail[0] && collection.thumbnail[0].src ? collection.thumbnail[0].src : `${tainacan_blocks.base_url}/assets/images/placeholder_square.png`}
|
||||
alt={ collection.thumbnail && collection.thumbnail[0] ? collection.thumbnail[0].alt : collection.name }/>
|
||||
<span>{ collection.name ? collection.name : '' }</span>
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
function setContent(){
|
||||
|
||||
selectedCollectionsHTML = [];
|
||||
|
||||
for (let i = 0; i < selectedCollectionsObject.length; i++)
|
||||
selectedCollectionsHTML.push(prepareCollection(selectedCollectionsObject[i]));
|
||||
|
||||
setAttributes({
|
||||
content: (
|
||||
<ul
|
||||
style={{ gridTemplateColumns: layout == 'grid' ? ('repeat(auto-fill, ' + (gridMargin + (showName ? 220 : 185)) + 'px)') : 'inherit' }}
|
||||
className={'collections-list collections-layout-' + layout + (!showName ? ' collections-list-without-margin' : '')}>
|
||||
{ selectedCollectionsHTML }
|
||||
</ul>
|
||||
),
|
||||
selectedCollectionsHTML: selectedCollectionsHTML
|
||||
});
|
||||
}
|
||||
|
||||
function openCollectionsModal() {
|
||||
isModalOpen = true;
|
||||
setAttributes( {
|
||||
isModalOpen: isModalOpen
|
||||
} );
|
||||
}
|
||||
|
||||
function removeCollectionOfId(collectionId) {
|
||||
|
||||
let existingCollectionIndex = selectedCollectionsObject.findIndex((existingCollection) => ((existingCollection.id == 'collection-id-' + collectionId) || (existingCollection.id == collectionId)));
|
||||
|
||||
if (existingCollectionIndex >= 0)
|
||||
selectedCollectionsObject.splice(existingCollectionIndex, 1);
|
||||
|
||||
setContent();
|
||||
}
|
||||
|
||||
function updateLayout(newLayout) {
|
||||
layout = newLayout;
|
||||
|
||||
if (layout == 'grid' && showImage == false)
|
||||
showImage = true;
|
||||
|
||||
if (layout == 'list' && showName == false)
|
||||
showName = true;
|
||||
|
||||
setAttributes({
|
||||
layout: layout,
|
||||
showImage: showImage,
|
||||
showName: showName
|
||||
});
|
||||
setContent();
|
||||
}
|
||||
|
||||
// Executed only on the first load of page
|
||||
if(content && content.length && content[0].type)
|
||||
setContent();
|
||||
|
||||
const layoutControls = [
|
||||
{
|
||||
icon: 'grid-view',
|
||||
title: __( 'Grid View', 'tainacan' ),
|
||||
onClick: () => updateLayout('grid'),
|
||||
isActive: layout === 'grid',
|
||||
},
|
||||
{
|
||||
icon: 'list-view',
|
||||
title: __( 'List View', 'tainacan' ),
|
||||
onClick: () => updateLayout('list'),
|
||||
isActive: layout === 'list',
|
||||
}
|
||||
];
|
||||
|
||||
return content == 'preview' ?
|
||||
<div className={className}>
|
||||
<img
|
||||
width="100%"
|
||||
src={ `${tainacan_blocks.base_url}/assets/images/collections-list.png` } />
|
||||
</div>
|
||||
: (
|
||||
<div className={className}>
|
||||
|
||||
<div>
|
||||
<BlockControls>
|
||||
{ TainacanBlocksCompatToolbar({ controls: layoutControls }) }
|
||||
{ selectedCollectionsHTML.length ?
|
||||
TainacanBlocksCompatToolbar({
|
||||
label: __( 'Select collections', 'tainacan' ),
|
||||
icon: <svg width="24" height="24" viewBox="0 -5 12 16">
|
||||
<path
|
||||
d="M10,8.8v1.3H1.2C0.6,10.1,0,9.5,0,8.8V2.5h1.3v6.3H10z M6.9,0H3.8C3.1,0,2.5,0.6,2.5,1.3l0,5c0,0.7,0.6,1.2,1.3,1.2h7.5
|
||||
c0.7,0,1.3-0.6,1.3-1.2V2.5c0-0.7-0.6-1.2-1.3-1.2H8.2L6.9,0z"/>
|
||||
</svg>,
|
||||
onClick: openCollectionsModal
|
||||
})
|
||||
: null }
|
||||
</BlockControls>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<InspectorControls>
|
||||
<PanelBody
|
||||
title={ __('List settings', 'tainacan') }
|
||||
initialOpen={ true }
|
||||
>
|
||||
{ layout == 'list' ?
|
||||
<ToggleControl
|
||||
label={__('Image', 'tainacan')}
|
||||
help={ showImage ? __('Toggle to show collection\'s image', 'tainacan') : __('Do not show collection\'s image', 'tainacan')}
|
||||
checked={ showImage }
|
||||
onChange={ ( isChecked ) => {
|
||||
showImage = isChecked;
|
||||
setAttributes({ showImage: showImage });
|
||||
setContent();
|
||||
}
|
||||
}
|
||||
/>
|
||||
: null }
|
||||
{ layout == 'grid' ?
|
||||
<div>
|
||||
<ToggleControl
|
||||
label={__('Name', 'tainacan')}
|
||||
help={ showName ? __('Toggle to show collection\'s name', 'tainacan') : __('Do not show collection\'s name', 'tainacan')}
|
||||
checked={ showName }
|
||||
onChange={ ( isChecked ) => {
|
||||
showName = isChecked;
|
||||
setAttributes({ showName: showName });
|
||||
setContent();
|
||||
}
|
||||
}
|
||||
/>
|
||||
<div style={{ marginTop: '16px'}}>
|
||||
<RangeControl
|
||||
label={__('Margin between collections', 'tainacan')}
|
||||
value={ gridMargin }
|
||||
onChange={ ( margin ) => {
|
||||
setAttributes( { gridMargin: margin } )
|
||||
setContent();
|
||||
}}
|
||||
min={ 0 }
|
||||
max={ 48 }
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
: null }
|
||||
</PanelBody>
|
||||
</InspectorControls>
|
||||
</div>
|
||||
|
||||
{ isSelected ?
|
||||
(
|
||||
<div>
|
||||
{ isModalOpen ?
|
||||
<CollectionsModal
|
||||
selectedCollectionsObject={ selectedCollectionsObject }
|
||||
onApplySelection={ (aSelectedCollectionsObject) =>{
|
||||
selectedCollectionsObject = aSelectedCollectionsObject
|
||||
setAttributes({
|
||||
selectedCollectionsObject: selectedCollectionsObject,
|
||||
isModalOpen: false
|
||||
});
|
||||
setContent();
|
||||
}}
|
||||
onCancelSelection={ () => setAttributes({ isModalOpen: false }) }/>
|
||||
: null
|
||||
}
|
||||
</div>
|
||||
) : null
|
||||
}
|
||||
|
||||
{ !selectedCollectionsHTML.length ? (
|
||||
<Placeholder
|
||||
className="tainacan-block-placeholder"
|
||||
icon={(
|
||||
<img
|
||||
width={148}
|
||||
src={ `${tainacan_blocks.base_url}/assets/images/tainacan_logo_header.svg` }
|
||||
alt="Tainacan Logo"/>
|
||||
)}>
|
||||
<p>
|
||||
<svg width="24" height="24" viewBox="0 -5 12 16">
|
||||
<path
|
||||
d="M10,8.8v1.3H1.2C0.6,10.1,0,9.5,0,8.8V2.5h1.3v6.3H10z M6.9,0H3.8C3.1,0,2.5,0.6,2.5,1.3l0,5c0,0.7,0.6,1.2,1.3,1.2h7.5
|
||||
c0.7,0,1.3-0.6,1.3-1.2V2.5c0-0.7-0.6-1.2-1.3-1.2H8.2L6.9,0z"/>
|
||||
</svg>
|
||||
{__('Expose collections from your Tainacan repository', 'tainacan')}
|
||||
</p>
|
||||
<Button
|
||||
isPrimary
|
||||
type="button"
|
||||
onClick={ () => openCollectionsModal() }>
|
||||
{__('Select collections', 'tainacan')}
|
||||
</Button>
|
||||
</Placeholder>
|
||||
) : null
|
||||
}
|
||||
|
||||
<ul
|
||||
style={{ gridTemplateColumns: layout == 'grid' ? 'repeat(auto-fill, ' + (gridMargin + (showName ? 220 : 185)) + 'px)' : 'inherit' }}
|
||||
className={'collections-list-edit collections-layout-' + layout + (!showName ? ' collections-list-without-margin' : '')}>
|
||||
{ selectedCollectionsHTML }
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,9 @@
|
|||
const { SVG, Path } = wp.components;
|
||||
|
||||
export default (
|
||||
<SVG width="24" height="24" viewBox="0 -3 12 16">
|
||||
<Path
|
||||
d="M10,8.8v1.3H1.2C0.6,10.1,0,9.5,0,8.8V2.5h1.3v6.3H10z M6.9,0H3.8C3.1,0,2.5,0.6,2.5,1.3l0,5c0,0.7,0.6,1.2,1.3,1.2h7.5
|
||||
c0.7,0,1.3-0.6,1.3-1.2V2.5c0-0.7-0.6-1.2-1.3-1.2H8.2L6.9,0z"/>
|
||||
</SVG>
|
||||
);
|
|
@ -0,0 +1,15 @@
|
|||
import tainacanRegisterBlockType from '../../js/tainacan-blocks-compat-register.js';
|
||||
|
||||
import metadata from './block.json';
|
||||
import icon from './icon.js';
|
||||
import edit from './edit.js';
|
||||
import save from './save.js';
|
||||
import deprecated from './deprecated.js';
|
||||
|
||||
tainacanRegisterBlockType({
|
||||
metadata,
|
||||
icon,
|
||||
edit,
|
||||
save,
|
||||
deprecated
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue