Merge branch 'develop' into 447-prevent-xss

This commit is contained in:
Rodrigo de Oliveira 2021-03-06 17:27:47 -03:00
commit 9253724ba5
142 changed files with 4807 additions and 3139 deletions

View File

@ -1,6 +1,7 @@
sudo: true
language: php
php:
#- 8.0
- 7.1
- 7.2
- 5.6

View File

@ -1,19 +1,21 @@
{
"name": "medialabufg/tainacan",
"name": "tainacan/tainacan",
"description": "Transforme seu site wordpress em um repositório digital.",
"type": "wordpress-plugin",
"require": {
"respect/validation": "^1.1",
"smalot/pdfparser": "*"
"smalot/pdfparser": "*",
"kornrunner/blurhash": "^1.1"
},
"require-dev": {
"squizlabs/php_codesniffer": "^2.2 || ^3.0.2",
"wimg/php-compatibility": "*"
"phpcompatibility/php-compatibility": "*"
},
"prefer-stable" : true,
"minimum-stability": "dev",
"config": {
"vendor-dir": "src/vendor"
"vendor-dir": "src/vendor",
"platform-check": false
},
"scripts": {
"post-install-cmd": "\"src/vendor/bin/phpcs\" --config-set installed_paths src/vendor/wimg/php-compatibility",

276
composer.lock generated
View File

@ -4,8 +4,51 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "e2a614836d1857e45c4f9be57073c2b2",
"content-hash": "977d4fe3cad3f53c6559a0cc2656dcc1",
"packages": [
{
"name": "kornrunner/blurhash",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/kornrunner/php-blurhash.git",
"reference": "5a09325353229c108c8d2ff129ec08b447753f9b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kornrunner/php-blurhash/zipball/5a09325353229c108c8d2ff129ec08b447753f9b",
"reference": "5a09325353229c108c8d2ff129ec08b447753f9b",
"shasum": ""
},
"require": {
"php": "^7.2"
},
"require-dev": {
"ocramius/package-versions": "<1.5",
"phpstan/phpstan": "^0.12",
"phpunit/phpunit": "^8.2",
"vimeo/psalm": "^3.4"
},
"type": "library",
"autoload": {
"psr-4": {
"kornrunner\\Blurhash\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Boris Momčilović",
"email": "boris.momcilovic@gmail.com"
}
],
"description": "Pure PHP implementation of Blurhash",
"homepage": "https://github.com/kornrunner/php-blurhash",
"time": "2020-04-15T22:06:04+00:00"
},
{
"name": "respect/validation",
"version": "1.1.31",
@ -71,26 +114,26 @@
},
{
"name": "smalot/pdfparser",
"version": "v0.14.0",
"version": "v0.18.1",
"source": {
"type": "git",
"url": "https://github.com/smalot/pdfparser.git",
"reference": "ec72a99028ba5e21a0acad92047b85e128cbf81f"
"reference": "b47f26425e32a814dc1ee55e3ce669b9e73b8458"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/smalot/pdfparser/zipball/ec72a99028ba5e21a0acad92047b85e128cbf81f",
"reference": "ec72a99028ba5e21a0acad92047b85e128cbf81f",
"url": "https://api.github.com/repos/smalot/pdfparser/zipball/b47f26425e32a814dc1ee55e3ce669b9e73b8458",
"reference": "b47f26425e32a814dc1ee55e3ce669b9e73b8458",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"ext-zlib": "*",
"php": ">=5.3.0",
"tecnickcom/tcpdf": "~6.0"
"php": ">=5.6",
"symfony/polyfill-mbstring": "^1.18"
},
"require-dev": {
"atoum/atoum": "^2.8 | ^3.0"
"friendsofphp/php-cs-fixer": "^2.16",
"symfony/phpunit-bridge": "^5.2"
},
"type": "library",
"autoload": {
@ -104,12 +147,12 @@
],
"authors": [
{
"name": "Sebastien Malot",
"name": "Sebastien MALOT",
"email": "sebastien@malot.fr"
}
],
"description": "Pdf parser library. Can read and extract information from pdf file.",
"homepage": "http://www.pdfparser.org",
"homepage": "https://www.pdfparser.org",
"keywords": [
"extract",
"parse",
@ -117,24 +160,24 @@
"pdf",
"text"
],
"time": "2019-01-23T09:14:37+00:00"
"time": "2021-01-05T08:52:07+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.12.0",
"version": "v1.22.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17"
"reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17",
"reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f377a3dd1fde44d37b9831d68dc8dea3ffd28e13",
"reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
"php": ">=7.1"
},
"suggest": {
"ext-mbstring": "For best performance"
@ -142,7 +185,11 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.12-dev"
"dev-main": "1.22-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
@ -176,135 +223,36 @@
"portable",
"shim"
],
"time": "2019-08-06T08:03:45+00:00"
},
{
"name": "tecnickcom/tcpdf",
"version": "6.2.26",
"source": {
"type": "git",
"url": "https://github.com/tecnickcom/TCPDF.git",
"reference": "367241059ca166e3a76490f4448c284e0a161f15"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/367241059ca166e3a76490f4448c284e0a161f15",
"reference": "367241059ca166e3a76490f4448c284e0a161f15",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"autoload": {
"classmap": [
"config",
"include",
"tcpdf.php",
"tcpdf_parser.php",
"tcpdf_import.php",
"tcpdf_barcodes_1d.php",
"tcpdf_barcodes_2d.php",
"include/tcpdf_colors.php",
"include/tcpdf_filters.php",
"include/tcpdf_font_data.php",
"include/tcpdf_fonts.php",
"include/tcpdf_images.php",
"include/tcpdf_static.php",
"include/barcodes/datamatrix.php",
"include/barcodes/pdf417.php",
"include/barcodes/qrcode.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0"
],
"authors": [
"funding": [
{
"name": "Nicola Asuni",
"email": "info@tecnick.com",
"role": "lead"
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
"homepage": "http://www.tcpdf.org/",
"keywords": [
"PDFD32000-2008",
"TCPDF",
"barcodes",
"datamatrix",
"pdf",
"pdf417",
"qrcode"
],
"time": "2018-10-16T17:24:05+00:00"
"time": "2021-01-07T16:49:33+00:00"
}
],
"packages-dev": [
{
"name": "squizlabs/php_codesniffer",
"version": "3.4.2",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8",
"reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8",
"shasum": ""
},
"require": {
"ext-simplexml": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"bin": [
"bin/phpcs",
"bin/phpcbf"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Greg Sherwood",
"role": "lead"
}
],
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
"keywords": [
"phpcs",
"standards"
],
"time": "2019-04-10T23:49:02+00:00"
},
{
"name": "wimg/php-compatibility",
"version": "9.3.1",
"name": "phpcompatibility/php-compatibility",
"version": "9.3.5",
"source": {
"type": "git",
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
"reference": "9999344e47e7af6b00e1a898eacc4e4368fb7196"
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9999344e47e7af6b00e1a898eacc4e4368fb7196",
"reference": "9999344e47e7af6b00e1a898eacc4e4368fb7196",
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
"shasum": ""
},
"require": {
@ -349,8 +297,58 @@
"phpcs",
"standards"
],
"abandoned": "phpcompatibility/php-compatibility",
"time": "2019-09-05T18:36:49+00:00"
"time": "2019-12-27T09:44:58+00:00"
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.5.8",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "9d583721a7157ee997f235f327de038e7ea6dac4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4",
"reference": "9d583721a7157ee997f235f327de038e7ea6dac4",
"shasum": ""
},
"require": {
"ext-simplexml": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"bin": [
"bin/phpcs",
"bin/phpcbf"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Greg Sherwood",
"role": "lead"
}
],
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
"keywords": [
"phpcs",
"standards"
],
"time": "2020-10-23T02:01:07+00:00"
}
],
"aliases": [],
@ -359,5 +357,9 @@
"prefer-stable": true,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
"platform-dev": [],
"platform-overrides": {
"php": "7.2"
},
"plugin-api-version": "1.1.0"
}

68
package-lock.json generated
View File

@ -1895,29 +1895,11 @@
"integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug=="
},
"axios": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
"integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"requires": {
"follow-redirects": "1.5.10"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"requires": {
"debug": "=3.1.0"
}
}
"follow-redirects": "^1.10.0"
}
},
"babel-code-frame": {
@ -2163,6 +2145,11 @@
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==",
"dev": true
},
"blurhash": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/blurhash/-/blurhash-1.1.3.tgz",
"integrity": "sha512-yUhPJvXexbqbyijCIE/T2NCXcj9iNPhWmOKbPTuR/cm7Q5snXYIfnVnz6m7MWOXxODMz/Cr3UcVkRdHiuDVRDw=="
},
"bn.js": {
"version": "4.11.8",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz",
@ -4467,8 +4454,7 @@
"follow-redirects": {
"version": "1.12.1",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.12.1.tgz",
"integrity": "sha512-tmRv0AVuR7ZyouUHLeNSiO6pqulF7dYa3s19c6t+wz9LD69/uSzdMxJ2S91nTI9U3rt/IldxpzMOFejp6f0hjg==",
"dev": true
"integrity": "sha512-tmRv0AVuR7ZyouUHLeNSiO6pqulF7dYa3s19c6t+wz9LD69/uSzdMxJ2S91nTI9U3rt/IldxpzMOFejp6f0hjg=="
},
"for-in": {
"version": "1.0.2",
@ -4746,12 +4732,6 @@
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
"bundled": true,
"dev": true,
"optional": true
},
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
@ -5780,9 +5760,9 @@
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"ini": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
"dev": true
},
"inquirer": {
@ -6841,7 +6821,8 @@
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
},
"multicast-dns": {
"version": "6.2.3",
@ -6914,9 +6895,9 @@
"dev": true
},
"node-forge": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz",
"integrity": "sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ==",
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz",
"integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==",
"dev": true
},
"node-gyp": {
@ -8879,12 +8860,12 @@
"dev": true
},
"selfsigned": {
"version": "1.10.7",
"resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.7.tgz",
"integrity": "sha512-8M3wBCzeWIJnQfl43IKwOmC4H/RAp50S8DF60znzjW5GVqTcSe2vWclt7hmYVPkKPlHWOu5EaWOMZ2Y6W8ZXTA==",
"version": "1.10.8",
"resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.8.tgz",
"integrity": "sha512-2P4PtieJeEwVgTU9QEcwIRDQ/mXJLX8/+I3ur+Pg16nS8oNbrGxEso9NyYWy8NAmXiNl4dlAp5MwoNeCWzON4w==",
"dev": true,
"requires": {
"node-forge": "0.9.0"
"node-forge": "^0.10.0"
}
},
"semver": {
@ -10723,6 +10704,11 @@
"resolved": "https://registry.npmjs.org/vue-awesome-swiper/-/vue-awesome-swiper-4.1.1.tgz",
"integrity": "sha512-50um10t6N+lJaORkpwSi1wWuMmBI1sgFc9Znsi5oUykw2cO5DzLaBHcO2JNX21R+Ue4TGoIJDhhxjBHtkFrTEQ=="
},
"vue-blurhash": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/vue-blurhash/-/vue-blurhash-0.1.4.tgz",
"integrity": "sha512-B76GgfHXHkdmYgAfI2rZl3BgCMD9OxAgn4Jw2Ro0a8ZoAKa6gqTWUrTo5EGXOftm/EKuMYi1Cc+UcAvV0jnoRw=="
},
"vue-eslint-parser": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-5.0.0.tgz",

View File

@ -8,7 +8,8 @@
"build-prod": "cross-env NODE_ENV=production webpack --config webpack.prod.js --display-error-details --progress --hide-modules"
},
"dependencies": {
"axios": "^0.19.2",
"blurhash": "^1.1.3",
"axios": "^0.21.1",
"buefy": "^0.9.4",
"bulma": "^0.9.1",
"css-vars-ponyfill": "^2.3.1",
@ -23,6 +24,7 @@
"v-tooltip": "^2.0.3",
"vue": "^2.6.11",
"vue-awesome-swiper": "^4.1.1",
"vue-blurhash": "^0.1.4",
"vue-masonry-css": "^1.0.3",
"vue-router": "^3.1.6",
"vue-the-mask": "^0.11.1",

View File

@ -18,16 +18,16 @@
display: flex;
display: -ms-grid;
display: grid;
-ms-grid-columns: 33% 33% 33%;
grid-template-columns: 33% 33% 33%;
-ms-grid-rows: 50% 50%;
grid-template-rows: 50% 50%;
grid-column-gap: 2px;
grid-row-gap: 2px;
-ms-grid-columns: 1fr 1fr 1fr;
grid-template-columns: 1fr 1fr 1fr;
-ms-grid-rows: 1fr 1fr;
grid-template-rows: 1fr 1fr;
grid-gap: 5px;
gap: 5px;
width: 60px;
height: 40px;
margin: 4px auto 8px auto; }
.components-panel__body .collection-carousel-view-modes button.collection-carousel-view-mode-grid div > div:first-of-type {
.components-panel__body .collection-carousel-view-modes button.collection-carousel-view-mode-grid div > *:first-of-type {
flex-basis: 100%;
-ms-grid-column: 1;
-ms-grid-column-span: 2;
@ -35,12 +35,12 @@
-ms-grid-row-span: 2;
grid-column: 1/3;
grid-row: 1/3;
width: 41px;
height: 42px; }
.components-panel__body .collection-carousel-view-modes button.collection-carousel-view-mode-grid div > div {
width: 100%;
height: 100%; }
.components-panel__body .collection-carousel-view-modes button.collection-carousel-view-mode-grid div > * {
flex-basis: 50%;
width: 20px;
height: 20px;
width: 100%;
height: 100%;
background: var(--tainacan-block-gray4, #555758);
transition: background-color ease 0.5s; }
.components-panel__body .collection-carousel-view-modes button.collection-carousel-view-mode-thumbnail {
@ -139,11 +139,13 @@
display: flex;
display: -ms-grid;
display: grid;
grid-template-columns: 33% 33% 33%;
grid-template-rows: 50% 50%;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr;
width: 100%;
grid-gap: 5px;
gap: 5px;
box-sizing: border-box; }
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper-container .swiper-slide.collection-list-item-grid .collection-items-grid img:first-of-type {
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper-container .swiper-slide.collection-list-item-grid .collection-items-grid > *:first-of-type {
flex-basis: 100%;
-ms-grid-column: 1;
-ms-grid-column-span: 2;
@ -151,11 +153,10 @@
-ms-grid-row-span: 2;
grid-column: 1/3;
grid-row: 1/3; }
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper-container .swiper-slide.collection-list-item-grid .collection-items-grid img {
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper-container .swiper-slide.collection-list-item-grid .collection-items-grid > * {
flex-basis: 50%;
width: 100%;
height: auto;
padding: 2px;
margin-bottom: 0px; }
.wp-block-tainacan-carousel-collections-list .preview-warning {
width: 100%;
@ -313,9 +314,11 @@
display: flex;
display: -ms-grid;
display: grid;
grid-template-columns: 33% 33% 33%;
grid-template-rows: 50% 50%; }
.wp-block-tainacan-carousel-collections-list ul.collections-list-edit li.collection-list-item .collection-items-grid img:first-of-type {
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr;
grid-gap: 5px;
gap: 5px; }
.wp-block-tainacan-carousel-collections-list ul.collections-list-edit li.collection-list-item .collection-items-grid > *:first-of-type {
flex-basis: 100%;
-ms-grid-column: 1;
-ms-grid-column-span: 2;
@ -323,9 +326,8 @@
-ms-grid-row-span: 2;
grid-column: 1/3;
grid-row: 1/3; }
.wp-block-tainacan-carousel-collections-list ul.collections-list-edit li.collection-list-item .collection-items-grid img {
.wp-block-tainacan-carousel-collections-list ul.collections-list-edit li.collection-list-item .collection-items-grid > * {
flex-basis: 50%;
padding: 2px;
margin-bottom: 0px; }
@media only screen and (max-width: 1686px) {
.wp-block-tainacan-carousel-collections-list ul.collections-list-edit li.collection-list-item {

File diff suppressed because one or more lines are too long

View File

@ -222,6 +222,7 @@
line-height: normal; }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item img {
height: auto;
display: block;
padding: 0px;
margin-bottom: 0.5em; }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item:hover a {

File diff suppressed because one or more lines are too long

View File

@ -18,12 +18,12 @@
display: flex;
display: -ms-grid;
display: grid;
-ms-grid-columns: 33% 33% 33%;
grid-template-columns: 33% 33% 33%;
-ms-grid-columns: 1fr 1fr 1fr;
grid-template-columns: 1fr 1fr 1fr;
-ms-grid-rows: 50% 50%;
grid-template-rows: 50% 50%;
grid-column-gap: 2px;
grid-row-gap: 2px;
grid-gap: 5px;
gap: 5px;
width: 60px;
height: 40px;
margin: 4px auto 8px auto; }
@ -35,12 +35,12 @@
-ms-grid-row-span: 2;
grid-column: 1/3;
grid-row: 1/3;
width: 41px;
height: 42px; }
width: 100%;
height: 100%; }
.components-panel__body .term-carousel-view-modes button.term-carousel-view-mode-grid div > div {
flex-basis: 50%;
width: 20px;
height: 20px;
width: 100%;
height: 100%;
background: var(--tainacan-block-gray4, #555758);
transition: background-color ease 0.5s; }
.components-panel__body .term-carousel-view-modes button.term-carousel-view-mode-thumbnail {
@ -139,10 +139,13 @@
display: flex;
display: -ms-grid;
display: grid;
grid-template-columns: 33% 33% 33%;
grid-template-rows: 50% 50%;
width: 100%; }
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container .swiper-slide.term-list-item-grid .term-items-grid img:first-of-type {
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr;
width: 100%;
grid-gap: 5px;
gap: 5px;
box-sizing: border-box; }
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container .swiper-slide.term-list-item-grid .term-items-grid > *:first-of-type {
flex-basis: 100%;
-ms-grid-column: 1;
-ms-grid-column-span: 2;
@ -150,11 +153,10 @@
-ms-grid-row-span: 2;
grid-column: 1/3;
grid-row: 1/3; }
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container .swiper-slide.term-list-item-grid .term-items-grid img {
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container .swiper-slide.term-list-item-grid .term-items-grid > * {
flex-basis: 50%;
width: 100%;
height: auto;
padding: 2px;
margin-bottom: 0px; }
.wp-block-tainacan-carousel-terms-list .preview-warning {
width: 100%;
@ -313,7 +315,7 @@
display: flex;
display: -ms-grid;
display: grid;
grid-template-columns: 33% 33% 33%;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 50% 50%; }
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item .term-items-grid img:first-of-type {
flex-basis: 100%;

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,9 @@
.wp-block-tainacan-dynamic-items-list {
margin: 2em auto; }
margin-top: 2em;
margin-bottom: 2em; }
.wp-block-tainacan-dynamic-items-list:not(.alignfull) {
margin-left: auto;
margin-right: auto; }
.wp-block-tainacan-dynamic-items-list .spinner-container {
min-height: 56px;
padding: 1em;
@ -117,19 +121,23 @@
top: -78px !important; }
.wp-block-tainacan-dynamic-items-list .dynamic-items-collection-header .collection-header-image {
background-color: transparent; } }
.wp-block-tainacan-dynamic-items-list.alignfull .dynamic-items-search-bar {
padding: 1.00em 2em 0.75em 2em; }
.wp-block-tainacan-dynamic-items-list .dynamic-items-search-bar {
width: 100%;
display: flex;
align-items: center;
border-bottom: 1px solid var(--tainacan-block-gray3, #cbcbcb);
padding: 1.00em 0.5em 0.75em 0.5em; }
padding: 1.00em 0.5em 0.75em 0.5em;
position: relative; }
@media only screen and (max-width: 768px) {
.wp-block-tainacan-dynamic-items-list .dynamic-items-search-bar {
flex-wrap: wrap; }
.wp-block-tainacan-dynamic-items-list .dynamic-items-search-bar .search-button {
order: 4;
position: absolute;
margin-top: 0.75em; }
bottom: 0.875em;
left: 1.0em; }
.wp-block-tainacan-dynamic-items-list .dynamic-items-search-bar input {
width: 100% !important;
order: 5;
@ -181,28 +189,6 @@
width: 100%;
border: 1px solid var(--tainacan-block-gray3, #cbcbcb);
box-shadow: none; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.items-list-without-margin,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.items-list-without-margin,
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.items-list-without-margin,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.items-list-without-margin {
grid-template-columns: repeat(auto-fill, 185px);
justify-content: center !important;
grid-template-rows: auto !important;
list-style: none; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.items-list-without-margin li,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.items-list-without-margin li,
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.items-list-without-margin li,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.items-list-without-margin li {
margin-top: 0 !important;
margin-right: 0 !important;
margin-left: 0 !important;
height: 185px !important; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.items-list-without-margin li img,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.items-list-without-margin li img,
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.items-list-without-margin li img,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.items-list-without-margin li img {
height: 185px !important;
margin-bottom: 0px !important; }
.wp-block-tainacan-dynamic-items-list ul.items-list-edit li.item-list-item {
display: flex;
align-items: flex-start; }
@ -236,38 +222,140 @@
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid {
padding: 0;
margin: 0;
flex-wrap: wrap;
display: flex;
display: -ms-grid;
display: grid;
-ms-grid-columns: 220px 220px 220px 220px 220px;
grid-template-columns: repeat(auto-fill, 220px);
grid-gap: 0px;
grid-gap: 24px;
gap: 24px;
justify-content: space-evenly;
list-style-type: none;
margin: 0; }
list-style-type: none; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid:not(.max-columns-count-1):not(.max-columns-count-2):not(.max-columns-count-3):not(.max-columns-count-4):not(.max-columns-count-5):not(.max-columns-count-6):not(.max-columns-count-7),
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid:not(.max-columns-count-1):not(.max-columns-count-2):not(.max-columns-count-3):not(.max-columns-count-4):not(.max-columns-count-5):not(.max-columns-count-6):not(.max-columns-count-7) {
-ms-grid-columns: 220px 220px 220px 220px;
grid-template-columns: repeat(4, 1fr); }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-7,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-7 {
-ms-grid-columns: 220px 220px 220px 220px 220px 220px 220px;
grid-template-columns: repeat(7, 1fr); }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-6,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-6 {
-ms-grid-columns: 220px 220px 220px 220px 220px 220px;
grid-template-columns: repeat(6, 1fr); }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-5,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-5 {
-ms-grid-columns: 220px 220px 220px 220px 220px;
grid-template-columns: repeat(5, 1fr); }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-4,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-4 {
-ms-grid-columns: 220px 220px 220px 220px;
grid-template-columns: repeat(4, 1fr); }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-3,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-3 {
-ms-grid-columns: 220px 220px 220px;
grid-template-columns: repeat(3, 1fr); }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-2,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-2 {
-ms-grid-columns: 220px 220px;
grid-template-columns: repeat(2, 1fr); }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-1,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-1 {
-ms-grid-columns: 220px;
grid-template-columns: repeat(1, 1fr); }
@media only screen and (max-width: 1600px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-7, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-6,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-7,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-6 {
-ms-grid-columns: 220px 220px 220px 220px 220px 220px;
grid-template-columns: repeat(6, 1fr); } }
@media only screen and (max-width: 1400px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-7, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-6, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-5,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-7,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-6,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-5 {
-ms-grid-columns: 220px 220px 220px 220px 220px;
grid-template-columns: repeat(5, 1fr); } }
@media only screen and (max-width: 1280px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid:not(.max-columns-count-1):not(.max-columns-count-2):not(.max-columns-count-3):not(.max-columns-count-4):not(.max-columns-count-5):not(.max-columns-count-6):not(.max-columns-count-7), .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-7, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-6, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-5, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-4,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid:not(.max-columns-count-1):not(.max-columns-count-2):not(.max-columns-count-3):not(.max-columns-count-4):not(.max-columns-count-5):not(.max-columns-count-6):not(.max-columns-count-7),
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-7,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-6,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-5,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-4 {
-ms-grid-columns: 220px 220px 220px 220px;
grid-template-columns: repeat(4, 1fr); } }
@media only screen and (max-width: 1024px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid:not(.max-columns-count-1):not(.max-columns-count-2):not(.max-columns-count-3):not(.max-columns-count-4):not(.max-columns-count-5):not(.max-columns-count-6):not(.max-columns-count-7), .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-7, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-6, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-5, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-4, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-3,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid:not(.max-columns-count-1):not(.max-columns-count-2):not(.max-columns-count-3):not(.max-columns-count-4):not(.max-columns-count-5):not(.max-columns-count-6):not(.max-columns-count-7),
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-7,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-6,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-5,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-4,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-3 {
-ms-grid-columns: 220px 220px 220px;
grid-template-columns: repeat(3, 1fr); } }
@media only screen and (max-width: 768px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid:not(.max-columns-count-1):not(.max-columns-count-2):not(.max-columns-count-3):not(.max-columns-count-4):not(.max-columns-count-5):not(.max-columns-count-6):not(.max-columns-count-7), .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-7, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-6, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-5, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-4, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-3, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-2,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid:not(.max-columns-count-1):not(.max-columns-count-2):not(.max-columns-count-3):not(.max-columns-count-4):not(.max-columns-count-5):not(.max-columns-count-6):not(.max-columns-count-7),
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-7,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-6,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-5,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-4,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-3,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-2 {
-ms-grid-columns: 220px 220px;
grid-template-columns: repeat(2, 1fr); } }
@media only screen and (max-width: 498px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid:not(.max-columns-count-1):not(.max-columns-count-2):not(.max-columns-count-3):not(.max-columns-count-4):not(.max-columns-count-5):not(.max-columns-count-6):not(.max-columns-count-7), .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-7, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-6, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-5, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-4, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-3, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-2, .wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid.max-columns-count-1,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid:not(.max-columns-count-1):not(.max-columns-count-2):not(.max-columns-count-3):not(.max-columns-count-4):not(.max-columns-count-5):not(.max-columns-count-6):not(.max-columns-count-7),
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-7,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-6,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-5,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-4,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-3,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-2,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid.max-columns-count-1 {
-ms-grid-columns: 220px;
grid-template-columns: repeat(1, 1fr); } }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid li.item-list-item,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid li.item-list-item {
position: relative;
display: block;
margin: 12px 12px 24px 12px;
margin-bottom: 12px;
width: 185px; }
display: flex;
flex-wrap: wrap;
width: 100%;
flex-basis: 100%;
justify-content: center;
align-items: center; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid li.item-list-item a,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid li.item-list-item a {
color: var(--tainacan-block-gray5, #454647);
border: none;
font-weight: bold;
line-height: normal; }
line-height: normal;
display: flex;
flex-basis: 100%;
justify-content: center;
align-items: center;
flex-direction: column; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid li.item-list-item a > div,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid li.item-list-item a > div {
width: 100%; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid li.item-list-item img,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid li.item-list-item img {
flex-basis: 100%;
height: auto;
width: 185px;
min-width: 185px;
padding: 0px;
width: 100%;
padding: 0px; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid li.item-list-item a:not(.item-without-title),
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid li.item-list-item a:not(.item-without-title) {
margin-bottom: 0.5em; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid li.item-list-item a.item-without-title span,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid li.item-list-item a.item-without-title span {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid li.item-list-item a > span,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid li.item-list-item a > span {
margin-right: auto;
margin-top: 0.5em; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid li.item-list-item a.item-without-title > span,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid li.item-list-item a.item-without-title > span {
display: none; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid li.item-list-item:hover a,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid li.item-list-item:hover a {
@ -286,19 +374,127 @@
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list {
padding: 0;
display: flex;
padding-left: 0;
margin: 0;
margin-left: 0;
flex-wrap: wrap;
align-items: center;
list-style-type: none;
margin: 0; }
display: flex;
display: -ms-grid;
display: grid;
align-items: self-start;
list-style-type: none; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-7,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-7 {
grid-template-columns: repeat(7, auto); }
@media only screen and (max-width: 1600px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-7,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-7 {
grid-template-columns: repeat(6, auto); } }
@media only screen and (max-width: 1400px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-7,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-7 {
grid-template-columns: repeat(5, auto); } }
@media only screen and (max-width: 1280px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-7,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-7 {
grid-template-columns: repeat(4, auto); } }
@media only screen and (max-width: 1024px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-7,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-7 {
grid-template-columns: repeat(3, auto); } }
@media only screen and (max-width: 768px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-7,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-7 {
grid-template-columns: repeat(2, auto); } }
@media only screen and (max-width: 498px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-7,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-7 {
grid-template-columns: repeat(1, auto); } }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-6,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-6 {
grid-template-columns: repeat(6, auto); }
@media only screen and (max-width: 1400px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-6,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-6 {
grid-template-columns: repeat(5, auto); } }
@media only screen and (max-width: 1280px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-6,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-6 {
grid-template-columns: repeat(4, auto); } }
@media only screen and (max-width: 1024px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-6,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-6 {
grid-template-columns: repeat(3, auto); } }
@media only screen and (max-width: 768px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-6,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-6 {
grid-template-columns: repeat(2, auto); } }
@media only screen and (max-width: 498px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-6,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-6 {
grid-template-columns: repeat(1, auto); } }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-5,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-5 {
grid-template-columns: repeat(5, auto); }
@media only screen and (max-width: 1280px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-5,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-5 {
grid-template-columns: repeat(4, auto); } }
@media only screen and (max-width: 1024px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-5,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-5 {
grid-template-columns: repeat(3, auto); } }
@media only screen and (max-width: 768px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-5,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-5 {
grid-template-columns: repeat(2, auto); } }
@media only screen and (max-width: 498px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-5,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-5 {
grid-template-columns: repeat(1, auto); } }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-4,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-4 {
grid-template-columns: repeat(4, auto); }
@media only screen and (max-width: 1024px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-4,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-4 {
grid-template-columns: repeat(3, auto); } }
@media only screen and (max-width: 768px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-4,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-4 {
grid-template-columns: repeat(2, auto); } }
@media only screen and (max-width: 498px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-4,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-4 {
grid-template-columns: repeat(1, auto); } }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-3,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-3 {
grid-template-columns: repeat(3, auto); }
@media only screen and (max-width: 768px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-3,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-3 {
grid-template-columns: repeat(2, auto); } }
@media only screen and (max-width: 498px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-3,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-3 {
grid-template-columns: repeat(1, auto); } }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-2,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-2 {
grid-template-columns: repeat(2, auto); }
@media only screen and (max-width: 498px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-2,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-2 {
grid-template-columns: repeat(1, auto); } }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list.max-columns-count-1,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list.max-columns-count-1 {
grid-template-columns: repeat(1, auto); }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list > div,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list > div {
flex-basis: 220px; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list li.item-list-item,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list li.item-list-item {
position: relative;
margin: 12px 12px 24px 12px;
margin-bottom: 12px;
min-height: 54px;
min-width: calc(20% - 24px);
width: calc(20% - 24px); }
display: inline-block;
padding: 12px 12px 24px 12px; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list li.item-list-item a,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list li.item-list-item a {
color: var(--tainacan-block-gray5, #454647);
@ -307,6 +503,14 @@
align-items: center;
word-break: break-all;
word-break: break-word; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list li.item-list-item a > div,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list li.item-list-item a > div {
padding: 0px;
padding-bottom: 0px !important;
margin-right: 20px;
display: block;
height: 54px;
width: 54px; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list li.item-list-item img,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list li.item-list-item img {
height: auto;
@ -321,26 +525,6 @@
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list li.item-list-item:hover a {
color: var(--tainacan-block-gray5, #454647);
text-decoration: none; }
@media only screen and (max-width: 1600px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list li.item-list-item,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list li.item-list-item {
min-width: calc(25% - 24px);
width: calc(25% - 24px); } }
@media only screen and (max-width: 1024px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list li.item-list-item,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list li.item-list-item {
min-width: calc(33.333% - 24px);
width: calc(33.333% - 24px); } }
@media only screen and (max-width: 768px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list li.item-list-item,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list li.item-list-item {
min-width: calc(50% - 24px);
width: calc(50% - 24px); } }
@media only screen and (max-width: 498px) {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-list li.item-list-item,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-list li.item-list-item {
min-width: calc(100% - 24px);
width: calc(100% - 24px); } }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-mosaic,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-mosaic {
width: auto;
@ -372,7 +556,8 @@
min-width: 100%;
background-size: cover;
background-position: center;
margin: 0; }
margin: 0;
overflow: hidden; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-mosaic .mosaic-container li.item-list-item a,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-mosaic .mosaic-container li.item-list-item a {
width: 100%;
@ -384,8 +569,8 @@
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-mosaic .mosaic-container li.item-list-item img,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-mosaic .mosaic-container li.item-list-item img {
display: none; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-mosaic .mosaic-container li.item-list-item a span,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-mosaic .mosaic-container li.item-list-item a span {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-mosaic .mosaic-container li.item-list-item a > span,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-mosaic .mosaic-container li.item-list-item a > span {
display: block;
position: absolute;
background: rgba(255, 255, 255, 0.75);
@ -397,8 +582,8 @@
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-mosaic .mosaic-container li.item-list-item:hover a span,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-mosaic .mosaic-container li.item-list-item:hover a span {
opacity: 1; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-mosaic .mosaic-container li.item-list-item a.item-without-title span,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-mosaic .mosaic-container li.item-list-item a.item-without-title span {
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-mosaic .mosaic-container li.item-list-item a.item-without-title > span,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-mosaic .mosaic-container li.item-list-item a.item-without-title > span {
display: none; }
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-mosaic .mosaic-container li.item-list-item:hover a,
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-mosaic .mosaic-container li.item-list-item:hover a {

File diff suppressed because one or more lines are too long

View File

@ -115,6 +115,8 @@
top: -78px !important; }
.wp-block-tainacan-facets-list .facets-collection-header .collection-header-image {
background-color: transparent; } }
.wp-block-tainacan-facets-list.alignfull .facets-search-bar {
padding: 1.00em 2em 0.75em 2em; }
.wp-block-tainacan-facets-list .facets-search-bar {
width: 100%;
display: flex;
@ -211,7 +213,7 @@
border: 1px solid var(--tainacan-block-gray3, #cbcbcb) !important; }
.wp-block-tainacan-facets-list ul.facets-list.facets-layout-grid,
.wp-block-tainacan-facets-list ul.facets-list-edit.facets-layout-grid {
padding: 0;
padding: 0 2em;
flex-wrap: wrap;
display: flex;
display: -ms-grid;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,36 @@
body:not([class]){
margin: auto;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
body:not([class]) > img {
width: auto;
}
body:not([class]) > iframe {
width: 100%;
height: 100%;
min-height: 80vh;
border: none;
}
body:not([class]) > audio,
body:not([class]) > video {
width: 100%;
height: auto;
min-height: 54px;
max-height: 100%;
}
body:not([class]) > audio {
width: 100%;
}
body:not([class]) > a,
body:not([class]) > p {
z-index: 99;
padding: 1rem 4.33337vw;
background: white;
border-radius: 3px;
word-wrap: break-word;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1010 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

View File

@ -248,7 +248,7 @@ class REST_Background_Processes_Controller extends REST_Controller {
if ( !isset($body['status']) || ($body['status'] != 'open' && $body['status'] != 'closed') ) {
return new \WP_REST_Response([
'error_message' => __('Status must be informed', 'tainacan' ),
'session_id' => $session_id
'session_id' => $id
], 400);
}

View File

@ -145,7 +145,7 @@ class REST_Items_Controller extends REST_Controller {
)
);
register_rest_route(
$this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/submission/(?P<submission_id>[\d]+)/finish',
$this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/submission/(?P<submission_id>[a-z0-9]+)/finish',
array(
array(
'methods' => \WP_REST_Server::CREATABLE,
@ -283,6 +283,7 @@ class REST_Items_Controller extends REST_Controller {
if( isset($item_arr['thumbnail']) ) {
$item_arr['thumbnail_alt'] = get_post_meta( $item->get__thumbnail_id(), '_wp_attachment_image_alt', true );
$item_arr['thumbnail_id'] = $item->get__thumbnail_id();
$item_arr['document_mimetype'] = $item->get_document_mimetype(); // In case the thumbnail is requested, we need the document mime type to generate proper placeholders
}
$item_arr['url'] = get_permalink( $item_arr['id'] );
@ -985,12 +986,16 @@ class REST_Items_Controller extends REST_Controller {
if ($item->validate()) {
$item = $this->items_repository->insert( $item );
$fake_id = \hexdec(\uniqid());
$fake_id = md5(uniqid(mt_rand(), true));
$id = $item->get_id();
set_transient('tnc_transient_submission_' . $fake_id, $id, 300);
$response_item = $this->prepare_item_for_response($item, $request);
$response_item['id'] = $fake_id;
return new \WP_REST_Response($response_item, 201 );
if (set_transient('tnc_transient_submission_' . $fake_id, $id, 300) == true) {
$response_item = $this->prepare_item_for_response($item, $request);
$response_item['id'] = $fake_id;
return new \WP_REST_Response($response_item, 201 );
} else return new \WP_REST_Response([
'error_message' => __('unable create submission ID.', 'tainacan'),
], 400);
} else {
return new \WP_REST_Response([
'error_message' => __('One or more values are invalid.', 'tainacan'),

View File

@ -308,14 +308,17 @@ class REST_Metadata_Controller extends REST_Controller {
$item_arr = $item->_toArray();
$item_arr['metadata_type_object'] = $item->get_metadata_type_object()->_toArray();
if(isset($item_arr['metadata_type_options']) && isset($item_arr['metadata_type_options']['taxonomy_id'])){
if ( isset($request['include_options_as_html']) && $request['include_options_as_html'] == 'yes' )
$item_arr['options_as_html'] = $item->get_metadata_type_object()->get_options_as_html();
if ( isset($item_arr['metadata_type_options']) && isset($item_arr['metadata_type_options']['taxonomy_id']) ) {
$taxonomy = Repositories\Taxonomies::get_instance()->get_db_identifier_by_id( $item_arr['metadata_type_options']['taxonomy_id'] );
//$taxonomy = new Entities\Taxonomy($item_arr['metadata_type_options']['taxonomy_id']);
//$item_arr['metadata_type_options']['taxonomy'] = $taxonomy->get_db_identifier();
$item_arr['metadata_type_options']['taxonomy'] = $taxonomy;
}
if($request['context'] === 'edit'){
if ($request['context'] === 'edit') {
$item_arr['current_user_can_edit'] = $item->can_edit();
$item_arr['current_user_can_delete'] = $item->can_delete();
ob_start();

View File

@ -151,6 +151,7 @@ class REST_Roles_Controller extends REST_Controller {
if ( isset($request['capabilities']) && is_array($request['capabilities']) ) {
$this->handle_capabilities_for_role($role_slug, $request['capabilities']);
$this->handle_capabilites_default_for_role($role_slug);
}
if ($new_role instanceof \WP_Role) {
@ -262,6 +263,7 @@ class REST_Roles_Controller extends REST_Controller {
if ( is_array($request['capabilities']) ) {
$this->handle_capabilities_for_role($role_slug, $request['capabilities']);
$this->handle_capabilites_default_for_role($role_slug);
} elseif ( isset($request['add_cap']) ) {
// validate that we only deal with tainacan capabilities
@ -317,6 +319,13 @@ class REST_Roles_Controller extends REST_Controller {
}
private function handle_capabilites_default_for_role($role_slug) {
if ( !isset( \wp_roles()->roles[$role_slug] ) ) {
return false;
}
\wp_roles()->add_cap($role_slug, 'read', true);
}
/**
* @param \WP_REST_Request $request
*

View File

@ -108,12 +108,13 @@ abstract class Background_Process extends \Tainacan_WP_Background_Process {
$this->table,
[
'data' => maybe_serialize($this->data),
'progress_value' => 0,
'user_id' => get_current_user_id(),
'priority' => $priority,
'action' => $this->action,
'name' => $this->get_name(),
'queued_on' => date('Y-m-d H:i:s'),
'status' => 'waiting'
'status' => 'waiting'
]
);
$this->ID = $wpdb->insert_id;
@ -126,7 +127,7 @@ abstract class Background_Process extends \Tainacan_WP_Background_Process {
* Update queue
*
* @param string $key Key.
* @param array $data Data.
* @param array|object $batch Data.
*
* @return $this
*/
@ -288,29 +289,30 @@ abstract class Background_Process extends \Tainacan_WP_Background_Process {
$this->write_log($batch->key, ['New Request']);
$newRequest = false;
}
register_shutdown_function(function() use($batch) {
$error = error_get_last();
if ( is_null($error) ||
! is_array($error) ||
! isset($error['type']) ||
$error['type'] !== 1 ) {
if ( is_null($error) ||
!is_array($error) ||
!isset($error['type']) ||
$error['type'] !== 1
) {
return;
}
$error_str = "Fatal error: " . json_encode($error);
if ( is_array($error) ) {
$error_str = $error['message'] . ' - ' . $error['file'] . ' - Line: ' . $error['line'];
}
$this->debug('Shutdown with Fatal error captured');
$error_str = $error['message'] . ' - ' . $error['file'] . ' - Line: ' . $error['line'].
$this->debug($error_str);
$this->write_error_log($batch->key, ['Fatal Error: ' . $error_str]);
$this->write_error_log($batch->key, ['Process aborted']);
$this->close( $batch->key, 'errored' );
$this->debug('Batch closed due to captured error');
$this->unlock_process();
});
$task = $batch;

View File

@ -21,6 +21,9 @@ class Media {
protected function __construct() {
add_action( 'init', [$this, 'add_attachment_page_rewrite_rule'] );
add_action( 'admin_enqueue_scripts', array( &$this, 'add_css' ) );
add_action( 'wp_enqueue_scripts', array( &$this, 'add_css' ) );
add_filter( 'query_vars', [$this, 'attachment_page_add_var'] );
add_action( 'template_redirect', [$this, 'attachment_page'] );
}
@ -33,6 +36,11 @@ class Media {
);
}
public function add_css() {
global $TAINACAN_BASE_URL;
wp_enqueue_style( 'tainacan-media-page', $TAINACAN_BASE_URL . '/assets/css/tainacan-media-page.css', [], TAINACAN_VERSION );
}
public function attachment_page_add_var($vars) {
$vars[] = 'tainacan_attachment_page';
return $vars;
@ -320,11 +328,11 @@ class Media {
public function attachment_page() {
$att_id = get_query_var('tainacan_attachment_page');
if ( ! $att_id ) {
return; // continue normal execution
}
$attachment = get_post($att_id);
if ( $attachment instanceof \WP_Post && $attachment->post_type == 'attachment' ) {
@ -359,7 +367,7 @@ class Media {
$output .= $img;
} else {
wp_print_styles('tainacan-media-page');
global $wp_embed;
$url = wp_get_attachment_url($att_id);

View File

@ -24,6 +24,9 @@ class Roles {
*/
private function __construct() {
$this->meta_caps = (new \Tainacan\Entities\Metadatum())->get_capabilities();
$this->filters_caps = (new \Tainacan\Entities\Filter())->get_capabilities();
$this->capabilities = [
'manage_tainacan' => [
'display_name' => __('Manage Tainacan', 'tainacan'),
@ -172,6 +175,10 @@ class Roles {
'display_name' => __('Manage Collection', 'tainacan'),
'description' => __('Manage all collection settings, items, metadata, filters, etc.', 'tainacan'),
'scope' => 'collection',
'dependencies' => [
$this->meta_caps->read_private_posts,
$this->filters_caps->read_private_posts
],
'supercaps' => [
'manage_tainacan',
'manage_tainacan_collection_all'
@ -247,6 +254,9 @@ class Roles {
'display_name' => __('View private metadata', 'tainacan'),
'description' => __('Access private metadata in this collection', 'tainacan'),
'scope' => 'collection',
'dependencies' => [
$this->meta_caps->read_private_posts, // e.g.: 'read_private_tainacan-metadata'
],
'supercaps' => [
'manage_tainacan',
'manage_tainacan_collection_all',
@ -258,6 +268,9 @@ class Roles {
'display_name' => __('View private filters', 'tainacan'),
'description' => __('Access private filters in this collection', 'tainacan'),
'scope' => 'collection',
'dependencies' => [
$this->filters_caps->read_private_posts, // e.g.: 'read_private_tainacan-filters'
],
'supercaps' => [
'manage_tainacan',
'manage_tainacan_collection_all',
@ -392,7 +405,8 @@ class Roles {
'slug' => 'tainacan-administrator',
'display_name' => 'Tainacan Administrator',
'caps' => [
'manage_tainacan' => true
'manage_tainacan' => true,
'read' => true
]
],
'tainacan-editor' => [
@ -414,7 +428,8 @@ class Roles {
'tnc_rep_read_private_metadata' => true,
'tnc_rep_read_private_filters' => true,
'tnc_rep_read_logs' => true,
'manage_tainacan_collection_all' => true
'manage_tainacan_collection_all' => true,
'read' => true
]
],
'tainacan-author' => [
@ -427,6 +442,7 @@ class Roles {
'tnc_rep_read_private_taxonomies' => true,
'tnc_rep_read_private_metadata' => true,
'tnc_rep_read_private_filters' => true,
'read' => true
]
],
];
@ -534,6 +550,17 @@ class Roles {
continue;
}
if( in_array($requested_cap, [
$this->meta_caps->read_private_posts,
$this->filters_caps->read_private_posts]
) && (
$user->has_cap('manage_tainacan') ||
$user->has_cap('manage_tainacan_collection_all')
)
) {
$allcaps = array_merge($allcaps, [ $requested_cap => true ]);
}
if ( \strpos($cap, 'tnc_') === 0 ) {
if ( $user->has_cap('manage_tainacan') ) {

View File

@ -9,23 +9,23 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
*/
class Item extends Entity {
use \Tainacan\Traits\Entity_Collection_Relation;
protected
$terms,
$diplay_name,
$full,
$_thumbnail_id,
$modification_date,
$creation_date,
$author_id,
$url,
$id,
$title,
$order,
$parent,
$decription,
$document_type,
$document,
$collection_id;
protected
$terms,
$diplay_name,
$full,
$_thumbnail_id,
$modification_date,
$creation_date,
$author_id,
$url,
$id,
$title,
$order,
$parent,
$decription,
$document_type,
$document,
$collection_id;
/**
* {@inheritDoc}
@ -57,7 +57,7 @@ class Item extends Entity {
$array_item['url'] = get_permalink( $this->get_id() );
$array_item['creation_date'] = $this->get_date_i18n( explode( ' ', $array_item['creation_date'] )[0] );
$array_item['modification_date'] = $this->get_date_i18n( explode( ' ', $array_item['modification_date'] )[0] );
$array_item['document_mimetype'] = $this->get_document_mimetype();
return apply_filters('tainacan-item-to-array', $array_item, $this);
}
@ -116,26 +116,66 @@ class Item extends Entity {
return apply_filters("tainacan-item-get-author-name", $name, $this);
}
/**
* Gets the thumbnail list of files
*
* Each size is represented as an array in the format returned by
* @see https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src/
*
* @return array
*/
function get_thumbnail() {
/**
* Gets the thumbnail list of files
*
* Each size is represented as an array in the format returned by
* @see https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src/
*
* @return array
*/
function get_thumbnail() {
$sizes = get_intermediate_image_sizes();
$sizes = get_intermediate_image_sizes();
array_unshift($sizes, 'full');
array_unshift($sizes, 'full');
foreach ( $sizes as $size ) {
$thumbs[$size] = wp_get_attachment_image_src( $this->get__thumbnail_id(), $size );
}
if( in_array('tainacan-small', $sizes ) ) {
$tmp_src = wp_get_attachment_image_src( $this->get__thumbnail_id(), 'tainacan-small' );
$blurhash = $this->get_image_blurhash($tmp_src[0], $tmp_src[1], $tmp_src[2]);
}
return apply_filters("tainacan-item-get-thumbnail", $thumbs, $this);
}
foreach ( $sizes as $size ) {
$thumbs[$size] = wp_get_attachment_image_src( $this->get__thumbnail_id(), $size );
if (is_array($thumbs[$size]) && count($thumbs[$size]) == 4)
$thumbs[$size][] = $blurhash;
}
return apply_filters("tainacan-item-get-thumbnail", $thumbs, $this);
}
public function get_image_blurhash($file_path, $width, $height) {
if (
!(version_compare(PHP_VERSION, '7.2.0') >= 0) ||
!$image = @imagecreatefromstring(file_get_contents($file_path))
) {
return "V4P?:h00Rj~qM{of%MRjWBRjD%%MRjayofj[%M-;RjRj";
}
if($image == false)
return '';
$max_width = 45;
if( $width > $max_width ) {
$image = imagescale($image, $max_width);
$width = imagesx($image);
$height = imagesy($image);
}
$pixels = [];
for ($y = 0; $y < $height; ++$y) {
$row = [];
for ($x = 0; $x < $width; ++$x) {
$index = imagecolorat($image, $x, $y);
$colors = imagecolorsforindex($image, $index);
$row[] = [$colors['red'], $colors['green'], $colors['blue']];
}
$pixels[] = $row;
}
$components_x = 4;
$components_y = 3;
$blurhash = \kornrunner\Blurhash\Blurhash::encode($pixels, $components_x, $components_y);
return $blurhash;
}
/**
* @param $id
@ -148,10 +188,10 @@ class Item extends Entity {
* @return int|string
*/
function get__thumbnail_id() {
$_thumbnail_id = $this->get_mapped_property("_thumbnail_id");
if ( isset( $_thumbnail_id ) ) {
return $_thumbnail_id;
}
$_thumbnail_id = $this->get_mapped_property("_thumbnail_id");
if ( isset( $_thumbnail_id ) ) {
return $_thumbnail_id;
}
return get_post_thumbnail_id( $this->get_id() );
}
@ -238,6 +278,15 @@ class Item extends Entity {
return $this->get_mapped_property( 'document_type' );
}
/**
* Return the document mimetype
*
* @return string
*/
function get_document_mimetype() {
return $this->get_document_type() == 'attachment' ? get_post_mime_type($this->get_document()) : $this->get_document_type();
}
/**
* Return the item document
*
@ -271,7 +320,7 @@ class Item extends Entity {
* @return string "open"|"closed"
*/
public function get_comment_status() {
return apply_filters('comments_open', $this->get_mapped_property('comment_status'), $this->get_id());
return apply_filters('comments_open', $this->get_mapped_property('comment_status'), $this->get_id());
}
/**
@ -383,7 +432,7 @@ class Item extends Entity {
* @param $value string "open"|"closed"
*/
public function set_comment_status( $value ) {
$this->set_mapped_property('comment_status', $value);
$this->set_mapped_property('comment_status', $value);
}
/**
@ -498,6 +547,8 @@ class Item extends Entity {
*
* @type bool $hide_empty Wether to hide or not metadata the item has no value to
* Default: true
* @type bool $display_slug_as_class Show metadata slug as a class in the div before the metadata block
* Default: false
* @type string $before String to be added before each metadata block
* Default '<div class="metadata-type-$type">' where $type is the metadata type slug
* @type string $after String to be added after each metadata block
@ -530,7 +581,8 @@ class Item extends Entity {
'exclude_description' => false,
'exclude_core' => false,
'hide_empty' => true,
'before' => '<div class="metadata-type-$type">',
'display_slug_as_class' => false,
'before' => '<div class="metadata-type-$type $id">',
'after' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
@ -570,6 +622,12 @@ class Item extends Entity {
$item_meta = new \Tainacan\Entities\Item_Metadata_Entity($this, $metadatum_object);
if ($item_meta->has_value() || !$args['hide_empty']) {
$before = str_replace('$type', $mto->get_slug(), $args['before']);
if ($args['display_slug_as_class']) {
$before = str_replace('$id', 'metadata-slug-'.$item_meta->get_metadatum()->get_slug() , $before);
}
else {
$before = str_replace(' $id', '', $before);
}
$return .= $before;
$return .= $args['before_title'] . $metadatum_object->get_name() . $args['after_title'];
$return .= $args['before_value'] . $item_meta->get_value_as_html() . $args['after_value'];
@ -635,6 +693,12 @@ class Item extends Entity {
if ($item_meta->has_value() || !$args['hide_empty']) {
$before = str_replace('$type', $fto->get_slug(), $args['before']);
if ($args['display_slug_as_class']) {
$before = str_replace('$id', 'metadata-slug-'.$item_meta->get_metadatum()->get_slug() , $before);
}
else {
$before = str_replace(' $id', '', $before);
}
$return .= $before;
$return .= $args['before_title'] . $item_meta->get_metadatum()->get_name() . $args['after_title'];
$return .= $args['before_value'] . $item_meta->get_value_as_html() . $args['after_value'];

View File

@ -492,7 +492,7 @@ class Metadatum extends Entity {
if ( sizeof($meta_childrens) > 0 ) {
foreach($meta_childrens as $meta_children) {
if( $meta_children->is_required() ) {
$this->add_error($this->get_id(), __("Compound metadata with multiple values can't have a children metadata set to as required", 'tainacan'));
$this->add_error($this->get_id(), __("Compound metadata with multiple values can't have a children metadata set to as required", 'tainacan'));
return false;
}
}

View File

@ -57,14 +57,14 @@ class Csv extends Exposer {
return $a['name'];
}, $items[0]['metadata']);
fputcsv($csv, $headers, ';', '"' );
fputcsv($csv, $headers, ',', '"' );
foreach ($items as $item) {
$values = array_map(function($a) {
return $a['value_as_string'];
}, $item['metadata']);
fputcsv($csv, $values, ';', '"' );
fputcsv($csv, $values, ',', '"' );
}
rewind($csv);

View File

@ -9,9 +9,9 @@ class Background_Importer extends Background_Process {
*/
protected $action = 'import';
/**
* @var int
*/
/**
* @var int
*/
private $finish_status = 1;
public function __construct() {
@ -20,11 +20,11 @@ class Background_Importer extends Background_Process {
}
/**
* @param $status
*/
* @param $status
*/
private function set_finish_status( $status ){
$this->finish_status = $status;
}
$this->finish_status = $status;
}
function task($batch) {
@ -41,10 +41,10 @@ class Background_Importer extends Background_Process {
$this->write_log($key, $object->get_log());
$this->write_error_log($key, $object->get_error_log());
$batch->progress_label = $object->get_progress_label();
$batch->progress_value = $object->get_progress_value();
$batch->progress_label = $object->get_progress_label();
$batch->progress_value = $object->get_progress_value();
$batch->data = $object->_to_Array(true);
$batch->data = $object->_to_Array(true);
if (true === $object->get_abort()) {
throw new \Exception('Process aborted by Importer');

View File

@ -5,14 +5,14 @@ use Tainacan\Entities;
abstract class Importer {
/**
* The ID for this importer session
*
* When creating a new importer session via API, an id is returned and used to access this
* importer instance. This is temporarily stored in the database and discarded after the bg process is triggered
*
* @var identifier
*/
/**
* The ID for this importer session
*
* When creating a new importer session via API, an id is returned and used to access this
* importer instance. This is temporarily stored in the database and discarded after the bg process is triggered
*
* @var identifier
*/
private $id;
/**
@ -136,7 +136,7 @@ abstract class Importer {
'tmp_file'
];
public function __construct($attributess = array()) {
public function __construct($attributess = array()) {
$this->id = uniqid();
@ -181,41 +181,41 @@ abstract class Importer {
/////////////////////
// Getters and setters
/**
* @return string
*/
public function get_id(){
return $this->id;
}
/**
* @return string
*/
public function get_id(){
return $this->id;
}
/**
* Set URL
* @param $url string
* @return bool
*/
public function set_url($url)
{
if(!empty($url) && !is_array($url))
{
$this->url = rtrim(trim($url), "/");
return true;
}
/**
* Set URL
* @param $url string
* @return bool
*/
public function set_url($url)
{
if(!empty($url) && !is_array($url))
{
$this->url = rtrim(trim($url), "/");
return true;
}
return false;
}
return false;
}
/**
* @return string or bool
*/
public function get_url()
{
if(!empty($this->url))
{
return $this->url;
}
/**
* @return string or bool
*/
public function get_url()
{
if(!empty($this->url))
{
return $this->url;
}
return false;
}
return false;
}
public function get_current_step() {
return $this->current_step;
@ -250,12 +250,12 @@ abstract class Importer {
}
public function get_tmp_file(){
return $this->tmp_file;
}
return $this->tmp_file;
}
public function set_tmp_file($filepath){
$this->tmp_file = $filepath;
}
$this->tmp_file = $filepath;
}
public function get_collections() {
return $this->collections;
@ -266,13 +266,13 @@ abstract class Importer {
}
/**
* Gets the options for this importer, including default values for options
* that were not set yet.
* @return array Importer options
*/
public function get_options() {
return array_merge($this->default_options, $this->options);
}
* Gets the options for this importer, including default values for options
* that were not set yet.
* @return array Importer options
*/
public function get_options() {
return array_merge($this->default_options, $this->options);
}
/**
* Set the options array
@ -294,13 +294,13 @@ abstract class Importer {
}
public function set_steps($steps) {
$this->steps = $steps;
}
public function set_steps($steps) {
$this->steps = $steps;
}
public function get_steps() {
return $this->steps;
}
return $this->steps;
}
private function get_transients() {
@ -323,33 +323,33 @@ abstract class Importer {
// Utilities
/**
* @param $file File to be managed by importer
* @return bool
*/
public function add_file( $file ){
$new_file = $this->upload_file( $file );
if ( is_numeric( $new_file ) ) {
/**
* @param $file File to be managed by importer
* @return bool
*/
public function add_file( $file ){
$new_file = $this->upload_file( $file );
if ( is_numeric( $new_file ) ) {
$this->tmp_file = get_attached_file( $new_file );
return true;
} else {
return false;
}
}
} else {
return false;
}
}
/**
* log the actions from importer
*
* @param $type
* @param $messagelog
*/
public function add_log($message ){
$this->log[] = $message;
}
/**
* log the actions from importer
*
* @param $type
* @param $messagelog
*/
public function add_log($message ){
$this->log[] = $message;
}
public function add_error_log($message ){
$this->error_log[] = $message;
}
$this->error_log[] = $message;
}
public function add_collection(array $collection) {
if (isset($collection['id'])) {
@ -367,17 +367,17 @@ abstract class Importer {
}
}
/**
* internal function to upload the file
*
* @param $path_file
* @return array $response
*/
private function upload_file( $file_array ){
//$name = basename( $path_file );
//$file_array['name'] = $name;
//$file_array['tmp_name'] = $path_file;
//$file_array['size'] = filesize( $path_file );
/**
* internal function to upload the file
*
* @param $path_file
* @return array $response
*/
private function upload_file( $file_array ){
//$name = basename( $path_file );
//$file_array['name'] = $name;
//$file_array['tmp_name'] = $path_file;
//$file_array['size'] = filesize( $path_file );
if ( !function_exists('media_handle_upload') ) {
require_once(ABSPATH . "wp-admin" . '/includes/image.php');
@ -386,36 +386,36 @@ abstract class Importer {
}
//var_dump(media_handle_sideload( $file_array, 0 )); die;
return media_handle_sideload( $file_array, 0 );
}
}
/**
* get the content form url and creates a file
*
* @param $url
* @return array
*/
public function fetch_from_remote( $url ){
$tmp = wp_remote_get( $url );
if( !is_wp_error($tmp) && isset( $tmp['body'] ) ){
$file = fopen( $this->get_id().'.txt', 'w' );
fwrite( $file, $tmp['body'] );
fclose( $file );
return $this->add_file( $this->get_id().'.txt' );
}
}
/**
* get the content form url and creates a file
*
* @param $url
* @return array
*/
public function fetch_from_remote( $url ){
$tmp = wp_remote_get( $url );
if( !is_wp_error($tmp) && isset( $tmp['body'] ) ){
$file = fopen( $this->get_id().'.txt', 'w' );
fwrite( $file, $tmp['body'] );
fclose( $file );
return $this->add_file( $this->get_id().'.txt' );
}
}
/**
* Gets one option from the options array.
*
* Checks if option exist or if it have a default value. Otherwise return an empty string
*
* @param string $key the desired option
* @return mixed the option value, the default value or an empty string
*/
public function get_option($key) {
$options = $this->get_options();
return isset($options[$key]) ? $options[$key] : '';
}
/**
* Gets one option from the options array.
*
* Checks if option exist or if it have a default value. Otherwise return an empty string
*
* @param string $key the desired option
* @return mixed the option value, the default value or an empty string
*/
public function get_option($key) {
$options = $this->get_options();
return isset($options[$key]) ? $options[$key] : '';
}
/**
* Adds a new method accepeted by the importer
@ -464,15 +464,15 @@ abstract class Importer {
return null;
}
public function is_finished()
{
if($this->current_step >= count($this->steps))
{
return true;
}
public function is_finished()
{
if($this->current_step >= count($this->steps))
{
return true;
}
return false;
}
return false;
}
/**
* Cancel Scheduled abortion at the end of run()
@ -628,26 +628,26 @@ abstract class Importer {
// Abstract methods
/**
* get the metadata of file/url to allow mapping
* should return an array
*
* Used when $manual_mapping is set to true, to build the mapping interface
*
* @return array $metadata_source the metadata from the source
*/
public function get_source_metadata() {}
/**
* get the metadata of file/url to allow mapping
* should return an array
*
* Used when $manual_mapping is set to true, to build the mapping interface
*
* @return array $metadata_source the metadata from the source
*/
public function get_source_metadata() {}
/**
* get values for a single item
*
* @param $index
* @return array with metadatum_source's as the index and values for the
* item
*
* Ex: [ 'Metadatum1' => 'value1', 'Metadatum2' => [ 'value2','value3' ]
*/
abstract public function process_item( $index, $collection_id );
/**
* get values for a single item
*
* @param $index
* @return array with metadatum_source's as the index and values for the
* item
*
* Ex: [ 'Metadatum1' => 'value1', 'Metadatum2' => [ 'value2','value3' ]
*/
abstract public function process_item( $index, $collection_id );
@ -679,11 +679,11 @@ abstract class Importer {
////////////////////////////////////////
// Core methods
/**
* process an item from the collections queue
*
*/
public function process_collections() {
/**
* process an item from the collections queue
*
*/
public function process_collections() {
$current_collection = $this->get_current_collection();
$collections = $this->get_collections();
@ -705,7 +705,7 @@ abstract class Importer {
}
return $this->next_item();
}
}
protected function next_item() {
@ -718,8 +718,8 @@ abstract class Importer {
$this->set_current_collection_item($current_collection_item);
if( $this->get_transient('change_total') ){
$collection['total_items'] = $this->get_transient('change_total');
}
$collection['total_items'] = $this->get_transient('change_total');
}
if ($current_collection_item >= $collection['total_items']) {
return $this->next_collection();
@ -763,23 +763,23 @@ abstract class Importer {
return false;
}
/**
* insert processed item from source to Tainacan
*
* @param array $processed_item Associative array with metadatum source's as index with
* its value or values
* @param integet $collection_index The index in the $this->collections array of the collection the item is beeing inserted into
*
* @return Tainacan\Entities\Item Item inserted
*/
public function insert( $processed_item, $collection_index ) {
/**
* insert processed item from source to Tainacan
*
* @param array $processed_item Associative array with metadatum source's as index with
* its value or values
* @param integet $collection_index The index in the $this->collections array of the collection the item is beeing inserted into
*
* @return Tainacan\Entities\Item Item inserted
*/
public function insert( $processed_item, $collection_index ) {
remove_action( 'post_updated', 'wp_save_post_revision' );
$collections = $this->get_collections();
$collection_definition = isset($collections[$collection_index]) ? $collections[$collection_index] : false;
if ( !$collection_definition || !is_array($collection_definition) || !isset($collection_definition['id']) || !isset($collection_definition['mapping']) ) {
$this->add_error_log('Collection misconfigured');
return false;
return false;
}
$collection = \Tainacan\Repositories\Collections::get_instance()->fetch($collection_definition['id']);
@ -790,96 +790,96 @@ abstract class Importer {
}
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
$Tainacan_Items->disable_logs();
$Tainacan_Metadata->disable_logs();
$Tainacan_Item_Metadata->disable_logs();
$item = new Entities\Item( ( $this->get_transient('item_id') ) ? $this->get_transient('item_id') : 0 );
$item = new Entities\Item( ( $this->get_transient('item_id') ) ? $this->get_transient('item_id') : 0 );
$itemMetadataArray = [];
if( is_array( $processed_item ) ){
foreach ( $processed_item as $metadatum_source => $values ){
$tainacan_metadatum_id = array_search( $metadatum_source, $collection_definition['mapping'] );
$metadatum = $Tainacan_Metadata->fetch( $tainacan_metadatum_id );
if( is_array( $processed_item ) ){
foreach ( $processed_item as $metadatum_source => $values ){
$tainacan_metadatum_id = array_search( $metadatum_source, $collection_definition['mapping'] );
$metadatum = $Tainacan_Metadata->fetch( $tainacan_metadatum_id );
if( $metadatum instanceof Entities\Metadatum ){
$singleItemMetadata = new Entities\Item_Metadata_Entity( $item, $metadatum); // *empty item will be replaced by inserted in the next foreach
$singleItemMetadata->set_value( $values );
$itemMetadataArray[] = $singleItemMetadata;
} else {
if( $metadatum instanceof Entities\Metadatum ){
$singleItemMetadata = new Entities\Item_Metadata_Entity( $item, $metadatum); // *empty item will be replaced by inserted in the next foreach
$singleItemMetadata->set_value( $values );
$itemMetadataArray[] = $singleItemMetadata;
} else {
$this->add_error_log('Metadata ' . $metadatum_source . ' not found');
}
}
}
}
}
if( !empty( $itemMetadataArray ) && $collection instanceof Entities\Collection ){
if( !empty( $itemMetadataArray ) && $collection instanceof Entities\Collection ){
$item->set_collection( $collection );
if( $item->validate() ){
if( $item->validate() ){
$insertedItem = $Tainacan_Items->insert( $item );
} else {
$this->add_error_log( 'Error inserting item' );
$this->add_error_log( $item->get_errors() );
return false;
}
} else {
$this->add_error_log( 'Error inserting item' );
$this->add_error_log( $item->get_errors() );
return false;
}
foreach ( $itemMetadataArray as $itemMetadata ) {
$itemMetadata->set_item( $insertedItem ); // *I told you
foreach ( $itemMetadataArray as $itemMetadata ) {
$itemMetadata->set_item( $insertedItem ); // *I told you
if( $itemMetadata->validate() ){
if( $itemMetadata->validate() ){
$result = $Tainacan_Item_Metadata->insert( $itemMetadata );
} else {
$this->add_error_log('Error saving value for ' . $itemMetadata->get_metadatum()->get_name());
$this->add_error_log($itemMetadata->get_errors());
continue;
}
} else {
$this->add_error_log('Error saving value for ' . $itemMetadata->get_metadatum()->get_name());
$this->add_error_log($itemMetadata->get_errors());
continue;
}
//if( $result ){
// $values = ( is_array( $itemMetadata->get_value() ) ) ? implode( PHP_EOL, $itemMetadata->get_value() ) : $itemMetadata->get_value();
// $this->add_log( 'Item ' . $insertedItem->get_id() .
// ' has inserted the values: ' . $values . ' on metadata: ' . $itemMetadata->get_metadatum()->get_name() );
//} else {
// $this->add_error_log( 'Item ' . $insertedItem->get_id() . ' has an error' );
//}
//if( $result ){
// $values = ( is_array( $itemMetadata->get_value() ) ) ? implode( PHP_EOL, $itemMetadata->get_value() ) : $itemMetadata->get_value();
// $this->add_log( 'Item ' . $insertedItem->get_id() .
// ' has inserted the values: ' . $values . ' on metadata: ' . $itemMetadata->get_metadatum()->get_name() );
//} else {
// $this->add_error_log( 'Item ' . $insertedItem->get_id() . ' has an error' );
//}
}
$insertedItem->set_status('publish' );
if($insertedItem->validate()) {
if($insertedItem->validate()) {
$insertedItem = $Tainacan_Items->update( $insertedItem );
$this->after_inserted_item( $insertedItem, $collection_index );
} else {
$this->add_error_log( 'Error publishing Item' );
$this->add_error_log( $insertedItem->get_errors() );
return false;
} else {
$this->add_error_log( 'Error publishing Item' );
$this->add_error_log( $insertedItem->get_errors() );
return false;
}
return $insertedItem;
return $insertedItem;
} else {
$this->add_error_log( 'Collection not set');
return false;
}
} else {
$this->add_error_log( 'Collection not set');
return false;
}
}
/**
* allow importers executes process after item is insertes
* @param array $insertedItem Associative array with inserted item
* @param integer $collection_index The index in the $this->collections array of the collection the item is beeing inserted into
* @param integer $collection_index The index in the $this->collections array of the collection the item is beeing inserted into
*
*/
public function after_inserted_item($insertedItem, $collection_index){}
/**
* runs one iteration
*/
public function run(){
/**
* runs one iteration
*/
public function run(){
if ($this->is_finished()) {
return false;
@ -911,41 +911,41 @@ abstract class Importer {
}
return $return;
}
}
/**
* @param $metadata_description
* @param $collection_id
* @return bool
* @throws \Exception
*/
public function create_new_metadata( $metadata_description, $collection_id, $parent_id = null){
$taxonomy_repo = \Tainacan\Repositories\Taxonomies::get_instance();
$metadata_repo = \Tainacan\Repositories\Metadata::get_instance();
/**
* @param $metadata_description
* @param $collection_id
* @return bool
* @throws \Exception
*/
public function create_new_metadata( $metadata_description, $collection_id, $parent_id = null){
$taxonomy_repo = \Tainacan\Repositories\Taxonomies::get_instance();
$metadata_repo = \Tainacan\Repositories\Metadata::get_instance();
if(is_array($metadata_description)) {
$parent_metadata_description = key($metadata_description);
$parent_compound = $this->create_new_metadata($parent_metadata_description, $collection_id);
if($parent_compound == false) return false;
$children_mapping = [];
foreach($metadata_description[$parent_metadata_description] as $children_metadata_description) {
$children_compound = $this->create_new_metadata($children_metadata_description, $collection_id, $parent_compound->get_id());
if ( $children_compound == false )
return false;
$children_mapping[$children_compound->get_id()] = $children_metadata_description;
}
return [$parent_compound, $children_mapping];
}
$properties = array_filter( explode('|', $metadata_description) );
if(is_array($metadata_description)) {
$parent_metadata_description = key($metadata_description);
$parent_compound = $this->create_new_metadata($parent_metadata_description, $collection_id);
if($parent_compound == false) return false;
$children_mapping = [];
foreach($metadata_description[$parent_metadata_description] as $children_metadata_description) {
$children_compound = $this->create_new_metadata($children_metadata_description, $collection_id, $parent_compound->get_id());
if ( $children_compound == false )
return false;
$children_mapping[$children_compound->get_id()] = $children_metadata_description;
}
return [$parent_compound, $children_mapping];
}
$properties = array_filter( explode('|', $metadata_description) );
if( is_array($properties) && count($properties) < 2 ){
$properties[1] = 'text';
} else if( !$properties ){
return false;
}
if( is_array($properties) && count($properties) < 2 ){
$properties[1] = 'text';
} else if( !$properties ){
return false;
}
$name = $properties[0];
$type = $properties[1];
$name = $properties[0];
$type = $properties[1];
$supported_types = \Tainacan\Repositories\Metadata::get_instance()->fetch_metadata_types('NAME');
$supported_types = array_map('strtolower', $supported_types);
@ -956,89 +956,89 @@ abstract class Importer {
$type = 'text';
}
$newMetadatum = new Entities\Metadatum();
$newMetadatum->set_name($name);
$newMetadatum = new Entities\Metadatum();
$newMetadatum->set_name($name);
$type = ucfirst($type);
$newMetadatum->set_metadata_type('Tainacan\Metadata_Types\\'.$type);
$newMetadatum->set_collection_id( (isset($collection_id)) ? $collection_id : 'default');
$newMetadatum->set_status('auto-draft');
if($newMetadatum->validate()) {
$newMetadatum = $metadata_repo->insert( $newMetadatum );
} else {
$this->add_log('Error creating metadata ' . $name . ' in collection ' . $collection_id);
$this->add_log($newMetadatum->get_errors());
return false;
}
$newMetadatum->set_status('publish');
$type = ucfirst($type);
$newMetadatum->set_metadata_type('Tainacan\Metadata_Types\\'.$type);
$newMetadatum->set_collection_id( (isset($collection_id)) ? $collection_id : 'default');
$newMetadatum->set_status('auto-draft');
if($newMetadatum->validate()) {
$newMetadatum = $metadata_repo->insert( $newMetadatum );
} else {
$this->add_log('Error creating metadata ' . $name . ' in collection ' . $collection_id);
$this->add_log($newMetadatum->get_errors());
return false;
}
$newMetadatum->set_status('publish');
if( strcmp(strtolower($type), "taxonomy") === 0 ){
$taxonomy = new Entities\Taxonomy();
$taxonomy->set_name($name);
$taxonomy->set_status('publish');
$taxonomy->set_allow_insert('yes');
if( strcmp(strtolower($type), "taxonomy") === 0 ){
$taxonomy = new Entities\Taxonomy();
$taxonomy->set_name($name);
$taxonomy->set_status('publish');
$taxonomy->set_allow_insert('yes');
if( $taxonomy->validate() ){
$inserted_tax = $taxonomy_repo->insert( $taxonomy );
if(is_array($properties) && in_array( 'multiple', $properties) ){
$newMetadatum->set_metadata_type_options([
'taxonomy_id' => $inserted_tax->get_id(),
'allow_new_terms' => 'yes',
'input_type' => 'tainacan-taxonomy-checkbox'
]);
} else {
$newMetadatum->set_metadata_type_options([
'taxonomy_id' => $inserted_tax->get_id(),
'allow_new_terms' => 'no',
'input_type' => 'tainacan-taxonomy-radio'
]);
}
}
}
if( $taxonomy->validate() ){
$inserted_tax = $taxonomy_repo->insert( $taxonomy );
if(is_array($properties) && in_array( 'multiple', $properties) ){
$newMetadatum->set_metadata_type_options([
'taxonomy_id' => $inserted_tax->get_id(),
'allow_new_terms' => 'yes',
'input_type' => 'tainacan-taxonomy-checkbox'
]);
} else {
$newMetadatum->set_metadata_type_options([
'taxonomy_id' => $inserted_tax->get_id(),
'allow_new_terms' => 'no',
'input_type' => 'tainacan-taxonomy-radio'
]);
}
}
}
/*Properties of metadatum*/
if( is_array($properties) && in_array( 'required', $properties)){
$newMetadatum->set_required('yes');
}
/*Properties of metadatum*/
if( is_array($properties) && in_array( 'required', $properties)){
$newMetadatum->set_required('yes');
}
if(is_array($properties) && in_array( 'multiple', $properties) ){
$newMetadatum->set_multiple('yes');
}
if(is_array($properties) && in_array( 'multiple', $properties) ){
$newMetadatum->set_multiple('yes');
}
if( is_array($properties) && in_array( 'display_yes', $properties) ){
$newMetadatum->set_display('yes');
} else if(is_array($properties) && in_array( 'display_no', $properties) ){
$newMetadatum->set_display('no');
} else if(is_array($properties) && in_array( 'display_never', $properties) ){
$newMetadatum->set_display('never');
}
if( is_array($properties) && in_array( 'display_yes', $properties) ){
$newMetadatum->set_display('yes');
} else if(is_array($properties) && in_array( 'display_no', $properties) ){
$newMetadatum->set_display('no');
} else if(is_array($properties) && in_array( 'display_never', $properties) ){
$newMetadatum->set_display('never');
}
if( is_array($properties) && in_array( 'status_public', $properties) ){
$newMetadatum->set_status('publish');
} else if( is_array($properties) && in_array( 'status_private', $properties) ){
$newMetadatum->set_status('private');
}
if( is_array($properties) && in_array( 'status_public', $properties) ){
$newMetadatum->set_status('publish');
} else if( is_array($properties) && in_array( 'status_private', $properties) ){
$newMetadatum->set_status('private');
}
if( is_array($properties) && in_array( 'collection_key_yes', $properties) ){
$newMetadatum->set_collection_key('yes');
} else if( is_array($properties) && in_array( 'collection_key_no', $properties) ){
$newMetadatum->set_collection_key('no');
}
if( is_array($properties) && in_array( 'collection_key_yes', $properties) ){
$newMetadatum->set_collection_key('yes');
} else if( is_array($properties) && in_array( 'collection_key_no', $properties) ){
$newMetadatum->set_collection_key('no');
}
if(isset($parent_id) && $parent_id != null) {
$newMetadatum->set_parent($parent_id);
}
if(isset($parent_id) && $parent_id != null) {
$newMetadatum->set_parent($parent_id);
}
if($newMetadatum->validate()){
$inserted_metadata = $metadata_repo->insert( $newMetadatum );
if($newMetadatum->validate()){
$inserted_metadata = $metadata_repo->insert( $newMetadatum );
$this->add_log('Metadata created: ' . $inserted_metadata->get_name());
return $inserted_metadata;
} else {
$this->add_log('Error creating metadata ' . $name . ' in collection ' . $collection_id);
$this->add_log($newMetadatum->get_errors());
$this->add_log('Metadata created: ' . $inserted_metadata->get_name());
return $inserted_metadata;
} else {
$this->add_log('Error creating metadata ' . $name . ' in collection ' . $collection_id);
$this->add_log($newMetadatum->get_errors());
return false;
}
}
return false;
}
}
}

View File

@ -169,6 +169,7 @@
session_write_close();
if ( $this->is_process_running() ) {
$this->debug('process already running. To die...');
// Background process already running.
wp_die();
}
@ -219,6 +220,7 @@
* in a background process.
*/
protected function is_process_running() {
$this->debug('Checking if process ' . $this->identifier . ' is running:');
if ( get_site_transient( $this->identifier . '_process_lock' ) ) {
// Process already running.
$this->debug('process already running');
@ -236,10 +238,10 @@
* defined in the time_exceeded() method.
*/
protected function lock_process() {
$this->debug('locking process');
$this->debug('locking process: ' . $this->identifier);
$this->start_time = time(); // Set start time of current process.
$lock_duration = ( property_exists( $this, 'queue_lock_time' ) ) ? $this->queue_lock_time : 60; // 1 minute
$max_execution_time = ini_get('max_execution_time');
$lock_duration = ( property_exists( $this, 'queue_lock_time' ) ) ? $this->queue_lock_time : ( empty($max_execution_time) ? 60 : $max_execution_time ); // 1 minute
$lock_duration = apply_filters( $this->identifier . '_queue_lock_time', $lock_duration );
set_site_transient( $this->identifier . '_process_lock', microtime(), $lock_duration );

View File

@ -45,6 +45,13 @@ abstract class Repository {
$this->use_logs = true;
}
/**
* Get if creation of logs while inserting and updating entities are enable
*/
public function get_enabled_logs() {
return $this->use_logs;
}
/**
* Register hooks
*/

View File

@ -321,7 +321,7 @@ class Terms extends Repository {
$terms = get_terms($args);
if (empty($terms)) {
if (empty($terms) || $terms instanceof \WP_Error) {
return false;
}

View File

@ -35,7 +35,7 @@ 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'));
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'));
@ -62,6 +62,7 @@ class Theme_Helper {
$this->register_view_mode('table', [
'label' => __('Table', 'tainacan'),
'description' => 'The classic table display.',
'dynamic_metadata' => true,
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewtable tainacan-icon-1-25em"></i></span>',
'type' => 'component',
@ -71,7 +72,7 @@ class Theme_Helper {
$this->register_view_mode('cards', [
'label' => __('Cards', 'tainacan'),
'dynamic_metadata' => false,
'description' => 'A cards view, displaying title, description, author name and creation date.',
'description' => 'A cards view, displaying cropped thumbnails, title and description.',
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewcards tainacan-icon-1-25em"></i></span>',
'type' => 'component',
'implements_skeleton' => true,
@ -80,7 +81,7 @@ class Theme_Helper {
$this->register_view_mode('records', [
'label' => __('Records', 'tainacan'),
'dynamic_metadata' => true,
'description' => 'A records view, similiar to cards, but flexible for metadata',
'description' => 'A records view, similiar to cards, but flexible for metadata.',
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewrecords tainacan-icon-1-25em"></i></span>',
'type' => 'component',
'implements_skeleton' => true,
@ -95,9 +96,9 @@ class Theme_Helper {
'implements_skeleton' => true
]);
$this->register_view_mode('slideshow', [
'label' => __('Slideshow', 'tainacan'),
'label' => __('Slides', 'tainacan'),
'dynamic_metadata' => false,
'description' => 'A fullscreen slideshow view.',
'description' => 'A fullscreen slideshow view, that shows the item document instead of just thumbnails.',
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewgallery tainacan-icon-1-25em"></i></span>',
'type' => 'component',
'show_pagination' => false,
@ -106,7 +107,7 @@ class Theme_Helper {
$this->register_view_mode('list', [
'label' => __('List', 'tainacan'),
'dynamic_metadata' => true,
'description' => 'A list view, similiar to the records, but full width',
'description' => 'A list view, similiar to the records, but full width.',
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewlist tainacan-icon-1-25em"></i></span>',
'type' => 'component',
'implements_skeleton' => true,
@ -183,36 +184,36 @@ class Theme_Helper {
}
/**
* Filters the permalink for posts to:
*
* * Replace Collection single permalink with the link to the post type archive for items of that collection
*
* @return string new permalink
*/
function permalink_filter($permalink, $post, $leavename) {
$collection_post_type = \Tainacan\Entities\Collection::get_post_type();
if (!is_admin() && $post->post_type == $collection_post_type) {
$collection = new \Tainacan\Entities\Collection($post);
* Filters the permalink for posts to:
*
* * Replace Collection single permalink with the link to the post type archive for items of that collection
*
* @return string new permalink
*/
function permalink_filter($permalink, $post, $leavename) {
$collection_post_type = \Tainacan\Entities\Collection::get_post_type();
if (!is_admin() && $post->post_type == $collection_post_type) {
$collection = new \Tainacan\Entities\Collection($post);
if ( $collection->is_cover_page_enabled() ) {
return $permalink;
}
$items_post_type = $collection->get_db_identifier();
$post_type_object = get_post_type_object($items_post_type);
if (isset($post_type_object->rewrite) && is_array($post_type_object->rewrite) && isset($post_type_object->rewrite['slug']))
return get_post_type_archive_link($items_post_type);
}
return $permalink;
}
$post_type_object = get_post_type_object($items_post_type);
if (isset($post_type_object->rewrite) && is_array($post_type_object->rewrite) && isset($post_type_object->rewrite['slug']))
return get_post_type_archive_link($items_post_type);
}
return $permalink;
}
function tax_archive_pre_get_posts($wp_query) {
@ -389,10 +390,48 @@ class Theme_Helper {
return "<div id='tainacan-item-submission-form' $props ></div>";
}
/**
* Returns the div used by Vue to render the Items List with a powerful faceted search
*
* The items list bellong to a collection, to the whole repository or a taxonomy term, according to where
* it is used on the loop, or to given params
*
* The following params are all optional for customizing the rendered vue component
*
* @param array $args {
* Optional. Array of arguments.
* @type string $collection_id Collection ID for a collection items list
* @type string $term_id Term ID for a taxonomy term items list
* @type bool $hide_filters Completely hide filter sidebar or modal
* @type bool $hide_hide_filters_button Hides the button resonsible for collpasing filters sidebar on desktop
* @type bool $hide_search Hides the complete search bar, including advanced search link
* @type bool $hide_advanced_search Hides only the advanced search link
* @type bool $hide_displayed_metadata_dropdown Hides the "Displayed metadata" dropdown even if the current view modes allows it
* @type bool $hide_sorting_area Completely hides all sorting controls
* @type bool $hide_sort_by_button Hides the button where user can select the metadata to sort by items (keeps the sort direction)
* @type bool $hide_items_thumbnail Forces the thumbnail to be hiden on every listing. This setting also disables view modes that contain the 'requires-thumbnail' attr. By default is false or inherited from collection setting
* @type bool $hide_exposers_button Hides the "View as..." button, a.k.a. Exposers modal
* @type bool $hide_items_per_page_button Hides the button for selecting amount of items loaded per page
* @type bool $hide_go_to_page_button Hides the button for skiping to a specific page
* @type bool $hide_pagination_area Completely hides pagination controls
* @type int $default_items_per_page Default number of items per page loaded
* @type bool $show_filters_button_inside_search_control Display the "hide filters" button inside of the search control instead of floating
* @type bool $start_with_filters_hidden Loads the filters list hidden from start
* @type bool $filters_as_modal Display the filters as a modal instead of a collapsable region on desktop
* @type bool $show_inline_view_mode_options Display view modes as inline icon buttons instead of the dropdown
* @type bool $show_fullscreen_with_view_modes Lists fullscreen viewmodes alongside with other view modes istead of separatelly
* @type string $default_view_mode The default view mode
* @type bool $is_forced_view_mode Ignores user prefs to always render the choosen default view mode
* @type string[] $enabled_view_modes The list os enable view modes to display
* @return string The HTML div to be used for rendering the items list vue component
*/
public function search_shortcode($args) {
return $this->get_tainacan_items_list($args, true);
}
public function get_tainacan_items_list($args, $force_enqueue = false) {
$props = ' ';
// Loads info related to view modes
$view_modes = tainacan_get_the_view_modes();
$default_view_mode = $view_modes['default_view_mode'];
@ -412,20 +451,18 @@ class Theme_Helper {
}
// If in a collection page
$collection_id = tainacan_get_collection_id();
if ($collection_id) {
$props .= 'collection-id="' . $collection_id . '" ';
$collection = new \Tainacan\Entities\Collection($collection_id);
$collection = tainacan_get_collection($args);
if ($collection) {
$props .= 'collection-id="' . $collection->get_id() . '" ';
$default_view_mode = $collection->get_default_view_mode();
$enabled_view_modes = $collection->get_enabled_view_modes();
// Gets hideItemsThumbnail info from collection setting
$args['hide-items-thumbnail'] = $collection->get_hide_items_thumbnail_on_lists() == 'yes' ? true : false;
}
// If in a tainacan taxonomy
$term = tainacan_get_term();
$term = tainacan_get_term($args);
if ($term) {
$props .= 'term-id="' . $term->term_id . '" ';
$props .= 'taxonomy="' . $term->taxonomy . '" ';
@ -441,10 +478,9 @@ class Theme_Helper {
}
}
$this->enqueue_scripts(true);
$this->enqueue_scripts($force_enqueue);
return "<div id='tainacan-items-page' $props ></div>";
}
function get_items_list_slug() {
@ -453,33 +489,33 @@ class Theme_Helper {
}
function rewrite_rules( &$wp_rewrite ) {
$items_base = $this->get_items_list_slug();
$new_rules = array(
$items_base . "/?$" => "index.php?tainacan_repository_archive=1",
$items_base . "/?$" => "index.php?tainacan_repository_archive=1",
$items_base . "/page/([0-9]+)/?$" => 'index.php?tainacan_repository_archive=1&paged=$matches[1]'
);
);
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
}
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
}
function rewrite_rules_query_vars( $public_query_vars ) {
$public_query_vars[] = "tainacan_repository_archive";
return $public_query_vars;
}
function rewrite_rules_query_vars( $public_query_vars ) {
$public_query_vars[] = "tainacan_repository_archive";
return $public_query_vars;
}
function rewrite_rule_template_include( $template ) {
global $wp_query;
if ( $wp_query->get( 'tainacan_repository_archive' ) == 1 ) {
function rewrite_rule_template_include( $template ) {
global $wp_query;
if ( $wp_query->get( 'tainacan_repository_archive' ) == 1 ) {
$templates = apply_filters('tainacan_repository_archive_template_hierarchy', ['tainacan/archive-repository.php', 'index.php']);
$templates = apply_filters('tainacan_repository_archive_template_hierarchy', ['tainacan/archive-repository.php', 'index.php']);
return locate_template($templates, false);
}
return $template;
}
}
return $template;
}
function archive_repository_pre_get_posts($wp_query) {
if (!$wp_query->is_main_query() || $wp_query->get( 'tainacan_repository_archive' ) != 1)
@ -572,6 +608,60 @@ class Theme_Helper {
return isset($this->registered_view_modes[$slug]) ? $this->registered_view_modes[$slug] : false;
}
/**
* When visiting a collection archive or single, returns the current collection id
*
* @uses get_post_type() WordPress function, which looks for the global $wp_query variable
*/
function tainacan_get_collection_id() {
if ( is_post_type_archive() || is_single() ) {
return \Tainacan\Repositories\Collections::get_instance()->get_id_by_db_identifier(get_post_type());
} elseif ( false !== $this->visiting_collection_cover ) {
return $this->visiting_collection_cover;
}
return false;
}
/**
* When visiting a collection archive or single, returns the current collection object
*
* @uses tainacan_get_collection_id()
* @return \Tainacan\Entities\Collection | false
*/
function tainacan_get_collection($args = []) {
$collection_id = isset($args['collection_id']) ? $args['collection_id'] : $this->tainacan_get_collection_id();
if ( $collection_id ) {
$TainacanCollections = \Tainacan\Repositories\Collections::get_instance();
$collection = $TainacanCollections->fetch($collection_id);
if ( $collection instanceof \Tainacan\Entities\Collection ) {
return $collection;
}
}
return false;
}
/**
* Gets the Tainacan Item Entity object
*
* If used inside the Loop of items, will get the Item object for the current post
*/
function tainacan_get_item($post_id = 0) {
$post = get_post( $post_id );
if (!$post)
return null;
if (!$this->is_post_an_item($post))
return null;
$item = new \Tainacan\Entities\Item($post);
return $item;
}
/**
* Adds meta tags to the header to improve social sharing
*/

View File

@ -43,11 +43,15 @@ use \Tainacan\Repositories;
* @type string $after_value String to be added after each metadata value
* Default '</p>'
* }
*
* @param int|string $item_id (Optional) The item ID to retrive the metadatum as a HTML string to be used as output. Default is the global $post
*
*
* @return string The HTML output
*/
function tainacan_get_the_metadata($args = array()) {
function tainacan_get_the_metadata($args = array(), $item_id = 0) {
$item = tainacan_get_item();
$item = tainacan_get_item( $item_id );
if ($item instanceof \Tainacan\Entities\Item) {
return $item->get_metadata_as_html($args);
@ -66,10 +70,12 @@ function tainacan_the_metadata($args = array()) {
*
* Return the item document as a HTML string to be used as output.
*
* @param int|string $item_id (Optional) The item ID. Default is the global $post
*
* @return string The HTML output
*/
function tainacan_get_the_document() {
$item = tainacan_get_item();
function tainacan_get_the_document($item_id = 0) {
$item = tainacan_get_item($item_id);
if (!$item)
return;
@ -77,8 +83,8 @@ function tainacan_get_the_document() {
return apply_filters('tainacan-get-the-document', $item->get_document_as_html(), $item);
}
function tainacan_the_item_document_download_link() {
$item = tainacan_get_item();
function tainacan_the_item_document_download_link($item_id = 0) {
$item = tainacan_get_item($item_id);
if (!$item)
return;
@ -109,9 +115,9 @@ function tainacan_the_document() {
/**
* Return HTML display-ready version of an attachment
*/
function tainacan_get_single_attachment_as_html($attachment_id) {
function tainacan_get_single_attachment_as_html($attachment_id, $item_id = 0) {
$item = tainacan_get_item();
$item = tainacan_get_item($item_id);
if (!$attachment_id) {
return '';
@ -138,15 +144,10 @@ function tainacan_has_document() {
/**
* When visiting a collection archive or single, returns the current collection id
*
* @uses get_post_type() WordPress function, which looks for the global $wp_query variable
* @uses get_post_type() WordPress function via Theme Helper, which looks for the global $wp_query variable
*/
function tainacan_get_collection_id() {
if ( is_post_type_archive() || is_single() ) {
return Repositories\Collections::get_instance()->get_id_by_db_identifier(get_post_type());
} elseif ( false !== \Tainacan\Theme_Helper::get_instance()->visiting_collection_cover ) {
return \Tainacan\Theme_Helper::get_instance()->visiting_collection_cover;
}
return false;
return \Tainacan\Theme_Helper::get_instance()->tainacan_get_collection_id();
}
/**
@ -155,16 +156,8 @@ function tainacan_get_collection_id() {
* @uses tainacan_get_collection_id()
* @return \Tainacan\Entities\Collection | false
*/
function tainacan_get_collection() {
$collection_id = tainacan_get_collection_id();
if ( $collection_id ) {
$TainacanCollections = Repositories\Collections::get_instance();
$collection = $TainacanCollections->fetch($collection_id);
if ( $collection instanceof Entities\Collection ) {
return $collection;
}
return false;
}
function tainacan_get_collection($args = []) {
return \Tainacan\Theme_Helper::get_instance()->tainacan_get_collection($args);
}
/**
@ -268,9 +261,8 @@ function tainacan_get_the_view_modes() {
$enabled_view_modes = apply_filters( 'tainacan-enabled-view-modes-for-themes', $registered_view_modes_slugs );
// If in a collection page
$collection_id = tainacan_get_collection_id();
if ($collection_id) {
$collection = new \Tainacan\Entities\Collection($collection_id);
$collection = tainacan_get_collection();
if ($collection) {
$default_view_mode = $collection->get_default_view_mode();
$enabled_view_modes = $collection->get_enabled_view_modes();
}
@ -303,89 +295,40 @@ function tainacan_is_view_mode_enabled($view_mode_slug) {
* Outputs the div used by Vue to render the Items List with a powerful faceted search
*
* The items list bellong to a collection, to the whole repository or a taxonomy term, according to where
* it is used on the loop
* it is used on the loop, or to given params
*
* The following params all optional for customizing the rendered vue component
* The following params are all optional for customizing the rendered vue component
*
* @param array $args {
* Optional. Array of arguments.
*
* @type bool $hide_filters Completely hide filter sidebar or modal
* @type bool $hide_hide_filters_button Hides the button resonsible for collpasing filters sidebar on desktop
* @type bool $hide_search Hides the complete search bar, including advanced search link
* @type bool $hide_advanced_search Hides only the advanced search link
* @type bool $hide_displayed_metadata_dropdown Hides the "Displayed metadata" dropdown even if the current view modes allows it
* @type bool $hide_sorting_area Completely hides all sorting controls
* @type bool $hide_sort_by_button Hides the button where user can select the metadata to sort by items (keeps the sort direction)
* @type bool $hide_items_thumbnail Forces the thumbnail to be hiden on every listing. This setting also disables view modes that contain the 'requires-thumbnail' attr. By default is false or inherited from collection setting
* @type bool $hide_exposers_button Hides the "View as..." button, a.k.a. Exposers modal
* @type bool $hide_items_per_page_button Hides the button for selecting amount of items loaded per page
* @type bool $hide_go_to_page_button Hides the button for skiping to a specific page
* @type bool $hide_pagination_area Completely hides pagination controls
* @type int $default_items_per_page Default number of items per page loaded
* @type bool $show_filters_button_inside_search_control Display the "hide filters" button inside of the search control instead of floating
* @type bool $start_with_filters_hidden Loads the filters list hidden from start
* @type bool $filters_as_modal Display the filters as a modal instead of a collapsable region on desktop
* @type bool $show_inline_view_mode_options Display view modes as inline icon buttons instead of the dropdown
* @type bool $show_fullscreen_with_view_modes Lists fullscreen viewmodes alongside with other view modes istead of separatelly
* @type string $default_view_mode The default view mode
* @type bool $is_forced_view_mode Ignores user prefs to always render the choosen default view mode
* @type string[] $enabled_view_modes The list os enable view modes to display
* @type string $collection_id Collection ID for a collection items list
* @type string $term_id Term ID for a taxonomy term items list
* @type bool $hide_filters Completely hide filter sidebar or modal
* @type bool $hide_hide_filters_button Hides the button resonsible for collpasing filters sidebar on desktop
* @type bool $hide_search Hides the complete search bar, including advanced search link
* @type bool $hide_advanced_search Hides only the advanced search link
* @type bool $hide_displayed_metadata_dropdown Hides the "Displayed metadata" dropdown even if the current view modes allows it
* @type bool $hide_sorting_area Completely hides all sorting controls
* @type bool $hide_sort_by_button Hides the button where user can select the metadata to sort by items (keeps the sort direction)
* @type bool $hide_items_thumbnail Forces the thumbnail to be hiden on every listing. This setting also disables view modes that contain the 'requires-thumbnail' attr. By default is false or inherited from collection setting
* @type bool $hide_exposers_button Hides the "View as..." button, a.k.a. Exposers modal
* @type bool $hide_items_per_page_button Hides the button for selecting amount of items loaded per page
* @type bool $hide_go_to_page_button Hides the button for skiping to a specific page
* @type bool $hide_pagination_area Completely hides pagination controls
* @type int $default_items_per_page Default number of items per page loaded
* @type bool $show_filters_button_inside_search_control Display the "hide filters" button inside of the search control instead of floating
* @type bool $start_with_filters_hidden Loads the filters list hidden from start
* @type bool $filters_as_modal Display the filters as a modal instead of a collapsable region on desktop
* @type bool $show_inline_view_mode_options Display view modes as inline icon buttons instead of the dropdown
* @type bool $show_fullscreen_with_view_modes Lists fullscreen viewmodes alongside with other view modes istead of separatelly
* @type string $default_view_mode The default view mode
* @type bool $is_forced_view_mode Ignores user prefs to always render the choosen default view mode
* @type string[] $enabled_view_modes The list os enable view modes to display
* @return string The HTML div to be used for rendering the items list vue component
*/
function tainacan_the_faceted_search($args = array()) {
$props = ' ';
// Loads info related to view modes
$view_modes = tainacan_get_the_view_modes();
$default_view_mode = $view_modes['default_view_mode'];
$enabled_view_modes = $view_modes['enabled_view_modes'];
if( isset($args['default_view_mode']) ) {
$default_view_mode = $args['default_view_mode'];
unset($args['default_view_mode']);
}
if( isset($args['enabled_view_modes']) ) {
$enabled_view_modes = $args['enabled_view_modes'];
if ( !in_array($default_view_mode, $enabled_view_modes) ) {
$default_view_mode = $enabled_view_modes[0];
}
unset($args['enabled_view_modes']);
}
// If in a collection page
$collection_id = tainacan_get_collection_id();
if ($collection_id) {
$props .= 'collection-id="' . $collection_id . '" ';
$collection = new \Tainacan\Entities\Collection($collection_id);
$default_view_mode = $collection->get_default_view_mode();
$enabled_view_modes = $collection->get_enabled_view_modes();
// Gets hideItemsThumbnail info from collection setting
$args['hide-items-thumbnail'] = $collection->get_hide_items_thumbnail_on_lists() == 'yes' ? true : false;
}
// If in a tainacan taxonomy
$term = tainacan_get_term();
if ($term) {
$props .= 'term-id="' . $term->term_id . '" ';
$props .= 'taxonomy="' . $term->taxonomy . '" ';
}
$props .= 'default-view-mode="' . $default_view_mode . '" ';
$props .= 'enabled-view-modes="' . implode(',', $enabled_view_modes) . '" ';
// Passes arguments to custom props
foreach ($args as $key => $value) {
if ($value == true || $value == 'true') {
$props .= str_replace('_', '-', $key) . '="' . $value . '" ';
}
}
echo "<main id='tainacan-items-page' $props ></main>";
$theme_helper = \Tainacan\Theme_Helper::get_instance();
echo $theme_helper->get_tainacan_items_list($args);
}
/**
@ -393,7 +336,15 @@ function tainacan_the_faceted_search($args = array()) {
*
* @return false|\WP_Term
*/
function tainacan_get_term() {
function tainacan_get_term($args = []) {
if ( isset( $args['term_id'] ) ) {
$term = get_term($args['term_id']);
if ( $term instanceof \WP_Error ) {
return false;
}
return $term;
}
if ( is_tax() ) {
$term = get_queried_object();
$theme_helper = \Tainacan\Theme_Helper::get_instance();
@ -456,10 +407,11 @@ function tainacan_the_term_description() {
* Return the list of attachments of the current item (by default, excluding the document and the thumbnail)
*
* @param string|array IDs of attachments to be excluded (by default this function already excludes the document and the thumbnail)
* @param int|string $item_id (Optional) The item ID to retrive attachments. Default is the global $post
* @return array Array of WP_Post objects. @see https://developer.wordpress.org/reference/functions/get_children/
*/
function tainacan_get_the_attachments($exclude = null) {
$item = tainacan_get_item();
function tainacan_get_the_attachments($exclude = null, $item_id = 0) {
$item = tainacan_get_item($item_id);
if (!$item)
return [];
@ -485,20 +437,7 @@ function tainacan_register_view_mode($slug, $args = []) {
* If used inside the Loop of items, will get the Item object for the current post
*/
function tainacan_get_item($post_id = 0) {
$post = get_post( $post_id );
if (!$post)
return null;
$theme_helper = \Tainacan\Theme_Helper::get_instance();
if (!$theme_helper->is_post_an_item($post))
return null;
$item = new Entities\Item($post);
return $item;
return \Tainacan\Theme_Helper::get_instance()->tainacan_get_item($post_id);
}
/**
@ -510,17 +449,19 @@ function tainacan_get_item($post_id = 0) {
* @param string|integer The property to be checked. If a string is passed, it will check against
* one of the native property of the item, such as title, description and creation_date.
* If an integer is passed, it will check against the IDs of the metadata.
*
* @param int|string $item_id (Optional) The item ID. Default is the global $post
*
* @return bool
*/
function tainacan_current_view_displays($property) {
function tainacan_current_view_displays($property, $item_id = 0) {
global $view_mode_displayed_metadata;
// Core metadata appear in fetch_only as metadata
if ($property == 'title' || $property == 'description') {
$item = tainacan_get_item();
$item = tainacan_get_item($item_id);
$core_getter_method = "get_core_{$property}_metadatum";
$property = $item->get_collection()->$core_getter_method()->get_id();
$property = $item->get_collection()->$core_getter_method()->get_id();
}
if (is_string($property)) {

View File

@ -4,7 +4,7 @@ Tags: museums, libraries, archives, GLAM, collections, repository
Requires at least: 4.8
Tested up to: 5.6
Requires PHP: 5.6
Stable tag: 0.17.2
Stable tag: 0.17.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

View File

@ -4,13 +4,13 @@ Plugin Name: Tainacan
Plugin URI: https://tainacan.org/
Description: Open source, powerfull 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 respository platform.
Author: Tainacan.org
Version: 0.17.2
Version: 0.17.4
Text Domain: tainacan
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
const TAINACAN_VERSION = '0.17.2';
const TAINACAN_VERSION = '0.17.4';
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
$TAINACAN_BASE_URL = plugins_url('', __FILE__);

View File

@ -4,6 +4,7 @@
:class="{'repository-level-page' : isNewCollection }">
<tainacan-title
:bread-crumb-items="[{ path: '', label: $i18n.get('collection') }]"/>
<form
v-if="collection != null && collection != undefined && ((isNewCollection && $userCaps.hasCapability('tnc_rep_edit_collections')) || (!isNewCollection && collection.current_user_can_edit))"
class="tainacan-form"
@ -47,13 +48,13 @@
<file-item
v-if="collection.thumbnail != undefined && ((collection.thumbnail['tainacan-medium'] != undefined && collection.thumbnail['tainacan-medium'] != false) || (collection.thumbnail.medium != undefined && collection.thumbnail.medium != false))"
:show-name="false"
:modal-on-click="false"
:modal-on-click="true"
:size="178"
:file="{
media_type: 'image',
thumbnails: { 'tainacan-medium': [ collection.thumbnail['tainacan-medium'] ? collection.thumbnail['tainacan-medium'][0] : collection.thumbnail.medium[0] ] },
thumbnails: { 'tainacan-medium': [ $thumbHelper.getSrc(collection['thumbnail'], 'tainacan-medium') ] },
title: $i18n.get('label_thumbnail'),
description: `<img alt='` + $i18n.get('label_thumbnail') + `' src='` + collection.thumbnail.full[0] + `'/>`
description: `<img alt='` + $i18n.get('label_thumbnail') + `' src='` + $thumbHelper.getSrc(collection['thumbnail'], 'full') + `'/>`
}"/>
<figure
v-if="collection.thumbnail == undefined || ((collection.thumbnail.medium == undefined || collection.thumbnail.medium == false) && (collection.thumbnail['tainacan-medium'] == undefined || collection.thumbnail['tainacan-medium'] == false))"
@ -61,7 +62,7 @@
<span class="image-placeholder">{{ $i18n.get('label_empty_thumbnail') }}</span>
<img
:alt="$i18n.get('label_thumbnail')"
:src="thumbPlaceholderPath">
:src="$thumbHelper.getEmptyThumbnailPlaceholder()">
</figure>
<div class="thumbnail-buttons-row">
<a
@ -221,7 +222,7 @@
:message="$i18n.getHelperMessage('collections', 'enabled_view_modes')"/>
<div class="control">
<b-dropdown
class="two-columns-dropdown"
class="two-columns-dropdown enabled-view-modes-dropdown"
ref="enabledViewModesDropdown"
:mobile-modal="true"
:disabled="Object.keys(registeredViewModes).length < 0"
@ -247,14 +248,19 @@
@input="updateViewModeslist(viewMode)"
:value="checkIfViewModeEnabled(viewMode)"
:disabled="checkIfViewModeEnabled(viewMode) && form.enabled_view_modes.filter((aViewMode) => (registeredViewModes[aViewMode] && registeredViewModes[aViewMode].full_screen != true)).length <= 1">
<span
class="gray-icon"
:class="{
'has-text-secondary' : checkIfViewModeEnabled(viewMode),
'has-text-gray4' : !checkIfViewModeEnabled(viewMode)
}"
v-html="registeredViewModes[viewMode].icon"/>
<span>{{ registeredViewModes[viewMode].label }}</span>
<p>
<strong>
<span
class="gray-icon"
:class="{
'has-text-secondary' : checkIfViewModeEnabled(viewMode),
'has-text-gray4' : !checkIfViewModeEnabled(viewMode)
}"
v-html="registeredViewModes[viewMode].icon"/>
&nbsp;{{ registeredViewModes[viewMode].label }}
</strong>
</p>
<p v-if="registeredViewModes[viewMode].description">{{ registeredViewModes[viewMode].description }}</p>
</b-checkbox>
</b-dropdown-item>
</b-dropdown>
@ -669,7 +675,6 @@ export default {
isNewCollection: false,
isMapped: false,
mapper: false,
thumbPlaceholderPath: tainacan_plugin.base_url + '/assets/images/placeholder_square.png',
headerPlaceholderPath: tainacan_plugin.base_url + '/assets/images/placeholder_rectangle.png',
collections: [],
isFetchingCollections: true,
@ -1249,6 +1254,19 @@ export default {
margin-top: -1.5em;
border-left: 1px solid var(--tainacan-gray2);
}
.enabled-view-modes-dropdown {
/deep/ .dropdown-item {
display: flex !important;
}
p {
white-space: normal;
}
/deep/ svg {
margin-left: -2px;
overflow: hidden;
vertical-align: middle;
}
}
</style>

View File

@ -86,10 +86,10 @@
v-for="(item, index) of uploadedItems"
:key="item.id">
<img
v-if="item.document!= undefined && item.document != '' && item.document_type != 'empty'"
v-if="item.document != undefined && item.document != '' && item.document_type != 'empty'"
class="document-thumb"
:alt="$i18n.get('label_thumbnail') + ': ' + item.title"
:src="item.thumbnail['tainacan-small'] ? item.thumbnail['tainacan-small'][0] : (item.thumbnail.thumbnail ? item.thumbnail.thumbnail[0] : thumbPlaceholderPath)" >
:src="$thumbHelper.getSrc(item['thumbnail'], 'tainacan-small', item.document_mimetype)" >
<span
class="document-name"
v-html="item.title" />
@ -197,7 +197,6 @@ export default {
isLoading: false,
isCreatingSequenceEditGroup: false,
submitedFileList: [],
thumbPlaceholderPath: tainacan_plugin.base_url + '/assets/images/placeholder_square.png',
uploadedItems: [],
amountFinished: 0
}

View File

@ -305,17 +305,21 @@
:size="178"
:file="{
media_type: 'image',
thumbnails: { 'tainacan-medium': [ item.thumbnail['tainacan-medium'] ? item.thumbnail['tainacan-medium'][0] : item.thumbnail.medium[0] ] },
thumbnails: { 'tainacan-medium': [ $thumbHelper.getSrc(item['thumbnail'], 'tainacan-medium', item.document_mimetype) ] },
title: $i18n.get('label_thumbnail'),
description: `<img alt='` + $i18n.get('label_thumbnail') + `' src='` + item.thumbnail.full[0] + `'/>`
description: `<img alt='` + $i18n.get('label_thumbnail') + `' src='` + $thumbHelper.getSrc(item['thumbnail'], 'full', item.document_mimetype) + `'/>`
}"/>
<figure
v-if="item.thumbnail == undefined || ((item.thumbnail.medium == undefined || item.thumbnail.medium == false) && (item.thumbnail['tainacan-medium'] == undefined || item.thumbnail['tainacan-medium'] == false))"
class="image">
<span class="image-placeholder">{{ $i18n.get('label_empty_thumbnail') }}</span>
<span
class="image-placeholder"
v-if="item.document_type == 'empty'">
{{ $i18n.get('label_empty_thumbnail') }}
</span>
<img
:alt="$i18n.get('label_thumbnail')"
:src="thumbPlaceholderPath">
:src="$thumbHelper.getEmptyThumbnailPlaceholder(item.document_mimetype)">
</figure>
<div class="thumbnail-buttons-row">
<a
@ -628,7 +632,7 @@
v-if="collection && collection.current_user_can_publish_items"
@click="onSubmit(visibility)"
type="button"
class="button is-success">{{ $i18n.get('label_publish') }}</button>
class="button is-success">{{ $i18n.get('label_verb_publish') }}</button>
</div>
<div
class="form-submission-footer"
@ -673,13 +677,13 @@
v-if="!isOnSequenceEdit || (group != null && group.items_count != undefined && group.items_count == itemPosition)"
@click="onSubmit(visibility)"
type="button"
class="button is-success">{{ $i18n.get('label_publish') }}</button>
class="button is-success">{{ $i18n.get('label_verb_publish') }}</button>
<button
v-else
@click="onSubmit(visibility, 'next')"
type="button"
class="button is-success">
<span>{{ $i18n.get('label_publish') }}</span>
<span>{{ $i18n.get('label_verb_publish') }}</span>
<span class="icon is-large">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-next"/>
</span>
@ -835,7 +839,6 @@ export default {
},
thumbnail: {},
formErrorMessage: '',
thumbPlaceholderPath: tainacan_plugin.base_url + '/assets/images/placeholder_square.png',
thumbnailMediaFrame: undefined,
attachmentMediaFrame: undefined,
fileMediaFrame: undefined,

View File

@ -316,8 +316,8 @@
if (this.closedByForm) {
this.editedMetadatum.saved = true;
} else {
this.oldForm.saved = this.editForm.saved;
if (JSON.stringify(this.editForm) != JSON.stringify(this.oldForm))
this.$set(this.oldForm, 'saved', this.editForm.saved);
if (!_.isEqual(this.editForm, this.oldForm))
this.editedMetadatum.saved = false;
else
this.editedMetadatum.saved = true;
@ -341,7 +341,8 @@
metadatumId: metadatum.id,
isRepositoryLevel: this.isRepositoryLevel,
index: this.index,
options: this.editForm
options: this.editForm,
includeOptionsAsHtml: true
})
.then(() => {
this.editForm = {};
@ -380,7 +381,8 @@
metadatumId: metadatum.id,
isRepositoryLevel: this.isRepositoryLevel,
index: this.index,
options: formObj
options: formObj,
includeOptionsAsHtml: true
})
.then(() => {
this.editForm = {};

View File

@ -74,7 +74,7 @@
class="image-placeholder">{{ $i18n.get('label_empty_term_image') }}</span>
<img
:alt="$i18n.get('label_image')"
:src="(editForm.header_image === undefined || editForm.header_image === false) ? headerPlaceholderPath : editForm.header_image">
:src="(editForm.header_image === undefined || editForm.header_image === false) ? $thumbHelper.getEmptyThumbnailPlaceholder() : editForm.header_image">
</figure>
<div class="thumbnail-buttons-row">
<a
@ -241,7 +241,6 @@
data() {
return {
formErrors: {},
headerPlaceholderPath: tainacan_plugin.base_url + '/assets/images/placeholder_square.png',
headerImageMediaFrame: undefined,
isFetchingParentTerms: false,
parentTerms: [],

View File

@ -157,7 +157,7 @@
let metadata = this.query.metaquery[ index ];
if (this.metadatumType === 'Tainacan\\Metadata_Types\\Relationship') {
let query = qs.stringify({ postin: metadata.value, fetch_only: 'title,thumbnail', fetch_only_meta: '' });
let query = qs.stringify({ postin: metadata.value, fetch_only: 'title,thumbnail,document_mimetype', fetch_only_meta: '' });
let endpoint = '/items/';
if (this.relatedCollectionId != '')
@ -173,7 +173,7 @@
this.selected.push({
label: item.title,
value: item.id,
img: item.thumbnail && item.thumbnail.thumbnail && item.thumbnail.thumbnail[0] ? item.thumbnail.thumbnail[0] : null
img: item.thumbnail ? this.$thumbHelper.getSrc(item['thumbnail'], 'tainacan-small', item.document_mimetype) : null
});
}
}

View File

@ -239,7 +239,7 @@
<img
:alt="$i18n.get('label_thumbnail')"
v-if="collection.thumbnail != undefined"
:src="collection['thumbnail']['tainacan-medium'] ? collection['thumbnail']['tainacan-medium'][0] : (collection['thumbnail'].medium ? collection['thumbnail'].medium[0] : thumbPlaceholderPath)">
:src="$thumbHelper.getSrc(collection['thumbnail'], 'tainacan-medium')">
<!-- Name -->
<div class="metadata-title">
@ -259,11 +259,6 @@ export default {
isLoading: false,
collections: Array,
collectionsTotal: Number
},
data(){
return {
thumbPlaceholderPath: tainacan_plugin.base_url + '/assets/images/placeholder_square.png'
}
}
}
</script>

View File

@ -148,7 +148,7 @@
<img
:alt="$i18n.get('label_thumbnail')"
class="table-thumb"
:src="(collection.thumbnail && collection.thumbnail.thumbnail ) ? collection.thumbnail.thumbnail[0] : thumbPlaceholderPath">
:src="$thumbHelper.getSrc(collection['thumbnail'], 'tainacan-small')">
</span>
</td>
<!-- Name -->
@ -322,7 +322,6 @@ export default {
selectedCollections: [],
allCollectionsOnPageSelected: false,
isSelectingCollections: false,
thumbPlaceholderPath: tainacan_plugin.base_url + '/assets/images/placeholder_square.png',
cursorPosX: -1,
cursorPosY: -1,
contextMenuIndex: null,

View File

@ -176,11 +176,15 @@
v-if="item.thumbnail != undefined"
@click.left="onClickItem($event, item)"
@click.right="onRightClickItem($event, item)"
class="grid-item-thumbnail"
:style="{ backgroundImage: 'url(' + (item['thumbnail']['tainacan-medium'] ? item['thumbnail']['tainacan-medium'][0] : (item['thumbnail'].medium ? item['thumbnail'].medium[0] : thumbPlaceholderPath)) + ')' }">
<img
class="grid-item-thumbnail">
<blur-hash-image
:width="$thumbHelper.getWidth(item['thumbnail'], 'tainacan-medium', 120)"
:height="$thumbHelper.getHeight(item['thumbnail'], 'tainacan-medium', 120)"
:hash="$thumbHelper.getBlurhashString(item['thumbnail'], 'tainacan-medium')"
:src="$thumbHelper.getSrc(item['thumbnail'], 'tainacan-medium', item.document_mimetype)"
:alt="item.thumbnail_alt ? item.thumbnail_alt : $i18n.get('label_thumbnail')"
:src="item['thumbnail']['tainacan-medium'] ? item['thumbnail']['tainacan-medium'][0] : (item['thumbnail'].medium ? item['thumbnail'].medium[0] : thumbPlaceholderPath)">
:transition-duration="500"
/>
</a>
<!-- Actions -->
@ -286,16 +290,19 @@
</div>
<!-- Thumbnail -->
<div
<blur-hash-image
@click.left="onClickItem($event, item)"
@click.right="onRightClickItem($event, item)"
v-if="item.thumbnail != undefined"
class="tainacan-masonry-item-thumbnail"
:style="{ backgroundImage: 'url(' + (item['thumbnail']['tainacan-medium-full'] ? item['thumbnail']['tainacan-medium-full'][0] : (item['thumbnail'].medium_large ? item['thumbnail'].medium_large[0] : thumbPlaceholderPath)) + ')' }">
<img
:alt="item.thumbnail_alt ? item.thumbnail_alt : $i18n.get('label_thumbnail')"
:src="item['thumbnail']['tainacan-medium-full'] ? item['thumbnail']['tainacan-medium-full'][0] : (item['thumbnail'].medium_large ? item['thumbnail'].medium_large[0] : thumbPlaceholderPath)">
</div>
:width="$thumbHelper.getWidth(item['thumbnail'], 'tainacan-medium-full', 120)"
:height="$thumbHelper.getHeight(item['thumbnail'], 'tainacan-medium-full', 120)"
:hash="$thumbHelper.getBlurhashString(item['thumbnail'], 'tainacan-medium-full')"
:src="$thumbHelper.getSrc(item['thumbnail'], 'tainacan-medium-full', item.document_mimetype)"
:srcset="$thumbHelper.getSrcSet(item['thumbnail'], 'tainacan-medium-full', item.document_mimetype)"
:alt="item.thumbnail_alt ? item.thumbnail_alt : $i18n.get('label_thumbnail')"
:transition-duration="500"
/>
<!-- Actions -->
<div
@ -459,13 +466,19 @@
@click.right="onRightClickItem($event, item)">
<div
v-if="collection && collection.hide_items_thumbnail_on_lists != 'yes'"
:style="{ backgroundImage: 'url(' + (item['thumbnail']['tainacan-medium'] ? item['thumbnail']['tainacan-medium'][0] : (item['thumbnail'].medium ? item['thumbnail'].medium[0] : thumbPlaceholderPath)) + ')' }"
class="card-thumbnail">
<img
:alt="item.thumbnail_alt ? item.thumbnail_alt : $i18n.get('label_thumbnail')"
<blur-hash-image
v-if="item.thumbnail != undefined"
:src="item['thumbnail']['tainacan-medium'] ? item['thumbnail']['tainacan-medium'][0] : (item['thumbnail'].medium ? item['thumbnail'].medium[0] : thumbPlaceholderPath)">
class="tainacan-masonry-item-thumbnail"
:width="$thumbHelper.getWidth(item['thumbnail'], 'tainacan-medium', 120)"
:height="$thumbHelper.getHeight(item['thumbnail'], 'tainacan-medium', 120)"
:hash="$thumbHelper.getBlurhashString(item['thumbnail'], 'tainacan-medium')"
:src="$thumbHelper.getSrc(item['thumbnail'], 'tainacan-medium', item.document_mimetype)"
:alt="item.thumbnail_alt ? item.thumbnail_alt : $i18n.get('label_thumbnail')"
:transition-duration="500"
/>
</div>
<div class="list-metadata media-body">
<!-- Description -->
@ -653,10 +666,19 @@
@click.right="onRightClickItem($event, item)">
<div class="list-metadata media-body">
<div class="tainacan-record-thumbnail">
<img
:alt="item.thumbnail_alt ? item.thumbnail_alt : $i18n.get('label_thumbnail')"
<blur-hash-image
@click.left="onClickItem($event, item)"
@click.right="onRightClickItem($event, item)"
v-if="item.thumbnail != undefined"
:src="item['thumbnail']['tainacan-medium-full'] ? item['thumbnail']['tainacan-medium-full'][0] : (item['thumbnail'].medium_large ? item['thumbnail'].medium_large[0] : thumbPlaceholderPath)">
class="tainacan-record-item-thumbnail"
:width="$thumbHelper.getWidth(item['thumbnail'], 'tainacan-medium-full', 120)"
:height="$thumbHelper.getHeight(item['thumbnail'], 'tainacan-medium-full', 120)"
:hash="$thumbHelper.getBlurhashString(item['thumbnail'], 'tainacan-medium-full')"
:src="$thumbHelper.getSrc(item['thumbnail'], 'tainacan-medium-full', item.document_mimetype)"
:srcset="$thumbHelper.getSrcSet(item['thumbnail'], 'tainacan-medium-full', item.document_mimetype)"
:alt="item.thumbnail_alt ? item.thumbnail_alt : $i18n.get('label_thumbnail')"
:transition-duration="500"
/>
</div>
<span
v-for="(column, metadatumIndex) in displayedMetadata"
@ -826,11 +848,17 @@
column.metadatum !== 'row_description'"
v-html="renderMetadata(item.metadata, column) != '' ? renderMetadata(item.metadata, column) : `<span class='has-text-gray3 is-italic'>` + $i18n.get('label_value_not_provided') + `</span>`"/>
<span v-if="column.metadatum == 'row_thumbnail'">
<img
<span
class="table-thumb"
v-if="column.metadatum == 'row_thumbnail'">
<blur-hash-image
:width="$thumbHelper.getWidth(item['thumbnail'], 'tainacan-small', 40)"
:height="$thumbHelper.getHeight(item['thumbnail'], 'tainacan-small', 40)"
:hash="$thumbHelper.getBlurhashString(item['thumbnail'], 'tainacan-small')"
:src="$thumbHelper.getSrc(item['thumbnail'], 'tainacan-small', item.document_mimetype)"
:alt="item.thumbnail_alt ? item.thumbnail_alt : $i18n.get('label_thumbnail')"
class="table-thumb"
:src="item['thumbnail']['tainacan-small'] ? item['thumbnail']['tainacan-small'][0] : (item['thumbnail'].thumbnail ? item['thumbnail'].thumbnail[0] : thumbPlaceholderPath)">
:transition-duration="500"
/>
</span>
<p
v-tooltip="{
@ -1033,9 +1061,19 @@
<div
class="tainacan-list-thumbnail"
v-if="item.thumbnail != undefined">
<img
<blur-hash-image
@click.left="onClickItem($event, item)"
@click.right="onRightClickItem($event, item)"
v-if="item.thumbnail != undefined"
class="tainacan-list-item-thumbnail"
:width="$thumbHelper.getWidth(item['thumbnail'], 'tainacan-medium-full', 120)"
:height="$thumbHelper.getHeight(item['thumbnail'], 'tainacan-medium-full', 120)"
:hash="$thumbHelper.getBlurhashString(item['thumbnail'], 'tainacan-medium-full')"
:src="$thumbHelper.getSrc(item['thumbnail'], 'tainacan-medium-full', item.document_mimetype)"
:srcset="$thumbHelper.getSrcSet(item['thumbnail'], 'tainacan-medium-full', item.document_mimetype)"
:alt="item.thumbnail_alt ? item.thumbnail_alt : $i18n.get('label_thumbnail')"
:src="item['thumbnail']['tainacan-medium-full'] ? item['thumbnail']['tainacan-medium-full'][0] : (item['thumbnail'].medium_large ? item['thumbnail'].medium_large[0] : thumbPlaceholderPath)">
:transition-duration="500"
/>
</div>
<div class="list-metadata media-body">
<span
@ -1048,6 +1086,15 @@
v-html="renderMetadata(item.metadata, column)"
class="metadata-value"/>
</span>
<span
v-for="(column, metadatumIndex) in displayedMetadata"
:key="metadatumIndex"
v-if="(column.metadatum == 'row_creation' || column.metadatum == 'row_author') && item[column.slug] != undefined">
<h3 class="metadata-label">{{ column.name }}</h3>
<p
v-html="column.metadatum == 'row_creation' ? parseDateToNavigatorLanguage(item[column.slug]) : item[column.slug]"
class="metadata-value"/>
</span>
</div>
</div>
</div>
@ -1080,7 +1127,6 @@ export default {
return {
isAllItemsSelected: false,
queryAllItemsSelected: {},
thumbPlaceholderPath: tainacan_plugin.base_url + '/assets/images/placeholder_square.png',
cursorPosX: -1,
cursorPosY: -1,
contextMenuItem: null,
@ -1463,6 +1509,9 @@ export default {
@import "../../scss/_view-mode-grid.scss";
@import "../../scss/_view-mode-records.scss";
@import "../../scss/_view-mode-list.scss";
// Vue Blurhash transtition effect
@import '../../../../../node_modules/vue-blurhash/dist/vue-blurhash.css';
.selection-control {
margin-bottom: 6px;

View File

@ -1,9 +1,6 @@
<template>
<div>
<div
v-if="processes.length > 0 && !isLoading"
class="table-container">
@ -163,76 +160,73 @@
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-approvedcircle"/>
</span>
<span
v-tooltip="{
delay: {
show: 500,
hide: 300,
},
content: $i18n.get('label_process_completed_with_errors'),
autoHide: false, classes: ['tooltip', 'repository-tooltip'],
placement: 'auto-start'
}"
v-if=" bgProcess.status === 'finished-errors' || ( bgProcess.done > 0 && bgProcess.error_log && bgProcess.status === 'finished' ) "
class="icon has-text-success">
<i
style="margin-right: -5px;"
class="tainacan-icon tainacan-icon-1-25em tainacan-icon-alert has-text-yellow2"/>
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-approvedcircle"/>
v-tooltip="{
delay: {
show: 500,
hide: 300,
},
content: $i18n.get('label_process_completed_with_errors'),
autoHide: false, classes: ['tooltip', 'repository-tooltip'],
placement: 'auto-start'
}"
v-if=" bgProcess.status === 'finished-errors' || ( bgProcess.done > 0 && bgProcess.error_log && bgProcess.status === 'finished' ) "
class="icon has-text-success">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-alertcircle has-text-yellow2"/>
</span>
<span
v-tooltip="{
delay: {
show: 500,
hide: 300,
},
content: $i18n.get('label_process_cancelled'),
autoHide: false, classes: ['tooltip', 'repository-tooltip'],
placement: 'auto-start'
}"
v-if=" bgProcess.status === 'cancelled' "
class="icon has-text-success">
v-tooltip="{
delay: {
show: 500,
hide: 300,
},
content: $i18n.get('label_process_cancelled'),
autoHide: false, classes: ['tooltip', 'repository-tooltip'],
placement: 'auto-start'
}"
v-if=" bgProcess.status === 'cancelled' "
class="icon has-text-success">
<i class="tainacan-icon has-text-danger tainacan-icon-1-25em tainacan-icon-repprovedcircle"/>
</span>
<span
v-tooltip="{
delay: {
show: 500,
hide: 300,
},
content: $i18n.get('label_process_paused'),
autoHide: false, classes: ['tooltip', 'repository-tooltip'],
placement: 'auto-start'
}"
v-if=" bgProcess.status === 'paused' "
class="icon has-text-gray">
v-tooltip="{
delay: {
show: 500,
hide: 300,
},
content: $i18n.get('label_process_paused'),
autoHide: false, classes: ['tooltip', 'repository-tooltip'],
placement: 'auto-start'
}"
v-if=" bgProcess.status === 'paused' "
class="icon has-text-gray">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-pause"/>
</span>
<span
v-tooltip="{
delay: {
show: 500,
hide: 300,
},
content: $i18n.get('label_process_waiting'),
autoHide: false, classes: ['tooltip', 'repository-tooltip'],
placement: 'auto-start'
}"
v-if=" bgProcess.status === 'waiting' "
class="icon has-text-gray">
v-tooltip="{
delay: {
show: 500,
hide: 300,
},
content: $i18n.get('label_process_waiting'),
autoHide: false, classes: ['tooltip', 'repository-tooltip'],
placement: 'auto-start'
}"
v-if=" bgProcess.status === 'waiting' "
class="icon has-text-gray">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-waiting"/>
</span>
<span
v-tooltip="{
delay: {
show: 500,
hide: 300,
},
content: $i18n.get('label_process_failed'),
autoHide: false, classes: ['tooltip', 'repository-tooltip'],
placement: 'auto-start'
}"
v-if="bgProcess.status === 'errored'"
class="icon has-text-danger">
v-tooltip="{
delay: {
show: 500,
hide: 300,
},
content: $i18n.get('label_process_failed'),
autoHide: false, classes: ['tooltip', 'repository-tooltip'],
placement: 'auto-start'
}"
v-if="bgProcess.status === 'errored'"
class="icon has-text-danger">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-processerror" />
</span>
</div>
@ -310,7 +304,6 @@
</center>
</div>
</div>
</template>
<script>

View File

@ -14,8 +14,8 @@
</p>
<p>{{ $i18n.get('info_create_child_metadata') }}</p>
</div>
</section>
<draggable
</section>
<draggable
v-model="childrenMetadata"
:style="{ minHeight: childrenMetadata.length > 0 ? '40px' : '70px' }"
class="active-metadata-area child-metadata-area"
@ -31,18 +31,31 @@
<div
class="active-metadatum-item"
:class="{
'not-sortable-item': metadatum.id == undefined || openedMetadatumId != '' || isUpdatingMetadataOrder || metadatum.parent == 0 || metadatum.collection_id != collectionId,
'not-sortable-item': metadatum.id == undefined || openedMetadatumId != '' || isUpdatingMetadataOrder || metadatum.parent == 0 || metadatum.collection_id != collectionId || metadataNameFilterString != '' || hasSomeMetadataTypeFilterApplied,
'not-focusable-item': openedMetadatumId == metadatum.id,
'disabled-metadatum': parent.enabled == false,
'inherited-metadatum': (metadatum.collection_id != collectionId && metadatum.parent == 0) || isRepositoryLevel
}"
v-for="(metadatum, index) in childrenMetadata"
:key="metadatum.id">
:key="metadatum.id"
v-show="(metadataNameFilterString == '' || filterByMetadatumName(metadatum)) && filterByMetadatumType(metadatum)">
<div
:ref="'metadatum-handler-' + metadatum.id"
class="handle">
<span
:style="{ opacity: !( metadatum.id == undefined || openedMetadatumId != '' || isUpdatingMetadataOrder || metadatum.parent == 0 || metadatum.collection_id != collectionId) ? '1.0' : '0.0' }"
v-tooltip="{
content: $i18n.get('label_view_metadata_details'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'
}"
@click="$set(collapses, metadatum.id, !isCollapseOpen(metadatum.id))"
class="gray-icon icon"
:style="{ cursor: 'pointer', opacity: openedMetadatumId != metadatum.id ? '1.0' : '0.0' }">
<i :class="'tainacan-icon tainacan-icon-1-25em tainacan-icon-' + (isCollapseOpen(metadatum.id) ? 'arrowdown' : 'arrowright')" />
</span>
<span
:style="{ opacity: !(metadatum.id == undefined || openedMetadatumId != '' || isUpdatingMetadataOrder || metadatum.parent == 0 || metadatum.collection_id != collectionId || metadataNameFilterString != '' || hasSomeMetadataTypeFilterApplied) ? '1.0' : '0.0' }"
v-tooltip="{
content: metadatum.id == undefined || openedMetadatumId != '' || isUpdatingMetadataOrder ? $i18n.get('info_not_allowed_change_order_metadata') : $i18n.get('instruction_drag_and_drop_metadatum_sort'),
autoHide: true,
@ -52,24 +65,7 @@
class="icon grip-icon">
<i class="tainacan-icon tainacan-icon-18px tainacan-icon-drag"/>
</span>
<span
v-tooltip="{
content: (metadatum.collection_id == 'default') || isRepositoryLevel ? $i18n.get('label_repository_metadatum') : $i18n.get('label_collection_metadatum'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'
}"
class="icon icon-level-identifier">
<i
:class="{
'tainacan-icon-collections': (metadatum.collection_id != 'default' && !isRepositoryLevel),
'tainacan-icon-repository': (metadatum.collection_id == 'default') || isRepositoryLevel,
'has-text-turquoise5': (metadatum.collection_id != 'default' && !isRepositoryLevel),
'has-text-blue5': (metadatum.collection_id == 'default' || isRepositoryLevel),
'has-text-gray3': !parent.enabled
}"
class="tainacan-icon" />
</span>
<span
class="metadatum-name"
:class="{'is-danger': formWithErrors == metadatum.id }">
@ -97,9 +93,43 @@
</span>
<span
v-if="metadatum.status == 'private'"
class="icon">
class="icon"
v-tooltip="{
content: $i18n.get('status_private'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'
}">
<i class="tainacan-icon tainacan-icon-private"/>
</span>
<span
v-if="metadatum.required === 'yes'"
v-tooltip="{
content: $i18n.get('label_required'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'
}">
*&nbsp;
</span>
<span
v-tooltip="{
content: (metadatum.collection_id == 'default') || isRepositoryLevel ? $i18n.get('label_repository_metadatum') : $i18n.get('label_collection_metadatum'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'
}"
class="icon icon-level-identifier">
<i
:class="{
'tainacan-icon-collections': (metadatum.collection_id != 'default' && !isRepositoryLevel),
'tainacan-icon-repository': (metadatum.collection_id == 'default') || isRepositoryLevel,
'has-text-turquoise5': (metadatum.collection_id != 'default' && !isRepositoryLevel),
'has-text-blue5': (metadatum.collection_id == 'default' || isRepositoryLevel),
'has-text-gray3': !parent.enabled
}"
class="tainacan-icon" />
</span>
</span>
<span
class="loading-spinner"
@ -147,6 +177,11 @@
</a>
</span>
</div>
<transition name="form-collapse">
<metadatum-details
v-if="isCollapseOpen(metadatum.id) && openedMetadatumId !== metadatum.id"
:metadatum="metadatum" />
</transition>
<transition name="form-collapse">
<div v-if="openedMetadatumId == metadatum.id">
<metadatum-edition-form
@ -169,16 +204,31 @@
<script>
import { mapActions } from 'vuex';
import MetadatumEditionForm from '../../edition/metadatum-edition-form.vue';
import MetadatumDetails from '../../other/metadatum-details.vue';
import CustomDialog from '../../other/custom-dialog.vue';
export default {
components: {
MetadatumEditionForm
MetadatumEditionForm,
MetadatumDetails
},
props: {
isRepositoryLevel: Boolean,
parent: Object,
isParentMultiple: Boolean
isParentMultiple: Boolean,
metadataNameFilterString: String,
hasSomeMetadataTypeFilterApplied: {
type: Boolean,
default: new Boolean()
},
metadataTypeFilterOptions: {
type: Array,
default: new Array()
},
collapseAll: {
type: Boolean,
default: new Boolean()
}
},
data() {
return {
@ -190,7 +240,8 @@
hightlightedMetadatum: '',
editForms: {},
metadataSearchCancel: undefined,
childrenMetadata: []
childrenMetadata: [],
collapses: {}
}
},
watch: {
@ -213,6 +264,9 @@
this.childrenMetadata = [];
},
immediate: true
},
collapseAll(isCollapsed) {
this.childrenMetadata.forEach((metadatum) => this.$set(this.collapses, metadatum.id, isCollapsed));
}
},
beforeRouteLeave ( to, from, next ) {
@ -378,6 +432,23 @@
isAvailableChildMetadata(to, from, item) {
return !['tainacan-compound', 'tainacan-taxonomy'].includes(item.id);
},
isCollapseOpen(metadatumId) {
return this.collapses[metadatumId] == true;
},
filterByMetadatumName(metadatum) {
return metadatum.name.toString().toLowerCase().indexOf(this.metadataNameFilterString.toString().toLowerCase()) >= 0;
},
filterByMetadatumType(metadatum) {
if (!this.hasSomeMetadataTypeFilterApplied)
return true;
for (let metadatumType of this.metadataTypeFilterOptions) {
if (metadatumType.enabled && metadatum.metadata_type == metadatumType.type)
return true;
}
return false;
}
}
}
</script>

View File

@ -73,6 +73,17 @@ class Compound extends Metadata_Type {
]
];
}
/**
* Gets print-ready version of the options list in html
*
* Checks if at least one option exists, otherwise return an empty string
*
* @return string An html content with labels and values for the options or an empty string
*/
public function get_options_as_html() {
return '';
}
/**
* save options and remove old children

View File

@ -25,6 +25,7 @@ class MetadataTypeControlHelper {
static function update_control_metadatum( $item ) {
if ( $item instanceof \Tainacan\Entities\Item ) {
$item_metadata_repositories = \Tainacan\Repositories\Item_Metadata::get_instance();
$enabled_logs = $item_metadata_repositories->get_enabled_logs();
$item_metadata_repositories->disable_logs();
$collection = $item->get_collection();
$args = [
@ -68,7 +69,7 @@ class MetadataTypeControlHelper {
$errors[] = $update_item_metadatum->get_errors();
}
}
$item_metadata_repositories->enable_logs();
if($enabled_logs) $item_metadata_repositories->enable_logs();
}
}
}

View File

@ -199,12 +199,38 @@ abstract class Metadata_Type {
return isset($options[$key]) ? $options[$key] : '';
}
/**
* Gets print-ready version of the options list in html
*
* Checks if at least one option exists, otherwise return an empty string
*
* @return string An html content with labels and values for the options or an empty string
*/
public function get_options_as_html() {
$options_as_html = '';
$options = $this->get_options();
if ( count($options) > 0 ) {
$form_labels = $this->get_form_labels();
foreach($options as $option_label => $option_value) {
if ( $option_value != '' ) {
$options_as_html .= '<div class="field"><div class="label">' . ( isset($form_labels[$option_label]) && isset($form_labels[$option_label]['title']) ? $form_labels[$option_label]['title'] : $option_label ) .'</div>';
$options_as_html .= '<div class="value">' . ($option_value == 'yes' ? __('Yes', 'tainacan') : ($option_value == 'no' ? __('No', 'tainacan') : $option_value) ) . '</div></div>';
}
}
}
return $options_as_html;
}
/**
* allow i18n from messages
*/
public function get_form_labels(){
return [];
}
/**
* generate the metadata for this metadatum type
*/
@ -226,7 +252,7 @@ abstract class Metadata_Type {
$attributes['primitive_type'] = $this->get_primitive_type();
$attributes['form_component'] = $this->get_form_component();
$attributes['preview_template'] = $this->get_preview_template();
return $attributes;
}

View File

@ -37,4 +37,5 @@ class Numeric extends Metadata_Type {
]
];
}
}

View File

@ -120,14 +120,14 @@
if (this.itemMetadatum.value && (Array.isArray( this.itemMetadatum.value ) ? this.itemMetadatum.value.length > 0 : true )) {
let query = qs.stringify({ postin: ( Array.isArray( this.itemMetadatum.value ) ) ? this.itemMetadatum.value : [ this.itemMetadatum.value ] });
query += this.itemMetadatum.metadatum.metadata_type_options.search ? '&fetch_only_meta=' + this.itemMetadatum.metadatum.metadata_type_options.search : '';
axios.get('/collection/' + this.collectionId + '/items?' + query + '&nopaging=1&fetch_only=title,thumbnail&order=asc')
axios.get('/collection/' + this.collectionId + '/items?' + query + '&nopaging=1&fetch_only=title,document_mimetype,thumbnail&order=asc')
.then( res => {
if (res.data.items) {
for (let item of res.data.items)
this.selected.push({
label: this.getItemLabel(item),
value: item.id,
img: item.thumbnail && item.thumbnail['tainacan-small'] && item.thumbnail['tainacan-small'][0] ? item.thumbnail['tainacan-small'][0] : ''
img: this.$thumbHelper.getSrc(item['thumbnail'], 'tainacan-small', item.document_mimetype)
});
}
})
@ -194,7 +194,7 @@
this.options.push({
label: this.getItemLabel(item),
value: item.id,
img: item.thumbnail && item.thumbnail['tainacan-small'] && item.thumbnail['tainacan-small'][0] ? item.thumbnail['tainacan-small'][0] : ''
img: this.$thumbHelper.getSrc(item['thumbnail'], 'tainacan-small', item.document_mimetype)
})
}
if (res.headers['x-wp-total'])

View File

@ -66,6 +66,69 @@ class Relationship extends Metadata_Type {
];
}
/**
* Gets print-ready version of the options list in html
*
* Checks if at least one option exists, otherwise return an empty string
*
* @return string An html content with labels and values for the options or an empty string
*/
public function get_options_as_html() {
$options_as_html = '';
$options = $this->get_options();
if ( count($options) > 0 ) {
// Remove this option that is not relevant for the user
if ( isset($options['related_primitive_type']) )
unset($options['related_primitive_type']);
$form_labels = $this->get_form_labels();
foreach($options as $option_label => $option_value) {
if ( $option_value != '' ) {
$options_as_html .= '<div class="field"><div class="label">' . ( isset($form_labels[$option_label]) && isset($form_labels[$option_label]['title']) ? $form_labels[$option_label]['title'] : $option_label ) .'</div>';
$readable_option_value = '';
switch($option_label) {
case 'collection_id':
$collection = \tainacan_collections()->fetch( (int) $option_value );
if ( $collection instanceof \Tainacan\Entities\Collection )
$readable_option_value = $collection->get_name();
else
$readable_option_value = $option_value;
break;
case 'search':
$metadata = \tainacan_metadata()->fetch( (int) $option_value );
if ( $metadata ) {
$readable_option_value = $metadata;
} else
$readable_option_value = $option_value;
break;
case 'repeated':
if ($option_value == 'yes')
$readable_option_value = __('Yes', 'tainacan');
else if ($option_value == 'no')
$readable_option_value = __('No', 'tainacan');
else
$readable_option_value = $option_value;
break;
default:
$readable_option_value = $option_value;
}
$options_as_html .= '<div class="value">' . $readable_option_value . '</div></div>';
}
}
}
return $options_as_html;
}
public function validate_options(\Tainacan\Entities\Metadatum $metadatum) {
if ( !in_array($metadatum->get_status(), apply_filters('tainacan-status-require-validation', ['publish','future','private'])) )
return true;

View File

@ -118,12 +118,12 @@
<template slot-scope="props">
<div class="media">
<div
v-if="props.option.thumbnail && props.option.thumbnail.thumbnail && props.option.thumbnail.thumbnail[0]"
v-if="props.option.thumbnail && props.option.thumbnail['tainacan-small'] && props.option.thumbnail['tainacan-small']"
class="media-left">
<img
width="24"
:alt="$i18n.get('label_thumbnail')"
:src="props.option.thumbnail.thumbnail[0]" >
:src="$thumbHelper.getSrc(props.option['thumbnail'], 'tainacan-small')" >
</div>
<div class="media-content">
{{ props.option.name }}
@ -153,6 +153,7 @@
isReady: false,
taxonomies: [],
taxonomy_id: '',
taxonomy: '',
loading: false,
allow_new_terms: 'yes',
link_filtered_by_collections: [],
@ -235,6 +236,7 @@
this.visible_options_list = ( this.value.visible_options_list ) ? this.value.visible_options_list : false;
this.link_filtered_by_collections = ( this.value.link_filtered_by_collections ) ? this.value.link_filtered_by_collections : [];
this.taxonomy = this.value.taxonomy ? this.value.taxonomy : '';
}
this.isReady = true;
@ -286,7 +288,8 @@
input_type: this.input_type,
allow_new_terms: this.allow_new_terms,
visible_options_list: this.visible_options_list,
link_filtered_by_collections: this.link_filtered_by_collections
link_filtered_by_collections: this.link_filtered_by_collections,
taxonomy: this.taxonomy
})
},
updateSelectedCollections(selectedCollections) {

View File

@ -82,8 +82,8 @@ class Taxonomy extends Metadata_Type {
public function get_form_labels(){
return [
'taxonomy_id' => [
'title' => __( 'Related Collection', 'tainacan' ),
'description' => __( 'Select the collection to fetch items', 'tainacan' ),
'title' => __( 'Related Taxonomy', 'tainacan' ),
'description' => __( 'Select the taxonomy to fetch terms', 'tainacan' ),
],
'input_type' => [
'title' => __( 'Input type', 'tainacan' ),
@ -104,6 +104,102 @@ class Taxonomy extends Metadata_Type {
];
}
/**
* Gets print-ready version of the options list in html
*
* Checks if at least one option exists, otherwise return an empty string
*
* @return string An html content with labels and values for the options or an empty string
*/
public function get_options_as_html() {
$options_as_html = '';
$options = $this->get_options();
if ( count($options) > 0 ) {
// Remove this option as it doesn't matter if using a taginput
if ( isset($options['visible_options_list']) && isset($options['input_type']) && $options['input_type'] == 'tainacan-taxonomy-tag-input' )
unset($options['visible_options_list']);
$form_labels = $this->get_form_labels();
foreach($options as $option_label => $option_value) {
if ( $option_value != '' ) {
$options_as_html .= '<div class="field"><div class="label">' . ( isset($form_labels[$option_label]) && isset($form_labels[$option_label]['title']) ? $form_labels[$option_label]['title'] : $option_label ) .'</div>';
$readable_option_value = '';
switch($option_label) {
case 'taxonomy_id':
$taxonomy = \tainacan_taxonomies()->fetch( (int) $option_value );
if ( $taxonomy instanceof \Tainacan\Entities\Taxonomy )
$readable_option_value = $taxonomy->get_name();
else
$readable_option_value = $option_value;
break;
case 'input_type':
if ($option_value == 'tainacan-taxonomy-radio')
$readable_option_value = __('Radio', 'tainacan');
else if ($option_value == 'tainacan-taxonomy-checkbox')
$readable_option_value = __('Checkbox', 'tainacan');
else if ($option_value == 'tainacan-taxonomy-tag-input')
$readable_option_value = __('Taginput', 'tainacan');
else
$readable_option_value = $option_value;
break;
case 'visible_options_list':
if ($option_value == 1)
$readable_option_value = __('Yes', 'tainacan');
else if ($option_value == 0)
$readable_option_value = __('No', 'tainacan');
else
$readable_option_value = $option_value;
break;
case 'allow_new_terms':
if ($option_value == 'yes')
$readable_option_value = __('Yes', 'tainacan');
else if ($option_value == 'no')
$readable_option_value = __('No', 'tainacan');
else
$readable_option_value = $option_value;
break;
case 'link_filtered_by_collections':
if (count($option_value) > 0) {
$collections = \tainacan_collections()->fetch( [ 'post__in' => $option_value ], 'OBJECT' );
if ( is_array($collections) ) {
$collection_names = '';
for ($i = 0; $i < count($collections); $i++) {
$collection_names .= $collections[$i]->get_name();
if ($i < count($collections) - 1)
$collection_names .= ', ';
}
$readable_option_value = $collection_names;
}
else
$readable_option_value = $option_value;
} else
$readable_option_value = __( 'None', 'tainacan' );
break;
default:
$readable_option_value = $option_value;
}
$options_as_html .= '<div class="value">' . $readable_option_value . '</div></div>';
}
}
}
return $options_as_html;
}
public function validate_options( Metadatum $metadatum) {
if ( !in_array($metadatum->get_status(), apply_filters('tainacan-status-require-validation', ['publish','future','private'])) )

View File

@ -49,7 +49,7 @@
<picture>
<img
width="150px"
:src="diff.old ? diff.old : placeholderSquareImage"
:src="diff.old ? diff.old : $thumbHelper.getEmptyThumbnailPlaceholder()"
:alt="attributeName">
</picture>
</div>
@ -158,7 +158,7 @@
<picture>
<img
width="150px"
:src="diff.new ? diff.new : placeholderSquareImage"
:src="diff.new ? diff.new : $thumbHelper.getEmptyThumbnailPlaceholder()"
:alt="attributeName">
</picture>
</div>
@ -622,7 +622,6 @@
infoEmpty: `[ ${this.$i18n.get('info_empty').toLowerCase()} ]`,
dateFormat: '',
activityCreationDate: '',
placeholderSquareImage: `${tainacan_plugin.base_url}/assets/images/placeholder_square.png`,
isLoadingActivity: false,
adminFullURL: tainacan_plugin.admin_url + 'admin.php?page=tainacan_admin#',
}

View File

@ -276,7 +276,7 @@ export default {
return this.selectedItems && this.selectedItems.length ? 1 : Math.ceil(Number(this.totalItems)/Number(this.maxItemsPerPage));
},
exposerBaseURL() {
let baseURL = this.collectionId != undefined ? '/collection/' + this.collectionId + '/items/' : '/items/';
let baseURL = this.collectionId ? '/collection/' + this.collectionId + '/items/' : '/items/';
let currentParams = JSON.parse(JSON.stringify(this.$route.query));
// Removes Fetch Only

View File

@ -0,0 +1,106 @@
<template>
<div class="tainacan-form metadatum-details">
<div
v-if="metadatum.description"
class="field">
<div class="label">{{ $i18n.getHelperTitle('metadata', 'description') }}</div>
<div class="value">{{ metadatum.description }}</div>
</div>
<div
v-if="metadatum.semantic_uri"
class="field">
<div class="label">{{ $i18n.getHelperTitle('metadata', 'semantic_uri') }}</div>
<div class="value">{{ metadatum.semantic_uri }}</div>
</div>
<!-- <div class="field">
<div class="label">{{ $i18n.getHelperTitle('metadata', 'status') }}</div>
<div class="value">
<template v-if="metadatum.status === 'publish'">{{ $i18n.get('publish_visibility') }}</template>
<template v-if="metadatum.status === 'private'">{{ $i18n.get('private_visibility') }}</template>
</div>
</div> -->
<div class="field">
<div class="label">{{ $i18n.get('label_display') }}</div>
<div class="value">
<template v-if="metadatum.display === 'yes'">{{ $i18n.get('label_display_default') }}</template>
<template v-if="metadatum.display === 'no'">{{ $i18n.get('label_not_display') }}</template>
<template v-if="metadatum.display === 'never'">{{ $i18n.get('label_display_never') }}</template>
</div>
</div>
<div
v-if="insertOptions != ''"
class="field">
<div class="label">{{ $i18n.get('label_insert_options') }}</div>
<div class="value">{{ insertOptions }}</div>
</div>
<div
v-if="metadatum.options_as_html"
v-html="metadatum.options_as_html" />
</div>
</template>
<script>
export default {
props: {
metadatum: Object
},
computed: {
insertOptions() {
const enableInsertOptions = [];
if (this.metadatum.required === 'yes')
enableInsertOptions.push(this.$i18n.getHelperTitle('metadata', 'required'));
if (this.metadatum.multiple === 'yes')
enableInsertOptions.push(this.$i18n.getHelperTitle('metadata', 'multiple'));
if (this.metadatum.collection_key === 'yes')
enableInsertOptions.push(this.$i18n.getHelperTitle('metadata', 'collection_key'));
return enableInsertOptions.join(', ');
}
}
}
</script>
<style lang="scss" scoped>
.metadatum-details {
padding: 0.75em 1.5em 0.75em 3.5em;
-moz-column-count: 3;
-moz-column-gap: 0;
-moz-column-rule: none;
-webkit-column-count: 3;
-webkit-column-gap: 0;
-webkit-column-rule: none;
column-count: 3;
column-gap: 4em;
column-rule: none;
@media screen and (max-width: 1024px) {
-moz-column-count: 2;
-webkit-column-count: 2;
column-count: 2;
}
@media screen and (max-width: 768px) {
-moz-column-count: 1;
-webkit-column-count: 1;
column-count: 1;
}
/deep/ .field {
-webkit-column-break-inside: avoid;
page-break-inside: avoid;
break-inside: avoid;
margin-bottom: 1em;
& > .field:not(:last-child) {
margin-bottom: 0em;
}
.label {
white-space: normal;
}
.value {
font-size: 0.9em;
}
}
}
</style>

View File

@ -5,19 +5,21 @@
class="processes-popup-backdrop" />
<div class="processes-popup">
<div class="popup-header">
<span
@click="bgProcesses.length > 0 ? showProcessesList = !showProcessesList : null"
class="header-title">{{ getUnfinishedProcesses() + ' ' + $i18n.get('info_unfinished_processes') }}</span>
<a
v-if="bgProcesses.length > 0"
@click="showProcessesList = !showProcessesList">
<span class="icon has-text-blue5">
<span
style="margin-left: -0.5rem"
class="icon has-text-blue5">
<i
:class="{ 'tainacan-icon-arrowup': showProcessesList,
'tainacan-icon-arrowdown': !showProcessesList }"
:class="{ 'tainacan-icon-arrowdown': showProcessesList,
'tainacan-icon-arrowright': !showProcessesList }"
class="tainacan-icon tainacan-icon-18px"/>
</span>
</a>
</a>
<span
@click="bgProcesses.length > 0 ? showProcessesList = !showProcessesList : null"
class="header-title">{{ getUnfinishedProcesses() + ' ' + $i18n.get('info_unfinished_processes') }}</span>
<a @click="$emit('closeProcessesPopup')">
<span class="icon has-text-blue5">
<i class="tainacan-icon tainacan-icon-close"/>

View File

@ -22,11 +22,13 @@
isRepositoryLevel) || filters.length > 0)"
class="link-style collapse-all"
@click="collapseAll = !collapseAll">
{{ !collapseAll ? $i18n.get('label_collapse_all') : $i18n.get('label_expand_all') }}
<span class="icon">
<i
:class="{ 'tainacan-icon-arrowdown' : !collapseAll, 'tainacan-icon-arrowright' : collapseAll }"
class="has-text-secondary tainacan-icon tainacan-icon-1-25em"/>
class="has-text-secondary tainacan-icon tainacan-icon-1-125em"/>
</span>
<span class="collapse-all__text">
{{ !collapseAll ? $i18n.get('label_collapse_all') : $i18n.get('label_expand_all') }}
</span>
</button>
@ -495,6 +497,9 @@
.collapse-all {
display: inline-flex;
align-items: center;
margin-left: -0.65em;
}
.collapse-all__text {
font-size: 0.75em !important;
}
.filters-components-list {

View File

@ -0,0 +1,431 @@
import qs from 'qs';
import axios from 'axios';
const wpApi = axios.create({
baseURL: tainacan_plugin.wp_api_url
});
wpApi.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce;
// CONSOLE PLUGIN - Allows custom use of console functions and avoids eslint warnings.
export const ConsolePlugin = {};
ConsolePlugin.install = function (Vue, options = { visual: false }) {
Vue.prototype.$console = {
log(something) {
if (options.visual) {
Vue.prototype.$buefy.snackbar.open({
message: something,
type: 'is-secondary',
position: 'is-bottom-right',
indefinite: true,
queue: false
});
} else {
console.log(something);
}
},
info(someInfo) {
if (options.visual) {
Vue.prototype.$buefy.snackbar.open({
message: someInfo,
type: 'is-primary',
position: 'is-bottom-right',
duration: 5000,
queue: false
});
} else {
console.info(someInfo);
}
},
error(someError) {
if (options.visual) {
Vue.prototype.$buefy.snackbar.open({
message: someError,
type: 'is-danger',
position: 'is-bottom-right',
indefinite: true,
queue: false
});
} else {
console.error(someError);
}
}
}
};
// I18N PLUGIN - Allows access to Wordpress translation file.
export const I18NPlugin = {};
I18NPlugin.install = function (Vue, options = {}) {
Vue.prototype.$i18n = {
get(key) {
let string = tainacan_plugin.i18n[key];
return (string != undefined && string != null && string != '' ) ? string : "Invalid i18n key: " + tainacan_plugin.i18n[key];
},
getFrom(entity, key) {
if (entity == 'taxonomies') // Temporary hack, while we decide this terminology...
entity = 'taxonomies'
if (tainacan_plugin.i18n['entities_labels'][entity] == undefined)
return 'Invalid i18n entity: ' + entity;
let string = tainacan_plugin.i18n['entities_labels'][entity][key];
return (string != undefined && string != null && string != '' ) ? string : "Invalid i18n key: " + key;
},
getHelperTitle(entity, key) {
if (entity == 'taxonomies') // Temporary hack, while we decide this terminology...
entity = 'taxonomies'
if (tainacan_plugin.i18n['helpers_label'][entity] == undefined)
return 'Invalid i18n entity: ' + entity;
if (tainacan_plugin.i18n['helpers_label'][entity][key] == undefined)
return 'Invalid i18n key: ' + key;
let string = tainacan_plugin.i18n['helpers_label'][entity][key].title;
return (string != undefined && string != null && string != '' ) ? string : "Invalid i18n helper object.";
},
getHelperMessage(entity, key) {
if (entity == 'taxonomies') // Temporary hack, while we decide this terminology...
entity = 'taxonomies'
if (tainacan_plugin.i18n['helpers_label'][entity] == undefined)
return 'Invalid i18n entity: ' + entity;
if (tainacan_plugin.i18n['helpers_label'][entity][key] == undefined)
return 'Invalid i18n key: ' + key;
let string = tainacan_plugin.i18n['helpers_label'][entity][key].description;
return (string != undefined && string != null && string != '' ) ? string : "Invalid i18n helper object. ";
},
/**
* Parsed strings created with variables according to WordPress Logic.
* Check https://developer.wordpress.org/themes/functionality/internationalization/#variables
* An example: ('This sentence has %s letters', [nLetters])
* or ('This one has %1$s letters and %2$s words', [nLetters, nWords]).
*/
getWithVariables(key, variables) { // TRY WITH regex: \%((\d)\$)*s
let rawString = tainacan_plugin.i18n[key];
if (rawString != undefined && rawString != null && rawString != '' ) {
// let splits = rawString.match(/\%((\d)\$)*s*/gm); // An array with all the %s, %1$s, %2$s, etc
// let parsedString = '';
// for (let i = 0; i < splits.length; i++) {
// parsedString += rawString.split(splits[i]).join(variables[i]);
// }
// return parsedString;
const regex = /\%(\d\$)*s/m;
for (let variable of variables)
rawString = rawString.replace(regex, variable);
return rawString;
} else {
"Invalid i18n key: " + tainacan_plugin.i18n[key];
}
}
}
};
// USER PREFERENCES - Used to save key-value information for user settings of plugin
export const UserPrefsPlugin = {};
UserPrefsPlugin.install = function (Vue, options = {}) {
Vue.prototype.$userPrefs = {
tainacanPrefs: {
'items_per_page': 12,
'collections_per_page': 12,
'taxonomies_per_page': 12,
'activities_per_page': 12,
'order': 'DESC',
'order_by': {
slug: 'creation_date',
name: 'Creation Date'
},
'view_mode': undefined,
'admin_view_mode': 'cards',
'fetch_only': 'thumbnail,creation_date,author_name',
'fetch_only_meta': '',
'taxonomies_order': 'asc',
'taxonomies_order_by': 'title',
'collections_order': 'desc',
'collections_order_by': 'date'
},
init() {
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.") );
} else {
let prefs = JSON.parse(tainacan_plugin.user_prefs);
this.tainacanPrefs = prefs;
}
},
get(key) {
return this.tainacanPrefs[key] ? this.tainacanPrefs[key] : undefined;
},
set(key, value) {
this.tainacanPrefs[key] = value;
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.") );
});
},
clean() {
let data = {'meta': {'tainacan_prefs': ''} };
wpApi.post('/users/me/', qs.stringify(data))
}
}
};
// ROUTER HELPER PLUGIN - Allows easy access to URL paths for entities
export const RouterHelperPlugin = {};
RouterHelperPlugin.install = function (Vue, options = {}) {
Vue.prototype.$routerHelper = {
// Lists
getCollectionsPath(query) {
return '/collections/?' + qs.stringify(query);
},
getCollectionItemsPath(collectionId, query) {
return '/collections/'+ collectionId + '/items/?' + qs.stringify(query);
},
getCollectionSequenceEditPath(collectionId, sequenceId, itemPosition) {
return '/collections/'+ collectionId + '/sequence/' + sequenceId + '/' + itemPosition;
},
getCollectionMetadataPath(collectionId) {
return '/collections/'+ collectionId + '/metadata/';
},
getCollectionFiltersPath(collectionId) {
return '/collections/'+ collectionId + '/filters/';
},
getCollectionActivitiesPath(collectionId) {
return '/collections/'+ collectionId + '/activities/';
},
getCollectionCapabilitiesPath(collectionId) {
return '/collections/'+ collectionId + '/capabilities/';
},
getItemsPath(query) {
return '/items/?' + qs.stringify(query);
},
getTaxonomiesPath() {
return '/taxonomies/'
},
getTaxonomyTermsPath(taxonomyId, query) {
return '/taxonomyId/' + taxonomyId + '/terms/?' + qs.stringify(query);
},
getFiltersPath(query) {
return '/filters/?' + qs.stringify(query);
},
getActivitiesPath(query) {
return '/activities/?' + qs.stringify(query);
},
getCapabilitiesPath() {
return '/capabilities';
},
getAvailableImportersPath() {
return '/importers';
},
getProcessesPage(highlightedProcess) {
if (highlightedProcess)
return '/activities?tab=processes&highlight=' + highlightedProcess;
else
return '/activities?tab=processes';
},
// Singles
getCollectionPath(id) {
return '/collections/' + id;
},
getItemPath(collectionId, itemId) {
return '/collections/' + collectionId + '/items/' + itemId;
},
getFilterPath(id) {
return '/filters/' + id;
},
getTaxonomyPath(id) {
return '/taxonomies/' + id;
},
getTermPath(taxonomyId, termId) {
return '/taxonomies/' + taxonomyId + '/terms/' + termId;
},
getImporterPath(importerType, sessionId) {
return '/importers/' + importerType + '/' + sessionId;
},
getCollectionActivityPath(collectionId, activityId) {
return '/collections/' + collectionId + '/activities/' + activityId;
},
// New
getNewCollectionPath() {
return '/collections/new';
},
getNewMappedCollectionPath(mapperSlug) {
return '/collections/new/' + mapperSlug;
},
getNewItemPath(collectionId) {
return '/collections/' + collectionId + '/items/new';
},
getNewCollectionMetadatumPath(collectionId) {
return '/collections/' + collectionId + '/metadata/';
},
getNewMetadatumPath() {
return '/metadata';
},
getNewCollectionFilterPath(collectionId) {
return '/collections/' + collectionId + '/filters/';
},
getNewFilterPath() {
return '/filters/new';
},
getNewTaxonomyPath() {
return '/taxonomies/new';
},
getNewTermPath(taxonomyId) {
return '/taxonomies/' + taxonomyId + '/terms/new';
},
getNewItemBulkAddPath(collectionId) {
return '/collections/' + collectionId + '/bulk-add';
},
// Edit
getCollectionEditPath(id) {
return '/collections/' + id + '/settings';
},
getItemEditPath(collectionId, itemId) {
return '/collections/' + collectionId + '/items/' + itemId + '/edit';
},
getMetadataEditPath(metadatumId) {
return '/metadata/?edit=' + metadatumId;
},
getFilterEditPath(filterId) {
return '/filters/?edit=' + filterId;
},
getCollectionMetadataEditPath(collectionId, metadatumId) {
return '/collections/' + collectionId + '/metadata/?edit=' + metadatumId;
},
getCollectionFilterEditPath(collectionId, filterId) {
return '/collections/' + collectionId + '/filters/?edit=' + filterId;
},
getTaxonomyEditPath(id, isRecent) {
return isRecent != undefined ? '/taxonomies/' + id + '/edit?recent=true' : '/taxonomies/' + id + '/edit';
},
getTermEditPath(taxonomyId, termId) {
return '/taxonomies/' + taxonomyId + '/edit?tab=terms';
},
getImporterEditionPath(importerType) {
return '/importers/' + importerType;
},
getImporterMappingPath(importerType, sessionId, collectionId) {
return '/importers/' + importerType + '/' + sessionId + '/mapping/' + collectionId;
},
getItemMetadataBulkAddPath(collectionId, groupId) {
return '/collections/' + collectionId + '/bulk-add/' + groupId;
},
getExporterEditionPath(exporterType) {
return '/exporters/' + exporterType;
},
getAvailableExportersPath(){
return '/exporters';
},
}
};
// USER CAPABILITIES PLUGIN - Allows easy checking of user capabilities.
export const UserCapabilitiesPlugin = {};
UserCapabilitiesPlugin.install = function (Vue, options = {}) {
Vue.prototype.$userCaps = {
hasCapability(key) {
return tainacan_plugin.user_caps[key];
}
}
};
// STATUS ICONS PLUGIN - Sets icon for status option
export const StatusHelperPlugin = {};
StatusHelperPlugin.install = function (Vue, options = {}) {
Vue.prototype.$statusHelper = {
statuses: [
{ name: tainacan_plugin.i18n['status_publish'], slug: 'publish' },
{ name: tainacan_plugin.i18n['status_private'], slug: 'private' },
{ name: tainacan_plugin.i18n['status_draft'], slug: 'draft' },
{ name: tainacan_plugin.i18n['status_trash'], slug: 'trash' }
],
getIcon(status) {
switch (status) {
case 'publish': return 'tainacan-icon-public';
case 'private': return 'tainacan-icon-private';
case 'draft': return 'tainacan-icon-draft';
case 'trash': return 'tainacan-icon-delete';
default: '';
}
},
hasIcon(status) {
return ['publish', 'private', 'draft', 'trash'].includes(status);
},
getStatuses() {
return this.statuses;
},
loadStatuses() {
wpApi.get('/statuses/')
.then( res => {
let loadedStatus = res.data;
this.statuses = [];
if (loadedStatus['publish'] != undefined)
this.statuses.push(loadedStatus['publish']);
this.statuses.concat(Object.values(loadedStatus).filter((status) => {
return !['publish','private', 'draft', 'trash'].includes(status.slug);
}));
// We always show private, draft and trash
this.statuses.push({
name: tainacan_plugin.i18n['status_private'],
slug: 'private'
});
this.statuses.push({
name: tainacan_plugin.i18n['status_draft'],
slug: 'draft'
});
this.statuses.push({
name: tainacan_plugin.i18n['status_trash'],
slug: 'trash'}
);
})
.catch(error => {
console.error( error );
});
}
}
};
// COMMENTS STATUS PLUGIN -
export const CommentsStatusHelperPlugin = {};
CommentsStatusHelperPlugin.install = function (Vue, options = {}) {
Vue.prototype.$commentsStatusHelper = {
statuses: [
{ name: tainacan_plugin.i18n['comments_status_open'], slug: 'open' },
{ name: tainacan_plugin.i18n['comments_status_closed'], slug: 'closed' }
],
getStatuses() {
return this.statuses;
}
}
};

View File

@ -36,7 +36,6 @@ export const filterTypeMixin = {
export const dynamicFilterTypeMixin = {
data () {
return {
thumbPlaceholderPath: tainacan_plugin.base_url + '/assets/images/placeholder_square.png',
getOptionsValuesCancel: undefined,
isLoadingOptions: false,
facetSearchPage: 1
@ -304,14 +303,14 @@ export const dynamicFilterTypeMixin = {
sResults.push({
label: item.label,
value: item.value,
img: item.thumbnail && item.thumbnail['tainacan-small'] && item.thumbnail['tainacan-small'][0] ? item.thumbnail['tainacan-small'][0] : (item.img ? item.img : ''),
img: item.thumbnail ? this.$thumbHelper.getSrc(item['thumbnail'], 'tainacan-small') : (item.img ? item.img : ''),
total_items: item.total_items
});
} else if (indexToIgnore < 0) {
opts.push({
label: item.label,
value: item.value,
img: item.thumbnail && item.thumbnail['tainacan-small'] && item.thumbnail['tainacan-small'][0] ? item.thumbnail['tainacan-small'][0] : (item.img ? item.img : ''),
img: item.thumbnail ? this.$thumbHelper.getSrc(item['thumbnail'], 'tainacan-small') : (item.img ? item.img : ''),
total_items: item.total_items
});
}
@ -320,14 +319,14 @@ export const dynamicFilterTypeMixin = {
sResults.push({
label: item.label,
value: item.value,
img: item.thumbnail && item.thumbnail['tainacan-small'] && item.thumbnail['tainacan-small'][0] ? item.thumbnail['tainacan-small'][0] : (item.img ? item.img : ''),
img: item.thumbnail ? this.$thumbHelper.getSrc(item['thumbnail'], 'tainacan-small') : (item.img ? item.img : ''),
total_items: item.total_items
});
} else {
opts.push({
label: item.label,
value: item.value,
img: item.thumbnail && item.thumbnail['tainacan-small'] && item.thumbnail['tainacan-small'][0] ? item.thumbnail['tainacan-small'][0] : (item.img ? item.img : ''),
img: item.thumbnail ? this.$thumbHelper.getSrc(item['thumbnail'], 'tainacan-small') : (item.img ? item.img : ''),
total_items: item.total_items
});
}

View File

@ -10,6 +10,7 @@ import VueMasonry from 'vue-masonry-css';
import draggable from 'vuedraggable';
import VueTheMask from 'vue-the-mask';
import cssVars from 'css-vars-ponyfill';
import VueBlurHash from 'vue-blurhash';
// Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development';
@ -62,7 +63,18 @@ import store from './store/store'
import router from './router'
import eventBusSearch from './event-bus-search';
import eventBusTermsList from './event-bus-terms-list.js';
import { I18NPlugin, UserPrefsPlugin, RouterHelperPlugin, ConsolePlugin, UserCapabilitiesPlugin, StatusHelperPlugin, CommentsStatusHelperPlugin } from './utilities';
import {
I18NPlugin,
UserPrefsPlugin,
RouterHelperPlugin,
ConsolePlugin,
UserCapabilitiesPlugin,
StatusHelperPlugin,
CommentsStatusHelperPlugin
} from './admin-utilities';
import {
ThumbnailHelperPlugin
} from './utilities';
/* Registers Extra Vue Plugins passed to the window.tainacan_extra_plugins */
if (typeof window.tainacan_extra_plugins != "undefined") {
@ -76,10 +88,12 @@ Vue.use(Buefy, {
});
Vue.use(VTooltip);
Vue.use(VueMasonry);
Vue.use(VueBlurHash);
Vue.use(I18NPlugin);
Vue.use(UserPrefsPlugin);
Vue.use(RouterHelperPlugin);
Vue.use(UserCapabilitiesPlugin);
Vue.use(ThumbnailHelperPlugin);
Vue.use(StatusHelperPlugin);
Vue.use(ConsolePlugin, {visual: false});
Vue.use(VueTheMask);

View File

@ -1,6 +1,6 @@
import axios from '../../../axios';
export const fetchMetadata = ({commit}, {collectionId, isRepositoryLevel, isContextEdit, includeDisabled, isAdvancedSearch, parent, includeControlMetadataTypes}) => {
export const fetchMetadata = ({commit}, { collectionId, isRepositoryLevel, isContextEdit, includeDisabled, isAdvancedSearch, parent, includeControlMetadataTypes, includeOptionsAsHtml }) => {
const source = axios.CancelToken.source();
@ -26,6 +26,9 @@ export const fetchMetadata = ({commit}, {collectionId, isRepositoryLevel, isCont
if (includeControlMetadataTypes)
endpoint += '&include_control_metadata_types=true';
if (includeOptionsAsHtml)
endpoint += '&include_options_as_html=yes';
axios.tainacan.get(endpoint, { cancelToken: source.token })
.then((res) => {
let metadata = res.data;
@ -48,7 +51,7 @@ export const fetchMetadata = ({commit}, {collectionId, isRepositoryLevel, isCont
});
};
export const sendMetadatum = ({commit}, {collectionId, name, metadatumType, status, isRepositoryLevel, newIndex, parent}) => {
export const sendMetadatum = ({commit}, {collectionId, name, metadatumType, status, isRepositoryLevel, newIndex, parent, includeOptionsAsHtml}) => {
return new Promise((resolve, reject) => {
let endpoint = '';
if (!isRepositoryLevel)
@ -56,7 +59,12 @@ export const sendMetadatum = ({commit}, {collectionId, name, metadatumType, stat
else
endpoint = '/metadata/';
axios.tainacan.post(endpoint + '?context=edit', {
endpoint += '?context=edit';
if (includeOptionsAsHtml)
endpoint += '&include_options_as_html=yes';
axios.tainacan.post(endpoint, {
name: name,
metadata_type: metadatumType,
status: status,
@ -74,7 +82,7 @@ export const sendMetadatum = ({commit}, {collectionId, name, metadatumType, stat
});
};
export const updateMetadatum = ({commit}, {collectionId, metadatumId, isRepositoryLevel, index, options}) => {
export const updateMetadatum = ({commit}, {collectionId, metadatumId, isRepositoryLevel, index, options, includeOptionsAsHtml}) => {
return new Promise((resolve, reject) => {
let endpoint = '';
@ -83,7 +91,12 @@ export const updateMetadatum = ({commit}, {collectionId, metadatumId, isReposito
else
endpoint = '/metadata/' + metadatumId;
axios.tainacan.put(endpoint + '?context=edit', options)
endpoint += '?context=edit';
if (includeOptionsAsHtml)
endpoint += '&include_options_as_html=yes';
axios.tainacan.put(endpoint, options)
.then(res => {
let metadatum = res.data;
commit('setSingleMetadatum', { metadatum: metadatum, index: index, isRepositoryLevel: isRepositoryLevel });

View File

@ -1,432 +1,105 @@
import qs from 'qs';
import axios from 'axios';
// THUMBNAIL PLUGIN - Translates api path of thumbnails src to render placeholders and propoper sizes.
export const ThumbnailHelperPlugin = {};
const wpApi = axios.create({
baseURL: tainacan_plugin.wp_api_url
});
export const ThumbnailHelperFunctions = () => {
return {
imagesFolderPath: tainacan_plugin.base_url + '/assets/images/',
getSrc(thumbnail, tainacanSize, documentType) {
const wordpressSize = this.getWordpressFallbackSize(tainacanSize);
return (thumbnail && thumbnail[tainacanSize]) ? thumbnail[tainacanSize][0] : ((thumbnail && thumbnail[wordpressSize]) ? thumbnail[wordpressSize][0] : this.getEmptyThumbnailPlaceholder(documentType, tainacanSize));
},
getSrcSet(thumbnail, tainacanSize, documentType) {
const defaultSrc = this.getSrc(thumbnail, tainacanSize, documentType);
const retinaSrc = (thumbnail && thumbnail['full']) ? thumbnail['full'][0] : this.getEmptyThumbnailPlaceholder(documentType, 'full');
return defaultSrc + ' 1x, ' + retinaSrc + ' 2x';
},
getWidth(thumbnail, tainacanSize, fallbackSizeValue) {
const wordpressSize = this.getWordpressFallbackSize(tainacanSize);
return (thumbnail && thumbnail[tainacanSize]) ? thumbnail[tainacanSize][1] : ((thumbnail && thumbnail[wordpressSize]) ? thumbnail[wordpressSize][1] : (fallbackSizeValue ? fallbackSizeValue : 120));
},
getHeight(thumbnail, tainacanSize, fallbackSizeValue) {
const wordpressSize = this.getWordpressFallbackSize(tainacanSize);
return (thumbnail && thumbnail[tainacanSize]) ? thumbnail[tainacanSize][2] : ((thumbnail && thumbnail[wordpressSize]) ? thumbnail[wordpressSize][2] : (fallbackSizeValue ? fallbackSizeValue : 120));
},
getBlurhashString(thumbnail, tainacanSize) {
const wordpressSize = this.getWordpressFallbackSize(tainacanSize);
return (thumbnail && thumbnail[tainacanSize]) ? thumbnail[tainacanSize][4] : ((thumbnail && thumbnail[wordpressSize]) ? thumbnail[wordpressSize][4] : 'V4P?:h00Rj~qM{of%MRjWBRjD%%MRjayofj[%M-;RjRj');
},
getEmptyThumbnailPlaceholder(documentType, tainacanSize) {
let imageSrc = '';
switch(documentType) {
case 'image/png':
case 'image/jpeg':
case 'image/gif':
case 'image/bmp':
case 'image/webp':
case 'image/svg+xml':
imageSrc = 'placeholder_image';
break;
case 'audio/midi':
case 'audio/mpeg':
case 'audio/webm':
case 'audio/ogg':
case 'audio/wav':
imageSrc = 'placeholder_audio';
break;
case 'text':
case 'text/plain':
case 'text/html':
case 'text/css':
case 'text/javascript':
case 'text/csv':
imageSrc = 'placeholder_text';
break;
case 'video/webm':
case 'video/ogg':
case 'video/mpeg':
imageSrc = 'placeholder_video';
break;
case 'url':
imageSrc = 'placeholder_url';
break;
case 'application/pdf':
imageSrc = 'placeholder_pdf';
break;
case 'empty':
default:
imageSrc = 'placeholder_square';
}
wpApi.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce;
// CONSOLE PLUGIN - Allows custom use of console functions and avoids eslint warnings.
export const ConsolePlugin = {};
ConsolePlugin.install = function (Vue, options = { visual: false }) {
Vue.prototype.$console = {
log(something) {
if (options.visual) {
Vue.prototype.$buefy.snackbar.open({
message: something,
type: 'is-secondary',
position: 'is-bottom-right',
indefinite: true,
queue: false
});
} else {
console.log(something);
return this.getEmptyThumbnailPlaceholderBySize(imageSrc, tainacanSize);
},
getEmptyThumbnailPlaceholderBySize(imageSrc, tainacanSize) {
switch(tainacanSize) {
case 'tainacan-medium-full':
case 'tainacan-medium':
case 'medium_large':
case 'medium':
return this.imagesFolderPath + imageSrc + '_medium.png';
case 'tainacan-small':
case 'thumbnail':
return this.imagesFolderPath + imageSrc + '_small.png';
case 'full':
default:
return this.imagesFolderPath + imageSrc + '.png';
}
},
info(someInfo) {
if (options.visual) {
Vue.prototype.$buefy.snackbar.open({
message: someInfo,
type: 'is-primary',
position: 'is-bottom-right',
duration: 5000,
queue: false
});
} else {
console.info(someInfo);
}
},
error(someError) {
if (options.visual) {
Vue.prototype.$buefy.snackbar.open({
message: someError,
type: 'is-danger',
position: 'is-bottom-right',
indefinite: true,
queue: false
});
} else {
console.error(someError);
getWordpressFallbackSize(tainacanSize) {
switch(tainacanSize) {
case 'tainacan-medium-full':
return 'medium_large';
case 'tainacan-medium':
return 'medium';
case 'tainacan-small':
return 'thumbnail';
default:
return 'thumbnail';
}
}
}
}
ThumbnailHelperPlugin.install = function (Vue, options = {}) {
Vue.prototype.$thumbHelper = ThumbnailHelperFunctions();
};
// I18N PLUGIN - Allows access to Wordpress translation file.
export const I18NPlugin = {};
I18NPlugin.install = function (Vue, options = {}) {
Vue.prototype.$i18n = {
get(key) {
let string = tainacan_plugin.i18n[key];
return (string != undefined && string != null && string != '' ) ? string : "Invalid i18n key: " + tainacan_plugin.i18n[key];
},
getFrom(entity, key) {
if (entity == 'taxonomies') // Temporary hack, while we decide this terminology...
entity = 'taxonomies'
if (tainacan_plugin.i18n['entities_labels'][entity] == undefined)
return 'Invalid i18n entity: ' + entity;
let string = tainacan_plugin.i18n['entities_labels'][entity][key];
return (string != undefined && string != null && string != '' ) ? string : "Invalid i18n key: " + key;
},
getHelperTitle(entity, key) {
if (entity == 'taxonomies') // Temporary hack, while we decide this terminology...
entity = 'taxonomies'
if (tainacan_plugin.i18n['helpers_label'][entity] == undefined)
return 'Invalid i18n entity: ' + entity;
if (tainacan_plugin.i18n['helpers_label'][entity][key] == undefined)
return 'Invalid i18n key: ' + key;
let string = tainacan_plugin.i18n['helpers_label'][entity][key].title;
return (string != undefined && string != null && string != '' ) ? string : "Invalid i18n helper object.";
},
getHelperMessage(entity, key) {
if (entity == 'taxonomies') // Temporary hack, while we decide this terminology...
entity = 'taxonomies'
if (tainacan_plugin.i18n['helpers_label'][entity] == undefined)
return 'Invalid i18n entity: ' + entity;
if (tainacan_plugin.i18n['helpers_label'][entity][key] == undefined)
return 'Invalid i18n key: ' + key;
let string = tainacan_plugin.i18n['helpers_label'][entity][key].description;
return (string != undefined && string != null && string != '' ) ? string : "Invalid i18n helper object. ";
},
/**
* Parsed strings created with variables according to WordPress Logic.
* Check https://developer.wordpress.org/themes/functionality/internationalization/#variables
* An example: ('This sentence has %s letters', [nLetters])
* or ('This one has %1$s letters and %2$s words', [nLetters, nWords]).
*/
getWithVariables(key, variables) { // TRY WITH regex: \%((\d)\$)*s
let rawString = tainacan_plugin.i18n[key];
if (rawString != undefined && rawString != null && rawString != '' ) {
// let splits = rawString.match(/\%((\d)\$)*s*/gm); // An array with all the %s, %1$s, %2$s, etc
// let parsedString = '';
// for (let i = 0; i < splits.length; i++) {
// parsedString += rawString.split(splits[i]).join(variables[i]);
// }
// return parsedString;
const regex = /\%(\d\$)*s/m;
for (let variable of variables)
rawString = rawString.replace(regex, variable);
return rawString;
} else {
"Invalid i18n key: " + tainacan_plugin.i18n[key];
}
}
}
};
// USER PREFERENCES - Used to save key-value information for user settings of plugin
export const UserPrefsPlugin = {};
UserPrefsPlugin.install = function (Vue, options = {}) {
Vue.prototype.$userPrefs = {
tainacanPrefs: {
'items_per_page': 12,
'collections_per_page': 12,
'taxonomies_per_page': 12,
'activities_per_page': 12,
'order': 'DESC',
'order_by': {
slug: 'creation_date',
name: 'Creation Date'
},
'view_mode': undefined,
'admin_view_mode': 'cards',
'fetch_only': 'thumbnail,creation_date,author_name',
'fetch_only_meta': '',
'taxonomies_order': 'asc',
'taxonomies_order_by': 'title',
'collections_order': 'desc',
'collections_order_by': 'date'
},
init() {
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.") );
} else {
let prefs = JSON.parse(tainacan_plugin.user_prefs);
this.tainacanPrefs = prefs;
}
},
get(key) {
return this.tainacanPrefs[key] ? this.tainacanPrefs[key] : undefined;
},
set(key, value) {
this.tainacanPrefs[key] = value;
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.") );
});
},
clean() {
let data = {'meta': {'tainacan_prefs': ''} };
wpApi.post('/users/me/', qs.stringify(data))
}
}
};
// ROUTER HELPER PLUGIN - Allows easy access to URL paths for entities
export const RouterHelperPlugin = {};
RouterHelperPlugin.install = function (Vue, options = {}) {
Vue.prototype.$routerHelper = {
// Lists
getCollectionsPath(query) {
return '/collections/?' + qs.stringify(query);
},
getCollectionItemsPath(collectionId, query) {
return '/collections/'+ collectionId + '/items/?' + qs.stringify(query);
},
getCollectionSequenceEditPath(collectionId, sequenceId, itemPosition) {
return '/collections/'+ collectionId + '/sequence/' + sequenceId + '/' + itemPosition;
},
getCollectionMetadataPath(collectionId) {
return '/collections/'+ collectionId + '/metadata/';
},
getCollectionFiltersPath(collectionId) {
return '/collections/'+ collectionId + '/filters/';
},
getCollectionActivitiesPath(collectionId) {
return '/collections/'+ collectionId + '/activities/';
},
getCollectionCapabilitiesPath(collectionId) {
return '/collections/'+ collectionId + '/capabilities/';
},
getItemsPath(query) {
return '/items/?' + qs.stringify(query);
},
getTaxonomiesPath() {
return '/taxonomies/'
},
getTaxonomyTermsPath(taxonomyId, query) {
return '/taxonomyId/' + taxonomyId + '/terms/?' + qs.stringify(query);
},
getFiltersPath(query) {
return '/filters/?' + qs.stringify(query);
},
getActivitiesPath(query) {
return '/activities/?' + qs.stringify(query);
},
getCapabilitiesPath() {
return '/capabilities';
},
getAvailableImportersPath() {
return '/importers';
},
getProcessesPage(highlightedProcess) {
if (highlightedProcess)
return '/activities?tab=processes&highlight=' + highlightedProcess;
else
return '/activities?tab=processes';
},
// Singles
getCollectionPath(id) {
return '/collections/' + id;
},
getItemPath(collectionId, itemId) {
return '/collections/' + collectionId + '/items/' + itemId;
},
getFilterPath(id) {
return '/filters/' + id;
},
getTaxonomyPath(id) {
return '/taxonomies/' + id;
},
getTermPath(taxonomyId, termId) {
return '/taxonomies/' + taxonomyId + '/terms/' + termId;
},
getImporterPath(importerType, sessionId) {
return '/importers/' + importerType + '/' + sessionId;
},
getCollectionActivityPath(collectionId, activityId) {
return '/collections/' + collectionId + '/activities/' + activityId;
},
// New
getNewCollectionPath() {
return '/collections/new';
},
getNewMappedCollectionPath(mapperSlug) {
return '/collections/new/' + mapperSlug;
},
getNewItemPath(collectionId) {
return '/collections/' + collectionId + '/items/new';
},
getNewCollectionMetadatumPath(collectionId) {
return '/collections/' + collectionId + '/metadata/';
},
getNewMetadatumPath() {
return '/metadata';
},
getNewCollectionFilterPath(collectionId) {
return '/collections/' + collectionId + '/filters/';
},
getNewFilterPath() {
return '/filters/new';
},
getNewTaxonomyPath() {
return '/taxonomies/new';
},
getNewTermPath(taxonomyId) {
return '/taxonomies/' + taxonomyId + '/terms/new';
},
getNewItemBulkAddPath(collectionId) {
return '/collections/' + collectionId + '/bulk-add';
},
// Edit
getCollectionEditPath(id) {
return '/collections/' + id + '/settings';
},
getItemEditPath(collectionId, itemId) {
return '/collections/' + collectionId + '/items/' + itemId + '/edit';
},
getMetadataEditPath(metadatumId) {
return '/metadata/?edit=' + metadatumId;
},
getFilterEditPath(filterId) {
return '/filters/?edit=' + filterId;
},
getCollectionMetadataEditPath(collectionId, metadatumId) {
return '/collections/' + collectionId + '/metadata/?edit=' + metadatumId;
},
getCollectionFilterEditPath(collectionId, filterId) {
return '/collections/' + collectionId + '/filters/?edit=' + filterId;
},
getTaxonomyEditPath(id, isRecent) {
return isRecent != undefined ? '/taxonomies/' + id + '/edit?recent=true' : '/taxonomies/' + id + '/edit';
},
getTermEditPath(taxonomyId, termId) {
return '/taxonomies/' + taxonomyId + '/edit?tab=terms';
},
getImporterEditionPath(importerType) {
return '/importers/' + importerType;
},
getImporterMappingPath(importerType, sessionId, collectionId) {
return '/importers/' + importerType + '/' + sessionId + '/mapping/' + collectionId;
},
getItemMetadataBulkAddPath(collectionId, groupId) {
return '/collections/' + collectionId + '/bulk-add/' + groupId;
},
getExporterEditionPath(exporterType) {
return '/exporters/' + exporterType;
},
getAvailableExportersPath(){
return '/exporters';
},
}
};
// USER CAPABILITIES PLUGIN - Allows easy checking of user capabilities.
export const UserCapabilitiesPlugin = {};
UserCapabilitiesPlugin.install = function (Vue, options = {}) {
Vue.prototype.$userCaps = {
hasCapability(key) {
return tainacan_plugin.user_caps[key];
}
}
};
// STATUS ICONS PLUGIN - Sets icon for status option
export const StatusHelperPlugin = {};
StatusHelperPlugin.install = function (Vue, options = {}) {
Vue.prototype.$statusHelper = {
statuses: [
{ name: tainacan_plugin.i18n['status_publish'], slug: 'publish' },
{ name: tainacan_plugin.i18n['status_private'], slug: 'private' },
{ name: tainacan_plugin.i18n['status_draft'], slug: 'draft' },
{ name: tainacan_plugin.i18n['status_trash'], slug: 'trash' }
],
getIcon(status) {
switch (status) {
case 'publish': return 'tainacan-icon-public';
case 'private': return 'tainacan-icon-private';
case 'draft': return 'tainacan-icon-draft';
case 'trash': return 'tainacan-icon-delete';
default: '';
}
},
hasIcon(status) {
return ['publish', 'private', 'draft', 'trash'].includes(status);
},
getStatuses() {
return this.statuses;
},
loadStatuses() {
wpApi.get('/statuses/')
.then( res => {
let loadedStatus = res.data;
this.statuses = [];
if (loadedStatus['publish'] != undefined)
this.statuses.push(loadedStatus['publish']);
this.statuses.concat(Object.values(loadedStatus).filter((status) => {
return !['publish','private', 'draft', 'trash'].includes(status.slug);
}));
// We always show private, draft and trash
this.statuses.push({
name: tainacan_plugin.i18n['status_private'],
slug: 'private'
});
this.statuses.push({
name: tainacan_plugin.i18n['status_draft'],
slug: 'draft'
});
this.statuses.push({
name: tainacan_plugin.i18n['status_trash'],
slug: 'trash'}
);
})
.catch(error => {
console.error( error );
});
}
}
};
// COMMENTS STATUS PLUGIN -
export const CommentsStatusHelperPlugin = {};
CommentsStatusHelperPlugin.install = function (Vue, options = {}) {
Vue.prototype.$commentsStatusHelper = {
statuses: [
{ name: tainacan_plugin.i18n['comments_status_open'], slug: 'open' },
{ name: tainacan_plugin.i18n['comments_status_closed'], slug: 'closed' }
],
getStatuses() {
return this.statuses;
}
}
};

View File

@ -109,7 +109,11 @@
</div>
</div>
</template>
<template slot="empty">{{ $i18n.get('info_no_user_found') }}</template>
<template
v-if="!isFetchingUsers"
slot="empty">
{{ $i18n.get('info_no_user_found') }}
</template>
</b-autocomplete>
</b-field>

View File

@ -12,12 +12,31 @@
<div
v-if="(isRepositoryLevel && $userCaps.hasCapability('tnc_rep_edit_filters') || (!isRepositoryLevel && collection && collection.current_user_can_edit_filters))"
:style="{ height: activeFilterList.length <= 0 && !isLoadingFilters ? 'auto' : 'calc(100vh - 6px - ' + columnsTopY + 'px)'}"
:style="{ height: activeFiltersList.length <= 0 && !isLoadingFilters ? 'auto' : 'calc(100vh - 6px - ' + columnsTopY + 'px)'}"
class="columns"
ref="filterEditionPageColumns">
<div class="column">
<div class="tainacan-form sub-header">
<h3>{{ $i18n.get('filters') }}</h3>
<template v-if="activeFiltersList && activeFiltersList.length > 5 && !isLoadingFilters">
<b-field class="header-item">
<b-input
:placeholder="$i18n.get('instruction_type_search_filter_filter')"
v-model="filterNameFilterString"
icon="magnify"
size="is-small"
icon-right="close-circle"
icon-right-clickable
@icon-right-click="filterNameFilterString = ''" />
</b-field>
</template>
</div>
<section
v-if="activeFilterList.length <= 0 && !isLoadingFilters"
v-if="activeFiltersList.length <= 0 && !isLoadingFilters"
class="field is-grouped-centered section">
<div class="content has-text-gray has-text-centered">
<p>
@ -28,32 +47,34 @@
<p>{{ $i18n.get('info_there_is_no_filter' ) }}</p>
<p>{{ $i18n.get('info_create_filters' ) }}</p>
</div>
</section>
<draggable
</section>
<draggable
class="active-filters-area"
@change="handleChangeOnFilter"
:class="{'filters-area-receive': isDraggingFromAvailable}"
v-model="activeFilterList"
v-model="activeFiltersList"
:group="{ name:'filters', pull: false, put: true }"
:sort="(openedFilterId == '' || openedFilterId == undefined) && !isRepositoryLevel"
:handle="'.handle'"
ghost-class="sortable-ghost"
filter=".not-sortable-item"
:prevent-on-filter="false"
:animation="250">
<div
:animation="250">
<div
class="active-filter-item"
:class="{
'not-sortable-item': (isSelectingFilterType || filter.id == undefined || openedFilterId != '' || choosenMetadatum.name == filter.name || isUpdatingFiltersOrder == true),
'not-sortable-item': (isRepositoryLevel || isSelectingFilterType || filter.id == undefined || openedFilterId != '' || choosenMetadatum.name == filter.name || isUpdatingFiltersOrder == true || filterNameFilterString != ''),
'not-focusable-item': openedFilterId == filter.id,
'disabled-filter': filter.enabled == false,
'inherited-filter': filter.inherited || isRepositoryLevel
}"
v-for="(filter, index) in activeFilterList"
:key="filter.id">
v-for="(filter, index) in activeFiltersList"
:key="filter.id"
v-show="filterNameFilterString == '' || filter.name.toString().toLowerCase().indexOf(filterNameFilterString.toString().toLowerCase()) >= 0">
<div class="handle">
<span
:style="{ opacity: !(isSelectingFilterType || filter.id == undefined || openedFilterId != '' || choosenMetadatum.name == filter.name || isUpdatingFiltersOrder == true || isRepositoryLevel) ? '1.0' : '0.0' }"
:style="{ opacity: !(isSelectingFilterType || filter.id == undefined || openedFilterId != '' || choosenMetadatum.name == filter.name || isUpdatingFiltersOrder == true || isRepositoryLevel || filterNameFilterString != '') ? '1.0' : '0.0' }"
v-tooltip="{
content: (isSelectingFilterType || filter.id == undefined || openedFilterId != '' || choosenMetadatum.name == filter.name || isUpdatingFiltersOrder == true) ? $i18n.get('info_not_allowed_change_order_filters') : $i18n.get('instruction_drag_and_drop_filter_sort'),
autoHide: true,
@ -63,24 +84,6 @@
class="icon grip-icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-drag"/>
</span>
<span
v-tooltip="{
content: filter.collection_id != collectionId ? $i18n.get('label_repository_filter') : $i18n.get('label_collection_filter'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'
}"
class="icon icon-level-identifier">
<i
:class="{
'tainacan-icon-collections': filter.collection_id == collectionId,
'tainacan-icon-repository': filter.collection_id != collectionId,
'has-text-turquoise5': filter.enabled && filter.collection_id != 'default',
'has-text-blue5': filter.enabled && filter.collection_id == 'default',
'has-text-gray3': !filter.enabled
}"
class="tainacan-icon" />
</span>
<span
class="filter-name"
:class="{'is-danger': formWithErrors == filter.id }">
@ -98,10 +101,34 @@
</span>
<span
v-if="filter.status == 'private'"
class="icon">
class="icon"
v-tooltip="{
content: $i18n.get('status_private'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'
}">
<i class="tainacan-icon tainacan-icon-private"/>
</span>
</span>
<span
v-tooltip="{
content: filter.collection_id != collectionId ? $i18n.get('label_repository_filter') : $i18n.get('label_collection_filter'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'
}"
class="icon icon-level-identifier">
<i
:class="{
'tainacan-icon-collections': filter.collection_id == collectionId,
'tainacan-icon-repository': filter.collection_id != collectionId,
'has-text-turquoise5': filter.enabled && filter.collection_id != 'default',
'has-text-blue5': filter.enabled && filter.collection_id == 'default',
'has-text-gray3': !filter.enabled
}"
class="tainacan-icon" />
</span>
</span>
<span
class="loading-spinner"
v-if="filter.id == undefined"/>
@ -164,7 +191,7 @@
v-if="(isRepositoryLevel && $userCaps.hasCapability('tnc_rep_edit_filters') || !isRepositoryLevel)"
class="column available-metadata-area">
<div class="field" >
<h3 class="label has-text-secondary"> {{ $i18n.get('label_available_metadata') }}</h3>
<h3 class="label"> {{ $i18n.get('label_available_metadata') }}</h3>
<draggable
@change="handleChangeOnMetadata"
v-if="availableMetadata.length > 0 && !isLoadingMetadatumTypes"
@ -193,22 +220,7 @@
}"
class="icon grip-icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-drag"/>
</span>
<span
v-tooltip="{
content: isRepositoryLevel || metadatum.collection_id != collectionId ? $i18n.get('label_repository_filter') : $i18n.get('label_collection_filter'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'
}"
class="icon icon-level-identifier">
<i
:class="{
'tainacan-icon-collections has-text-turquoise5': metadatum.collection_id == collectionId && !isRepositoryLevel,
'tainacan-icon-repository has-text-blue5': isRepositoryLevel || metadatum.collection_id != collectionId
}"
class="tainacan-icon" />
</span>
</span>
<span
v-tooltip="{
content: metadatum.name + (metadatum.parent_name ? (' (' + $i18n.get('info_child_of') + ' ' + metadatum.parent_name + ')') : ''),
@ -225,6 +237,21 @@
<em>{{ '(' + $i18n.get('info_child_of') + ' ' + metadatum.parent_name + ')' }}</em>
</span>
</span>
<span
v-tooltip="{
content: isRepositoryLevel || metadatum.collection_id != collectionId ? $i18n.get('label_repository_filter') : $i18n.get('label_collection_filter'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'
}"
class="icon icon-level-identifier">
<i
:class="{
'tainacan-icon-collections has-text-turquoise5': metadatum.collection_id == collectionId && !isRepositoryLevel,
'tainacan-icon-repository has-text-blue5': isRepositoryLevel || metadatum.collection_id != collectionId
}"
class="tainacan-icon" />
</span>
</div>
</template>
</draggable>
@ -380,11 +407,12 @@ export default {
currentFilterTypePreview: undefined,
columnsTopY: 0,
filtersSearchCancel: undefined,
metadataSearchCancel: undefined
metadataSearchCancel: undefined,
filterNameFilterString: ''
}
},
computed: {
activeFilterList: {
activeFiltersList: {
get() {
return this.getFilters();
},
@ -400,9 +428,9 @@ export default {
'$route.query': {
handler(newQuery) {
if (newQuery.edit != undefined) {
let existingFilterIndex = this.activeFilterList.findIndex((filter) => filter.id == newQuery.edit);
let existingFilterIndex = this.activeFiltersList.findIndex((filter) => filter.id == newQuery.edit);
if (existingFilterIndex >= 0)
this.editFilter(this.activeFilterList[existingFilterIndex])
this.editFilter(this.activeFiltersList[existingFilterIndex])
}
},
immediate: true
@ -541,7 +569,7 @@ export default {
this.availableMetadata.splice(metadatumIndex, 1);
// Inserts it at the end of the list
let lastFilterIndex = this.activeFilterList.length;
let lastFilterIndex = this.activeFiltersList.length;
// // Updates store with temporary Filter
// this.addTemporaryFilter(metadatumType);
@ -567,7 +595,7 @@ export default {
this.choosenMetadatum = {};
// Removes element from filters list
this.activeFilterList.splice(this.newFilterIndex, 1);
this.activeFiltersList.splice(this.newFilterIndex, 1);
},
handleChangeOnMetadata($event) {
if ($event.removed) {
@ -576,7 +604,7 @@ export default {
},
updateFiltersOrder() {
let filtersOrder = [];
for (let filter of this.activeFilterList) {
for (let filter of this.activeFiltersList) {
filtersOrder.push({'id': filter.id, 'enabled': filter.enabled});
}
this.isUpdatingFiltersOrder = true;
@ -602,7 +630,7 @@ export default {
}
}
for (let activeFilter of this.activeFilterList) {
for (let activeFilter of this.activeFiltersList) {
for (let i = availableMetadata.length - 1; i >= 0 ; i--) {
if (activeFilter.metadatum != undefined) {
if (activeFilter.metadatum.metadatum_id == availableMetadata[i].id)
@ -615,7 +643,7 @@ export default {
},
onChangeEnable($event, index) {
let filtersOrder = [];
for (let filter of this.activeFilterList) {
for (let filter of this.activeFiltersList) {
filtersOrder.push({'id': filter.id, 'enabled': filter.enabled});
}
filtersOrder[index].enabled = $event;
@ -744,16 +772,16 @@ export default {
// Checks URL as router watcher would not wait for list to load
if (this.$route.query.edit != undefined) {
let existingFilterIndex = this.activeFilterList.findIndex((filter) => filter.id == this.$route.query.edit);
let existingFilterIndex = this.activeFiltersList.findIndex((filter) => filter.id == this.$route.query.edit);
if (existingFilterIndex >= 0)
this.editFilter(this.activeFilterList[existingFilterIndex]);
this.editFilter(this.activeFiltersList[existingFilterIndex]);
}
// Cancels previous Request
if (this.metadataSearchCancel != undefined)
this.metadataSearchCancel.cancel('Metadata search Canceled.');
// Needs to be done after activeFilterList exists to compare and remove chosen metadata.
// Needs to be done after activeFiltersList exists to compare and remove chosen metadata.
this.fetchMetadata({
collectionId: this.collectionId,
isRepositoryLevel: this.isRepositoryLevel,
@ -822,6 +850,7 @@ export default {
.column {
overflow-x: hidden;
overflow-y: auto;
padding: 0.75em 0;
&>section.field {
position: absolute;
@ -835,6 +864,25 @@ export default {
margin-right: 0;
}
}
h3 {
font-weight: 500;
}
}
.sub-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.5em 1em 0.5em 0.5em;
.header-item {
margin-left: 0.75rem;
margin-bottom: 0px;
}
h3 {
margin-right: auto;
}
}
.loading-spinner {
@ -851,7 +899,6 @@ export default {
.active-filters-area {
font-size: 0.875em;
margin-right: 0.8em;
margin-left: -0.8em;
padding-right: 3em;
min-height: 330px;
@ -866,7 +913,7 @@ export default {
}
&.filters-area-receive {
border: 1px dashed gray;
border: 1px dashed var(--tainacan-gray4);
}
.collapse {
@ -928,7 +975,7 @@ export default {
.controls {
font-size: 0.875em;
position: absolute;
right: 5px;
right: 10px;
top: 10px;
.switch {
position: relative;
@ -941,53 +988,42 @@ export default {
}
}
&.not-sortable-item, &.not-sortable-item:hover {
&.not-sortable-item,
&.not-sortable-item:hover {
cursor: default;
background-color: var(--tainacan-white) !important;
}
&.not-focusable-item, &.not-focusable-item:hover {
&.not-focusable-item,
&.not-focusable-item:hover {
cursor: default;
.metadatum-name {
color: var(--tainacan-secondary);
}
}
&.disabled-metadatum {
&.disabled-filter:not(.not-sortable-item),
&.disabled-filter:not(.not-sortable-item):hover {
color: var(--tainacan-gray3);
.label-details, .not-saved {
color: var(--tainacan-gray3) !important;
}
}
}
.active-filter-item:not(:hover) .icon-level-identifier .tainacan-icon::before,
.active-filter-item:hover.not-sortable-item .icon-level-identifier .tainacan-icon::before {
color: var(--tainacan-gray3) !important;
}
.active-filter-item:hover:not(.not-sortable-item) {
background-color: var(--tainacan-secondary);
border-color: var(--tainacan-secondary);
color: var(--tainacan-white) !important;
background-color: var(--tainacan-turquoise1);
border-color: var(--tainacan-turquoise1);
&>.field, form {
background-color: var(--tainacan-white) !important;
.label-details, .not-saved {
color: var(--tainacan-gray4) !important;
}
.grip-icon {
color: var(--tainacan-white);
color: var(--tainacan-secondary);
}
.label-details, .icon, .icon-level-identifier>i {
color: var(--tainacan-white) !important;
}
.switch.is-small {
input[type="checkbox"] + .check {
background-color: var(--tainacan-secondary) !important;
border: 1.5px solid white !important;
&::before { background-color: var(--tainacan-white) !important; }
}
input[type="checkbox"]:checked + .check {
border: 1.5px solid white !important;
&::before { background-color: var(--tainacan-white) !important; }
}
&:hover input[type="checkbox"] + .check {
border: 1.5px solid white !important;
background-color: var(--tainacan-secondary) !important;
}
}
}
.sortable-ghost {
border: 1px dashed var(--tainacan-gray2);
@ -999,9 +1035,7 @@ export default {
position: relative;
.grip-icon {
color: var(--tainacan-gray3);
top: 2px;
position: relative;
color: var(--tainacan-white);
}
}
}
@ -1026,7 +1060,7 @@ export default {
}
h3 {
margin: 0.2em 0em 1em 0em;
margin: 0.875em 0em 1em 0em;
font-weight: 500;
}
@ -1059,7 +1093,7 @@ export default {
font-weight: bold;
margin-left: 0.4em;
display: inline-block;
width: calc(100% - 80px);
width: calc(100% - 60px);
}
&:after,
&:before {
@ -1103,56 +1137,55 @@ export default {
position: relative;
top: 2px;
}
.available-metadatum-item:not(.disabled-metadatum) {
&:hover{
background-color: var(--tainacan-secondary);
border-color: var(--tainacan-secondary);
color: var(--tainacan-white) !important;
position: relative;
left: -4px;
.available-metadatum-item:not(:hover) .icon-level-identifier .tainacan-icon::before,
.available-filter-item:hover.not-sortable-item .icon-level-identifier .tainacan-icon::before {
color: var(--tainacan-gray3) !important;
}
.available-metadatum-item:not(.disabled-metadatum):hover{
background-color: var(--tainacan-turquoise1);
border-color: var(--tainacan-turquoise2);
position: relative;
left: -4px;
&:after {
border-color: transparent var(--tainacan-secondary) transparent transparent;
}
&:before {
border-color: transparent var(--tainacan-secondary) transparent transparent;
}
.icon-level-identifier>i {
color: var(--tainacan-white) !important;
}
.grip-icon {
color: var(--tainacan-white) !important;
}
&:after {
border-color: transparent var(--tainacan-turquoise1) transparent transparent;
}
&:before {
border-color: transparent var(--tainacan-turquoise2) transparent transparent;
}
.grip-icon {
color: var(--tainacan-secondary) !important;
}
}
}
.inherited-filter {
&.active-filter-item:hover:not(.not-sortable-item) {
background-color: var(--tainacan-blue5);
border-color: var(--tainacan-blue5);
background-color: var(--tainacan-blue1);
border-color: var(--tainacan-blue2);
.switch.is-small {
input[type="checkbox"] + .check {
background-color: var(--tainacan-blue5) !important;
}
&:hover input[type="checkbox"] + .check {
background-color: var(--tainacan-blue5) !important;
}
.grip-icon {
color: var(--tainacan-blue5) !important;
}
}
}
.inherited-metadatum {
&.available-metadatum-item:hover {
background-color: var(--tainacan-blue5) !important;
border-color: var(--tainacan-blue5) !important;
.switch.is-small input[type="checkbox"]:checked + .check {
border: 1.5px solid var(--tainacan-blue5);
&::before { background-color: var(--tainacan-blue5); }
}
&.available-metadatum-item:not(.disabled-metadatum):hover {
background-color: var(--tainacan-blue1) !important;
border-color: var(--tainacan-blue2) !important;
.grip-icon {
color: var(--tainacan-blue5) !important;
}
&:after {
border-color: transparent var(--tainacan-blue5) transparent transparent !important;
border-color: transparent var(--tainacan-blue1) transparent transparent !important;
}
&:before {
border-color: transparent var(--tainacan-blue5) transparent transparent !important;
border-color: transparent var(--tainacan-blue2) transparent transparent !important;
}
}

View File

@ -948,12 +948,14 @@
let descriptionMetadatum = this.localDisplayedMetadata.find(metadatum => metadatum.metadata_type_object != undefined ? metadatum.metadata_type_object.related_mapped_prop == 'description' : false);
// Updates Search
this.$eventBusSearch.addFetchOnly(
((thumbnailMetadatum != undefined && thumbnailMetadatum.display) ? 'thumbnail' : null) + ',' +
((creationDateMetadatum != undefined && creationDateMetadatum.display) ? 'creation_date' : null) + ',' +
((authorNameMetadatum != undefined && authorNameMetadatum.display) ? 'author_name': null) + ',' +
(this.isRepositoryLevel ? 'title' : null) + ',' +
(this.isRepositoryLevel && descriptionMetadatum.display ? 'description' : null), false, fetchOnlyMetadatumIds.toString());
let fetchOnlyArray = [
((thumbnailMetadatum != undefined && thumbnailMetadatum.display) ? 'thumbnail' : null),
((creationDateMetadatum != undefined && creationDateMetadatum.display) ? 'creation_date' : null),
((authorNameMetadatum != undefined && authorNameMetadatum.display) ? 'author_name': null),
(this.isRepositoryLevel ? 'title' : null),
(this.isRepositoryLevel && descriptionMetadatum.display ? 'description' : null)
];
this.$eventBusSearch.addFetchOnly(fetchOnlyArray.filter((fetchOnly) => fetchOnly != null).toString() , false, fetchOnlyMetadatumIds.toString());
// Closes dropdown
this.$refs.displayedMetadataDropdown.toggle();
@ -972,7 +974,8 @@
this.fetchMetadata({
collectionId: this.collectionId,
isRepositoryLevel: this.isRepositoryLevel,
isContextEdit: false
isContextEdit: false,
includeControlMetadataTypes: true
})
.then((resp) => {
resp.request
@ -1028,39 +1031,41 @@
let fetchOnlyMetadatumIds = [];
for (let metadatum of this.metadata) {
if (metadatum.display !== 'never') {
if (metadatum.display !== 'never' || metadatum.metadata_type == 'Tainacan\\Metadata_Types\\Control') {
let display;
if (metadatum.metadata_type != 'Tainacan\\Metadata_Types\\Control') {
let display;
// Deciding display based on collection settings
if (metadatum.display == 'no')
display = false;
else if (metadatum.display == 'yes')
display = true;
// Deciding display based on collection settings
if (metadatum.display == 'no')
display = false;
else if (metadatum.display == 'yes')
display = true;
// Deciding display based on user prefs
if (prefsFetchOnlyMetaObject.length) {
let index = prefsFetchOnlyMetaObject.findIndex(metadatumId => metadatumId == metadatum.id);
// Deciding display based on user prefs
if (prefsFetchOnlyMetaObject.length) {
let index = prefsFetchOnlyMetaObject.findIndex(metadatumId => metadatumId == metadatum.id);
display = index >= 0;
display = index >= 0;
}
metadata.push({
name: metadatum.name,
metadatum: metadatum.description,
slug: metadatum.slug,
metadata_type: metadatum.metadata_type,
metadata_type_object: metadatum.metadata_type_object,
metadata_type_options: metadatum.metadata_type_options,
id: metadatum.id,
display: display,
collection_id: metadatum.collection_id,
multiple: metadatum.multiple,
});
if (display)
fetchOnlyMetadatumIds.push(metadatum.id);
}
metadata.push({
name: metadatum.name,
metadatum: metadatum.description,
slug: metadatum.slug,
metadata_type: metadatum.metadata_type,
metadata_type_object: metadatum.metadata_type_object,
metadata_type_options: metadatum.metadata_type_options,
id: metadatum.id,
display: display,
collection_id: metadatum.collection_id,
multiple: metadatum.multiple,
});
if (display)
fetchOnlyMetadatumIds.push(metadatum.id);
if (
metadatum.metadata_type != 'Tainacan\\Metadata_Types\\Core_Description' &&
metadatum.metadata_type != 'Tainacan\\Metadata_Types\\Taxonomy' &&
@ -1095,13 +1100,14 @@
display: authorNameMetadatumDisplay
});
this.$eventBusSearch.addFetchOnly(
(thumbnailMetadatumDisplay ? 'thumbnail' : null) +','+
(creationDateMetadatumDisplay ? 'creation_date' : null) +','+
(authorNameMetadatumDisplay ? 'author_name' : null) +','+
(this.isRepositoryLevel ? 'title' : null) +','+
let fetchOnlyArray = [
(thumbnailMetadatumDisplay ? 'thumbnail' : null),
(creationDateMetadatumDisplay ? 'creation_date' : null),
(authorNameMetadatumDisplay ? 'author_name' : null),
(this.isRepositoryLevel ? 'title' : null),
(this.isRepositoryLevel ? 'description' : null)
, false, fetchOnlyMetadatumIds.toString());
];
this.$eventBusSearch.addFetchOnly(fetchOnlyArray.filter((fetchOnly) => fetchOnly != null).toString() , false, fetchOnlyMetadatumIds.toString());
// Sorting metadata
if (this.isRepositoryLevel) {
@ -1153,7 +1159,7 @@
}
for (let metadatum of this.metadata) {
if (metadatum.display !== 'never' &&
if ((metadatum.display !== 'never' || metadatum.metadata_type == 'Tainacan\\Metadata_Types\\Control') &&
metadatum.metadata_type != 'Tainacan\\Metadata_Types\\Core_Description' &&
metadatum.metadata_type != 'Tainacan\\Metadata_Types\\Taxonomy' &&
metadatum.metadata_type != 'Tainacan\\Metadata_Types\\Relationship'&&

View File

@ -1,7 +1,7 @@
<template>
<div :class="{ 'repository-level-page page-container': isRepositoryLevel }">
<tainacan-title
:bread-crumb-items="[{ path: '', label: this.$i18n.get('metadata') }]"/>
:bread-crumb-items="[{ path: '', label: this.$i18n.get('metadata') }]"/>
<template v-if="isRepositoryLevel">
<p>{{ $i18n.get('info_repository_metadata_inheritance') }}</p>
@ -14,12 +14,78 @@
v-model="activeTab">
<b-tab-item :label="$i18n.get('metadata')">
<div
:style="{ height: activeMetadatumList.length <= 0 && !isLoadingMetadata ? 'auto' : 'calc(100vh - 6px - ' + columnsTopY + 'px)'}"
:style="{ height: activeMetadatumList && activeMetadatumList.length <= 0 && !isLoadingMetadata ? 'auto' : 'calc(100vh - 6px - ' + columnsTopY + 'px)'}"
class="columns"
ref="metadataEditionPageColumns">
<b-loading :active.sync="isLoadingMetadatumTypes"/>
<div class="column">
<div class="column">
<div class="tainacan-form sub-header">
<h3>{{ $i18n.get('metadata') }}</h3>
<template v-if="activeMetadatumList && !isLoadingMetadata">
<b-field class="header-item">
<b-dropdown
:mobile-modal="true"
:disabled="activeMetadatumList.length <= 0"
class="show metadata-options-dropdown"
aria-role="list"
trap-focus>
<button
:aria-label="$i18n.get('label_filter_by_metadata_type')"
class="button is-white"
slot="trigger">
<span>{{ $i18n.get('label_filter_by_metadata_type') }}</span>
<span class="icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-arrowdown"/>
</span>
</button>
<div class="metadata-options-container">
<b-dropdown-item
v-for="(metadataType, index) in metadataTypeFilterOptions"
:key="index"
class="control"
custom
aria-role="listitem">
<b-checkbox
v-model="metadataType.enabled"
:native-value="metadataType.enabled">
{{ metadataType.name }}
</b-checkbox>
</b-dropdown-item>
</div>
</b-dropdown>
</b-field>
<b-field class="header-item">
<b-input
:placeholder="$i18n.get('instruction_type_search_metadata_filter')"
v-model="metadataNameFilterString"
icon="magnify"
size="is-small"
icon-right="close-circle"
icon-right-clickable
@icon-right-click="metadataNameFilterString = ''" />
</b-field>
</template>
</div>
<button
aria-controls="filters-items-list"
:aria-expanded="!collapseAll"
v-if="activeMetadatumList.length > 0"
class="link-style collapse-all"
@click="collapseAll = !collapseAll">
<span class="icon">
<i
:class="{ 'tainacan-icon-arrowdown' : collapseAll, 'tainacan-icon-arrowright' : !collapseAll }"
class="has-text-secondary tainacan-icon tainacan-icon-1-125em"/>
</span>
<span class="collapse-all__text">
{{ collapseAll ? $i18n.get('label_collapse_all') : $i18n.get('label_expand_all') }}
</span>
</button>
<section
v-if="activeMetadatumList.length <= 0 && !isLoadingMetadata"
class="field is-grouped-centered section">
@ -32,7 +98,8 @@
<p>{{ $i18n.get('info_there_is_no_metadatum' ) }}</p>
<p>{{ $i18n.get('info_create_metadata' ) }}</p>
</div>
</section>
</section>
<draggable
v-model="activeMetadatumList"
class="active-metadata-area"
@ -47,11 +114,13 @@
:animation="250">
<div
v-for="(metadatum, index) in activeMetadatumList.filter((meta) => meta != undefined && meta.parent == 0)"
:key="metadatum.id">
:key="metadatum.id"
v-show="(metadataNameFilterString == '' || filterByMetadatumName(metadatum)) && filterByMetadatumType(metadatum)">
<div
class="active-metadatum-item"
:class="{
'not-sortable-item': isRepositoryLevel || metadatum.id == undefined || openedMetadatumId != '' || isUpdatingMetadataOrder,
'is-compact-item': !isCollapseOpen(metadatum.id),
'not-sortable-item': isRepositoryLevel || metadatum.id == undefined || openedMetadatumId != '' || isUpdatingMetadataOrder || metadataNameFilterString != '' || hasSomeMetadataTypeFilterApplied,
'not-focusable-item': openedMetadatumId == metadatum.id,
'disabled-metadatum': metadatum.enabled == false,
'inherited-metadatum': metadatum.inherited || isRepositoryLevel,
@ -61,7 +130,19 @@
:ref="'metadatum-handler-' + metadatum.id"
class="handle">
<span
:style="{ opacity: !(isRepositoryLevel || metadatum.id == undefined || openedMetadatumId != '' || isUpdatingMetadataOrder) ? '1.0' : '0.0' }"
v-tooltip="{
content: $i18n.get('label_view_metadata_details'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'
}"
@click="$set(collapses, metadatum.id, !isCollapseOpen(metadatum.id))"
class="gray-icon icon"
:style="{ cursor: 'pointer', opacity: openedMetadatumId != metadatum.id ? '1.0' : '0.0' }">
<i :class="'tainacan-icon tainacan-icon-1-25em tainacan-icon-' + (isCollapseOpen(metadatum.id) ? 'arrowdown' : 'arrowright')" />
</span>
<span
:style="{ opacity: !(isRepositoryLevel || metadatum.id == undefined || openedMetadatumId != '' || isUpdatingMetadataOrder || metadataNameFilterString != '' || hasSomeMetadataTypeFilterApplied) ? '1.0' : '0.0' }"
v-tooltip="{
content: isRepositoryLevel || metadatum.id == undefined || openedMetadatumId != '' || isUpdatingMetadataOrder ? $i18n.get('info_not_allowed_change_order_metadata') : $i18n.get('instruction_drag_and_drop_metadatum_sort'),
autoHide: true,
@ -71,24 +152,6 @@
class="icon grip-icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-drag"/>
</span>
<span
v-tooltip="{
content: (metadatum.collection_id == 'default') || isRepositoryLevel ? $i18n.get('label_repository_metadatum') : $i18n.get('label_collection_metadatum'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'
}"
class="icon icon-level-identifier">
<i
:class="{
'tainacan-icon-collections': (metadatum.collection_id != 'default' && !isRepositoryLevel),
'tainacan-icon-repository': (metadatum.collection_id == 'default') || isRepositoryLevel,
'has-text-turquoise5': metadatum.enabled && (metadatum.collection_id != 'default' && !isRepositoryLevel),
'has-text-blue5': metadatum.enabled && (metadatum.collection_id == 'default' || isRepositoryLevel),
'has-text-gray3': !metadatum.enabled
}"
class="tainacan-icon" />
</span>
<span
class="metadatum-name"
:class="{'is-danger': formWithErrors == metadatum.id }">
@ -106,10 +169,44 @@
{{ $i18n.get('info_not_saved') }}
</span>
<span
v-if="metadatum.status == 'private'"
class="icon">
v-if="metadatum.status === 'private'"
class="icon"
v-tooltip="{
content: $i18n.get('status_private'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'
}">
<i class="tainacan-icon tainacan-icon-private"/>
</span>
<span
v-if="metadatum.required === 'yes'"
v-tooltip="{
content: $i18n.get('label_required'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'
}">
*&nbsp;
</span>
<span
v-tooltip="{
content: (metadatum.collection_id == 'default') || isRepositoryLevel ? $i18n.get('label_repository_metadatum') : $i18n.get('label_collection_metadatum'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'
}"
class="icon icon-level-identifier">
<i
:class="{
'tainacan-icon-collections': (metadatum.collection_id != 'default' && !isRepositoryLevel),
'tainacan-icon-repository': (metadatum.collection_id == 'default') || isRepositoryLevel,
'has-text-turquoise5': metadatum.enabled && (metadatum.collection_id != 'default' && !isRepositoryLevel),
'has-text-blue5': metadatum.enabled && (metadatum.collection_id == 'default' || isRepositoryLevel),
'has-text-gray3': !metadatum.enabled
}"
class="tainacan-icon" />
</span>
</span>
<span
class="loading-spinner"
@ -158,6 +255,11 @@
</a>
</span>
</div>
<transition name="form-collapse">
<metadatum-details
v-if="isCollapseOpen(metadatum.id) && openedMetadatumId !== metadatum.id"
:metadatum="metadatum" />
</transition>
<transition name="form-collapse">
<div v-if="openedMetadatumId == metadatum.id">
<metadatum-edition-form
@ -175,8 +277,12 @@
<child-metadata-list
v-if="metadatum.metadata_type_object && metadatum.metadata_type_object.component == 'tainacan-compound'"
:parent.sync="metadatum"
:metadata-name-filter-string="metadataNameFilterString"
:metadata-type-filter-options="metadataTypeFilterOptions"
:has-some-metadata-type-filter-applied="hasSomeMetadataTypeFilterApplied"
:is-parent-multiple="metadatum.multiple == 'yes' || (editForms[metadatum.id] && editForms[metadatum.id].multiple == 'yes')"
:is-repository-level="isRepositoryLevel" />
:is-repository-level="isRepositoryLevel"
:collapse-all="collapseAll" />
</div>
</draggable>
</div>
@ -185,7 +291,7 @@
v-if="(isRepositoryLevel && $userCaps.hasCapability('tnc_rep_edit_metadata')) || !isRepositoryLevel"
class="column available-metadata-area" >
<div class="field">
<h3 class="label has-text-secondary">{{ $i18n.get('label_available_metadata_types') }}</h3>
<h3 class="label">{{ $i18n.get('label_available_metadata_types') }}</h3>
<draggable
v-model="availableMetadatumList"
:sort="false"
@ -254,6 +360,7 @@
<script>
import MetadataMappingList from '../../components/lists/metadata-mapping-list.vue';
import MetadatumEditionForm from '../../components/edition/metadatum-edition-form.vue';
import MetadatumDetails from '../../components/other/metadatum-details.vue';
import ChildMetadataList from '../../components/metadata-types/compound/child-metadata-list.vue';
import CustomDialog from '../../components/other/custom-dialog.vue';
import { mapGetters, mapActions } from 'vuex';
@ -263,7 +370,8 @@ export default {
components: {
MetadataMappingList,
MetadatumEditionForm,
ChildMetadataList
ChildMetadataList,
MetadatumDetails
},
data() {
return {
@ -277,13 +385,20 @@ export default {
formWithErrors: '',
hightlightedMetadatum: '',
editForms: {},
columnsTopY: 0
collapses: {},
columnsTopY: 0,
collapseAll: false,
metadataNameFilterString: '',
metadataTypeFilterOptions: []
}
},
computed: {
collection() {
return this.getCollection();
},
hasSomeMetadataTypeFilterApplied() {
return this.metadataTypeFilterOptions.length && this.metadataTypeFilterOptions.some((metadatumType) => metadatumType.enabled);
},
availableMetadatumList: {
get() {
return this.getMetadatumTypes();
@ -311,6 +426,9 @@ export default {
}
},
immediate: true
},
collapseAll(isCollapsed) {
this.activeMetadatumList.forEach((metadatum) => this.$set(this.collapses, metadatum.id, isCollapsed));
}
},
beforeRouteLeave ( to, from, next ) {
@ -356,13 +474,20 @@ export default {
this.fetchMetadatumTypes()
.then(() => {
this.metadataTypeFilterOptions = JSON.parse(JSON.stringify(this.getMetadatumTypes()))
.map((metadatumType) => {
return {
enabled: false,
name: metadatumType.name,
type: metadatumType.className
}
});
this.isLoadingMetadatumTypes = false;
})
.catch(() => {
this.isLoadingMetadatumTypes = false;
});
this.refreshMetadata();
},
beforeDestroy() {
@ -389,8 +514,7 @@ export default {
'getMetadatumTypes',
'getMetadata',
]),
handleChange(event) {
handleChange(event) {
if (event.added) {
this.addNewMetadatum(event.added.element, event.added.newIndex);
} else if (event.removed) {
@ -538,7 +662,8 @@ export default {
isRepositoryLevel: this.isRepositoryLevel,
isContextEdit: true,
includeDisabled: true,
parent: '0'
parent: '0',
includeOptionsAsHtml: true
}).then((resp) => {
resp.request
.then(() => {
@ -575,15 +700,56 @@ export default {
<div>` + metadatum.preview_template + `</div>
</div>
</div>`;
},
filterByMetadatumName(metadatum) {
if (metadatum.metadata_type_object &&
metadatum.metadata_type_object.component == 'tainacan-compound' &&
metadatum.metadata_type_options &&
metadatum.metadata_type_options.children_objects &&
metadatum.metadata_type_options.children_objects.length
) {
let childNamesArray = metadatum.metadata_type_options.children_objects.map((children) => children.name);
childNamesArray.push(metadatum.name);
return childNamesArray.some((childName) => childName.toString().toLowerCase().indexOf(this.metadataNameFilterString.toString().toLowerCase()) >= 0);
}
else
return metadatum.name.toString().toLowerCase().indexOf(this.metadataNameFilterString.toString().toLowerCase()) >= 0;
},
filterByMetadatumType(metadatum) {
if (!this.hasSomeMetadataTypeFilterApplied)
return true;
if (metadatum.metadata_type_object &&
metadatum.metadata_type_object.component == 'tainacan-compound' &&
metadatum.metadata_type_options &&
metadatum.metadata_type_options.children_objects &&
metadatum.metadata_type_options.children_objects.length
) {
let childTypesArray = metadatum.metadata_type_options.children_objects.map((children) => children.metadata_type);
childTypesArray.push(metadatum.metadata_type);
for (let metadatumType of this.metadataTypeFilterOptions) {
if (metadatumType.enabled && childTypesArray.some((childType) => childType == metadatumType.type))
return true;
}
} else {
for (let metadatumType of this.metadataTypeFilterOptions) {
if (metadatumType.enabled && metadatum.metadata_type == metadatumType.type)
return true;
}
}
return false;
},
isCollapseOpen(metadatumId) {
return this.collapses[metadatumId] == true;
}
}
}
</script>
<style lang="scss">
#tainacan-admin-app .metadata-list-page .available-metadata-area .available-metadatum-item:hover .icon {
color: white !important;
}
.metadata-list-page {
padding-bottom: 0;
@ -603,12 +769,12 @@ export default {
flex-shrink: 1;
flex-grow: 1;
}
a.back-link{
a.back-link {
font-weight: 500;
float: right;
margin-top: 5px;
}
hr{
hr {
margin: 3px 0px 4px 0px;
height: 1px;
background-color: var(--tainacan-secondary);
@ -624,6 +790,7 @@ export default {
.column {
overflow-x: hidden;
overflow-y: auto;
padding: 0.75em 0;
&>section.field {
position: absolute;
@ -637,6 +804,9 @@ export default {
margin-right: 0;
}
}
h3 {
font-weight: 500;
}
}
.page-title {
@ -648,6 +818,50 @@ export default {
}
}
.sub-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.5em 1em 0.5em 0.5em;
.header-item {
margin-left: 0.75rem;
margin-bottom: 0px;
}
h3 {
margin-right: auto;
}
.dropdown-menu {
display: block;
div.dropdown-content {
padding: 0;
.metadata-options-container {
max-height: 288px;
overflow: auto;
font-size: 1.125em;
}
.dropdown-item {
padding: 0.25em 1.0em 0.25em 0.75em;
}
.dropdown-item span{
vertical-align: middle;
}
}
}
}
.collapse-all {
display: inline-flex;
align-items: center;
margin-left: 0.25em;
}
.collapse-all__text {
font-size: 0.75em !important;
}
.loading-spinner {
animation: spinAround 500ms infinite linear;
border: 2px solid var(--tainacan-gray2);
@ -662,7 +876,6 @@ export default {
.active-metadata-area {
font-size: 0.875em;
margin-right: 0.8em;
margin-left: -0.8em;
padding-right: 3em;
min-height: 330px;
@ -677,7 +890,7 @@ export default {
}
&.metadata-area-receive {
border: 1px dashed gray;
border: 1px dashed var(--tainacan-gray4);
}
.collapse {
@ -732,7 +945,7 @@ export default {
.controls {
font-size: 0.875em;
position: absolute;
right: 5px;
right: 10px;
top: 10px;
.switch {
position: relative;
@ -750,48 +963,35 @@ export default {
cursor: default;
background-color: var(--tainacan-white) !important;
}
&.not-focusable-item, &.not-focusable-item:hover {
&.not-focusable-item,
&.not-focusable-item:hover {
cursor: default;
.metadatum-name {
color: var(--tainacan-secondary);
}
}
&.disabled-metadatum {
&.disabled-metadatum:not(.not-sortable-item),
&.disabled-metadatum:not(.not-sortable-item):hover {
color: var(--tainacan-gray3);
}
.label-details, .not-saved {
color: var(--tainacan-gray3) !important;
}
}
}
.active-metadatum-item:not(:hover) .icon-level-identifier .tainacan-icon::before,
.active-filter-item:hover.not-sortable-item .icon-level-identifier .tainacan-icon::before {
color: var(--tainacan-gray3) !important;
}
.active-metadatum-item:hover:not(.not-sortable-item) {
background-color: var(--tainacan-secondary);
border-color: var(--tainacan-secondary);
color: var(--tainacan-white) !important;
&>.field, form {
background-color: var(--tainacan-white) !important;
}
background-color: var(--tainacan-turquoise1);
border-color: var(--tainacan-turquoise1);
.label-details, .icon, .not-saved, .icon-level-identifier>i {
color: var(--tainacan-white) !important;
.label-details, .not-saved {
color: var(--tainacan-gray4) !important;
}
.grip-icon {
color: var(--tainacan-white);
}
.switch.is-small {
input[type="checkbox"] + .check {
background-color: var(--tainacan-secondary) !important;
border: 1.5px solid white !important;
&::before { background-color: var(--tainacan-white) !important; }
}
input[type="checkbox"]:checked + .check {
border: 1.5px solid white !important;
&::before { background-color: var(--tainacan-white) !important; }
}
&:hover input[type="checkbox"] + .check {
border: 1.5px solid white !important;
background-color: var(--tainacan-secondary) !important;
}
color: var(--tainacan-secondary) !important;
}
}
.sortable-ghost {
@ -829,8 +1029,7 @@ export default {
}
h3 {
margin: 0.2em 0em 1em 0em;
font-weight: 500;
margin: 0.875em 0em 1em 0em;
}
.available-metadatum-item {
@ -915,13 +1114,13 @@ export default {
}
25% {
color: var(--tainacan-white);
background-color: #2cb4c1;
border-color: #2cb4c1;
background-color: var(--tainacan-secondary);
border-color: var(--tainacan-secondary);
}
75% {
color: var(--tainacan-white);
background-color: #2cb4c1;
border-color: #2cb4c1;
background-color: var(--tainacan-secondary);
border-color: var(--tainacan-secondary);
}
100% {
color: #222;
@ -930,10 +1129,10 @@ export default {
}
}
@keyframes hightlighten-icon {
0% { color: #b1b1b1; }
0% { color: var(--tainacan-gray3); }
25% { color: var(--tainacan-white); }
75% { color: var(--tainacan-white); }
100% { color: #b1b1b1; }
100% { color: var(--tainacan-gray3); }
}
@keyframes hightlighten-arrow {
0% {
@ -941,12 +1140,12 @@ export default {
border-color: transparent white transparent transparent;
}
25% {
border-color: transparent #2cb4c1 transparent transparent;
border-color: transparent #2cb4c1 transparent transparent;
border-color: transparent var(--tainacan-secondary) transparent transparent;
border-color: transparent var(--tainacan-secondary) transparent transparent;
}
75% {
border-color: transparent #2cb4c1 transparent transparent;
border-color: transparent #2cb4c1 transparent transparent;
border-color: transparent var(--tainacan-secondary) transparent transparent;
border-color: transparent var(--tainacan-secondary)transparent transparent;
}
100% {
border-color: transparent white transparent transparent;
@ -975,51 +1174,48 @@ export default {
}
}
.available-metadatum-item:hover {
background-color: var(--tainacan-secondary);
border-color: var(--tainacan-secondary);
color: var(--tainacan-white);
background-color: var(--tainacan-turquoise1);
border-color: var(--tainacan-turquoise2);
position: relative;
left: -4px;
&:after {
border-color: transparent var(--tainacan-secondary) transparent transparent;
border-color: transparent var(--tainacan-turquoise1) transparent transparent;
}
&:before {
border-color: transparent var(--tainacan-secondary) transparent transparent;
border-color: transparent var(--tainacan-turquoise2) transparent transparent;
}
.icon {
color: var(--tainacan-white) !important;
}
.grip-icon {
color: var(--tainacan-white);
color: var(--tainacan-secondary);
}
}
}
.inherited-metadatum {
.switch.is-small input[type="checkbox"]:checked + .check {
border: 1.5px solid var(--tainacan-blue5);
&::before { background-color: var(--tainacan-blue5); }
}
&.active-metadatum-item:hover:not(.not-sortable-item) {
background-color: var(--tainacan-blue5);
border-color: var(--tainacan-blue5);
background-color: var(--tainacan-blue1);
border-color: var(--tainacan-blue1);
.switch.is-small {
input[type="checkbox"] + .check {
background-color: var(--tainacan-blue5) !important;
}
&:hover input[type="checkbox"] + .check {
background-color: var(--tainacan-blue5) !important;
}
.grip-icon {
color: var(--tainacan-blue5) !important;
}
}
&.available-metadatum-item:hover {
background-color: var(--tainacan-blue5) !important;
border-color: var(--tainacan-blue5) !important;
background-color: var(--tainacan-blue1) !important;
border-color: var(--tainacan-blue2) !important;
.grip-icon {
color: var(--tainacan-blue5) !important;
}
&:after {
border-color: transparent var(--tainacan-blue5) transparent transparent !important;
border-color: transparent var(--tainacan-blue1) transparent transparent !important;
}
&:before {
border-color: transparent var(--tainacan-blue5) transparent transparent !important;
border-color: transparent var(--tainacan-blue2) transparent transparent !important;
}
}
}

View File

@ -79,17 +79,21 @@
:size="178"
:file="{
media_type: 'image',
thumbnails: { 'tainacan-medium': [ item.thumbnail['tainacan-medium'] ? item.thumbnail['tainacan-medium'][0] : item.thumbnail.medium[0] ] },
thumbnails: { 'tainacan-medium': [ $thumbHelper.getSrc(item['thumbnail'], 'tainacan-medium', item.document_mimetype) ] },
title: $i18n.get('label_thumbnail'),
description: `<img alt='` + $i18n.get('label_thumbnail') + `' src='` + item.thumbnail.full[0] + `'/>`
description: `<img alt='` + $i18n.get('label_thumbnail') + `' src='` + $thumbHelper.getSrc(item['thumbnail'], 'full', item.document_mimetype) + `'/>`
}"/>
<figure
v-if="item.thumbnail == undefined || ((item.thumbnail.medium == undefined || item.thumbnail.medium == false) && (item.thumbnail['tainacan-medium'] == undefined || item.thumbnail['tainacan-medium'] == false))"
class="image">
<span class="image-placeholder">{{ $i18n.get('label_empty_thumbnail') }}</span>
<span
v-if="item.document_type == 'empty'"
class="image-placeholder">
{{ $i18n.get('label_empty_thumbnail') }}
</span>
<img
:alt="$i18n.get('label_thumbnail')"
:src="thumbPlaceholderPath">
:src="$thumbHelper.getEmptyThumbnailPlaceholder(item.document_mimetype)">
</figure>
</div>
<br>
@ -346,7 +350,6 @@
itemRequestCancel: undefined,
isLoading: false,
open: true,
thumbPlaceholderPath: tainacan_plugin.base_url + '/assets/images/placeholder_square.png',
urls_open: false,
activeTab: 0
}
@ -384,7 +387,7 @@
this.fetchItem({
itemId: this.itemId,
contextEdit: true,
fetchOnly: 'title,thumbnail,status,modification_date,document_type,document,comment_status,document_as_html'
fetchOnly: 'title,thumbnail,status,modification_date,document_type,document_mimetype,document,comment_status,document_as_html'
})
.then((resp) => {
resp.request.then((item) => {

View File

@ -6,6 +6,11 @@
.icon {
color: var(--tainacan-secondary);
align-items: center;
svg {
fill: var(--tainacan-secondary);
overflow: hidden;
vertical-align: middle;
}
}
.gray-icon {
padding-right: 0 !important;
@ -54,7 +59,10 @@
&:hover { background-color: var(--tainacan-input-border-color); }
.is-small { color: var(--tainacan-info-color); }
&.is-active { background-color: var(--tainacan-primary); }
svg {
overflow: hidden;
vertical-align: middle;
}
.media {
display: flex;
align-items: center;

View File

@ -202,11 +202,16 @@
text-decoration: none !important;
}
}
img.table-thumb {
img.table-thumb,
.table-thumb>div {
max-height: 38px !important;
min-height: 38px;
max-width: 38px;
border-radius: 0px;
padding-bottom: 0px !important;
padding-left: 0px !important;
padding-right: 0px !important;
padding-top: 0px !important;
}
td.actions-cell {
padding: 0px;

View File

@ -36,7 +36,7 @@
}
.b-tabs {
.tab-content {
padding: 0.75em 1.5em;
padding: 0.75em;
}
.tabs a,
.tabs a:hover,

View File

@ -14,10 +14,10 @@
}
.repository-tooltip {
.tooltip-inner {
background: var(--tainacan-blue1) !important;
background: var(--tainacan-blue2) !important;
}
.tooltip-arrow {
border-color: var(--tainacan-blue1) !important;
border-color: var(--tainacan-blue2) !important;
}
}
.tooltip {

View File

@ -41,11 +41,7 @@
min-height: 171px;
max-height: 171px;
img {
width: 130px !important;
height: 130px !important;
}
.skeleton {
&.skeleton {
width: 130px !important;
height: 130px !important;
}
@ -105,11 +101,18 @@
opacity: 0;
visibility: hidden;
}
img {
width: 170px;
height: 170px;
/deep/ img,
/deep/ canvas {
width: 170px !important;
height: 170px !important;
border-radius: 0px;
visibility: hidden;
object-fit: cover;
object-position: center;
@media screen and (max-width: 480px) {
width: 130px !important;
height: 130px !important;
}
}
.card-thumbnail {
width: 170px;
@ -119,11 +122,9 @@
background-repeat: no-repeat;
margin: 0;
}
.skeleton {
&.skeleton {
width: 170px;
height: 170px;
position: absolute;
z-index: -1;
background-color: var(--tainacan-skeleton-color);
}
.metadata-title {

View File

@ -76,6 +76,7 @@
margin: 0 0.875em 0.875em 0.875em;
}
}
.tainacan-list-item-thumbnail,
img {
width: 170px;
height: auto;

Some files were not shown because too many files have changed in this diff Show More