Merge branch 'release/0.20.5'

This commit is contained in:
vnmedeiros 2023-11-22 17:00:27 -03:00
commit 573257fec6
153 changed files with 3805 additions and 1814 deletions

View File

@ -11,7 +11,7 @@
},
"require-dev": {
"squizlabs/php_codesniffer": "^2.2 || ^3.0.2",
"yoast/phpunit-polyfills": "^1.0.1"
"yoast/phpunit-polyfills": "^1.1.0"
},
"prefer-stable" : true,
"minimum-stability": "dev",

1325
composer.lock generated

File diff suppressed because it is too large Load Diff

43
package-lock.json generated
View File

@ -1294,6 +1294,22 @@
"regenerator-runtime": "^0.13.11"
}
},
"@babel/runtime-corejs3": {
"version": "7.23.2",
"resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.23.2.tgz",
"integrity": "sha512-54cIh74Z1rp4oIjsHjqN+WM4fMyCBYe+LpZ9jWm51CZ1fbH3SkAzQD/3XLoNkjbJ7YEmjobLXyvQrFypRHOrXw==",
"requires": {
"core-js-pure": "^3.30.2",
"regenerator-runtime": "^0.14.0"
},
"dependencies": {
"regenerator-runtime": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz",
"integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA=="
}
}
},
"@babel/template": {
"version": "7.21.9",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.21.9.tgz",
@ -3001,6 +3017,11 @@
"browserslist": "^4.21.5"
}
},
"core-js-pure": {
"version": "3.33.1",
"resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.33.1.tgz",
"integrity": "sha512-wCXGbLjnsP10PlK/thHSQlOLlLKNEkaWbTzVvHHZ79fZNeN1gUmw2gBlpItxPv/pvqldevEXFh/d5stdNvl6EQ=="
},
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
@ -4406,6 +4427,14 @@
"integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==",
"dev": true
},
"imask": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/imask/-/imask-7.1.3.tgz",
"integrity": "sha512-jZCqTI5Jgukhl2ff+znBQd8BiHOTlnFYCIgggzHYDdoJsHmSSWr1BaejcYBxsjy4ZIs8Rm0HhbOxQcobcdESRQ==",
"requires": {
"@babel/runtime-corejs3": "^7.22.6"
}
},
"import-fresh": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
@ -6982,6 +7011,11 @@
"resolved": "https://registry.npmjs.org/vue-countup-v2/-/vue-countup-v2-4.0.0.tgz",
"integrity": "sha512-XjKeHo1ndRlJtXvHd6B1eWOpbrJDdNU3rdYZwVPv2YlUXbvthsBT4kms5Fc/mn9RdXPrMX2H/ktAAQtKjWFisw=="
},
"vue-demi": {
"version": "0.14.6",
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.6.tgz",
"integrity": "sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w=="
},
"vue-eslint-parser": {
"version": "9.3.0",
"resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.3.0.tgz",
@ -7003,6 +7037,15 @@
"integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==",
"dev": true
},
"vue-imask": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/vue-imask/-/vue-imask-7.1.3.tgz",
"integrity": "sha512-WkkEwx34UjNJhN5vwgfLNgydLoqyFxBGJibT2322Extl68kW6YHQrFIusLeEZ4EVGzmv2zWhuxXxke55I2x4Dw==",
"requires": {
"imask": "^7.1.3",
"vue-demi": "^0.14.5"
}
},
"vue-loader": {
"version": "15.10.1",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.10.1.tgz",

View File

@ -31,6 +31,7 @@
"vue-apexcharts": "^1.6.2",
"vue-blurhash": "^0.1.4",
"vue-countup-v2": "^4.0.0",
"vue-imask": "^7.1.3",
"vue-router": "^3.6.5",
"vue-the-mask": "^0.11.1",
"vue2-leaflet": "^2.7.1",

View File

@ -518,141 +518,141 @@
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item:hover button:hover {
background-color: white !important;
border: 1px solid var(--tainacan-block-gray3, #a5a5a5) !important; }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-9 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-9 {
width: calc((100% / 9) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 9) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-8 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-8 {
width: calc((100% / 8) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 8) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-7 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-7 {
width: calc((100% / 7) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 7) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-6 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-6 {
width: calc((100% / 6) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 6) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-5 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-5 {
width: calc((100% / 5) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 5) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-4 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-4 {
width: calc((100% / 4) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 4) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-3 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-3 {
width: calc((100% / 3) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 3) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-2 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-2 {
width: calc((100% / 2) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 2) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-1 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-1 {
width: calc(100% - var(--spaceBetweenItems, 32px) );
min-width: calc(100% - var(--spaceBetweenItems, 32px) ); }
@media only screen and (max-width: 1686px) {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item {
width: calc(16.666% - var(--spaceBetweenItems, 32px) );
min-width: calc(16.666% - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-9 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-9 {
width: calc((100% / 8) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 8) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-8 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-8 {
width: calc((100% / 7) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 7) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-7 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-7 {
width: calc((100% / 6) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 6) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-6 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-6 {
width: calc((100% / 5) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 5) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-5 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-5 {
width: calc((100% / 4) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 4) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-4 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-4 {
width: calc((100% / 3) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 3) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-3 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-3 {
width: calc((100% / 2) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 2) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-2, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-1 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-2, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-1 {
width: calc(100% - var(--spaceBetweenItems, 32px) );
min-width: calc(100% - var(--spaceBetweenItems, 32px) ); } }
@media only screen and (max-width: 1452px) {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item {
width: calc(20% - var(--spaceBetweenItems, 32px) );
min-width: calc(20% - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-9 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-9 {
width: calc((100% / 7) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 7) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-8 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-8 {
width: calc((100% / 6) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 6) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-7 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-7 {
width: calc((100% / 5) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 5) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-6 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-6 {
width: calc((100% / 4) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 4) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-5 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-5 {
width: calc((100% / 3) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 3) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-4 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-4 {
width: calc((100% / 2) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 2) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-3, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-2, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-1 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-3, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-2, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-1 {
width: calc(100% - var(--spaceBetweenItems, 32px) );
min-width: calc(100% - var(--spaceBetweenItems, 32px) ); } }
@media only screen and (max-width: 1118px) {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item {
width: calc(25% - var(--spaceBetweenItems, 32px) );
min-width: calc(25% - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-9 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-9 {
width: calc((100% / 6) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 6) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-8 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-8 {
width: calc((100% / 5) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 5) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-7 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-7 {
width: calc((100% / 4) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 4) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-6 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-6 {
width: calc((100% / 3) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 3) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-5 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-5 {
width: calc((100% / 2) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 2) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-4, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-3, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-2, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-1 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-4, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-3, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-2, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-1 {
width: calc(100% - var(--spaceBetweenItems, 32px) );
min-width: calc(100% - var(--spaceBetweenItems, 32px) ); } }
@media only screen and (max-width: 854px) {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item {
width: calc(33.333% - var(--spaceBetweenItems, 32px) );
min-width: calc(33.333% - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-9 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-9 {
width: calc((100% / 5) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 5) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-8 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-8 {
width: calc((100% / 4) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 4) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-7 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-7 {
width: calc((100% / 3) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 3) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-6 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-6 {
width: calc((100% / 2) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 2) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-5, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-4, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-3, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-2, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-1 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-5, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-4, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-3, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-2, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-1 {
width: calc(100% - var(--spaceBetweenItems, 32px) );
min-width: calc(100% - var(--spaceBetweenItems, 32px) ); } }
@media only screen and (max-width: 584px) {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item {
width: calc(50% - var(--spaceBetweenItems, 32px) );
min-width: calc(50% - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-9 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-9 {
width: calc((100% / 4) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 4) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-8 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-8 {
width: calc((100% / 3) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 3) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-7 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-7 {
width: calc((100% / 2) - var(--spaceBetweenItems, 32px) );
min-width: calc((100% / 2) - var(--spaceBetweenItems, 32px) ); }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-6, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-5, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-4, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-3, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-2, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-1 {
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-6, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-5, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-4, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-3, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-2, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-items-per-screen-1 {
width: calc(100% - var(--spaceBetweenItems, 32px) );
min-width: calc(100% - var(--spaceBetweenItems, 32px) ); } }
.wp-block-tainacan-carousel-items-list .swiper-slide-duplicate img {

View File

@ -206,6 +206,143 @@
opacity: 0;
z-index: -1000; }
:root {
/*
--swiper-pagination-color: var(--swiper-theme-color);
--swiper-pagination-bullet-size: 8px;
--swiper-pagination-bullet-width: 8px;
--swiper-pagination-bullet-height: 8px;
--swiper-pagination-bullet-inactive-color: #000;
--swiper-pagination-bullet-inactive-opacity: 0.2;
--swiper-pagination-bullet-opacity: 1;
--swiper-pagination-bullet-horizontal-gap: 4px;
--swiper-pagination-bullet-vertical-gap: 6px;
*/ }
.swiper-pagination {
position: absolute;
text-align: center;
transition: 300ms opacity;
transform: translate3d(0, 0, 0);
z-index: 10; }
.swiper-pagination.swiper-pagination-hidden {
opacity: 0; }
.swiper-pagination-disabled > .swiper-pagination, .swiper-pagination.swiper-pagination-disabled {
display: none !important; }
/* Common Styles */
.swiper-pagination-fraction,
.swiper-pagination-custom,
.swiper-horizontal > .swiper-pagination-bullets,
.swiper-pagination-bullets.swiper-pagination-horizontal {
bottom: 10px;
left: 0;
width: 100%; }
/* Bullets */
.swiper-pagination-bullets-dynamic {
overflow: hidden;
font-size: 0; }
.swiper-pagination-bullets-dynamic .swiper-pagination-bullet {
transform: scale(0.33);
position: relative; }
.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active {
transform: scale(1); }
.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main {
transform: scale(1); }
.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev {
transform: scale(0.66); }
.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev {
transform: scale(0.33); }
.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next {
transform: scale(0.66); }
.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next {
transform: scale(0.33); }
.swiper-pagination-bullet {
width: var(--swiper-pagination-bullet-width, var(--swiper-pagination-bullet-size, 8px));
height: var(--swiper-pagination-bullet-height, var(--swiper-pagination-bullet-size, 8px));
display: inline-block;
border-radius: 50%;
background: var(--swiper-pagination-bullet-inactive-color, #000);
opacity: var(--swiper-pagination-bullet-inactive-opacity, 0.2); }
button.swiper-pagination-bullet {
border: none;
margin: 0;
padding: 0;
box-shadow: none;
appearance: none; }
.swiper-pagination-clickable .swiper-pagination-bullet {
cursor: pointer; }
.swiper-pagination-bullet:only-child {
display: none !important; }
.swiper-pagination-bullet-active {
opacity: var(--swiper-pagination-bullet-opacity, 1);
background: var(--swiper-pagination-color, var(--swiper-theme-color)); }
.swiper-vertical > .swiper-pagination-bullets,
.swiper-pagination-vertical.swiper-pagination-bullets {
right: 10px;
top: 50%;
transform: translate3d(0px, -50%, 0); }
.swiper-vertical > .swiper-pagination-bullets .swiper-pagination-bullet,
.swiper-pagination-vertical.swiper-pagination-bullets .swiper-pagination-bullet {
margin: var(--swiper-pagination-bullet-vertical-gap, 6px) 0;
display: block; }
.swiper-vertical > .swiper-pagination-bullets.swiper-pagination-bullets-dynamic,
.swiper-pagination-vertical.swiper-pagination-bullets.swiper-pagination-bullets-dynamic {
top: 50%;
transform: translateY(-50%);
width: 8px; }
.swiper-vertical > .swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet,
.swiper-pagination-vertical.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet {
display: inline-block;
transition: 200ms transform, 200ms top; }
.swiper-horizontal > .swiper-pagination-bullets .swiper-pagination-bullet,
.swiper-pagination-horizontal.swiper-pagination-bullets .swiper-pagination-bullet {
margin: 0 var(--swiper-pagination-bullet-horizontal-gap, 4px); }
.swiper-horizontal > .swiper-pagination-bullets.swiper-pagination-bullets-dynamic,
.swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic {
left: 50%;
transform: translateX(-50%);
white-space: nowrap; }
.swiper-horizontal > .swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet,
.swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet {
transition: 200ms transform, 200ms left; }
.swiper-horizontal.swiper-rtl > .swiper-pagination-bullets-dynamic .swiper-pagination-bullet {
transition: 200ms transform, 200ms right; }
/* Progress */
.swiper-pagination-progressbar {
background: rgba(0, 0, 0, 0.25);
position: absolute; }
.swiper-pagination-progressbar .swiper-pagination-progressbar-fill {
background: var(--swiper-pagination-color, var(--swiper-theme-color));
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
transform: scale(0);
transform-origin: left top; }
.swiper-rtl .swiper-pagination-progressbar .swiper-pagination-progressbar-fill {
transform-origin: right top; }
.swiper-horizontal > .swiper-pagination-progressbar, .swiper-pagination-progressbar.swiper-pagination-horizontal, .swiper-vertical > .swiper-pagination-progressbar.swiper-pagination-progressbar-opposite, .swiper-pagination-progressbar.swiper-pagination-vertical.swiper-pagination-progressbar-opposite {
width: 100%;
height: 4px;
left: 0;
top: 0; }
.swiper-vertical > .swiper-pagination-progressbar, .swiper-pagination-progressbar.swiper-pagination-vertical, .swiper-horizontal > .swiper-pagination-progressbar.swiper-pagination-progressbar-opposite, .swiper-pagination-progressbar.swiper-pagination-horizontal.swiper-pagination-progressbar-opposite {
width: 4px;
height: 100%;
left: 0;
top: 0; }
.swiper-pagination-lock {
display: none; }
.item-gallery-edit-container .tainacan-media-component .swiper-slide,
.item-gallery-edit-container .tainacan-media-component .swiper-button-prev,
.item-gallery-edit-container .tainacan-media-component .swiper-button-next {
@ -251,7 +388,9 @@
--tainacan-media-thumbs-carousel-width: 100%;
--tainacan-media-thumbs-carousel-item-size: 136px;
height: auto;
display: block;
display: flex;
flex-direction: column;
gap: 1rem;
background-color: var(--tainacan-media-background, transparent);
box-sizing: border-box; }
.tainacan-media-component:not(.alignfull):not(.alignwide) {
@ -325,7 +464,8 @@
.tainacan-media-component__swiper-main li.swiper-slide .swiper-slide-metadata {
text-align: center;
font-size: 0.875em;
margin-bottom: 1em; }
margin-bottom: 1em;
margin-top: 1rem; }
.tainacan-media-component__swiper-main li.swiper-slide .swiper-slide-metadata.hide-name .swiper-slide-metadata__name {
display: none;
visibility: hidden; }
@ -398,7 +538,7 @@
background: var(--tainacan-media-background, #ffffff);
border-radius: 3px;
word-wrap: break-word;
padding: 1rem 2rem;
padding: 0rem 2rem;
display: block; }
.tainacan-media-component__swiper-main .swiper-slide-content audio {
background: black;
@ -424,6 +564,10 @@
.tainacan-media-component__swiper-thumbs {
width: 100%;
max-width: var(--tainacan-media-thumbs-carousel-width, 100%); }
.tainacan-media-component__swiper-thumbs.swiper-is-beginning .swiper-start-border {
display: none; }
.tainacan-media-component__swiper-thumbs.swiper-is-end .swiper-end-border {
display: none; }
.tainacan-media-component__swiper-thumbs ul.swiper-wrapper {
max-width: calc(100% - var(--swiper-navigation-size, 44px) - var(--swiper-navigation-size, 44px));
margin: 0 var(--swiper-navigation-size, 44px); }
@ -654,6 +798,10 @@
max-width: calc((90vh * 9) / 16); }
.tainacan-photoswipe-layer .pswp__container .tainacan-content-embed.tainacan-embed-aspect-1-2 {
max-width: calc((90vh * 1) / 2); }
.tainacan-photoswipe-layer .pswp__container .pswp__content {
display: flex;
justify-content: center;
align-content: center; }
.tainacan-photoswipe-layer .pswp__container .pswp__content > .tainacan-content-embed:not(.attachment-without-image) {
margin-top: 60px; }
.tainacan-photoswipe-layer .pswp__container a:first-of-type,

File diff suppressed because one or more lines are too long

View File

@ -129,14 +129,14 @@
height: 1.5em;
width: 18%;
border: 2px solid var(--tainacan-input-border-color, rgba(200, 200, 200, 0.3));
border-radius: 3px;
border-radius: var(--tainacan-input-border-radius, 1px);
display: inline-block; }
.wp-block-tainacan-item-submission-form .item-submission-form-placeholder .fake-textarea {
background-color: var(--tainacan-input-background-color, rgba(200, 200, 200, 0.3));
height: 2.5em;
width: 100%;
border: 2px solid var(--tainacan-input-border-color, rgba(200, 200, 200, 0.3));
border-radius: 3px;
border-radius: var(--tainacan-input-border-radius, 1px);
display: inline-block; }
.wp-block-tainacan-item-submission-form .item-submission-form-placeholder .fake-button {
background-color: var(--tainacan-secondary, rgba(200, 200, 200, 0.3));
@ -146,7 +146,7 @@
max-width: 3.45em;
min-width: 1em;
margin-left: 6px;
border-radius: 3px;
border-radius: var(--tainacan-button-border-radius, 4px);
display: flex;
align-items: center;
margin-right: auto; }

File diff suppressed because one or more lines are too long

View File

@ -207,6 +207,17 @@ abstract class REST_Controller extends \WP_REST_Controller {
}
protected function sanitize_value($value) {
if (is_numeric($value) || empty($value) ) {
return $value;
}
$allowed_html = wp_kses_allowed_html('post');
unset($allowed_html["a"]);
return trim(wp_kses($value, $allowed_html));
}
/**
* @param $mapped
* @param $request
@ -219,6 +230,7 @@ abstract class REST_Controller extends \WP_REST_Controller {
*/
private function prepare_meta($mapped, $request, $query, $mapped_v, $args){
$request_meta_query = $request[$mapped];
$query_field_scaped = ["value", "terms"];
// if the meta/date/taxquery has a root relation
if( isset( $request_meta_query['relation']) )
@ -231,7 +243,15 @@ abstract class REST_Controller extends \WP_REST_Controller {
foreach ( $query as $mapped_meta => $meta_v ) {
if ( isset( $a[ $mapped_meta ] ) ) {
$args[ $mapped_v ][ $index1 ][ $meta_v ] = $request[ $mapped ][ $index1 ][ $mapped_meta ];
if( in_array($mapped_meta, $query_field_scaped) ) {
$valeu = is_array($request[ $mapped ][ $index1 ][ $mapped_meta ])
? array_map([$this, 'sanitize_value'], $request[ $mapped ][ $index1 ][ $mapped_meta ])
: $this->sanitize_value($request[ $mapped ][ $index1 ][ $mapped_meta ]);
$args[ $mapped_v ][ $index1 ][ $meta_v ] = $valeu;
} else {
$args[ $mapped_v ][ $index1 ][ $meta_v ] = $request[ $mapped ][ $index1 ][ $mapped_meta ];
}
}
}
@ -240,7 +260,13 @@ abstract class REST_Controller extends \WP_REST_Controller {
} else {
foreach ( $query as $mapped_meta => $meta_v ) {
if(isset($request[$mapped][$mapped_meta])) {
$args[ $mapped_v ][ $meta_v ] = $request[ $mapped ][ $mapped_meta ];
if( in_array($mapped_meta, $query_field_scaped) ) {
$args[ $mapped_v ][ $meta_v ] = is_array($request[ $mapped ][ $mapped_meta ])
? array_map([$this, 'sanitize_value'], $request[ $mapped ][ $mapped_meta ])
: $this->sanitize_value($request[ $mapped ][ $mapped_meta ]);
} else {
$args[ $mapped_v ][ $meta_v ] = $request[ $mapped ][ $mapped_meta ];
}
}
}
}
@ -405,6 +431,50 @@ abstract class REST_Controller extends \WP_REST_Controller {
* @return array
*/
protected function get_meta_queries_params(){
$metaquery_properties = array(
'key' => array(
'type' => ['integer', 'string'],
'description' => __('Custom metadata key.'),
),
'value' => array(
'type' => ['string', 'array'],
'items' => array('type' => 'string'),
'description' => __('Custom metadata value. It can be an array only when compare is IN, NOT IN, BETWEEN, or NOT BETWEEN. You dont have to specify a value when using the EXISTS or NOT EXISTS comparisons in WordPress 3.9 and up. (Note: Due to bug #23268, value is required for NOT EXISTS comparisons to work correctly prior to 3.9. You must supply some string for the value parameter. An empty string or NULL will NOT work. However, any other string will do the trick and will NOT show up in your SQL when using NOT EXISTS. Need inspiration? How about \'bug #23268\'.'),
'sanitize_callback' => 'sanitize_text_field',
),
'compare' => array(
'type' => 'string',
'description' => __('Operator to test.'),
'default' => '=',
'enum' => array(
'=',
'!=',
'>',
'>=',
'<',
'<=',
'LIKE',
'NOT LIKE',
'IN',
'NOT IN',
'BETWEEN',
'NOT BETWEEN',
'EXISTS',
'NOT EXISTS'
)
),
'relation' => array(
'type' => 'string',
'description' => __('OR or AND, how the sub-arrays should be compared.'),
'default' => 'AND',
),
'metadatumtype' => array(
'type' => 'string',
'description' => __('Custom metadata type. Possible values are NUMERIC, BINARY, CHAR, DATE, DATETIME, DECIMAL, SIGNED, TIME, UNSIGNED. Default value is CHAR. You can also specify precision and scale for the DECIMAL and NUMERIC types (for example, DECIMAL(10,5) or NUMERIC(10) are valid). The type DATE works with the compare value BETWEEN only if the date is stored at the format YYYY-MM-DD and tested with this format.'),
),
);
return array(
'metakey' => array(
'type' => ['integer', 'string'],
@ -413,6 +483,7 @@ abstract class REST_Controller extends \WP_REST_Controller {
'metavalue' => array(
'type' => ['string', 'array'],
'description' => __('Custom metadata value'),
'sanitize_callback' => 'sanitize_text_field',
),
'metavaluenum' => array(
'type' => 'number',
@ -443,50 +514,11 @@ abstract class REST_Controller extends \WP_REST_Controller {
),
'metaquery' => array(
'description' => __('Limits result set to items that have specific custom metadata'),
'type' => ['array', 'object'],
'type' => ['array', 'object',],
'properties' => $metaquery_properties,
'items' => array(
'keys' => array(
'key' => array(
'type' => 'string',
'description' => __('Custom metadata key.'),
),
'value' => array(
'type' => ['string', 'array'],
'description' => __('Custom metadata value. It can be an array only when compare is IN, NOT IN, BETWEEN, or NOT BETWEEN. You dont have to specify a value when using the EXISTS or NOT EXISTS comparisons in WordPress 3.9 and up.
(Note: Due to bug #23268, value is required for NOT EXISTS comparisons to work correctly prior to 3.9. You must supply some string for the value parameter. An empty string or NULL will NOT work. However, any other string will do the trick and will NOT show up in your SQL when using NOT EXISTS. Need inspiration? How about \'bug #23268\'.'),
),
'compare' => array(
'type' => 'string',
'description' => __('Operator to test.'),
'default' => '=',
'enum' => array(
'=',
'!=',
'>',
'>=',
'<',
'<=',
'LIKE',
'NOT LIKE',
'IN',
'NOT IN',
'BETWEEN',
'NOT BETWEEN',
'EXISTS',
'NOT EXISTS'
)
),
'relation' => array(
'type' => 'string',
'description' => __('OR or AND, how the sub-arrays should be compared.'),
'default' => 'AND',
),
'metadatumtype' => array(
'type' => 'string',
'description' => __('Custom metadata type. Possible values are NUMERIC, BINARY, CHAR, DATE, DATETIME, DECIMAL, SIGNED, TIME, UNSIGNED. Default value is CHAR. You can also specify precision and scale for the DECIMAL and NUMERIC types (for example, DECIMAL(10,5) or NUMERIC(10) are valid). The type DATE works with the compare value BETWEEN only if the date is stored at the format YYYY-MM-DD and tested with this format.'),
),
),
'type' => ['array', 'object']
'type' => 'object',
'properties' => $metaquery_properties,
),
),
'datequery' => array(
@ -586,6 +618,7 @@ abstract class REST_Controller extends \WP_REST_Controller {
),
'terms' => array(
'type' => ['integer', 'string', 'array'],
'sanitize_callback' => 'sanitize_text_field',
'description' => __('Taxonomy term(s).'),
),
'operator' => array(

View File

@ -322,7 +322,7 @@ class REST_Exporters_Controller extends REST_Controller {
'readonly' => true
],
'options_form' => [
'description' => esc_html__( 'The form to input the set set of options exporter may have its own.', 'tainacan' ),
'description' => esc_html__( 'The HTML form with a set of options that the exporter may have.', 'tainacan' ),
'type' => 'string',
'context' => array( 'view' ),
'readonly' => true
@ -472,13 +472,13 @@ class REST_Exporters_Controller extends REST_Controller {
'readonly' => true
],
'manual_mapping' => [
'description' => esc_html__( 'Wether Tainacan must present the user with an interface to manually choose a mapping standard. This will allow them to export the items mapped to a chosen standard instead of in its original form.', 'tainacan' ),
'description' => esc_html__( 'Whether Tainacan must present the user with an interface to manually choose a mapping standard. This will allow them to export the items mapped to a chosen standard instead of in its original form.', 'tainacan' ),
'type' => 'boolean',
'context' => array( 'view' ),
'readonly' => true
],
'manual_collection' => [
'description' => esc_html__( 'Wether Tainacan will let the user choose the source collection. If set to true, Tainacan give the user a select box from where he/she will Choose one (and only one) Collection to export items from. Otherwise, the child exporter class must choose the collections somehow.', 'tainacan' ),
'description' => esc_html__( 'Whether Tainacan will let the user choose the source collection. If set to true, Tainacan give the user a select box from where he/she will Choose one (and only one) Collection to export items from. Otherwise, the child exporter class must choose the collections somehow.', 'tainacan' ),
'type' => 'boolean',
'context' => array( 'view' ),
'readonly' => true

View File

@ -245,7 +245,7 @@ class REST_Facets_Controller extends REST_Controller {
],
'parent' => [
'type' => 'string',
'description' => __( 'Parent metadatum id, if the metadtumof the facet', 'tainacan' ),
'description' => __( 'Parent term id, if coming from a Taxonomy metadata type tha has hierarchy.', 'tainacan' ),
],
'total_items' => [
'type' => 'integer',

View File

@ -197,12 +197,12 @@ class REST_Filters_Controller extends REST_Controller {
$collection = $this->collection_repository->fetch( $request['collection_id'] );
if ( $collection instanceof Entities\Collection ) {
return current_user_can( 'tnc_col_' . $collection->get_id() . '_manage_filters' );
return $collection->user_can( 'edit_filters' );
}
} else {
return current_user_can( 'tnc_rep_manage_filters' );
return current_user_can( 'tnc_rep_edit_filters' );
}

View File

@ -132,7 +132,7 @@ class REST_Item_Metadata_Controller extends REST_Controller {
public function prepare_item_for_response( $item, $request ) {
$item_arr = $item->_toArray(true, true);
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();
}

View File

@ -57,13 +57,13 @@ class REST_Items_Controller extends REST_Controller {
'callback' => array($this, 'get_items'),
'permission_callback' => array($this, 'get_items_permissions_check'),
'args' => array_merge([
'collection_id' => [
'description' => __( 'Collection ID', 'tainacan' ),
'required' => true,
'collection_id' => [
'description' => __( 'Collection ID', 'tainacan' ),
'required' => true,
],
],
],
$this->get_wp_query_params()
),
$this->get_wp_query_params()
),
),
array(
'methods' => \WP_REST_Server::CREATABLE,
@ -457,6 +457,7 @@ class REST_Items_Controller extends REST_Controller {
private function prepare_filters_arguments ( $args, $collection_id = false ) {
$filters_arguments = array();
$meta_query = isset($args['meta_query']) ? $args['meta_query'] : [];
if(isset($meta_query['value'])) $meta_query = [$meta_query];
$tax_query = isset($args['tax_query']) ? $args['tax_query'] : [];
foreach($tax_query as $tax) {

View File

@ -442,7 +442,7 @@ class REST_Reports_Controller extends REST_Controller {
'list' => array()
);
$collection_id = $request['collection_id'];
$taxonomy_metadata_id = $request['metadata_id'];;
$taxonomy_metadata_id = $request['metadata_id'];
$parent_id = 0;
if ( isset($request['parent']) ) {
$parent_id = (int) $request['parent'];

View File

@ -56,7 +56,7 @@ class REST_Sequence_Edit_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item_in_sequence'),
'permission_callback' => array($this, 'sequence_edit_permissions_check'),
'args' => $this->get_sequence_params()
'args' => $this->get_sequence_index_params()
),
'schema' => [$this, 'get_sequence_index_schema']
)
@ -212,12 +212,36 @@ class REST_Sequence_Edit_Controller extends REST_Controller {
}
/**
/**
* @param string $method
*
* @return array|mixed
*/
public function get_sequence_params() {
$endpoint_args = [
'collection_id' => [
'type' => 'string',
'description' => __( 'Collection ID', 'tainacan' ),
'required' => true,
],
'group_id' => [
'type' => 'string',
'description' => __( 'Group ID', 'tainacan' ),
'required' => true,
]
];
return $endpoint_args;
}
/**
* @param string $method
*
* @return array|mixed
*/
public function get_sequence_index_params() {
$endpoint_args = [
'collection_id' => [
'type' => 'string',

View File

@ -7,10 +7,11 @@ namespace Tainacan;
class Media {
private static $instance = null;
private static $file_handle = null;
private static $file_name = null;
private $attachment_html_url_base = 'tainacan_attachment_html';
public static $content_index_meta = 'document_content_index';
public static function get_instance() {
if(!isset(self::$instance)) {
self::$instance = new self();
@ -246,10 +247,8 @@ class Media {
return;
}
$content_index_meta = 'document_content_index';
if ($file == null) {
$meta_id = update_post_meta( $item_id, $content_index_meta, null );
update_post_meta( $item_id, SELF::$content_index_meta, null );
return true;
}
@ -274,9 +273,8 @@ class Media {
$wp_charset = get_bloginfo('charset');
$content_charset = mb_detect_encoding($content);
$content = mb_convert_encoding($content, $wp_charset, $content_charset);
$meta_id = update_post_meta( $item_id, $content_index_meta, $content );
} catch(Exception $e) {
update_post_meta( $item_id, SELF::$content_index_meta, $content );
} catch(\Exception $e) {
error_log('Caught exception: ' . $e->getMessage() . "\n");
return false;
}

View File

@ -191,7 +191,7 @@ class Private_Files {
$upload_dir = wp_get_upload_dir();
$base_upload_url = preg_replace('/^https?:\/\//', '', $upload_dir['baseurl']);
$requested_uri = sanitize_text_field($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
$requested_uri = ($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
if ( strpos($requested_uri, $base_upload_url) === false ) {
// Not uploads

View File

@ -176,10 +176,16 @@ class Search_Engine {
$seperator = ' OR ';
}
if ( empty($search_meta_query) ) return '';
$content_index_meta = '';
if ( defined('TAINACAN_INDEX_PDF_CONTENT') && true === TAINACAN_INDEX_PDF_CONTENT ) {
$content_index_meta_meta_key = \TAINACAN\Media::$content_index_meta;
$content_index_meta = "OR (m.meta_key='{$content_index_meta_meta_key}')";
}
$join = \is_user_logged_in()
? ''
: " INNER JOIN $wpdb->posts pmeta ON m.meta_key = pmeta.ID AND pmeta.post_status = 'publish'";
: " INNER JOIN $wpdb->posts pmeta ON (m.meta_key = pmeta.ID AND pmeta.post_status = 'publish') $content_index_meta";
return "EXISTS (
SELECT m.post_id
FROM $wpdb->postmeta m $join

View File

@ -40,7 +40,18 @@ class Collection extends Entity {
$hide_items_thumbnail_on_lists,
$submission_anonymous_user,
$submission_default_status,
$submission_use_recaptcha;
$submission_use_recaptcha,
$item_enabled_document_types,
$item_document_label,
$item_thumbnail_label,
$item_enable_thubmnail,
$item_attachment_label,
$item_enable_attachments,
$item_enable_metadata_focus_mode,
$item_enable_metadata_required_filter,
$item_enable_metadata_searchbar,
$item_enable_metadata_collapses,
$item_enable_metadata_enumeration;
/**
* {@inheritDoc}
@ -607,14 +618,112 @@ class Collection extends Entity {
/**
* Get the default metadata section properties.
*
* @param [string] $value
*
* @return void
*/
function get_default_metadata_section_properties( ) {
return $this->get_mapped_property( 'default_metadata_section_properties' );
}
/**
* Get the enabled document types for this collection.
*
* @return array The enabled document types.
*/
function get_item_enabled_document_types() {
return $this->get_mapped_property('item_enabled_document_types');
}
/**
* Get the label for the section in this collection.
*
* @return string The label for the section.
*/
function get_item_document_label() {
return $this->get_mapped_property('item_document_label');
}
/**
* Get the label for the thumbnail section in this collection.
*
* @return string The label for the thumbnail section.
*/
function get_item_thumbnail_label() {
return $this->get_mapped_property('item_thumbnail_label');
}
/**
* Check if thumbnail are enabled for this collection.
*
* @return string 'yes' if thumbnail are enabled, 'no' otherwise.
*/
function get_item_enable_thumbnail() {
return $this->get_mapped_property('item_enable_thumbnail');
}
/**
* Get the label for the attachment section in this collection.
*
* @return string The label for the attachment section.
*/
function get_item_attachment_label() {
return $this->get_mapped_property('item_attachment_label');
}
/**
* Check if attachments are enabled for this collection.
*
* @return string 'yes' if attachments are enabled, 'no' otherwise.
*/
function get_item_enable_attachments() {
return $this->get_mapped_property('item_enable_attachments');
}
/**
* Check if metadata focus mode is enabled for this collection.
*
* @return string 'yes' if metadata focus mode is enabled, 'no' otherwise.
*/
function get_item_enable_metadata_focus_mode() {
return $this->get_mapped_property('item_enable_metadata_focus_mode');
}
/**
* Check if metadata required filter is enabled for this collection.
*
* @return string 'yes' if metadata required filter is enabled, 'no' otherwise.
*/
function get_item_enable_metadata_required_filter() {
return $this->get_mapped_property('item_enable_metadata_required_filter');
}
/**
* Check if metadata search bar is enabled for this collection.
*
* @return string 'yes' if metadata search bar is enabled, 'no' otherwise.
*/
function get_item_enable_metadata_searchbar() {
return $this->get_mapped_property('item_enable_metadata_searchbar');
}
/**
* Check if metadata collapses are enabled for this collection.
*
* @return bool 'yes' if metadata collapses are enabled, 'no' otherwise.
*/
function get_item_enable_metadata_collapses() {
return $this->get_mapped_property('item_enable_metadata_collapses');
}
/**
* Check if metadata and metadata section should be enumerated in the edition form.
*
* @return bool 'yes' if metadata are enumerated, 'no' otherwise.
*/
function get_item_enable_metadata_enumeration() {
return $this->get_mapped_property('item_enable_metadata_enumeration');
}
// Setters
/**
* Set the collection name
*
@ -750,7 +859,7 @@ class Collection extends Entity {
* @return void
*/
function set_metadata_section_order( $value ) {
if( !empty($value) ) {
if( !empty( $value ) ) {
$metadata_order = array( );
foreach($value as $section) {
$metadata_order = array_merge($metadata_order, $section['metadata_order']);
@ -888,6 +997,117 @@ class Collection extends Entity {
return $this->set_mapped_property( 'default_metadata_section_properties', $value);
}
/**
* Set the enabled document types for this collection.
*
* @param array $value The enabled document types.
* @return void
*/
function set_item_enabled_document_types( $value ) {
$this->set_mapped_property('item_enabled_document_types', $value);
}
/**
* Set the label for the document section in this collection.
*
* @param string $value The label for the document section.
* @return void
*/
function set_item_document_label( $value ) {
$this->set_mapped_property('item_document_label', $value);
}
/**
* Set the label for the thumbnail section in this collection.
*
* @param string $value The label for the thumbnail section.
* @return void
*/
function set_item_thumbnail_label( $value ) {
$this->set_mapped_property('item_thumbnail_label', $value);
}
/**
* Enable or disable thumbnail for this collection.
*
* @param string $value 'yes' to enable thumbnail, 'no' to disable.
* @return void
*/
function set_item_enable_thumbnail( $value ) {
$this->set_mapped_property('item_enable_thumbnail', $value);
}
/**
* Set the label for the attachment section in this collection.
*
* @param string $value The label for the attachment section.
* @return void
*/
function set_item_attachment_label( $value ) {
$this->set_mapped_property('item_attachment_label', $value);
}
/**
* Enable or disable attachments for this collection.
*
* @param string $value 'yes' to enable attachments, 'no' to disable.
* @return void
*/
function set_item_enable_attachments( $value ) {
$this->set_mapped_property('item_enable_attachments', $value);
}
/**
* Enable or disable metadata focus mode for this collection.
*
* @param string $value 'yes' to enable metadata focus mode, 'no' to disable.
* @return void
*/
function set_item_enable_metadata_focus_mode( $value ) {
$this->set_mapped_property('item_enable_metadata_focus_mode', $value);
}
/**
* Enable or disable metadata required filter for this collection.
*
* @param string $value 'yes' to enable metadata required filter, 'no' to disable.
* @return void
*/
function set_item_enable_metadata_required_filter( $value ) {
$this->set_mapped_property('item_enable_metadata_required_filter', $value);
}
/**
* Enable or disable metadata search bar for this collection.
*
* @param string $value 'yes' to enable metadata search bar, 'no' to disable.
* @return void
*/
function set_item_enable_metadata_searchbar( $value ) {
$this->set_mapped_property('item_enable_metadata_searchbar', $value);
}
/**
* Enable or disable metadata collapses for this collection.
*
* @param string $value 'yes' to enable metadata collapses, 'no' to disable.
* @return void
*/
function set_item_enable_metadata_collapses( $value ) {
$this->set_mapped_property('item_enable_metadata_collapses', $value);
}
/**
* Enable or disable metadata and metadata sections enumeration for the item edition form this collection.
*
* @param string $value 'yes' to enable metadata enumeration, 'no' to disable.
* @return void
*/
function set_item_enable_metadata_enumeration( $value ) {
$this->set_mapped_property('item_enable_metadata_enumeration', $value);
}
/**
* Validate Collection
*

View File

@ -40,7 +40,7 @@ class Entity {
public $WP_Post;
/**
* Indicates wether an entity was validated, calling the validate() method
* Indicates whether an entity was validated, calling the validate() method
*
* Entities MUST be validated before attempt to save
*

View File

@ -19,7 +19,8 @@ class Filter extends Entity {
$max_options,
$filter_type,
$filter_type_options,
$begin_with_filter_collapsed;
$begin_with_filter_collapsed,
$display_in_repository_level_lists;
static $post_type = 'tainacan-filter';
public $enabled_for_collection = true;
@ -179,6 +180,15 @@ class Filter extends Entity {
return $this->get_mapped_property('begin_with_filter_collapsed');
}
/**
* Return 'yes' or 'no' to the option of display in repository level lists
*
* @return string
*/
public function get_display_in_repository_level_lists() {
return $this->get_mapped_property('display_in_repository_level_lists');
}
/**
* Define the filter name
@ -252,6 +262,15 @@ class Filter extends Entity {
$this->set_mapped_property('begin_with_filter_collapsed', $begin_with_filter_collapsed);
}
/**
* Tells if filter should appear in repository level lists, even belonging to a collection
*
* @param string $display_in_repository_level_lists
*/
public function set_display_in_repository_level_lists($display_in_repository_level_lists) {
$this->set_mapped_property('display_in_repository_level_lists', $display_in_repository_level_lists);
}
/**
* Transient property used to store the status of the filter for a particular collection
*

View File

@ -417,7 +417,7 @@ class Item_Metadata_Entity extends Entity {
}
/**
* Check wether the item has a value stored in the database or not
* Check whether the item has a value stored in the database or not
*
* @return bool
*/

View File

@ -307,7 +307,9 @@ 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());
$comment_status = $this->get_mapped_property('comment_status');
$comment_status_filtered = apply_filters('comments_open', $comment_status == 'open', $this->get_id()) == true ? 'open' : 'closed';
return $comment_status_filtered;
}
/**
@ -537,7 +539,7 @@ class Item extends Entity {
*
* @type bool $exclude_core Exclude Core Metadata (title and description) from result. Default false
*
* @type bool $hide_empty Wether to hide or not metadata the item has no value to
* @type bool $hide_empty Whether to hide or not metadata the item has no value to
* Default: true
* @type string $empty_value_message Message string to display if $hide_empty is false and there is not metadata value.
* Default: ''
@ -707,7 +709,7 @@ class Item extends Entity {
* @param array|string $args {
* Optional. Array or string of arguments.
*
* @type bool $hide_empty Wether to hide or not metadata the item has no value to
* @type bool $hide_empty Whether to hide or not metadata the item has no value to
* Default: true
* @type string $empty_value_message Message string to display if $hide_empty is false and there is not metadata value.
* Default: ''
@ -780,9 +782,16 @@ class Item extends Entity {
// Renders the metadatum name
$metadatum_title_before = $args['before_title'];
$metadatum_title_before = apply_filters( 'tainacan-get-item-metadatum-as-html-before-title', $metadatum_title_before, $item_metadatum );
$metadatum_status_info = '';
if ( $item_metadatum->get_metadatum()->get_status() != 'publish' ) {
$metadatum_status_object = get_post_status_object( $item_metadatum->get_metadatum()->get_status() );
$metadatum_status_info = ( $metadatum_status_object && $metadatum_status_object->label ? __( $metadatum_status_object->label, 'tainacan') : $item_metadatum->get_metadatum()->get_status() ) . ': ';
}
$metadatum_title_after = $args['after_title'];
$metadatum_title_after = apply_filters( 'tainacan-get-item-metadatum-as-html-after-title', $metadatum_title_after, $item_metadatum );
$return .= $metadatum_title_before . $item_metadatum->get_metadatum()->get_name() . $metadatum_title_after;
$return .= $metadatum_title_before . $metadatum_status_info . $item_metadatum->get_metadatum()->get_name() . $metadatum_title_after;
// Renders the metadatum value
$metadatum_value_before = $args['before_value'];
@ -982,7 +991,7 @@ class Item extends Entity {
*
* @type bool $hide_description Do not display the Metadata Section description. Default true
*
* @type bool $hide_empty Wether to hide or not metadata sections if there are no metadata list or they are empty
* @type bool $hide_empty Whether to hide or not metadata sections if there are no metadata list or they are empty
* Default: true
* @type string $empty_metadata_list_message Message string to display if $hide_empty is false and there is not metadata section metadata list.
* Default: ''
@ -1142,7 +1151,7 @@ class Item extends Entity {
*
* @type bool $hide_description Do not display the Metadata Section description. Default true
*
* @type bool $hide_empty Wether to hide or not metadata sections if there are no metadata list or they are empty
* @type bool $hide_empty Whether to hide or not metadata sections if there are no metadata list or they are empty
* Default: true
* @type string $empty_metadata_list_message Message string to display if $hide_empty is false and there is not metadata section metadata list.
* Default: ''
@ -1176,13 +1185,15 @@ class Item extends Entity {
if ( $metadata_section->is_conditional_section() ) {
$rules = $metadata_section->get_conditional_section_rules();
$item_id = $this->get_id();
if( !empty($rules) ) {
$item_id = $this->get_id();
foreach ( $rules as $meta_id => $meta_values_conditional ) {
foreach ( $rules as $meta_id => $meta_values_conditional ) {
$meta_values = get_post_meta( $item_id, $meta_id );
if (!array_intersect($meta_values, $meta_values_conditional))
return $return;
$meta_values = get_post_meta( $item_id, $meta_id );
if (!array_intersect($meta_values, $meta_values_conditional))
return $return;
}
}
}

View File

@ -271,7 +271,7 @@ class Taxonomy extends Entity {
*
* @param string $term_name The term name
* @param int|null $parent The ID of the parent term to look for children or null to look for terms in any hierarchical position. Default is null
* @param bool $return_term wether to return the term object if it exists. default is to false
* @param bool $return_term whether to return the term object if it exists. default is to false
*
* @return bool|WP_Term return boolean indicating if term exists. If $return_term is true and term exists, return WP_Term object
*/

View File

@ -13,7 +13,7 @@ class CSV extends Exporter {
$this->accept_no_mapping = true;
if ($current_collection = $this->get_current_collection_object()) {
$name = $current_collection->get_name();
$this->collection_name = sanitize_title($name) . "_csv_export.csv";;
$this->collection_name = sanitize_title($name) . "_csv_export.csv";
} else {
$this->collection_name = "csv_export.csv";
}
@ -285,13 +285,13 @@ class CSV extends Exporter {
$current_user = wp_get_current_user();
$author_name = $current_user->user_login;
$message = __('target collections:', 'tainacan');
$message = __('Target collections:', 'tainacan');
$message .= " <b>" . implode(", ", $this->get_collections_names() ) . "</b><br/>";
$message .= __('Exported by:', 'tainacan');
$message .= " <b> $author_name </b><br/>";
$message .= __('Your CSV file is ready! Access it in the link below:', 'tainacan');
$message .= '<br/><br/>';
$message .= '<a href="' . $file['url'] . '">Download</a>';
$message .= '<a target="_blank" href="' . $file['url'] . '">Download</a>';
return $message;

View File

@ -124,14 +124,14 @@ abstract class Exporter {
*
* Add and remove transient data using add_transient() and delete_transient() methods
*
* Transitens can be strings, numbers or arrays. Avoid storing objects.
* Transients can be strings, numbers or arrays. Avoid storing objects.
*
* @var array
*/
protected $transients = [];
/**
* Wether to abort importer/exporter execution.
* Whether to abort importer/exporter execution.
* @var bool
*/
protected $abort = false;
@ -386,7 +386,7 @@ abstract class Exporter {
}
/**
* Return wether importer should abort execution or not
* Return whether importer should abort execution or not
* @return bool
*/
public function get_abort() {

View File

@ -177,7 +177,7 @@ abstract class Generic_Process {
}
/**
* Return wether importer should abort execution or not
* Return whether importer should abort execution or not
* @return bool
*/
public function get_abort() {

View File

@ -115,7 +115,7 @@ class Importer_Handler {
* @type string $slug A unique slug for the importer. e.g. 'This is an example importer description'
* @type string $description The importer description. e.g. 'example-importer'
* @type string $class_name The Importer Class. e.g. '\Tainacan\Importer\Test_Importer'
* @type bool $manual_mapping Wether Tainacan must present the user with an interface to manually map
* @type bool $manual_mapping Whether Tainacan must present the user with an interface to manually map
* the metadata from the source to the target collection.
*
* If set to true, Importer Class must implement the method
@ -123,7 +123,7 @@ class Importer_Handler {
*
* Note that this will only work when importing items to one single collection.
*
* @type bool $manual_collection Wether Tainacan will let the user choose a destination collection.
* @type bool $manual_collection Whether Tainacan will let the user choose a destination collection.
*
* If set to true, the API endpoints will handle Collection creation and will assign it to
* the importer object using add_collection() method.

View File

@ -93,7 +93,7 @@ abstract class Importer {
*
* Add and remove transient data using add_transient() and delete_transient() methods
*
* Transitens can be strings, numbers or arrays. Avoid storing objects.
* Transients can be strings, numbers or arrays. Avoid storing objects.
*
* @var array
*/
@ -484,7 +484,7 @@ abstract class Importer {
}
/**
* Return wether importer should abort execution or not
* Return whether importer should abort execution or not
* @return bool
*/
public function get_abort() {

View File

@ -330,6 +330,141 @@ class Collections extends Repository {
]
]
],
'item_enabled_document_types' => [
'map' => 'meta',
'title' => __( 'Enabled document types', 'tainacan' ),
'type' => 'object',
'description' => __( 'The document types that are available in the item edition form.', 'tainacan' ),
'items' => [
'type' => 'object',
'properties' => [
'enabled' => [
'description' => __( 'Whether the document type is enabled or not.', 'tainacan' ),
'type' => 'string',
'enum' => [ 'yes', 'no' ],
],
'label' => [
'description' => __( 'The label that will represent the document type.', 'tainacan' ),
'type' => 'string',
],
'icon' => [
'description' => __( 'The slug of the icon that will represent the document type.', 'tainacan' ),
'type' => 'string',
],
]
],
'default' => [
'attachment' => [
'enabled' => 'yes',
'label' => __( 'File', 'tainacan' ),
'icon' => 'attachments'
],
'url' => [
'enabled' => 'yes',
'label' => __('URL', 'tainacan' ),
'icon' => 'url'
],
'text' => [
'enabled' => 'yes',
'label' => __('Text', 'tainacan' ),
'icon' => 'text'
]
]
],
'item_document_label' => [
'map' => 'meta',
'title' => __( 'Main document label', 'tainacan' ),
'type' => 'string',
'description' => __( 'The label for the main document section in the item edition form', 'tainacan' ),
'default' => __( 'Document', 'tainacan' ),
//'validation' => v::stringType(),
],
'item_thumbnail_label' => [
'map' => 'meta',
'title' => __( 'Thumbnail label', 'tainacan' ),
'type' => 'string',
'description' => __( 'The label for the thumbnail section in the item edition form', 'tainacan' ),
'default' => __( 'Thumbnail', 'tainacan' ),
//'validation' => v::stringType(),
],
'item_enable_thumbnail' => [
'map' => 'meta',
'title' => __( 'Item thumbnail', 'tainacan' ),
'type' => 'string',
'description' => __( 'If enabled, each item can have a thumbnail customized instead of the one automatically generated based on the item document.', 'tainacan' ),
'default' => 'yes',
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
'enum' => [ 'yes', 'no' ],
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
],
'item_attachment_label' => [
'map' => 'meta',
'title' => __( 'Attachments label', 'tainacan' ),
'type' => 'string',
'description' => __( 'The label for the attachments section in the item edition form', 'tainacan' ),
'default' => __( 'Attachments', 'tainacan' ),
//'validation' => v::stringType(),
],
'item_enable_attachments' => [
'map' => 'meta',
'title' => __( 'Item attachments', 'tainacan' ),
'type' => 'string',
'description' => __( 'If enabled, each item can have a set of files attached to it, complementary to the item document.', 'tainacan' ),
'default' => 'yes',
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
'enum' => [ 'yes', 'no' ],
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
],
'item_enable_metadata_focus_mode' => [
'map' => 'meta',
'title' => __( 'Metadata focus mode', 'tainacan' ),
'type' => 'string',
'description' => __( 'If enabled, a button can start a special navigation mode, that focus one metadatum per time in the item edition form.', 'tainacan' ),
'default' => 'yes',
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
'enum' => [ 'yes', 'no' ],
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
],
'item_enable_metadata_required_filter' => [
'map' => 'meta',
'title' => __( 'Metadata required filter', 'tainacan' ),
'type' => 'string',
'description' => __( 'If enabled, a switch can be toggled to display only required metadata in the item edition form.', 'tainacan' ),
'default' => 'yes',
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
'enum' => [ 'yes', 'no' ],
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
],
'item_enable_metadata_searchbar' => [
'map' => 'meta',
'title' => __( 'Metadata search bar', 'tainacan' ),
'type' => 'string',
'description' => __( 'If enabled, a search bar can be used for filtering the list of metadata in the item edition form.', 'tainacan' ),
'default' => 'yes',
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
'enum' => [ 'yes', 'no' ],
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
],
'item_enable_metadata_collapses' => [
'map' => 'meta',
'title' => __( 'Metadata collapses', 'tainacan' ),
'type' => 'string',
'description' => __( 'If enabled, each metadata in the item form will be wrapped in a collapsable component.', 'tainacan' ),
'default' => 'yes',
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
'enum' => [ 'yes', 'no' ],
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
],
'item_enable_metadata_enumeration' => [
'map' => 'meta',
'title' => __( 'Metadata enumeration', 'tainacan' ),
'type' => 'string',
'description' => __( 'If enabled, the metadata sections and their metadata in the item form will be enumerated automatically.', 'tainacan' ),
'default' => 'no',
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
'enum' => [ 'yes', 'no' ],
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
]
] );
}

View File

@ -79,6 +79,16 @@ class Filters extends Repository {
'enum' => [ 'yes', 'no' ],
'default' => 'no'
],
'display_in_repository_level_lists' => [
'map' => 'meta',
'title' => __( 'Display in repository level lists', 'tainacan' ),
'type' => 'string',
'description' => __( 'With this option enabled, the filter will appear even in repository level items lists, such as the complete items list and the term items list.', 'tainacan' ),
'on_error' => __( 'Please set the "Display in repository level lists" value as "yes" or "no"', 'tainacan' ),
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
'enum' => [ 'yes', 'no' ],
'default' => 'no'
],
'collection_id' => [
'map' => 'meta',
'title' => __( 'Collection', 'tainacan' ),

View File

@ -103,7 +103,7 @@ class Items extends Repository {
'map' => 'meta',
'title' => __( 'Document', 'tainacan' ),
'type' => 'string',
'description' => __( 'The document itself. An ID in case of attachment, an URL in case of link or a text in the case of text.', 'tainacan' ),
'description' => __( 'The item main content. May be a file attached, an URL or a text depending on the type of the document.', 'tainacan' ),
'on_error' => __( 'Invalid document', 'tainacan' ),
'default' => ''
],
@ -189,11 +189,12 @@ class Items extends Repository {
* @see \Tainacan\Repositories\Repository::register_post_type()
*/
public function register_post_type() {
$Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance();
$Tainacan_Taxonomies = \Tainacan\Repositories\Taxonomies::get_instance();
$collections = $Tainacan_Collections->fetch( [], 'OBJECT' );
// TODO: This can be a problem in large repositories.
$collections = $Tainacan_Collections->fetch( ['nopaging' => true], 'OBJECT' );
$taxonomies = $Tainacan_Taxonomies->fetch( [
'status' => [
'auto-draft',
@ -220,7 +221,7 @@ class Items extends Repository {
}
// register taxonomies to collections considering metadata inheritance
$Tainacan_Taxonomies->register_taxonomies_for_all_collections();
$Tainacan_Taxonomies->register_taxonomies_for_all_collections($collections);
}
@ -582,11 +583,11 @@ class Items extends Repository {
/**
* Return if comment are open for this item (post_id) and the collection too
*
* @param bool $open_comment
* @param bool $comments_open
* @param integer $post_id Item id
* @return bool
*/
public function hook_comments_open($open_comment, $post_id) {
public function hook_comments_open($comments_open, $post_id) {
$item = self::get_entity_by_post($post_id);
if($item != false && $item instanceof Entities\Item) {
@ -594,7 +595,7 @@ class Items extends Repository {
if( $collection != null && $collection->get_allow_comments() !== 'open' ) return false;
}
return $open_comment;
return $comments_open;
}
/**

View File

@ -661,7 +661,7 @@ class Metadata extends Repository {
*
* @param array $result Response from method fetch_by_collection
* @param Entities\Collection $collection
* @param bool $include_disabled Wether to include disabled metadata in the results or not
* @param bool $include_disabled Whether to include disabled metadata in the results or not
*
* @return array
*/
@ -737,8 +737,8 @@ class Metadata extends Repository {
public function insert( $metadatum ) {
$this->pre_update_taxonomy_metadatum( $metadatum );
$new_metadatum = parent::insert( $metadatum );
$this->update_taxonomy_metadatum( $new_metadatum );
$this->update_metadata_type_index( $new_metadatum );
$this->update_taxonomy_metadatum( $new_metadatum );
return $new_metadatum;
}
@ -1426,6 +1426,7 @@ class Metadata extends Repository {
'parent' => $r->parent,
'total_items' => $total_items,
'type' => 'Taxonomy',
'description' => term_description($r->term_id),
'hierarchy_path' => get_term_parents_list($r->term_id, $taxonomy_slug, ['format'=>'name', 'separator'=>$separator, 'link'=>false, 'inclusive'=>false])
];

View File

@ -336,21 +336,41 @@ class Taxonomies extends Repository {
}
public function register_taxonomies_for_all_collections() {
public function register_taxonomies_for_all_collections($all_collections = null) {
global $wpdb;
$Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance();
// TODO: This can be a problem in large repositories.
$collections = $Tainacan_Collections->fetch( ['nopaging' => true], 'OBJECT' );
$collections = $all_collections != null ? $all_collections : $Tainacan_Collections->fetch( ['nopaging' => true], 'OBJECT' );
if ( ! is_array( $collections ) ) {
return;
}
// register taxonomies to other collections considering metadata inheritance
foreach ( $collections as $collection ) {
$taxonomies = $this->fetch_by_collection($collection, ['nopaging' => true]);
foreach ( $taxonomies as $taxonomy ) {
register_taxonomy_for_object_type( $taxonomy->get_db_identifier(), $collection->get_db_identifier() );
$taxonomies_res = $wpdb->get_results("
SELECT
meta.post_id as meta_id, meta.meta_value as tax_id, col.meta_value as collection_id
FROM
$wpdb->postmeta meta INNER JOIN (
SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key='collection_id'
) as col ON meta.post_id = col.post_id
WHERE
meta.meta_key='_option_taxonomy_id'
AND meta.post_id IN (SELECT post_id FROM $wpdb->postmeta WHERE meta_key='metadata_type' and meta_value='Tainacan\\\Metadata_Types\\\Taxonomy');
");
foreach ($taxonomies_res as $tax_res) {
// Aqui você pode acessar os valores de cada coluna
$tax_id = $tax_res->tax_id;
$collection_id = $tax_res->collection_id;
$tax_db_identifier_by_id = $this->get_db_identifier_by_id($tax_id);
if ($collection_id != 'default' ) {
$collection_slug = Entities\Collection::$db_identifier_prefix . $collection_id . Entities\Collection::$db_identifier_sufix;
register_taxonomy_for_object_type($tax_db_identifier_by_id ,$collection_slug);
} else {
foreach ( $collections as $collection ) {
register_taxonomy_for_object_type($tax_db_identifier_by_id, $collection->get_db_identifier());
}
}
}
}
@ -378,7 +398,7 @@ class Taxonomies extends Repository {
* @param Entities\Taxonomy $taxonomy The taxonomy object where to look for terms
* @param string $term_name The term name
* @param int|null $parent The ID of the parent term to look for children or null to look for terms in any hierarchical position. Default is null
* @param bool $return_term wether to return the term object if it exists. default is to false
* @param bool $return_term whether to return the term object if it exists. default is to false
*
* @return bool|WP_Term return boolean indicating if term exists. If $return_term is true and term exists, return WP_Term object
*/

View File

@ -305,7 +305,7 @@ class Terms extends Repository {
* @param string $searched_term The term name (string) or term_id (integer). If term id is passed, parent is not considered.
* @param mixed $taxonomy The taxonomy ID, slug or Entity.
* @param int $parent The ID of the parent term to look for children or null to look for terms in any hierarchical position. Default is null
* @param bool $return_term wether to return the term object if it exists. default is to false
* @param bool $return_term whether to return the term object if it exists. default is to false
*
* @return bool|WP_Term return boolean indicating if term exists. If $return_term is true and term exists, return WP_Term object
*/

View File

@ -69,7 +69,7 @@ class Theme_Helper {
$this->register_view_mode('table', [
'label' => __('Table', 'tainacan'),
'description' => 'The classic table display.',
'description' => __('The classic table display.', 'tainacan'),
'dynamic_metadata' => true,
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewtable tainacan-icon-1-25em"></i></span>',
'type' => 'component',
@ -79,7 +79,7 @@ class Theme_Helper {
$this->register_view_mode('cards', [
'label' => __('Cards', 'tainacan'),
'dynamic_metadata' => false,
'description' => 'A cards view, displaying cropped thumbnails, title and description.',
'description' => __('A cards view, displaying cropped thumbnails, title and description.', 'tainacan'),
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewcards tainacan-icon-1-25em"></i></span>',
'type' => 'component',
'implements_skeleton' => true,
@ -88,7 +88,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.', 'tainacan'),
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewrecords tainacan-icon-1-25em"></i></span>',
'type' => 'component',
'implements_skeleton' => true,
@ -97,7 +97,7 @@ class Theme_Helper {
$this->register_view_mode('masonry', [
'label' => __('Masonry', 'tainacan'),
'dynamic_metadata' => false,
'description' => 'A masonry view, similar to pinterest, which will display images without cropping.',
'description' => __('A masonry view, similar to pinterest, which will display images without cropping.', 'tainacan'),
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewmasonry tainacan-icon-1-25em"></i></span>',
'type' => 'component',
'implements_skeleton' => true
@ -105,7 +105,7 @@ class Theme_Helper {
$this->register_view_mode('slideshow', [
'label' => __('Slides', 'tainacan'),
'dynamic_metadata' => false,
'description' => 'A fullscreen slideshow view, that shows the item document instead of just thumbnails.',
'description' => __('A fullscreen slideshow view, that shows the item document instead of just thumbnails.', 'tainacan'),
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewgallery tainacan-icon-1-25em"></i></span>',
'type' => 'component',
'show_pagination' => false,
@ -114,7 +114,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.', 'tainacan'),
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewlist tainacan-icon-1-25em"></i></span>',
'type' => 'component',
'implements_skeleton' => true,
@ -123,7 +123,7 @@ class Theme_Helper {
$this->register_view_mode('map', [
'label' => __('Map', 'tainacan'),
'dynamic_metadata' => true,
'description' => 'A map view, for displaying items that have geocoordinate metadata.',
'description' => __('A map view, for displaying items that have geocoordinate metadata.', 'tainacan'),
'icon' => '<span class="icon">
<i>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="var(--tainacan-info-color, #505253)" width="1.25em" height="1.25em">
@ -757,12 +757,12 @@ class Theme_Helper {
* Default view-mode-{$slug}
* @type string $thumbnail Full URL to an thumbnail that represents the view mode. Displayed in admin.
* @type string $icon HTML that outputs an icon that represents the view mode. Displayed in front end.
* @type bool $show_pagination Wether to display or not pagination controls. Default true.
* @type bool $full_screen Wether the view mode will display full screen or not. Default false.
* @type bool $dynamic_metadata Wether to display or not (and use or not) the "displayed metadata" selector. Default false.
* @type bool $implements_skeleton Wether the view mode has its own strategy for disaplying loading state.
* @type bool $show_pagination Whether to display or not pagination controls. Default true.
* @type bool $full_screen Whether the view mode will display full screen or not. Default false.
* @type bool $dynamic_metadata Whether to display or not (and use or not) the "displayed metadata" selector. Default false.
* @type bool $implements_skeleton Whether the view mode has its own strategy for disaplying loading state.
* @type string $skeleton_template If the view mode is a template, this is the html of its loading state.
* @type bool $required_thumbnail Wether the view mode considers essential that the item thumbnail is available, even if it is a placeholder.
* @type bool $required_thumbnail Whether the view mode considers essential that the item thumbnail is available, even if it is a placeholder.
* }
*
* @return void
@ -1614,6 +1614,48 @@ class Theme_Helper {
$wrapper_attributes .= 'class="tainacan-media-component"';
}
/**
* Filters the Swiper options for the main slider
*
* @param Object item The current item object
* @param Object args Arguments passed to the get_tainacan_item_gallery function
*/
$extra_swiper_main_options = [];
$extra_swiper_main_options = apply_filters( 'tainacan-swiper-main-options', $extra_swiper_main_options, $item, $args );
$swiper_main_options = array_merge(
$extra_swiper_main_options,
$layout_elements['main'] ? array(
'navigation' => array(
'nextEl' => sprintf('.swiper-navigation-next_tainacan-item-gallery-block_id-%s-main', $block_id),
'prevEl' => sprintf('.swiper-navigation-prev_tainacan-item-gallery-block_id-%s-main', $block_id),
'preloadImages' => false,
'lazy' => true
)
) : []
);
/**
* Filters the Swiper options for the thumbnails slider
*
* @param Object item The current item object
* @param Object args Arguments passed to the get_tainacan_item_gallery function
*/
$extra_swiper_thumbs_options = [];
$extra_swiper_thumbs_options = apply_filters( 'tainacan-swiper-thumbs-options', $extra_swiper_thumbs_options, $item, $args );
$swiper_thumbs_options = array_merge(
$extra_swiper_thumbs_options,
( $layout_elements['thumbnails'] && !$layout_elements['main'] ) ? array(
'navigation' => array(
'nextEl' => sprintf('.swiper-navigation-next_tainacan-item-gallery-block_id-%s-thumbs', $block_id),
'prevEl' => sprintf('.swiper-navigation-prev_tainacan-item-gallery-block_id-%s-thumbs', $block_id),
'preloadImages' => false,
'lazy' => true
)
) : []
);
return tainacan_get_the_media_component(
'tainacan-item-gallery-block_id-' . $block_id,
$layout_elements['thumbnails'] ? $media_items_thumbnails : null,
@ -1622,22 +1664,8 @@ class Theme_Helper {
'wrapper_attributes' => $wrapper_attributes,
'class_main_div' => '',
'class_thumbs_div' => '',
'swiper_main_options' => $layout_elements['main'] ? array(
'navigation' => array(
'nextEl' => sprintf('.swiper-navigation-next_tainacan-item-gallery-block_id-%s-main', $block_id),
'prevEl' => sprintf('.swiper-navigation-prev_tainacan-item-gallery-block_id-%s-main', $block_id),
'preloadImages' => false,
'lazy' => true
)
) : '',
'swiper_thumbs_options' => ( $layout_elements['thumbnails'] && !$layout_elements['main'] ) ? array(
'navigation' => array(
'nextEl' => sprintf('.swiper-navigation-next_tainacan-item-gallery-block_id-%s-thumbs', $block_id),
'prevEl' => sprintf('.swiper-navigation-prev_tainacan-item-gallery-block_id-%s-thumbs', $block_id),
'preloadImages' => false,
'lazy' => true
)
) : '',
'swiper_main_options' => $swiper_main_options,
'swiper_thumbs_options' => $swiper_thumbs_options,
'swiper_arrows_as_svg' => $show_arrows_as_svg,
'disable_lightbox' => !$open_lightbox_on_click,
'hide_media_name' => $hide_file_name_lightbox,
@ -1667,7 +1695,7 @@ class Theme_Helper {
* @type bool $exclude_title Exclude the Core Title Metadata from result. Default false
* @type bool $exclude_description Exclude the Core Description Metadata from result. Default false
* @type bool $exclude_core Exclude Core Metadata (title and description) from result. Default false
* @type bool $hide_empty Wether to hide or not metadata the item has no value to
* @type bool $hide_empty Whether to hide or not metadata the item has no value to
* Default: true
* @type string $empty_value_message Message string to display if $hide_empty is false and there is not metadata value. Default ''
* @type string $before String to be added before each metadata block

View File

@ -23,7 +23,7 @@ use \Tainacan\Repositories;
* @type bool $exclude_title Exclude the Core Title Metadata from result. Default false
* @type bool $exclude_description Exclude the Core Description Metadata from result. Default false
* @type bool $exclude_core Exclude Core Metadata (title and description) from result. Default false
* @type bool $hide_empty Wether to hide or not metadata the item has no value to
* @type bool $hide_empty Whether to hide or not metadata the item has no value to
* Default: true
* @type string $empty_value_message Message string to display if $hide_empty is false and there is not metadata value. Default ''
* @type string $before String to be added before each metadata block
@ -465,7 +465,7 @@ function tainacan_get_the_media_component(
<?php if ( $args['swiper_thumbs_options'] && isset($args['swiper_thumbs_options']['pagination']) ) : ?>
<!-- If we need pagination -->
<div class="swiper-paginations swiper-pagination_<?php echo esc_attr($args['media_thumbs_id']) ?>"></div>
<div class="swiper-pagination swiper-pagination_<?php echo esc_attr($args['media_thumbs_id']) ?>"></div>
<?php endif; ?>
<?php if ( $args['swiper_thumbs_options'] && isset($args['swiper_thumbs_options']['navigation']) ) : ?>
@ -834,7 +834,7 @@ function tainacan_get_item($post_id = 0) {
/**
* To be used inside The Loop of a faceted serach view mode template.
*
* Returns true or false indicating wether a certain property or metadata is
* Returns true or false indicating whether a certain property or metadata is
* selected to be displayed
*
* @param string|integer The property to be checked. If a string is passed, it will check against
@ -1019,7 +1019,15 @@ function tainacan_get_the_mime_type_icon($mime_type, $image_size = 'medium') {
$icon_file = 'placeholder_square';
}
return $images_path . $icon_file . $image_size . '.png';
/**
* Filter the image source for the empty thumbnail placeholder.
*
* @param string src The image source for the empty thumbnail placeholder.
* Default is 'placeholder_square'.
* @param string mime_type The document type of the item.
* @param string image_size The size of the image to be loaded.
*/
return apply_filters('tainacan-get-the-mime-type-icon', $images_path . $icon_file . $image_size . '.png', $mime_type, $image_size);
}
/**
@ -1157,7 +1165,7 @@ function tainacan_the_item_gallery($args = []) {
*
* @type bool $hide_description Do not display the Metadata Section description. Default true
*
* @type bool $hide_empty Wether to hide or not metadata sections if there are no metadata list or they are empty
* @type bool $hide_empty Whether to hide or not metadata sections if there are no metadata list or they are empty
* Default: true
* @type string $empty_metadata_list_message Message string to display if $hide_empty is false and there is not metadata section metadata list.
* Default: ''
@ -1468,7 +1476,7 @@ function tainacan_get_single_taxonomy_content($post, $args = []) {
if ( !$args['hide_term_items_count'] && $args['term_items_count_position'] === 'before' )
echo '<span class="term-items-count">' . $term->count . '</span>&nbsp;';
echo ($term->count == 1 || $term->count == '1') ? __('Item', 'tainacan') : __('Itens', 'tainacan');
echo ($term->count == 1 || $term->count == '1') ? __('Item', 'tainacan') : __('Items', 'tainacan');
if ( !$args['hide_term_items_count'] && $args['term_items_count_position'] !== 'before' )
echo '&nbsp;<span class="term-items-count">(' . $term->count . ')</span>';

View File

@ -2,9 +2,9 @@
Contributors: andrebenedito, daltonmartins, fabianobn, jacsonp, leogermani, weryques, wetah, eduardohumberto, ravipassos, jessicafpx, marinagiolo, omarceloavila, vnmedeiros, tainacan, r-guimaraes, suelanesilva, ccaio, alanargomes, ateneagarcia123, rodrigo0freire, clarandreozzi
Tags: museums, libraries, archives, GLAM, collections, repository
Requires at least: 5.9
Tested up to: 6.3
Tested up to: 6.4
Requires PHP: 7.0
Stable tag: 0.20.4
Stable tag: 0.20.5
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

View File

@ -5,17 +5,17 @@ Plugin URI: https://tainacan.org/
Description: Open source, powerful and flexible repository platform for WordPress. Manage and publish you digital collections as easily as publishing a post to your blog, while having all the tools of a professional repository platform.
Author: Tainacan.org
Author URI: https://tainacan.org/
Version: 0.20.4
Version: 0.20.5
Requires at least: 5.9
Tested up to: 6.3
Tested up to: 6.4
Requires PHP: 7.0
Stable tag: 0.20.4
Stable tag: 0.20.5
Text Domain: tainacan
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
const TAINACAN_VERSION = '0.20.4';
const TAINACAN_VERSION = '0.20.5';
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
$TAINACAN_BASE_URL = plugins_url('', __FILE__);

View File

@ -171,7 +171,7 @@
--tainacan-sidebar-width: 3.0em;
}
#primary-menu:not(.is-compressed)~.is-main-content {
--tainacan-sidebar-width: 10em;
--tainacan-sidebar-width: 11em;
}
.is-secondary-content {

View File

@ -123,7 +123,7 @@
exporterType: '',
exporterName: '',
collections: [],
adminFullURL: tainacan_plugin.admin_url + 'admin.php?page=tainacan_admin#',
adminFullURL: tainacan_plugin.admin_url + '?page=tainacan_admin#',
isFetchingCollections: false,
selectedMapping: undefined,
selectedCollection: undefined,

View File

@ -152,7 +152,7 @@
</div>
</b-field>
<b-field
<b-field
:addons="false"
:label="$i18n.getHelperTitle('filters', 'begin_with_filter_collapsed')"
:type="formErrors['begin_with_filter_collapsed'] != undefined ? 'is-danger' : ''"
@ -173,6 +173,28 @@
</b-switch>
</b-field>
<b-field
v-if="form.collection_id && form.collection_id !== 'default'"
:addons="false"
:label="$i18n.getHelperTitle('filters', 'display_in_repository_level_lists')"
:type="formErrors['display_in_repository_level_lists'] != undefined ? 'is-danger' : ''"
:message="formErrors['display_in_repository_level_lists'] != undefined ? formErrors['display_in_repository_level_lists'] : ''">
&nbsp;
<b-switch
size="is-small"
@input="clearErrors('display_in_repository_level_lists')"
v-model="form.display_in_repository_level_lists"
:true-value="'yes'"
:false-value="'no'"
:native-value="form.display_in_repository_level_lists == 'yes' ? 'yes' : 'no'"
name="display_in_repository_level_lists">
<help-button
:title="$i18n.getHelperTitle('filters', 'display_in_repository_level_lists')"
:message="$i18n.getHelperMessage('filters', 'display_in_repository_level_lists')"
:extra-classes="isRepositoryLevel ? 'tainacan-repository-tooltip' : ''" />
</b-switch>
</b-field>
<component
:errors="formErrors['filter_type_options']"
v-if="(form.filter_type_object && form.filter_type_object.form_component) || form.edit_form == ''"
@ -273,11 +295,13 @@ export default {
this.isLoading = true;
for (let [key, value] of Object.entries(this.form)) {
if (key === 'begin_with_filter_collapsed')
if (key === 'begin_with_filter_collapsed' || key === 'display_in_repository_level_lists')
this.form[key] = (value == 'yes' || value == true) ? 'yes' : 'no';
}
if (this.form['begin_with_filter_collapsed'] === undefined)
this.form['begin_with_filter_collapsed'] = 'no';
if (this.form['display_in_repository_level_lists'] === undefined)
this.form['display_in_repository_level_lists'] = 'no';
this.updateFilter({ filterId: filter.id, index: this.index, options: this.form })
.then(() => {
@ -306,13 +330,15 @@ export default {
let formObj = {};
for (let [key, value] of formData.entries()) {
if (key === 'begin_with_filter_collapsed')
if (key === 'begin_with_filter_collapsed' || key === 'display_in_repository_level_lists')
formObj[key] = (value == 'yes' || value == true) ? 'yes' : 'no';
else
formObj[key] = value;
}
if (formObj['begin_with_filter_collapsed'] === undefined)
formObj['begin_with_filter_collapsed'] = 'no';
if (formObj['display_in_repository_level_lists'] === undefined)
formObj['display_in_repository_level_lists'] = 'no';
this.fillExtraFormData(formObj);
this.isLoading = true;

View File

@ -8,7 +8,7 @@
<span class="icon has-text-gray4">
<i class="tainacan-icon tainacan-icon-attachments"/>
</span>
{{ $i18n.get('label_attachments') }}&nbsp;
{{ collection && collection.item_attachment_label ? collection.item_attachment_label : $i18n.get('label_attachments') }}&nbsp;
<span
v-if="totalAttachments"
class="has-text-gray has-text-weight-normal"
@ -17,7 +17,7 @@
</span>
</label>
<help-button
:title="$i18n.get('label_attachments')"
:title="collection && collection.item_attachment_label ? collection.item_attachment_label : $i18n.get('label_attachments')"
:message="$i18n.get('info_edit_attachments')"/>
<button
style="float: right; font-size: 0.875em; margin: 2px 5px;"
@ -28,7 +28,7 @@
<span class="icon">
<i class="tainacan-icon tainacan-icon-edit"/>
</span>
{{ $i18n.get('label_add_or_update_attachments') }}
{{ $i18n.get('label_add_or_update') }}
</button>
</div>
<div
@ -38,6 +38,7 @@
<attachments-list
:item="item"
:form="form"
:collection="collection"
:is-editable="true"
:should-load-attachments="shouldLoadAttachments"
@onDeleteAttachment="($event) => $emit('onDeleteAttachment', $event)"/>
@ -55,6 +56,7 @@ export default {
props: {
item: Object,
form: Object,
collection: Object,
totalAttachments: Number,
isLoading: Boolean,
shouldLoadAttachments: Boolean

View File

@ -1,21 +1,17 @@
<template>
<div>
<div
v-if="!$adminOptions.hideItemEditionDocument"
class="section-label">
<div v-if="!$adminOptions.hideItemEditionDocument && ( !$adminOptions.hideItemEditionDocumentFileInput && !$adminOptions.hideItemEditionDocumentTextInput && !$adminOptions.hideItemEditionDocumentUrlInput )">
<div class="section-label">
<label>
<span class="icon has-text-gray4">
<i :class="'tainacan-icon tainacan-icon-' + ( (!form.document_type || form.document_type == 'empty' ) ? 'item' : (form.document_type == 'attachment' ? 'attachments' : form.document_type))"/>
</span>
{{ form.document != undefined && form.document != null && form.document != '' ? $i18n.get('label_document') : $i18n.get('label_document_empty') }}
{{ collection && collection.item_document_label ? collection.item_document_label : ( (form.document != undefined && form.document != null && form.document != '') ? $i18n.get('label_document') : $i18n.get('label_document_empty') ) }}
</label>
<help-button
:title="$i18n.getHelperTitle('items', 'document')"
:title="collection && collection.item_document_label ? collection.item_document_label : $i18n.getHelperTitle('items', 'document')"
:message="$i18n.getHelperMessage('items', 'document')"/>
</div>
<div
v-if="!$adminOptions.hideItemEditionDocument"
class="section-box document-field">
<div class="section-box document-field">
<div
v-if="form.document != undefined && form.document != null &&
form.document_type != undefined && form.document_type != null &&
@ -63,7 +59,7 @@
<ul
v-else
class="document-field-placeholder">
<li v-if="!$adminOptions.hideItemEditionDocumentFileInput">
<li v-if="!$adminOptions.hideItemEditionDocumentFileInput && (collection && collection.item_enabled_document_types && collection.item_enabled_document_types['attachment'] && collection.item_enabled_document_types['attachment']['enabled'] === 'yes')">
<button
type="button"
@click.prevent="($event) => $emit('onSetFileDocument', $event)">
@ -73,7 +69,7 @@
</button>
<p>{{ $i18n.get('label_file') }}</p>
</li>
<li v-if="!$adminOptions.hideItemEditionDocumentTextInput">
<li v-if="!$adminOptions.hideItemEditionDocumentTextInput && (collection && collection.item_enabled_document_types && collection.item_enabled_document_types['text'] && collection.item_enabled_document_types['text']['enabled'] === 'yes')">
<button
type="button"
@click.prevent="$emit('onSetTextDocument')">
@ -83,7 +79,7 @@
</button>
<p>{{ $i18n.get('label_text') }}</p>
</li>
<li v-if="!$adminOptions.hideItemEditionDocumentUrlInput">
<li v-if="!$adminOptions.hideItemEditionDocumentUrlInput && (collection && collection.item_enabled_document_types && collection.item_enabled_document_types['url'] && collection.item_enabled_document_types['url']['enabled'] === 'yes')">
<button
type="button"
@click.prevent="$emit('onSetURLDocument')">
@ -102,7 +98,8 @@
export default {
props: {
item: Object,
form: Object
form: Object,
collection: Object
}
}
</script>
@ -116,6 +113,11 @@ export default {
&.document-field-content--text {
padding-bottom: 2rem;
/deep/ article {
max-height: calc(32vh - 2rem);
overflow-y: auto;
}
}
/deep/ img,
@ -164,6 +166,7 @@ export default {
justify-content: space-evenly;
padding: 1.5rem 1rem 2rem 1rem;
border: 1px solid var(--tainacan-input-border-color);
border-radius: var(--tainacan-input-border-radius, 1px);
li {
text-align: center;

View File

@ -142,19 +142,19 @@
<span>{{ $i18n.get('label_all_metadata') }}</span>
</button>
<button
v-if="!$adminOptions.hideItemEditionDocument"
v-if="shouldDisplayItemEditionDocument || shouldDisplayItemEditionThumbnail"
@click="activeTab = 'document'; isMobileSubheaderOpen = false;">
<span><i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-item" /></span>
<span>{{ $i18n.get('label_document_and_thumbnail') }}</span>
</button>
<button
v-if="!$adminOptions.hideItemEditionAttachments"
v-if="shouldDisplayItemEditionAttachments"
@click="activeTab = 'attachments'; isMobileSubheaderOpen = false;">
<span><i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-attachments" /></span>
<span>{{ $i18n.get('label_all_attachments') }}</span>
</button>
<button
v-if="!$adminOptions.hideItemEditionRequiredOnlySwitch"
v-if="!$adminOptions.hideItemEditionRequiredOnlySwitch && (collection && collection.item_enable_metadata_required_filter === 'yes')"
@click="showOnlyRequiredMetadata = true; isMobileSubheaderOpen = false;">
<span><i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-metadata" /></span>
<span>{{ $i18n.get('label_only_required_metadata') }}</span>
@ -177,8 +177,8 @@
<div
class="column main-column"
:class="
(( (!$adminOptions.hideItemEditionDocument || !$adminOptions.hideItemEditionThumbnail) && !$adminOptions.itemEditionDocumentInsideTabs) ||
(!$adminOptions.hideItemEditionAttachments && !$adminOptions.itemEditionAttachmentsInsideTabs)) ? 'is-7' : 'is-12'">
(( (shouldDisplayItemEditionDocument || shouldDisplayItemEditionThumbnail) && !$adminOptions.itemEditionDocumentInsideTabs) ||
(shouldDisplayItemEditionAttachments && !$adminOptions.itemEditionAttachmentsInsideTabs)) ? 'is-7' : 'is-12'">
<!-- Hook for extra Form options -->
<template v-if="hasBeginRightForm">
@ -262,10 +262,10 @@
<!-- Metadata navigation Progress -->
<div
v-if="isMetadataNavigation && itemMetadata && itemMetadata.length > 3"
v-if="isMetadataNavigation"
class="sequence-progress-background" />
<div
v-if="isMetadataNavigation && focusedMetadatum !== false && itemMetadata && itemMetadata.length > 3"
v-if="isMetadataNavigation && focusedMetadatum !== false"
:style="{ width: ((focusedMetadatum + 1)/itemMetadata.length)*100 + '%' }"
class="sequence-progress" />
@ -287,7 +287,7 @@
class="header-item metadata-navigation"
:style="$adminOptions.hideItemEditionCollapses ? 'padding-left: 0.35em !important;' : ''">
<b-button
v-if="!$adminOptions.hideItemEditionFocusMode && !isMetadataNavigation && !showOnlyRequiredMetadata && !metadataNameFilterString"
v-if="!$adminOptions.hideItemEditionFocusMode && (collection && collection.item_enable_metadata_focus_mode === 'yes') && !isMetadataNavigation && !showOnlyRequiredMetadata && !metadataNameFilterString"
@click="isMetadataNavigation = true; setMetadatumFocus({ index: 0, scrollIntoView: true });"
class="collapse-all has-text-secondary"
size="is-small">
@ -340,7 +340,7 @@
</span>
<b-switch
v-if="!isMetadataNavigation && !$adminOptions.hideItemEditionRequiredOnlySwitch && itemMetadata && itemMetadata.length > 3"
v-if="!isMetadataNavigation && !$adminOptions.hideItemEditionRequiredOnlySwitch && (collection && collection.item_enable_metadata_required_filter === 'yes')"
id="tainacan-switch-required-metadata"
:style="'font-size: 0.625em;' + (isMobileScreen ? 'margin-right: 2rem;' : '')"
size="is-small"
@ -349,7 +349,7 @@
</b-switch>
<b-field
v-if="!isMetadataNavigation && itemMetadata && itemMetadata.length > 5"
v-if="!isMetadataNavigation && (collection && collection.item_enable_metadata_searchbar === 'yes')"
class="header-item metadata-name-search">
<b-input
v-if="!isMobileScreen || openMetadataNameFilter"
@ -398,6 +398,12 @@
<span class="icon has-text-gray4">
<i class="tainacan-icon tainacan-icon-metadata"/>
</span>
<span
v-if="metadataSections.length > 1 && collection.item_enable_metadata_enumeration === 'yes'"
style="opacity: 0.65;"
class="metadata-section-enumeration">
{{ Number(sectionIndex) + 1 }}.
</span>
{{ metadataSection.name }}&nbsp;
<span
v-if="metadataSection.metadata_object_list && metadataSection.metadata_object_list.length"
@ -433,11 +439,12 @@
:item-metadatum="itemMetadatum"
:metadata-name-filter-string="metadataNameFilterString"
:is-collapsed="metadataCollapses[index]"
:hide-collapses="$adminOptions.hideItemEditionCollapses || isMetadataNavigation"
:hide-collapses="$adminOptions.hideItemEditionCollapses || isMetadataNavigation || (collection && collection.item_enable_metadata_collapses === 'no')"
:hide-metadata-types="hideMetadataTypes"
:hide-help-buttons="false"
:help-info-bellow-label="false"
:is-mobile-screen="isMobileScreen"
:enumerate-metadatum="metadataSections.length > 1 && collection.item_enable_metadata_enumeration === 'yes' ? ( (Number(sectionIndex) + 1) + '.' + (Number(getMetadatumOrderInSection(sectionIndex, itemMetadatum.metadatum)) + 1) ) : false"
:is-last-metadatum="index > 2 && (index == itemMetadata.length - 1)"
:is-focused="focusedMetadatum === index"
:is-metadata-navigation="isMetadataNavigation"
@ -495,6 +502,7 @@
<item-document-edition-form
:item="item"
:form="form"
:collection="collection"
@onSetDocument="setDocument"
@onRemoveDocument="removeDocument"
@onSetFileDocument="setFileDocument"
@ -503,6 +511,7 @@
<item-thumbnail-edition-form
:item="item"
:form="form"
:collection="collection"
:is-loading="isLoading"
@onDeleteThumbnail="deleteThumbnail"
@onUpdateThumbnailAlt="($event) => onUpdateThumbnailAlt($event)"
@ -511,7 +520,7 @@
<!-- Attachments on mobile modal -->
<div
v-if="activeTab === 'attachments' && $adminOptions.itemEditionAttachmentsInsideTabs"
v-if="activeTab === 'attachments' && shouldDisplayItemEditionAttachments && $adminOptions.itemEditionAttachmentsInsideTabs"
class="tab-item"
role="tabpanel"
aria-labelledby="attachments-tab-label"
@ -519,6 +528,7 @@
<item-attachments-edition-form
:item="item"
:form="form"
:collection="collection"
:is-loading="isLoading"
:total-attachments="totalAttachments"
:should-load-attachments="shouldLoadAttachments"
@ -532,8 +542,8 @@
</div>
<div
v-if="( (!$adminOptions.hideItemEditionDocument || !$adminOptions.hideItemEditionThumbnail) && !$adminOptions.itemEditionDocumentInsideTabs) ||
(!$adminOptions.hideItemEditionAttachments && !$adminOptions.itemEditionAttachmentsInsideTabs)"
v-if="( (shouldDisplayItemEditionDocument || shouldDisplayItemEditionThumbnail) && !$adminOptions.itemEditionDocumentInsideTabs) ||
(shouldDisplayItemEditionAttachments && !$adminOptions.itemEditionAttachmentsInsideTabs)"
class="column is-5">
<div
@ -550,33 +560,37 @@
<!-- Document -------------------------------- -->
<item-document-edition-form
v-if="!$adminOptions.itemEditionDocumentInsideTabs"
v-if="shouldDisplayItemEditionDocument && !$adminOptions.itemEditionDocumentInsideTabs"
:item="item"
:form="form"
:collection="collection"
@onSetDocument="setDocument"
@onRemoveDocument="removeDocument"
@onSetFileDocument="setFileDocument"
@onSetTextDocument="setTextDocument"
@onSetURLDocument="setURLDocument" />
<hr>
<hr v-if="shouldDisplayItemEditionDocument && shouldDisplayItemEditionThumbnail">
<!-- Thumbnail -------------------------------- -->
<item-thumbnail-edition-form
v-if="!$adminOptions.itemEditionDocumentInsideTabs"
v-if="shouldDisplayItemEditionThumbnail && !$adminOptions.itemEditionDocumentInsideTabs"
:item="item"
:form="form"
:collection="collection"
:is-loading="isLoading"
@onDeleteThumbnail="deleteThumbnail"
@onUpdateThumbnailAlt="($event) => onUpdateThumbnailAlt($event)"
@openThumbnailMediaFrame="thumbnailMediaFrame.openFrame($event)" />
<hr v-if="!$adminOptions.itemEditionAttachmentsInsideTabs || hasEndLeftForm">
<hr v-if="(shouldDisplayItemEditionAttachments && !$adminOptions.itemEditionAttachmentsInsideTabs) || hasEndLeftForm">
<!-- Attachments -->
<item-attachments-edition-form
v-if="!$adminOptions.itemEditionAttachmentsInsideTabs"
v-if="shouldDisplayItemEditionAttachments && !$adminOptions.itemEditionAttachmentsInsideTabs"
:item="item"
:form="form"
:collection="collection"
:is-loading="isLoading"
:total-attachments="totalAttachments"
:should-load-attachments="shouldLoadAttachments"
@ -874,18 +888,18 @@ export default {
name: this.$i18n.get('metadata'),
total: this.itemMetadata.length
}];
if ( this.$adminOptions.itemEditionDocumentInsideTabs && (!this.$adminOptions.hideItemEditionDocument || !this.$adminOptions.hideItemEditionThumbnail) ) {
if ( this.$adminOptions.itemEditionDocumentInsideTabs && (this.shouldDisplayItemEditionDocument || this.shouldDisplayItemEditionThumbnail) ) {
pageTabs.push({
slug: 'document',
icon: 'item',
name: this.$i18n.get('label_document')
name: this.collection && this.collection.item_document_label ? this.collection.item_document_label : this.$i18n.get('label_document')
});
}
if ( this.$adminOptions.itemEditionAttachmentsInsideTabs && !this.$adminOptions.hideItemEditionAttachments ) {
if ( this.$adminOptions.itemEditionAttachmentsInsideTabs && this.shouldDisplayItemEditionAttachments ) {
pageTabs.push({
slug: 'attachments',
icon: 'attachments',
name: this.$i18n.get('label_attachments'),
name: this.collection && this.collection.item_attachment_label ? this.collection.item_attachment_label : this.$i18n.get('label_attachments'),
total: this.totalAttachments
});
}
@ -903,6 +917,21 @@ export default {
if (!this.isMetadataNavigation || !this.itemMetadata[this.focusedMetadatum])
return false;
return this.itemMetadata[this.focusedMetadatum].metadatum && this.itemMetadata[this.focusedMetadatum].metadatum.metadata_type === 'Tainacan\\Metadata_Types\\Compound';
},
shouldDisplayItemEditionDocument() {
return !this.$adminOptions.hideItemEditionDocument &&
( this.collection && this.collection.item_enabled_document_types && (
( this.collection.item_enabled_document_types['attachment'] && this.collection.item_enabled_document_types['attachment']['enabled'] === 'yes' ) ||
( this.collection.item_enabled_document_types['text'] && this.collection.item_enabled_document_types['text']['enabled'] === 'yes' ) ||
( this.collection.item_enabled_document_types['url'] && this.collection.item_enabled_document_types['url']['enabled'] === 'yes' )
)
);
},
shouldDisplayItemEditionThumbnail() {
return !this.$adminOptions.hideItemEditionThumbnail && (this.collection && this.collection.item_enable_thumbnail === 'yes');
},
shouldDisplayItemEditionAttachments() {
return !this.$adminOptions.hideItemEditionAttachments && (this.collection && this.collection.item_enable_attachments === 'yes');
}
},
watch: {
@ -1322,7 +1351,7 @@ export default {
if (currentItemMetadatum) {
const itemMetadatumValues = Array.isArray(currentItemMetadatum.value) ? currentItemMetadatum.value : [ currentItemMetadatum.value ];
const conditionalValues = Array.isArray(eventBusItemMetadata.conditionalSections[conditionalSectionId].metadatumValues) ? eventBusItemMetadata.conditionalSections[conditionalSectionId].metadatumValues : [eventBusItemMetadata.conditionalSections[conditionalSectionId].metadatumValues];
eventBusItemMetadata.conditionalSections[conditionalSectionId].hide = itemMetadatumValues.every(aValue => conditionalValues.indexOf(aValue) < 0);
eventBusItemMetadata.conditionalSections[conditionalSectionId].hide = Array.isArray(itemMetadatumValues) ? itemMetadatumValues.every(aValue => conditionalValues.indexOf(aValue['id'] ? aValue['id'] : aValue) < 0) : conditionalValues.indexOf(itemMetadatumValues) < 0;
}
}
@ -1847,6 +1876,19 @@ export default {
},
isSectionHidden(sectionId) {
return this.conditionalSections[sectionId] && this.conditionalSections[sectionId].hide;
},
getMetadatumOrderInSection(sectionIndex, metadatum) {
if ( !Array.isArray(this.collection['metadata_section_order']) || !this.collection['metadata_section_order'][sectionIndex] || !Array.isArray(this.collection['metadata_section_order'][sectionIndex]['metadata_order']) )
return -1;
let enabledMetadata = [];
for (let metadatum of this.collection['metadata_section_order'][sectionIndex]['metadata_order']) {
if ( metadatum.enabled )
enabledMetadata.push(metadatum.id);
}
return enabledMetadata.indexOf(metadatum.id);
}
}
}

View File

@ -7,10 +7,10 @@
<span class="icon has-text-gray4">
<i class="tainacan-icon tainacan-icon-image"/>
</span>
{{ $i18n.get('label_thumbnail') }}
{{ collection && collection.item_thumbnail_label ? collection.item_thumbnail_label : $i18n.get('label_thumbnail') }}
</label>
<help-button
:title="$i18n.getHelperTitle('items', '_thumbnail_id')"
:title="collection && collection.item_thumbnail_label ? collection.item_thumbnail_label: $i18n.getHelperTitle('items', '_thumbnail_id')"
:message="$i18n.getHelperMessage('items', '_thumbnail_id')"/>
</div>
@ -104,6 +104,7 @@ export default {
},
props: {
item: Object,
collection: Object,
form: Object
},
methods: {

View File

@ -10,7 +10,12 @@
v-if="form && Object.keys(form).length"
class="tainacan-modal-content">
<div class="tainacan-modal-title">
<h2 v-html="form.name ? ($i18n.get('instruction_configure_the_metadata_section') + ' <em>' + form.name + '</em>') : $i18n.get('instruction_configure_new_metadata_section')" />
<h2 v-if="form.name">
{{ $i18n.get('instruction_configure_the_metadata_section') }}&nbsp;<em>{{ form.name }}</em>
</h2>
<h2 v-else>
{{ $i18n.get('instruction_configure_new_metadata_section') }}
</h2>
<hr>
</div>
<div class="tainacan-form">
@ -179,8 +184,9 @@
:extra-classes="isRepositoryLevel ? 'tainacan-repository-tooltip' : ''" />
</label>
<b-select
v-model="selectedConditionalMetadatum"
:placeholder="$i18n.get('label_select_metadatum')">
v-model="selectedConditionalMetadatumId"
:placeholder="$i18n.get('label_select_metadatum')"
@input="reloadConditionalValueComponent()">
<option
v-for="conditionalMetadatum of availableConditionalMetadata"
:key="conditionalMetadatum.id"
@ -192,22 +198,23 @@
</transition>
<transition name="filter-item">
<b-field
v-if="isConditionalSection && selectedConditionalMetadatum"
v-if="isConditionalSection && selectedConditionalMetadatumId && selectedConditionalMetadatum && selectedConditionalMetadatum.name"
:addons="false"
:type="formErrors['conditional_section_rules'] != undefined ? 'is-danger' : ''"
:message="formErrors['conditional_section_rules'] != undefined ? formErrors['conditional_section_rules'] : ''">
<label class="label is-inline">
{{ availableConditionalMetadata.find((availableMetadatum) => availableMetadatum.id == selectedConditionalMetadatum).name }}
{{ selectedConditionalMetadatum.name }}
</label>
<div style="overflow-y: auto; overflow-x: hidden; max-height: 100px;">
<b-checkbox
v-model="selectedConditionalValue"
v-for="(conditionalValue, conditionalValueIndex) of availableConditionalMetadata.find((availableMetadatum) => availableMetadatum.id == selectedConditionalMetadatum).metadata_type_object.options.options.split('\n')"
:key="conditionalValueIndex"
:native-value="conditionalValue">
{{ conditionalValue }}
</b-checkbox>
</div>
<component
v-if="shouldUpdateConditionalValue"
:is="selectedConditionalMetadatum.metadata_type_object.component"
:forced-component-type="selectedConditionalMetadatum.metadata_type_object.component.includes('taxonomy') ? 'tainacan-taxonomy-tag-input' : ''"
:item-metadatum="{ metadatum: selectedConditionalMetadatum }"
:value="Array.isArray(selectedConditionalValue) ? selectedConditionalValue[0] : selectedConditionalValue"
:allow-new="false"
:maxtags="1"
@input="selectConditionalValue"
/>
</b-field>
</transition>
</div>
@ -266,9 +273,10 @@
closedByForm: false,
entityName: 'metadataSection',
isUpdating: false,
selectedConditionalMetadatum: undefined,
selectedConditionalMetadatumId: undefined,
selectedConditionalValue: [],
hideConditionalSectionSettings: false
hideConditionalSectionSettings: false,
shouldUpdateConditionalValue: true
}
},
computed: {
@ -276,18 +284,21 @@
'getMetadataSections'
]),
availableConditionalMetadata() {
if (this.getMetadataSections.length) {
if ( this.getMetadataSections.length ) {
const otherMetadataSections = this.getMetadataSections.filter(aMetadataSection => aMetadataSection.id != this.form.id);
const availableMetadata = [];
for (let aMetadataSection of otherMetadataSections)
availableMetadata.push.apply(availableMetadata, aMetadataSection.metadata_object_list);
return availableMetadata.filter(aMetadatum => aMetadatum.metadata_type === 'Tainacan\\Metadata_Types\\Selectbox');
return availableMetadata.filter(aMetadatum => aMetadatum.metadata_type === 'Tainacan\\Metadata_Types\\Selectbox' || aMetadatum.metadata_type === 'Tainacan\\Metadata_Types\\Taxonomy');
}
return {};
return [];
},
isConditionalSection() {
return this.form.is_conditional_section == 'yes';
}
},
selectedConditionalMetadatum() {
return this.availableConditionalMetadata.find(aMetadatum => aMetadatum.id == this.selectedConditionalMetadatumId)
},
},
created() {
this.form = JSON.parse(JSON.stringify(this.originalMetadataSection));
@ -297,7 +308,7 @@
if ( this.form.is_conditional_section == 'yes' && Object.keys(this.form.conditional_section_rules).length ) {
const conditionalMetadatum = Object.keys(this.form.conditional_section_rules)[0];
this.selectedConditionalMetadatum = conditionalMetadatum;
this.selectedConditionalMetadatumId = conditionalMetadatum;
this.selectedConditionalValue = this.form.conditional_section_rules[conditionalMetadatum];
}
@ -316,10 +327,9 @@
'updateMetadataSection'
]),
saveEdition(metadataSection) {
if ( this.form.is_conditional_section == 'yes' && this.selectedConditionalMetadatum && this.selectedConditionalValue ) {
if ( this.form.is_conditional_section == 'yes' && this.selectedConditionalMetadatumId && this.selectedConditionalValue ) {
this.form.conditional_section_rules = {}
this.form.conditional_section_rules[this.selectedConditionalMetadatum] = this.selectedConditionalValue;
this.form.conditional_section_rules[this.selectedConditionalMetadatumId] = this.selectedConditionalValue;
} else
this.form.conditional_section_rules = null;
@ -359,6 +369,15 @@
this.closedByForm = true;
this.$emit('onEditionCanceled');
},
selectConditionalValue(selected) {
const selectedValues = Array.isArray(selected) ? selected : [ selected ];
this.selectedConditionalValue = selectedValues.map( aSelected => aSelected.value ? aSelected.value : aSelected );
},
reloadConditionalValueComponent() {
this.shouldUpdateConditionalValue = false;
this.selectedConditionalValue = [];
this.$nextTick(() => this.shouldUpdateConditionalValue = true);
}
}
}
</script>
@ -436,6 +455,18 @@
height: 1px;
background-color: var(--tainacan-gray2);
margin-left: 42px;
transition: background-color 0.2s ease, height 0.2s ease;
}
&:hover {
.icon,
strong {
color: var(--tainacan-secondary);
}
hr {
background-color: var(--tainacan-primary);
height: 2px;
}
}
}
@ -447,6 +478,23 @@
}
}
}
/deep/ .is-special-hidden-for-mobile,
/deep/ .is-special-hidden-for-mobile:focus,
/deep/ .is-special-hidden-for-mobile:focus-visible {
opacity: 0;
width: 0;
height: 0 !important;
min-height: 0;
min-width: 0;
padding: 0 !important;
line-height: 0px !important;
border: none !important;
border-color: transparent !important;
border-width: 0px !important;
font-size: 0px !important;
display: block !important;
}
.form-submit {
background-color: var(--tainacan-gray1);
position: sticky;

View File

@ -10,7 +10,12 @@
v-if="form && Object.keys(form).length"
class="tainacan-modal-content">
<div class="tainacan-modal-title">
<h2 v-html="form.name ? ($i18n.get('instruction_configure_the_metadatum') + ' <em>' + form.name + '</em>') : $i18n.get('instruction_configure_new_metadatum')" />
<h2 v-if="form.name">
{{ $i18n.get('instruction_configure_the_metadatum') }}&nbsp;<em>{{ form.name }}</em>
</h2>
<h2 v-else>
{{ $i18n.get('instruction_configure_new_metadatum') }}
</h2>
<!-- <a
class="back-link"
@click="onEditionCanceled()">
@ -610,6 +615,18 @@
height: 1px;
background-color: var(--tainacan-gray2);
margin-left: 42px;
transition: background-color 0.2s ease, height 0.2s ease;
}
&:hover {
.icon,
strong {
color: var(--tainacan-secondary);
}
hr {
background-color: var(--tainacan-primary);
height: 2px;
}
}
}

View File

@ -231,7 +231,7 @@
class="button link-button"
:href="themeTaxonomiesURL + taxonomy.slug">
<span class="icon is-large">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-see"/>
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-openurl"/>
</span>
<span>{{ $i18n.get('label_taxonomy_page_on_website') }}</span>
</a>
@ -555,7 +555,7 @@
.status-radios {
display: flex;
}
.status-radios .control-lable {
.status-radios .control-label {
display: flex;
align-items: center;
}

View File

@ -15,7 +15,7 @@
target="_blank"
:href="form.url">
<span class="icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-see"/>
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-openurl"/>
</span>
<span class="menu-text">{{ $i18n.get('label_term_page_on_website') }}</span>
</a>
@ -233,7 +233,9 @@
originalForm: Object,
taxonomyId: '',
isHierarchical: Boolean,
isTermInsertionFlow: false
isTermInsertionFlow: false,
metadatumId: [String, Number],
itemId: [String, Number]
},
data() {
return {
@ -308,7 +310,9 @@
this.isLoading = true;
this.sendChildTerm({
taxonomyId: this.taxonomyId,
term: data
term: data,
metadatumId: this.metadatumId,
itemId: this.itemId
})
.then((term) => {
this.$emit('onEditionFinished', {term: term, hasChangedParent: this.hasChangedParent, initialParent: this.initialParentId });
@ -342,7 +346,9 @@
this.isLoading = true;
this.updateTerm({
taxonomyId: this.taxonomyId,
term: data
term: data,
metadatumId: this.metadatumId,
itemId: this.itemId
})
.then((term) => {
this.formErrors = {};

View File

@ -70,7 +70,7 @@
@input="emitOnlyYear($event)"
v-model="yearsOnlyValue"/> -->
<b-datepicker
position="is-bottom-left"
position="is-bottom-right"
:aria-labelledby="'filter-label-id-' + filter.id"
:placeholder="$i18n.get('instruction_select_a_date')"
v-model="value"
@ -103,7 +103,7 @@
$i18n.get('datepicker_month_october'),
$i18n.get('datepicker_month_november'),
$i18n.get('datepicker_month_december')
]"/>
]" />
<!-- filterTypeOptions FOR TYPE
v-else
:type="filterTypeOptions.type == 'month' ? 'month' : null"

View File

@ -236,27 +236,12 @@
}
.taginput-container {
border-radius: 1px !important;
border-radius: var(--tainacan-input-border-radius, 1px) !important;
box-shadow: none !important;
transition: background-color 0.1s;
}
.taginput-container {
border: none !important;
&.is-focused,
&.is-focused:active,
&.is-focused:focus,
&.is-focusable,
&.is-focusable:active
&.is-focusable:focus {
border: none !important;
input:active, input:focus {
border: 1px solid var(--tainacan-input-border-color) !important;
}
}
input{
border: 1px solid var(--tainacan-input-border-color) !important;
}
.tags {
display: none !important;
}

View File

@ -18,7 +18,7 @@
<span
v-if="form.document == attachment.id"
class="file-attachment-document-tag">
{{ $i18n.get('label_document') }}
{{ collection && collection.item_document_label ? collection.item_document_label : $i18n.get('label_document') }}
</span>
<file-item
:show-name="true"
@ -52,7 +52,7 @@
<i class="tainacan-icon tainacan-icon-30px tainacan-icon-attachments"/>
</span>
</p>
<p>{{ $i18n.get('info_no_attachments_on_item_yet') }}</p>
<p>{{ $i18n.getWithVariables('info_no_%s_on_item_yet', [ collection && collection.item_attachment_label ? collection.item_attachment_label : $i18n.get('label_attachments') ]) }}</p>
</div>
</section>
</div>
@ -63,7 +63,7 @@
v-if="attachments.length > 0">
<div class="shown-items">
{{
$i18n.get('info_showing_attachments') + ' ' +
$i18n.getWithVariables('info_showing_%s', [ collection && collection.item_attachment_label ? collection.item_attachment_label : $i18n.get('label_attachments') ]) + ' ' +
(attachmentsPerPage * (attachmentsPage - 1) + 1) +
$i18n.get('info_to') +
getLastAttachmentsNumber() +
@ -99,6 +99,7 @@
props: {
item: Object,
form: Object,
collection: Object,
shouldLoadAttachments: Boolean,
isEditable: Boolean,
},

View File

@ -260,7 +260,7 @@
popperClass: ['tainacan-tooltip', 'tooltip']
}"
class="icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-see"/>
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-openurl"/>
</span>
</a>
</li>

View File

@ -9,7 +9,9 @@
<span>
<b-checkbox
@click.native="selectAllCollectionsOnPage()"
:value="allCollectionsOnPageSelected">{{ $i18n.get('label_select_all_collections_page') }}</b-checkbox>
:native-value="allCollectionsOnPageSelected">
{{ $i18n.get('label_select_all_collections_page') }}
</b-checkbox>
</span>
</div>
<div class="field is-pulled-right">
@ -349,6 +351,24 @@
class="tainacan-icon tainacan-icon-1-25em"/>
</span>
</a>
<a
id="button-open-external"
:aria-label="$i18n.getFrom('collections','view_item')"
@click.stop=""
target="_blank"
:href="collection.url">
<span
v-tooltip="{
content: $i18n.get('label_view_collection_on_website'),
autoHide: true,
popperClass: ['tainacan-tooltip', 'tooltip', 'tainacan-repository-tooltip'],
placement: 'auto',
html: true
}"
class="icon">
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-openurl"/>
</span>
</a>
</div>
</td>
</tr>
@ -557,7 +577,7 @@ export default {
.selection-control {
padding: 6px 0px 0px 12px;
background: var(--tainacan-white);
background: var(--tainacan-background-color);
height: 40px;
.select-all {

View File

@ -303,6 +303,25 @@
class="has-text-secondary tainacan-icon tainacan-icon-1-25em"/>
</span>
</a>
<a
v-if="!isOnTrash"
id="button-open-external"
:aria-label="$i18n.getFrom('items','view_item')"
@click.stop=""
target="_blank"
:href="item.url">
<span
v-tooltip="{
content: $i18n.get('label_item_page_on_website'),
autoHide: true,
popperClass: ['tainacan-tooltip', 'tooltip', isRepositoryLevel ? 'tainacan-repository-tooltip' : ''],
placement: 'auto',
html: true
}"
class="icon">
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-openurl"/>
</span>
</a>
</div>
</div>
@ -448,6 +467,25 @@
class="has-text-secondary tainacan-icon tainacan-icon-1-25em"/>
</span>
</a>
<a
v-if="!isOnTrash"
id="button-open-external"
:aria-label="$i18n.getFrom('items','view_item')"
@click.stop=""
target="_blank"
:href="item.url">
<span
v-tooltip="{
content: $i18n.get('label_item_page_on_website'),
autoHide: true,
popperClass: ['tainacan-tooltip', 'tooltip', isRepositoryLevel ? 'tainacan-repository-tooltip' : ''],
placement: 'auto',
html: true
}"
class="icon">
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-openurl"/>
</span>
</a>
</div>
</div>
</li>
@ -579,6 +617,25 @@
class="has-text-secondary tainacan-icon tainacan-icon-1-25em"/>
</span>
</a>
<a
v-if="!isOnTrash"
id="button-open-external"
:aria-label="$i18n.getFrom('items','view_item')"
@click.stop=""
target="_blank"
:href="item.url">
<span
v-tooltip="{
content: $i18n.get('label_item_page_on_website'),
autoHide: true,
popperClass: ['tainacan-tooltip', 'tooltip', isRepositoryLevel ? 'tainacan-repository-tooltip' : ''],
placement: 'auto',
html: true
}"
class="icon">
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-openurl"/>
</span>
</a>
</div>
<!-- Remaining metadata -->
@ -802,6 +859,25 @@
class="has-text-secondary tainacan-icon tainacan-icon-1-25em"/>
</span>
</a>
<a
v-if="!isOnTrash"
id="button-open-external"
:aria-label="$i18n.getFrom('items','view_item')"
@click.stop=""
target="_blank"
:href="item.url">
<span
v-tooltip="{
content: $i18n.get('label_item_page_on_website'),
autoHide: true,
popperClass: ['tainacan-tooltip', 'tooltip', isRepositoryLevel ? 'tainacan-repository-tooltip' : ''],
placement: 'auto',
html: true
}"
class="icon">
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-openurl"/>
</span>
</a>
</div>
<!-- Remaining metadata -->
@ -1147,7 +1223,26 @@
<i
:class="{ 'tainacan-icon-delete': !isOnTrash, 'tainacan-icon-deleteforever': isOnTrash }"
class="has-text-secondary tainacan-icon tainacan-icon-1-25em"/>
</span>
</span>
</a>
<a
v-if="!isOnTrash"
id="button-open-external"
:aria-label="$i18n.getFrom('items','view_item')"
@click.stop=""
target="_blank"
:href="item.url">
<span
v-tooltip="{
content: $i18n.get('label_item_page_on_website'),
autoHide: true,
popperClass: ['tainacan-tooltip', 'tooltip', isRepositoryLevel ? 'tainacan-repository-tooltip' : ''],
placement: 'auto',
html: true
}"
class="icon">
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-openurl"/>
</span>
</a>
</div>
</td>
@ -1304,6 +1399,25 @@
class="has-text-secondary tainacan-icon tainacan-icon-1-25em"/>
</span>
</a>
<a
v-if="!isOnTrash"
id="button-open-external"
:aria-label="$i18n.getFrom('items','view_item')"
@click.stop=""
target="_blank"
:href="item.url">
<span
v-tooltip="{
content: $i18n.get('label_item_page_on_website'),
autoHide: true,
popperClass: ['tainacan-tooltip', 'tooltip', isRepositoryLevel ? 'tainacan-repository-tooltip' : ''],
placement: 'auto',
html: true
}"
class="icon">
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-openurl"/>
</span>
</a>
</div>
<!-- Remaining metadata -->
@ -1779,6 +1893,25 @@
class="has-text-secondary tainacan-icon tainacan-icon-1-25em"/>
</span>
</a>
<a
v-if="!isOnTrash"
id="button-open-external"
:aria-label="$i18n.getFrom('items','view_item')"
@click.stop=""
target="_blank"
:href="item.url">
<span
v-tooltip="{
content: $i18n.get('label_item_page_on_website'),
autoHide: true,
popperClass: ['tainacan-tooltip', 'tooltip', isRepositoryLevel ? 'tainacan-repository-tooltip' : ''],
placement: 'auto',
html: true
}"
class="icon">
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-openurl"/>
</span>
</a>
</div>
<!-- Remaining metadata -->
@ -2560,7 +2693,7 @@ export default {
.selection-control {
margin-bottom: 6px;
padding: 6px 0px 0px 12px;
background: var(--tainacan-white);
background: var(--tainacan-background-color);
height: 40px;
display: flex;
align-items: center;

View File

@ -517,12 +517,16 @@
.sub-header {
@include logs-container();
.header-item {
min-height: 1.875em;
}
}
.selection-control {
padding: 6px 0px 0px 12px;
background: var(--tainacan-white);
background: var(--tainacan-background-color);
height: 40px;
.select-all {

View File

@ -169,7 +169,7 @@
editItemId: false,
editCollectionId: false,
editItemModal: false,
adminURL: tainacan_plugin.admin_url + 'admin.php?',
adminURL: tainacan_plugin.admin_url + '?',
isUpdatingRelatedItems: false
}
},

View File

@ -10,7 +10,9 @@
<span>
<b-checkbox
@click.native="selectAllOnPage()"
:value="allOnPageSelected">{{ $i18n.get('label_select_all_taxonomies_page') }}</b-checkbox>
:native-value="allOnPageSelected">
{{ $i18n.get('label_select_all_taxonomies_page') }}
</b-checkbox>
</span>
</div>
<div class="field is-pulled-right">
@ -235,6 +237,25 @@
class="has-text-secondary tainacan-icon tainacan-icon-1-25em"/>
</span>
</a>
<a
v-if="!isOnTrash"
id="button-open-external"
:aria-label="$i18n.getFrom('taxonomies','view_item')"
@click.stop=""
target="_blank"
:href="themeTaxonomiesURL + taxonomy.slug">
<span
v-tooltip="{
content: $i18n.get('label_taxonomy_page_on_website'),
autoHide: true,
popperClass: ['tainacan-tooltip', 'tooltip', 'tainacan-repository-tooltip'],
placement: 'auto',
html: true
}"
class="icon">
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-openurl"/>
</span>
</a>
</div>
</td>
</tr>
@ -263,7 +284,8 @@
selected: [],
allOnPageSelected: false,
isSelecting: false,
adminUrl: tainacan_plugin.admin_url
adminUrl: tainacan_plugin.admin_url,
themeTaxonomiesURL: tainacan_plugin.theme_taxonomy_list_url
}
},
computed: {
@ -396,7 +418,7 @@
let htmlList = '';
for (let i = 0; i < collections.length; i++) {
htmlList += `<a target="_blank" href=${ this.adminUrl + 'admin.php?page=tainacan_admin#' + this.$routerHelper.getCollectionPath(collections[i].id)}>${collections[i].name} (${metadata[collections[i].id].name})</a>`;
htmlList += `<a target="_blank" href=${ this.adminUrl + '?page=tainacan_admin#' + this.$routerHelper.getCollectionPath(collections[i].id)}>${collections[i].name} (${metadata[collections[i].id].name})</a>`;
if (collections.length > 2 && i < collections.length - 1) {
if (i < collections.length - 2)
htmlList += ', '
@ -418,7 +440,7 @@
.selection-control {
padding: 6px 0px 0px 12px;
background: var(--tainacan-white);
background: var(--tainacan-background-color);
height: 40px;
.select-all {

View File

@ -136,9 +136,23 @@
placement: 'bottom'
}"
class="icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-delete"/>
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-delete"/>
</span>
</button>
<a
target="_blank"
:href="term.url">
<span
v-tooltip="{
content: $i18n.get('label_term_page_on_website'),
autoHide: true,
popperClass: ['tainacan-tooltip', 'tooltip', 'tainacan-repository-tooltip'],
placement: 'bottom'
}"
class="icon">
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-openurl"/>
</span>
</a>
</div>
</label>
<button
@ -737,7 +751,7 @@ export default {
let errorMessage = errors.length > 1 ? this.$i18n.getWithVariables('info_terms_creation_failed_due_to_values_%s', [ wrongValues ]) : this.$i18n.getWithVariables('info_terms_creation_failed_due_to_value_%s', [ wrongValues ]);
errorMessage += ' ' + errors[0]['errors'][0]['name'];
this.$buefy.snackbar.open({
message: errorMessage,
message: this.$htmlSanitizer.sanitize(errorMessage),
type: 'is-danger',
position: 'is-bottom-right',
pauseOnHover: true,
@ -852,7 +866,10 @@ export default {
.tainacan-hierarchical-list-columns-container {
background-color: var(--tainacan-background-color);
border: 1px solid var(--tainacan-gray2);
border-radius: 2px;
border-bottom-left-radius: var(--tainacan-dropdownmenu-border-radius);
border-bottom-right-radius: var(--tainacan-dropdownmenu-border-radius);
border-top-right-radius: 0px;
border-top-left-radius: 0px;
margin-top: 0px;
display: flex;
height: auto;

View File

@ -342,7 +342,10 @@ export default {
.tainacan-hierarchical-list-columns-container {
background-color: var(--tainacan-background-color);
border: 1px solid var(--tainacan-gray2);
border-radius: 2px;
border-bottom-left-radius: var(--tainacan-dropdownmenu-border-radius);
border-bottom-right-radius: var(--tainacan-dropdownmenu-border-radius);
border-top-right-radius: 0px;
border-top-left-radius: 0px;
margin-top: 0px;
display: flex;
height: auto;

View File

@ -30,6 +30,12 @@
<i class="has-text-secondary tainacan-icon tainacan-icon-1-25em tainacan-icon-arrowdown" />
</span>
<label class="label has-tooltip">
<span
v-if="enumerateMetadatum"
style="opacity: 0.65;"
class="metadatum-section-enumeration">
{{ enumerateMetadatum }}.
</span>
{{ childItemMetadatum.metadatum.name }}
</label>
<span
@ -69,6 +75,7 @@
}"
:is-focused="(focusedGroupMetadatum === groupIndex) && (focusedChildMetadatum === childIndex)"
:is-metadata-navigation="isMetadataNavigation"
:enumerate-metadatum="enumerateMetadatum ? ( enumerateMetadatum + ( childItemMetadataGroups.length > 1 ? ( '.' + (Number(groupIndex) + 1) ) : '' ) + '.' + (Number(childIndex) + 1) ) : false"
@touchstart.native="isMetadataNavigation ? setMetadatumChildFocus({ groupIndex: groupIndex, childIndex: childIndex, scrollIntoView: false }): ''"
@mousedown.native="isMetadataNavigation ? setMetadatumChildFocus({ groupIndex: groupIndex, childIndex: childIndex, scrollIntoView: false }) : ''"
@mobileSpecialFocus="setMetadatumChildFocus({ groupIndex: groupIndex, childIndex: childIndex, scrollIntoView: true })"
@ -129,6 +136,7 @@
metadataNameFilterString: '',
isMobileScreen: false,
isMetadataNavigation: false,
enumerateMetadatum: [Boolean|String],
isFocused: false
},
data() {
@ -161,7 +169,7 @@
},
watch: {
/* This will create the input object structure for
* <tainacan-item-form :item-metadatum="childItemMetadatum" />
* <tainacan-form-item :item-metadatum="childItemMetadatum" />
* looking at the values from the parent (this.itemMetadatum)
*/
'itemMetadatum.value': {

View File

@ -19,11 +19,24 @@ class Core_Description extends Metadata_Type {
$this->set_core(true);
$this->set_related_mapped_prop('description');
$this->set_component('tainacan-textarea');
$this->set_form_component('tainacan-form-textarea');
$this->set_name( __('Core Description', 'tainacan') );
$this->set_description( __('The "Core Description" is a compulsory metadata automatically created for all collections by default. This is the main description displayed in items lists and where the basic research tools will do their searches.', 'tainacan') );
$this->set_sortable( false );
}
/**
* @inheritdoc
*/
public function get_form_labels(){
return [
'maxlength' => [
'title' => __( 'Maximum of characters', 'tainacan' ),
'description' => __( 'Limits the character input to a maximum value an displays a counter.', 'tainacan' ),
]
];
}
/**
* generate the metadata for this metadatum type
*/

View File

@ -26,7 +26,7 @@ class Metadata_Type_Helper {
private function __construct() {
$this->registered_metadata_type = [];
$this->Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();;
$this->Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
$this->init();
}

View File

@ -91,7 +91,7 @@ abstract class Metadata_Type {
private $preview_template;
/**
* Indicates wether this metadata type will generate metadata that should be available as sorting options in the items list UI.
* Indicates whether this metadata type will generate metadata that should be available as sorting options in the items list UI.
*/
private $sortable = true;

View File

@ -69,6 +69,32 @@
</button>
</div>
</b-field>
<b-field :addons="false">
<label class="label is-inline">
{{ $i18n.getHelperTitle('tainacan-numeric', 'min') }}
<help-button
:title="$i18n.getHelperTitle('tainacan-numeric', 'min')"
:message="$i18n.getHelperMessage('tainacan-numeric', 'min')" />
</label>
<b-numberinput
v-model="min"
name="min"
step="1"
@input="onUpdateMin"/>
</b-field>
<b-field :addons="false">
<label class="label is-inline">
{{ $i18n.getHelperTitle('tainacan-numeric', 'max') }}
<help-button
:title="$i18n.getHelperTitle('tainacan-numeric', 'max')"
:message="$i18n.getHelperMessage('tainacan-numeric', 'max')" />
</label>
<b-numberinput
v-model="max"
name="max"
step="1"
@input="onUpdateMax"/>
</b-field>
</section>
</template>
@ -80,15 +106,25 @@
data() {
return {
step: [Number, String],
min: [Number, null],
max: [Number, null],
showEditStepOptions: false
}
},
created() {
this.step = this.value && this.value.step ? this.value.step : 0.01;
this.min = this.value && this.value.min ? Number(this.value.min) : null;
this.max = this.value && this.value.max ? Number(this.value.max) : null;
},
methods: {
onUpdateStep(value) {
this.$emit('input', { step: value });
this.$emit('input', { step: value, min: this.min, max: this.max });
},
onUpdateMin(value) {
this.$emit('input', { step: this.step, min: value, max: this.max });
},
onUpdateMax(value) {
this.$emit('input', { step: this.step, min: this.min, max: value });
}
}
}

View File

@ -1,15 +1,17 @@
<template>
<b-input
<b-numberinput
:disabled="disabled"
:ref="'tainacan-item-metadatum_id-' + itemMetadatum.metadatum.id + (itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + itemMetadatum.parent_meta_id) : '')"
:id="'tainacan-item-metadatum_id-' + itemMetadatum.metadatum.id + (itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + itemMetadatum.parent_meta_id) : '')"
:placeholder="itemMetadatum.metadatum.placeholder ? itemMetadatum.metadatum.placeholder : ''"
:value="value"
@input="onInput($event);"
@input="onInput"
@blur="onBlur"
@focus="onMobileSpecialFocus"
type="number"
lang="en"
:step="getStep"/>
:min="getMin"
:max="getMax"
:step="getStep" />
</template>
<script>
@ -25,10 +27,26 @@
return this.itemMetadatum.metadatum.metadata_type_options.step;
else
return 0.01;
},
getMin() {
if (this.itemMetadatum && this.itemMetadatum.metadatum.metadata_type_options && this.itemMetadatum.metadatum.metadata_type_options.min !== null && this.itemMetadatum.metadatum.metadata_type_options.min !== undefined && this.itemMetadatum.metadatum.metadata_type_options.min !== '')
return Number(this.itemMetadatum.metadatum.metadata_type_options.min);
else
return undefined;
},
getMax() {
if (this.itemMetadatum && this.itemMetadatum.metadatum.metadata_type_options && this.itemMetadatum.metadatum.metadata_type_options.max !== null && this.itemMetadatum.metadatum.metadata_type_options.max !== undefined && this.itemMetadatum.metadatum.metadata_type_options.max !== '')
return Number(this.itemMetadatum.metadatum.metadata_type_options.max);
else
return undefined;
}
},
methods: {
onInput(value) {
const inputRef = this.$refs['tainacan-item-metadatum_id-' + this.itemMetadatum.metadatum.id + (this.itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + this.itemMetadatum.parent_meta_id) : '')];
if ( inputRef && !inputRef.checkHtml5Validity())
return;
this.$emit('input', value);
},
onBlur() {
@ -40,3 +58,10 @@
}
}
</script>
<style scoped>
.b-numberinput {
border-bottom-width: 0px !important;
margin-left: 0 !important;
}
</style>

View File

@ -34,6 +34,14 @@ class Numeric extends Metadata_Type {
'step' => [
'title' => __( 'Step', 'tainacan' ),
'description' => __( 'The amount to be increased or decreased when clicking on the metadatum control buttons. This also defines whether the input accepts decimal numbers.', 'tainacan' ),
],
'min' => [
'title' => __( 'Minimum', 'tainacan' ),
'description' => __( 'The minimum value that the input will accept.', 'tainacan' ),
],
'max' => [
'title' => __( 'Maximum', 'tainacan' ),
'description' => __( 'The maximum value that the input will accept.', 'tainacan' ),
]
];
}

View File

@ -119,6 +119,21 @@
:message="$i18n.getHelperMessage('tainacan-relationship', 'accept_draft_items')"/>
</b-field>
<b-field
:addons="false"
:label="$i18n.getHelperTitle('tainacan-relationship', 'accept_only_items_authored_by_current_user')">
&nbsp;
<b-switch
size="is-small"
v-model="modelAcceptOnlyItemsAuthoredByCurrentUser"
@input="emitValues()"
true-value="yes"
false-value="no" />
<help-button
:title="$i18n.getHelperTitle('tainacan-relationship', 'accept_only_items_authored_by_current_user')"
:message="$i18n.getHelperMessage('tainacan-relationship', 'accept_only_items_authored_by_current_user')"/>
</b-field>
</section>
</template>
@ -148,6 +163,7 @@
collectionMessage: '',
displayRelatedItemMetadata: [],
modelAcceptDraftItems: 'no',
modelAcceptOnlyItemsAuthoredByCurrentUser: 'no',
isMetaqueryRelationshipEnabled: tainacan_plugin && tainacan_plugin.tainacan_enable_relationship_metaquery == true ? tainacan_plugin.tainacan_enable_relationship_metaquery : false
}
},
@ -172,6 +188,7 @@
this.modelSearch = '';
this.modelDisplayInRelatedItems = 'no';
this.modelAcceptDraftItems = 'no';
this.modelAcceptOnlyItemsAuthoredByCurrentUser = 'no';
this.emitValues();
}
},
@ -193,6 +210,7 @@
this.displayRelatedItemMetadata = this.value && this.value.display_related_item_metadata && Array.isArray(this.value.display_related_item_metadata) ? this.value.display_related_item_metadata : [];
this.modelDisplayInRelatedItems = this.value && this.value.display_in_related_items ? this.value.display_in_related_items : 'no';
this.modelAcceptDraftItems = this.value && this.value.accept_draft_items ? this.value.accept_draft_items : 'no';
this.modelAcceptOnlyItemsAuthoredByCurrentUser = this.value && this.value.accept_only_items_authored_by_current_user ? this.value.accept_only_items_authored_by_current_user : 'no';
},
methods: {
setErrorsAttributes( type, message ){
@ -283,7 +301,8 @@
search: this.modelSearch,
display_in_related_items: this.modelDisplayInRelatedItems,
display_related_item_metadata: this.displayRelatedItemMetadata,
accept_draft_items: this.modelAcceptDraftItems
accept_draft_items: this.modelAcceptDraftItems,
accept_only_items_authored_by_current_user: this.modelAcceptOnlyItemsAuthoredByCurrentUser
});
}
}

View File

@ -25,7 +25,7 @@
:placeholder="itemMetadatum.metadatum.placeholder ? itemMetadatum.metadatum.placeholder : $i18n.get('instruction_type_existing_item')"
:loading="isLoading"
:aria-close-label="$i18n.get('remove_value')"
:class="{'has-selected': selected != undefined && selected != []}"
:class="{ 'has-selected': selected != undefined && selected != [] }"
field="label"
@typing="search"
check-infinite-scroll
@ -56,7 +56,7 @@
<template
v-if="!isLoading"
slot="empty">
{{ $i18n.get('info_no_item_found') }}
{{ isAcceptingOnlyItemsAuthoredByCurrentUser ? $i18n.get('info_no_item_authored_by_you_found') : $i18n.get('info_no_item_found') }}
</template>
<template
v-if="currentUserCanEditItems && (!$adminOptions.itemEditionMode || $adminOptions.allowItemEditionModalInsideModal)"
@ -166,7 +166,7 @@
page: 1,
activeTab: 0,
editItemModalOpen: false,
adminURL: tainacan_plugin.admin_url + 'admin.php?',
adminURL: tainacan_plugin.admin_url + '?',
currentUserCanEditItems: false,
selectedValuesAsHtml: []
}
@ -209,6 +209,12 @@
this.itemMetadatum.metadatum &&
this.itemMetadatum.metadatum.metadata_type_options &&
this.itemMetadatum.metadatum.metadata_type_options.accept_draft_items === 'yes';
},
isAcceptingOnlyItemsAuthoredByCurrentUser() {
return this.itemMetadatum &&
this.itemMetadatum.metadatum &&
this.itemMetadatum.metadatum.metadata_type_options &&
this.itemMetadatum.metadatum.metadata_type_options.accept_only_items_authored_by_current_user === 'yes';
}
},
watch: {
@ -230,7 +236,8 @@
query['order'] = 'asc';
query['fetch_only'] = 'title,document_mimetype,thumbnail';
query['fetch_only_meta'] = this.isDisplayingRelatedItemMetadata ? (this.itemMetadatum.metadatum.metadata_type_options.display_related_item_metadata.filter(metadatumId => metadatumId !== 'thumbnail') + '') : (this.itemMetadatum.metadatum.metadata_type_options.search ? this.itemMetadatum.metadatum.metadata_type_options.search : '');
if (this.isAcceptingDraftItems)
if ( this.isAcceptingDraftItems )
query['status'] = ['publish','private','draft'];
axios.get('/collection/' + this.collectionId + '/items?' + qs.stringify(query) )
@ -251,7 +258,7 @@
});
}
// Checks if current user can edit itens on the related collection to offer modal
// Checks if current user can edit items on the related collection to offer modal
if (this.collection && this.collection.id == this.collectionId)
this.currentUserCanEditItems = this.collection.current_user_can_edit_items;
else {
@ -397,6 +404,9 @@
if (this.isAcceptingDraftItems)
query['status'] = ['publish','private','draft'];
if ( this.isAcceptingOnlyItemsAuthoredByCurrentUser )
query['authorid'] = tainacan_plugin.user_data.ID;
if (this.selected.length > 0)
query['exclude'] = this.selected.map((item) => item.value);

View File

@ -71,6 +71,10 @@ class Relationship extends Metadata_Type {
'accept_draft_items' => [
'title' => __( 'List and accept draft items on the relation', 'tainacan' ),
'description' => __( 'Include draft items as possible options to the relationship metadata.', 'tainacan' ),
],
'accept_only_items_authored_by_current_user' => [
'title' => __( 'Bind items only by current author', 'tainacan' ),
'description' => __( 'Accept stabelishing the replationship only with items authored by the current user editing the item.', 'tainacan' ),
]
];
}
@ -121,6 +125,7 @@ class Relationship extends Metadata_Type {
case 'display_in_related_items':
case 'accept_draft_items':
case 'accept_only_items_authored_by_current_user':
if ($option_value == 'yes')
$readable_option_value = __('Yes', 'tainacan');
else if ($option_value == 'no')
@ -177,13 +182,19 @@ class Relationship extends Metadata_Type {
// empty is ok
if ( !empty($this->get_option('display_in_related_items')) && !in_array($this->get_option('display_in_related_items'), ['yes', 'no']) ) {
return [
'display_in_related_items' => __('Display in related items must be a option yes or no','tainacan')
'display_in_related_items' => __('Display in related items must be an option yes or no','tainacan')
];
}
// empty is ok
if ( !empty($this->get_option('accept_draft_items')) && !in_array($this->get_option('accept_draft_items'), ['yes', 'no']) ) {
return [
'accept_draft_items' => __('Accept draft items must be a option yes or no','tainacan')
'accept_draft_items' => __('Accept draft items must be an option yes or no','tainacan')
];
}
// empty is ok
if ( !empty($this->get_option('accept_only_items_authored_by_current_user')) && !in_array($this->get_option('accept_only_items_authored_by_current_user'), ['yes', 'no']) ) {
return [
'accept_only_items_authored_by_current_user' => __('Bind items only by current author must be an option yes or no','tainacan')
];
}

View File

@ -33,7 +33,7 @@
disabled: false,
},
computed: {
getOptions(){
getOptions() {
if (this.itemMetadatum && this.itemMetadatum.metadatum.metadata_type_options && this.itemMetadatum.metadatum.metadata_type_options.options ) {
const metadata = this.itemMetadatum.metadatum.metadata_type_options.options;
return ( metadata ) ? metadata.split("\n") : [];

View File

@ -20,6 +20,12 @@
class="has-text-secondary tainacan-icon tainacan-icon-1-25em"/>
</span>
<label class="label">
<span
v-if="enumerateMetadatum"
style="opacity: 0.65;"
class="metadatum-section-enumeration">
{{ enumerateMetadatum }}.
</span>
{{ itemMetadatum.metadatum.name }}
</label>
<span
@ -147,7 +153,8 @@
:metadata-name-filter-string="metadataNameFilterString"
@mobileSpecialFocus="onMobileSpecialFocus"
:is-focused="isFocused"
:is-metadata-navigation="isMetadataNavigation" />
:is-metadata-navigation="isMetadataNavigation"
:enumerate-metadatum="enumerateMetadatum" />
</div>
</transition>
</b-field>
@ -169,7 +176,8 @@
metadataNameFilterString: '',
isMobileScreen: false,
isFocused: false,
isMetadataNavigation: false
isMetadataNavigation: false,
enumerateMetadatum: [String, Boolean]
},
data(){
return {

View File

@ -1,12 +1,10 @@
<template>
<div>
<taxonomy-tag-input
<tainacan-taxonomy-tag-input
v-if="getComponent == 'tainacan-taxonomy-tag-input'"
:disabled="disabled"
:is="getComponent"
:disabled="disabled || isFetchingTerms"
:maxtags="maxtags != undefined ? maxtags : (itemMetadatum.metadatum.multiple == 'yes' || allowNew === true ? (maxMultipleValues !== undefined ? maxMultipleValues : null) : '1')"
v-model="valueComponent"
:allow-select-to-create="allowSelectToCreate"
:allow-new="allowNewFromOptions"
:placeholder="itemMetadatum.metadatum.placeholder ? itemMetadatum.metadatum.placeholder : $i18n.get('instruction_type_existing_term')"
:taxonomy-id="taxonomyId"
@ -48,37 +46,43 @@
</a>
</div>
<!-- Term creation modal, used on admin for a complete term creation -->
<b-modal
v-model="isTermCreationModalOpen"
:width="768"
trap-focus
aria-role="dialog"
aria-modal
:can-cancel="['outside', 'escape']"
custom-class="tainacan-modal"
:close-button-aria-label="$i18n.get('close')">
<term-edition-form
:is-hierarchical="isHierarchical"
:taxonomy-id="taxonomyId"
:original-form="{ id: 'new', name: newTermName ? newTermName : '' }"
:is-term-insertion-flow="true"
@onEditionFinished="($event) => addRecentlyCreatedTerm($event.term)"
@onEditionCanceled="() => $console.log('Editing canceled')"
@onErrorFound="($event) => $console.log('Form with errors: ' + $event)" />
</b-modal>
<template v-if="allowNew && itemMetadatum.item">
<!-- Term creation modal, used on admin for a complete term creation -->
<b-modal
v-model="isTermCreationModalOpen"
:width="768"
trap-focus
aria-role="dialog"
aria-modal
:can-cancel="['outside', 'escape']"
custom-class="tainacan-modal"
:close-button-aria-label="$i18n.get('close')">
<term-edition-form
:metadatum-id="itemMetadatum.metadatum.id"
:item-id="itemMetadatum.item.id"
:is-hierarchical="isHierarchical"
:taxonomy-id="taxonomyId"
:original-form="{ id: 'new', name: newTermName ? newTermName : '' }"
:is-term-insertion-flow="true"
@onEditionFinished="($event) => addRecentlyCreatedTerm($event.term)"
@onEditionCanceled="() => $console.log('Editing canceled')"
@onErrorFound="($event) => $console.log('Form with errors: ' + $event)" />
</b-modal>
<!-- Term creation panel, used on item submission block for a simpler term creation -->
<transition name="filter-item">
<term-creation-panel
:is-hierarchical="isHierarchical"
v-if="isTermCreationPanelOpen"
:taxonomy-id="taxonomyId"
:original-form="{ id: 'new', name: newTermName ? newTermName : '' }"
@onEditionFinished="($event) => addTermToBeCreated($event)"
@onEditionCanceled="() => isTermCreationPanelOpen = false"
@onErrorFound="($event) => $console.log('Form with errors: ' + $event)" />
</transition>
<!-- Term creation panel, used on item submission block for a simpler term creation -->
<transition name="filter-item">
<term-creation-panel
:metadatum-id="itemMetadatum.metadatum.id"
:item-id="itemMetadatum.item.id"
:is-hierarchical="isHierarchical"
v-if="isTermCreationPanelOpen"
:taxonomy-id="taxonomyId"
:original-form="{ id: 'new', name: newTermName ? newTermName : '' }"
@onEditionFinished="($event) => addTermToBeCreated($event)"
@onEditionCanceled="() => isTermCreationPanelOpen = false"
@onErrorFound="($event) => $console.log('Form with errors: ' + $event)" />
</transition>
</template>
</div>
</template>
@ -86,6 +90,7 @@
import TainacanTaxonomyTagInput from './TaxonomyTaginput.vue';
import CheckboxRadioMetadataInput from '../../other/checkbox-radio-metadata-input.vue';
import { tainacan as axios } from '../../../js/axios.js';
import { mapActions } from 'vuex';
export default {
components: {
@ -99,7 +104,6 @@
forcedComponentType: '',
maxtags: '',
allowNew: false,
allowSelectToCreate: false,
isMobileScreen: false,
},
data(){
@ -112,7 +116,8 @@
isTermCreationModalOpen: false,
isTermCreationPanelOpen: false,
newTermName: '',
allowNewFromOptions: false
allowNewFromOptions: false,
isFetchingTerms: false
}
},
computed: {
@ -161,21 +166,55 @@
this.taxonomyId = metadata_type_options.taxonomy_id;
this.taxonomy = metadata_type_options.taxonomy;
this.allowNewFromOptions = this.allowNew === false ? false : metadata_type_options.allow_new_terms == 'yes';
this.allowNewFromOptions = this.allowNew === false ? false : metadata_type_options.allow_new_terms == 'yes' && (!this.$userCaps || this.$userCaps.hasCapability('tnc_rep_edit_taxonomies'));
this.getTermsId();
},
methods: {
...mapActions('taxonomy', [
'fetchTerms'
]),
getTermsId() {
let values = [];
if (this.value && this.itemMetadatum.metadatum && this.getComponent != 'tainacan-taxonomy-tag-input') {
if ( this.value && this.itemMetadatum.metadatum && this.getComponent != 'tainacan-taxonomy-tag-input' ) {
values = this.value.map(term => term.id).filter(term => term !== undefined);
this.valueComponent = (values.length > 0 && this.itemMetadatum.metadatum && this.itemMetadatum.metadatum.multiple === 'no') ? values[0] : values;
} else if (this.value && this.itemMetadatum.metadatum && this.getComponent == 'tainacan-taxonomy-tag-input') {
values = this.value.map((term) => { return { label: term.name, value: term.id } });
this.valueComponent = values;
// This first scenario happens in the item edition form, as the item metadata returns the terms as objects
const valuesInArray = Array.isArray(this.value) ? this.value : [this.value];
if ( valuesInArray[0] && valuesInArray[0] && valuesInArray[0].id ) {
values = valuesInArray.map((term) => { return { label: term.name, value: term.id } });
this.valueComponent = values;
// If the term is not returned as object, we're in bulk edition modal or in the metadata section condition metadata input, where value is a an array of IDs
} else if ( valuesInArray.length > 0 ) {
this.isFetchingTerms = true;
this.fetchTerms({
taxonomyId: this.taxonomyId,
fetchOnly: {
fetch_only: {
0: 'name',
1: 'id'
}
},
all: true,
include: valuesInArray
}).then((res) => {
values = res.terms.map((term) => { return { label: term.name, value: term.id } });
this.valueComponent = values;
this.isFetchingTerms = false;
}).catch((error) => {
this.isFetchingTerms = false;
throw error;
});
} else {
this.valueComponent = [];
}
}
},
addRecentlyCreatedTerm(term) {

View File

@ -5,12 +5,11 @@
:id="'tainacan-item-metadatum_id-' + itemMetadatum.metadatum.id + (itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + itemMetadatum.parent_meta_id) : '')"
size="is-small"
icon="magnify"
:allow-new="false"
@add="emitAdd"
@remove="emitRemove"
v-model="selected"
:data="labels"
:maxtags="maxtags"
:data="options"
:maxtags="maxtags != undefined ? maxtags : (itemMetadatum.metadatum.multiple == 'yes' || allowNew === true ? (maxMultipleValues !== undefined ? maxMultipleValues : null) : '1')"
field="label"
:remove-on-keys="[]"
:dropdown-position="isLastMetadatum ? 'top' :'auto'"
@ -21,10 +20,12 @@
:loading="isFetching"
:class="{ 'has-selected': selected != undefined && selected != [] }"
autocomplete
@typing="loadTerms"
@typing="search"
check-infinite-scroll
@infinite-scroll="loadMoreTerms"
:has-counter="false">
@infinite-scroll="searchMore"
:has-counter="false"
:append-to-body="!itemMetadatum.item"
:open-on-focus="false">
<template slot-scope="props">
<div class="media">
<div class="media-content">
@ -33,12 +34,12 @@
</div>
</template>
<template
v-if="!isFetching"
v-if="!isFetching && options.length <= 0 && searchName.length > 0"
slot="empty">
{{ $i18n.get('info_no_terms_found') }}
</template>
<template
v-if="allowNew"
v-if="allowNew && !isFetching && searchName.length > 0"
slot="footer">
<a @click="$emit('showAddNewTerm', { name: searchName })">
{{ $i18n.get('label_create_new_term') + ' "' + searchName + '"' }}
@ -57,55 +58,64 @@
allowNew: Boolean,
taxonomyId: Number,
disabled: false,
allowSelectToCreate: false,
maxtags: '',
isLastMetadatum: false
},
data() {
return {
selected: [],
labels: [],
options: [],
isFetching: false,
offset: 0,
searchName: '',
totalTerms: 0
}
},
computed: {
maxMultipleValues() {
return (
this.itemMetadatum &&
this.itemMetadatum.metadatum &&
this.itemMetadatum.metadatum.cardinality &&
!isNaN(this.itemMetadatum.metadatum.cardinality) &&
this.itemMetadatum.metadatum.cardinality > 1
) ? this.itemMetadatum.metadatum.cardinality : undefined;
},
},
watch: {
selected() {
if (this.allowSelectToCreate && this.selected[0]) {
this.selected[0].label.includes(`(${this.$i18n.get('select_to_create')})`);
this.selected[0].label = this.selected[0].label.split('(')[0];
}
value() {
if ( this.value && this.value.length > 0 && this.value[0].label )
this.selected = JSON.parse(JSON.stringify(this.value));
}
},
created() {
if (this.value && this.value.length > 0)
this.selected = this.value;
mounted() {
if ( this.value && this.value.length > 0 && this.value[0].label )
this.selected = JSON.parse(JSON.stringify(this.value));
},
methods: {
...mapActions('taxonomy', [
'fetchTerms'
]),
loadTerms: _.debounce( function(value) {
search: _.debounce( function(value) {
// String update
if (value != this.searchName) {
if ( value != this.searchName ) {
this.searchName = value;
this.labels = [];
this.options = [];
this.offset = 0;
}
// String cleared
if (!value.length) {
if ( !value.length ) {
this.searchName = value;
this.labels = [];
this.options = [];
this.offset = 0;
return;
}
// No need to load more
if (this.offset > 0 && this.labels.length >= this.totalTerms)
return
if ( this.offset > 0 && this.options.length >= this.totalTerms )
return;
this.isFetching = true;
@ -128,10 +138,7 @@
}).then((res) => {
for (let term of res.terms)
this.labels.push({ label: term.name, value: term.id });
if (res.terms.length <= 0 && this.allowSelectToCreate)
this.labels.push({ label: `${value} (${this.$i18n.get('select_to_create')})`, value: value })
this.options.push({ label: term.name, value: term.id });
this.offset += 12;
this.totalTerms = res.total;
@ -142,8 +149,8 @@
throw error;
});
}, 500),
loadMoreTerms: _.debounce(function () {
this.loadTerms(this.searchName)
searchMore: _.debounce(function () {
this.search(this.searchName)
}, 250),
updateSelectedValues(){
let selected = [];
@ -156,7 +163,7 @@
emitAdd(){
let val = this.selected;
let results = [];
if (val.length > 0) {
for (let term of val)
results.push( term.value );

View File

@ -354,6 +354,9 @@ class Taxonomy extends Metadata_Type {
public function get_value_as_html(Item_Metadata_Entity $item_metadata) {
$value = $item_metadata->get_value();
$return = '';
if ( !isset($value) )
return $return;
if ( $item_metadata->is_multiple() ) {
$count = 1;

View File

@ -14,6 +14,19 @@
:title="$i18n.getHelperTitle('tainacan-text', 'display_suggestions')"
:message="$i18n.getHelperMessage('tainacan-text', 'display_suggestions')"/>
</b-field>
<b-field :addons="false">
<label class="label is-inline">
{{ $i18n.getHelperTitle('tainacan-text', 'mask') }}
<help-button
:title="$i18n.getHelperTitle('tainacan-text', 'mask')"
:message="$i18n.getHelperMessage('tainacan-text', 'mask')" />
</label>
<b-input
:value="displaySuggestions === 'yes' ? '' : mask"
:disabled="displaySuggestions === 'yes'"
name="mask"
@input="onUpdateMask" />
</b-field>
</section>
</template>
@ -24,16 +37,22 @@
},
data() {
return {
displaySuggestions: String
displaySuggestions: String,
mask: String
}
},
created() {
this.displaySuggestions = this.value && this.value.display_suggestions ? this.value.display_suggestions : 'no';
this.mask = this.value && this.value.mask ? this.value.mask : '';
},
methods: {
onUpdateDisplaySuggestions(value) {
this.displaySuggestions = value;
this.$emit('input', { display_suggestions: value });
this.$emit('input', { display_suggestions: value, mask: value == 'yes' ? '' : this.mask });
},
onUpdateMask(value) {
this.mask = value;
this.$emit('input', { display_suggestions: this.displaySuggestions, mask: value });
}
}
}

View File

@ -1,14 +1,20 @@
<template>
<div>
<b-input
<div
v-if="!getDisplayAutocomplete"
:disabled="disabled"
:id="'tainacan-item-metadatum_id-' + itemMetadatum.metadatum.id + (itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + itemMetadatum.parent_meta_id) : '')"
:value="value"
:placeholder="itemMetadatum.metadatum.placeholder ? itemMetadatum.metadatum.placeholder : ''"
@input="onInput($event)"
@blur="onBlur"
@focus="onMobileSpecialFocus" />
class="control is-clearfix">
<input
class="input"
:disabled="disabled"
:id="'tainacan-item-metadatum_id-' + itemMetadatum.metadatum.id + (itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + itemMetadatum.parent_meta_id) : '')"
:value="value"
:placeholder="itemMetadatum.metadatum.placeholder ? itemMetadatum.metadatum.placeholder : ''"
@focus="onMobileSpecialFocus"
v-imask="getMask"
@complete="($event) => getMask ? onInput($event.detail.value) : null"
@input="($event) => getMask ? null : onInput($event.target.value)"
@blur="onBlur" >
</div>
<b-autocomplete
v-else
:disabled="disabled"
@ -44,8 +50,12 @@
<script>
import { isCancel } from '../../../js/axios';
import { dynamicFilterTypeMixin } from '../../../js/filter-types-mixin';
import { IMaskDirective } from 'vue-imask';
export default {
directives: {
imask: IMaskDirective
},
mixins: [dynamicFilterTypeMixin],
props: {
itemMetadatum: Object,
@ -72,6 +82,15 @@
return this.itemMetadatum.metadatum.metadata_type_options.display_suggestions == 'yes';
else
return false;
},
getMask() {
if (this.itemMetadatum && this.itemMetadatum.metadatum.metadata_type_options && this.itemMetadatum.metadatum.metadata_type_options.mask)
return {
mask: this.itemMetadatum.metadatum.metadata_type_options.mask,
lazy: false
};
else
return false;
}
},
created() {

View File

@ -35,6 +35,13 @@ class Text extends Metadata_Type {
'display_suggestions' => [
'title' => __( 'Display suggestions', 'tainacan' ),
'description' => __( 'Show an autocomplete input suggesting values inserted previously on other items for this metadatum.', 'tainacan' ),
],
'mask' => [
'title' => __( 'Mask input', 'tainacan' ),
'description' => sprintf(
__( 'Define a pattern of fixed characters that will be used to mask the input. Learn how to build mask patterns <a target="_blank" href="%1$s">here</a>.', 'tainacan' ),
'https://imask.js.org/guide.html#masked-pattern'
)
]
];
}

View File

@ -0,0 +1,50 @@
<template>
<section>
<b-field :addons="false">
<label class="label is-inline">
{{ $i18n.getHelperTitle('tainacan-textarea', 'maxlength') }}
<help-button
:title="$i18n.getHelperTitle('tainacan-textarea', 'maxlength')"
:message="$i18n.getHelperMessage('tainacan-textarea', 'maxlength')" />
</label>
<b-numberinput
v-model="maxlength"
name="maxlength"
step="1"
min="0"
@input="onUpdateMaxlength"/>
</b-field>
</section>
</template>
<script>
export default {
props: {
value: [ String, Object, Array ]
},
data() {
return {
maxlength: [Number, null]
}
},
created() {
this.maxlength = this.value && this.value.maxlength ? Number(this.value.maxlength) : null;
},
methods: {
onUpdateMaxlength(value) {
if (value == 0) value = null;
this.$emit('input', { maxlength: value });
}
}
}
</script>
<style scoped>
section{
margin-bottom: 10px;
}
.tainacan-help-tooltip-trigger {
font-size: 1em;
}
</style>

View File

@ -1,13 +1,15 @@
<template>
<b-input
:disabled="disabled"
:ref="'tainacan-item-metadatum_id-' + itemMetadatum.metadatum.id + (itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + itemMetadatum.parent_meta_id) : '')"
:id="'tainacan-item-metadatum_id-' + itemMetadatum.metadatum.id + (itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + itemMetadatum.parent_meta_id) : '')"
:placeholder="itemMetadatum.metadatum.placeholder ? itemMetadatum.metadatum.placeholder : ''"
:value="value"
@input="onInput($event)"
@blur="onBlur"
type="textarea"
@focus="onMobileSpecialFocus" />
@focus="onMobileSpecialFocus"
:maxlength="getMaxlength" />
</template>
<script>
@ -17,8 +19,20 @@
value: [String, Number, Array],
disabled: false
},
computed: {
getMaxlength() {
if (this.itemMetadatum && this.itemMetadatum.metadatum.metadata_type_options && this.itemMetadatum.metadatum.metadata_type_options.maxlength !== null && this.itemMetadatum.metadatum.metadata_type_options.maxlength !== undefined && this.itemMetadatum.metadatum.metadata_type_options.maxlength !== '')
return Number(this.itemMetadatum.metadatum.metadata_type_options.maxlength);
else
return undefined;
}
},
methods: {
onInput(value) {
const inputRef = this.$refs['tainacan-item-metadatum_id-' + this.itemMetadatum.metadatum.id + (this.itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + this.itemMetadatum.parent_meta_id) : '')];
if ( inputRef && this.getMaxlength && !inputRef.checkHtml5Validity() )
return;
this.$emit('input', value);
},
onBlur() {

View File

@ -15,6 +15,7 @@ class Textarea extends Metadata_Type {
parent::__construct();
$this->set_primitive_type('long_string');
$this->set_component('tainacan-textarea');
$this->set_form_component('tainacan-form-textarea');
$this->set_name( __('Textarea', 'tainacan') );
$this->set_description( __('A textarea with multiple lines', 'tainacan') );
$this->set_preview_template('
@ -26,6 +27,18 @@ class Textarea extends Metadata_Type {
');
}
/**
* @inheritdoc
*/
public function get_form_labels(){
return [
'maxlength' => [
'title' => __( 'Maximum of characters', 'tainacan' ),
'description' => __( 'Limits the character input to a maximum value an displays a counter.', 'tainacan' ),
]
];
}
public function get_multivalue_prefix() {
return '<p>';

View File

@ -623,7 +623,7 @@
dateFormat: '',
activityCreationDate: '',
isLoadingActivity: false,
adminFullURL: tainacan_plugin.admin_url + 'admin.php?page=tainacan_admin#',
adminFullURL: tainacan_plugin.admin_url + '?page=tainacan_admin#',
}
},
computed: {

View File

@ -92,7 +92,6 @@
:forced-component-type="bulkEditionProcedures[criterion].metadatum.metadata_type_object.component.includes('taxonomy') ? 'tainacan-taxonomy-tag-input' : ''"
:item-metadatum="{ metadatum: bulkEditionProcedures[criterion].metadatum }"
:allow-new="false"
:allow-select-to-create="false"
:maxtags="1"
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone}"
:disabled="bulkEditionProcedures[criterion].isDone"
@ -111,7 +110,6 @@
:forced-component-type="bulkEditionProcedures[criterion].metadatum.metadata_type_object.component.includes('taxonomy') ? 'tainacan-taxonomy-tag-input' : ''"
:item-metadatum="{ metadatum: bulkEditionProcedures[criterion].metadatum }"
:allow-new="false"
:allow-select-to-create="bulkEditionProcedures[criterion].metadatum.metadata_type_options.allow_new_terms === 'yes'"
:maxtags="1"
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone}"
class="tainacan-bulk-edition-field tainacan-bulk-edition-field-not-last"
@ -197,7 +195,6 @@
:forced-component-type="bulkEditionProcedures[criterion].metadatum.metadata_type_object.component.includes('taxonomy') ? 'tainacan-taxonomy-tag-input' : ''"
:item-metadatum="{ metadatum: bulkEditionProcedures[criterion].metadatum }"
:allow-new="false"
:allow-select-to-create="bulkEditionProcedures[criterion].metadatum.metadata_type_options.allow_new_terms === 'yes'"
:maxtags="1"
:class="{ 'is-field-history': bulkEditionProcedures[criterion].isDone }"
class="tainacan-bulk-edition-field tainacan-bulk-edition-field-last"
@ -213,7 +210,7 @@
:style="{
marginRight: !bulkEditionProcedures[criterion].isDone && !bulkEditionProcedures[criterion].isExecuting ? '-7.4px': 0
}"
class="field buttons-r-bulk">
class="field bulk-last-field">
<button
v-if="!bulkEditionProcedures[criterion].isDone && !bulkEditionProcedures[criterion].isExecuting"
@ -643,7 +640,7 @@
padding-left: 0 !important;
}
.buttons-r-bulk {
.bulk-last-field {
margin-left: 0 !important;
justify-content: center !important;
}
@ -786,9 +783,26 @@
&:not(:first-child) {
padding-left: 13px;
}
/deep/ .is-special-hidden-for-mobile,
/deep/ .is-special-hidden-for-mobile:focus,
/deep/ .is-special-hidden-for-mobile:focus-visible {
opacity: 0;
width: 0;
height: 0 !important;
min-height: 0;
min-width: 0;
padding: 0 !important;
line-height: 0px !important;
border: none !important;
border-color: transparent !important;
border-width: 0px !important;
font-size: 0px !important;
display: block !important;
}
}
.buttons-r-bulk {
.bulk-last-field {
display: flex;
align-items: center;
height: 32px;

View File

@ -508,7 +508,7 @@ export default {
p {
font-size: 1em;
color: var(--tainacan-gray5);
color: var(--tainacan-label-color);
padding: 0em 1.25em;
margin-top: 0.75em;
margin-bottom: 0;
@ -542,13 +542,13 @@ export default {
}
p {
font-size: 0.75em;
color: var(--tainacan-gray5);
color: var(--tainacan-label-color);
padding: 0em 0.5em;
margin-bottom: 0;
}
&:hover {
border: 1px solid var(--tainacan-gray3);
border: 1px solid var(--tainacan-item-hover-background-color);
}
}
}
@ -566,7 +566,7 @@ export default {
}
.collapse-handler:hover {
cursor: pointer;
background-color: var(--tainacan-gray1);
background-color: var(--tainacan-item-hover-background-color);
}
.collapse-handle {
cursor: pointer;
@ -626,9 +626,9 @@ export default {
}
}
&:hover {
background-color: var(--tainacan-gray1);
background-color: var(--tainacan-item-hover-background-color);
.exposer-item-actions {
background-color: var(--tainacan-gray2);
background-color: var(--tainacan-item-hover-background-color);
}
}
.exposer-item-actions {
@ -646,7 +646,7 @@ export default {
animation-name: appear-from-top-tooltip;
animation-duration: 0.3s;
position: absolute;
background: var(--tainacan-gray1);
background: var(--tainacan-item-hover-background-color);
padding: 0.5em 0.875em 0.75em 0.875em;
border-radius: 4px;
top: 44px;
@ -660,8 +660,8 @@ export default {
}
p { padding: 0 0 0.5em 0; }
input {
background-color: var(--tainacan-white);
border: 1px solid var(--tainacan-gray2);
background-color: var(--tainacan-input-background-color);
border: 1px solid var(--tainacan-input-border-color);
border-radius: 0;
padding: 2px 8px;
}
@ -673,7 +673,7 @@ export default {
width: 0;
height: 0;
border-style: solid;
border-color: transparent transparent var(--tainacan-gray1) transparent;
border-color: transparent transparent var(--tainacan-item-hover-background-color) transparent;
border-right-width: 14px;
border-bottom-width: 16px;
border-left-width: 14px;

View File

@ -157,7 +157,7 @@ export default {
max-height: 100vh;
overflow: auto;
z-index: 9;
max-width: 10em;
max-width: 11em;
-webkit-transition: max-width 0.2s linear; /* Safari */
transition: max-width 0.2s linear;

View File

@ -249,7 +249,7 @@ export default {
}
}
a {
color: var(--tainacan-white) !important;;
color: var(--tainacan-white) !important;
text-align: center;
white-space: nowrap;
padding: 6px 11px;

View File

@ -192,7 +192,7 @@
}
.logo-area {
height: $header-height;
min-width: 10em;
min-width: 11em;
cursor: pointer;
h1 {

View File

@ -72,7 +72,7 @@
class="button"
id="view-collection-button">
<span class="icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-see"/>
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-openurl"/>
</span>
<span class="is-hidden-mobile">{{ $i18n.get('label_view_collection_on_website') }}</span>
</a>
@ -85,7 +85,7 @@
class="button"
id="view-repository-button--taxonomies">
<span class="icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-see"/>
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-openurl"/>
</span>
<span class="is-hidden-mobile">{{ $i18n.get('label_view_taxonomies_on_website') }}</span>
</a>
@ -98,7 +98,7 @@
class="button"
id="view-repository-button">
<span class="icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-see"/>
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-openurl"/>
</span>
<span class="is-hidden-mobile">{{ $i18n.get('label_view_collections_on_website') }}</span>
</a>
@ -168,7 +168,7 @@ export default {
padding-top: 10px;
padding-bottom: 10px;
padding-right: 0;
padding-left: calc((var(--tainacan-one-column) - 6.666666667px) + 10em);
padding-left: calc((var(--tainacan-one-column) - 6.666666667px) + 11em);
margin: 0px;
display: flex;
vertical-align: middle;

View File

@ -187,7 +187,9 @@
:id="`${key}.${index}-tainacan-li-checkbox-model`"
:ref="`${key}.${index}-tainacan-li-checkbox-model`"
:key="index">
<label class="b-checkbox checkbox">
<label
@click="option.total_children > 0 && (!finderColumns[key + 1] || finderColumns[key + 1].label !== option.label) ? getOptionChildren(option, key, index) : null"
class="b-checkbox checkbox">
<input
@input="$emit('input', $event.target.value)"
:value="(isNaN(Number(option.value)) ? option.value : Number(option.value))"
@ -829,8 +831,8 @@
this.$emit('appliedCheckBoxModal');
},
renderHierarchicalPath(hierachyPath, label) {
return '<span style="color: var(--tainacan-info-color);">' + hierachyPath.replace(/>/g, '&nbsp;<span class="hierarchy-separator"> &gt; </span>&nbsp;') + '</span>' + label;
renderHierarchicalPath(hierarchyPath, label) {
return '<span style="color: var(--tainacan-info-color);">' + hierarchyPath.replace(/>/g, '&nbsp;<span class="hierarchy-separator"> &gt; </span>&nbsp;') + '</span>' + label;
}
}
}
@ -888,12 +890,12 @@
display: flex;
justify-content: center;
cursor: pointer;
border: 1px solid var(--tainacan-gray1);
border: 1px solid var(--tainacan-input-border-color);
margin-top: 10px;
margin-bottom: 0.1em;
&:hover {
background-color: var(--tainacan-blue1);
background-color: var(--tainacan-item-hover-background-color);
}
}
@ -922,7 +924,7 @@
}
&:hover {
background-color: var(--tainacan-gray1);
background-color: var(--tainacan-input-border-color);
}
}
@ -944,7 +946,7 @@
}
&:hover {
background-color: var(--tainacan-gray1);
background-color: var(--tainacan-item-hover-background-color);
}
&.result-info {
padding: 0.5rem 0.25rem 0.25rem 0.25rem;
@ -958,8 +960,12 @@
}
.tainacan-finder-columns-container {
background-color: var(--tainacan-white);
border: 1px solid var(--tainacan-gray1);
background-color: var(--tainacan-background-color);
border: 1px solid var(--tainacan-input-border-color);
border-bottom-left-radius: var(--tainacan-dropdownmenu-border-radius);
border-bottom-right-radius: var(--tainacan-dropdownmenu-border-radius);
border-top-right-radius: 0px;
border-top-left-radius: 0px;
border-top: 0px;
margin-top: -1px;
height: auto;
@ -975,7 +981,7 @@
}
.tainacan-finder-column {
border-right: solid 1px var(--tainacan-gray1);
border-right: solid 1px var(--tainacan-input-border-color);
flex-basis: auto;
flex-grow: 1;
max-width: 600px;
@ -1036,7 +1042,7 @@
padding: 0.45em 0.75em;
margin: 0;
position: relative;
border-bottom: 1px solid var(--tainacan-gray1);
border-bottom: 1px solid var(--tainacan-input-border-color);
}
&:not(:first-child) .column-label {
@ -1062,7 +1068,7 @@
}
&::before {
top: 0px;
border-color: transparent transparent transparent var(--tainacan-gray1);
border-color: transparent transparent transparent var(--tainacan-input-border-color);
border-left-width: 12px;
border-top-width: calc(1.2em + 1px);
border-bottom-width: calc(1.2em + 0px);
@ -1124,6 +1130,13 @@
}
}
.tainacan-finder-columns-container,
.tainacan-checkbox-list-container {
/deep/ .b-checkbox.checkbox {
font-size: 1em;
}
}
.tainacan-checkbox-list-page-changer {
height: 100%;
position: absolute;
@ -1131,7 +1144,7 @@
right: auto;
align-items: center;
display: flex;
background-color: var(--tainacan-gray1);
background-color: var(--tainacan-item-hover-background-color);
&:hover {
background-color: var(--tainacan-primary);

View File

@ -81,6 +81,13 @@
<span class="check" />
<span class="control-label">
<span
v-tooltip="{
content: option.description,
autoHide: true,
html: true,
placement: 'auto-start',
popperClass: ['tainacan-tooltip', 'tooltip']
}"
class="checkbox-label-text"
v-html="`${ option.name ? option.name : (option.label ? (option.hierarchy_path ? renderHierarchicalPath(option.hierarchy_path, option.label) : option.label) : '') }`" />
</span>
@ -147,7 +154,15 @@
:type="isCheckbox ? 'checkbox' : 'radio'">
<span class="check" />
<span class="control-label">
<span class="checkbox-label-text">{{ `${ (option.label ? option.label : '') }` }}</span>
<span
v-tooltip="{
content: option.description,
autoHide: true,
html: true,
placement: 'auto-start',
popperClass: ['tainacan-tooltip', 'tooltip']
}"
class="checkbox-label-text">{{ `${ (option.label ? option.label : '') }` }}</span>
</span>
</label>
</li>
@ -196,7 +211,8 @@
'b-checkbox checkbox': isCheckbox,
'b-radio radio': !isCheckbox,
'is-disabled': !isOptionSelected(option.value) && maxMultipleValues !== undefined && (maxMultipleValues - 1 < selected.length)
}" >
}"
@click="option.total_children > 0 && (!finderColumns[key + 1] || finderColumns[key + 1].label !== option.label) ? getOptionChildren(option, key, index) : null">
<input
:disabled="!isOptionSelected(option.value) && maxMultipleValues !== undefined && (maxMultipleValues - 1 < selected.length)"
@input="updateLocalSelection($event.target.value)"
@ -205,7 +221,15 @@
:type="isCheckbox ? 'checkbox' : 'radio'">
<span class="check" />
<span class="control-label">
<span class="checkbox-label-text">{{ option.label }}</span>
<span
v-tooltip="{
content: option.description,
autoHide: true,
html: true,
placement: 'auto-start',
popperClass: ['tainacan-tooltip', 'tooltip']
}"
class="checkbox-label-text">{{ option.label }}</span>
</span>
</label>
<a
@ -305,8 +329,8 @@
</div>
</b-tab-item>
</b-tabs>
<!-- <pre>{{ hierarchicalPath }}</pre>
<pre>{{ finderColumns }}</pre> -->
<!-- <pre>{{ hierarchicalPath }}</pre> -->
<!-- <pre>{{ finderColumns }}</pre> -->
<!--<pre>{{ totalRemaining }}</pre>-->
<!-- <pre>{{ selected }}</pre> -->
<!--<pre>{{ options }}</pre>-->
@ -444,7 +468,11 @@
axios.get(`/taxonomy/${this.taxonomy_id}/terms/?${qs.stringify({ hideempty: 0, include: selected})}`)
.then((res) => {
for (const term of res.data)
this.saveSelectedTagName(term.id, term.name, term.url);
this.saveSelectedTagName(
term.id,
!this.isCheckbox && term.hierarchy_path ? ( term.hierarchy_path + term.name ) : term.name,
term.url
);
this.isSelectedTermsLoading = false;
})
@ -803,15 +831,15 @@
});
}
},
renderHierarchicalPath(hierachyPath, label) {
return '<span style="color: var(--tainacan-info-color);">' + hierachyPath.replace(/>/g, '&nbsp;<span class="hierarchy-separator"> &gt; </span>&nbsp;') + '</span>' + label;
renderHierarchicalPath(hierarchyPath, label) {
return '<span style="color: var(--tainacan-info-color);">' + hierarchyPath.replace(/>/g, '&nbsp;<span class="hierarchy-separator"> &gt; </span>&nbsp;') + '</span>' + label;
},
onMobileSpecialFocus($event) {
$event.target.blur();
this.$emit('mobileSpecialFocus');
},
isOptionSelected(optionValue) {
if (Array.isArray(this.selected))
if ( Array.isArray(this.selected) )
return (this.selected.indexOf((isNaN(Number(optionValue)) ? optionValue : Number(optionValue))) >= 0)
else
return optionValue == this.selected;
@ -1006,6 +1034,10 @@
.tainacan-finder-columns-container {
background-color: var(--tainacan-white);
border: 1px solid var(--tainacan-gray1);
border-bottom-left-radius: var(--tainacan-dropdownmenu-border-radius);
border-bottom-right-radius: var(--tainacan-dropdownmenu-border-radius);
border-top-right-radius: 0px;
border-top-left-radius: 0px;
border-top: 0px;
margin-top: -1px;
display: flex;
@ -1211,7 +1243,7 @@
padding: 0px !important;
display: inline;
.control {
.field.is-grouped > .control:not(:last-child) {
margin-bottom: 0.25rem;
margin-right: 0.25rem;
}
@ -1223,6 +1255,11 @@
section p {
font-size: 0.875em;
}
/deep/ .field {
padding: 0.25rem !important;
margin: 0 !important;
}
}
.tainacan-modal-checkbox-search-results-body {

View File

@ -19,7 +19,7 @@
<div class="field is-grouped form-submit">
<div class="control">
<button
id="button-cancel-importer-edition"
id="button-cancel-file-preview"
class="button is-outlined"
type="button"
@click="$parent.close()">

View File

@ -143,7 +143,7 @@
<div class="field">
<button
@click.prevent="removeCriterion(searchCriterion)"
class="button is-white is-pulled-right has-text-secondary"
class="button button-remove-criterion is-pulled-right has-text-secondary"
type="button"
:aria-label="$i18n.get('remove_search_criterion')">
<span
@ -651,6 +651,7 @@
.tnc-advanced-search-container {
position: relative;
padding: 1.25em;
border-radius: var(--tainacan-dropdownmenu-border-radius, 0px);
h3 {
font-size: 1em !important;
@ -683,6 +684,13 @@
margin-right: 1em;
}
.button-remove-criterion {
color: var(--tainacan-input-color);
background: transparent;
border: none;
border-radius: var(--tainacan-button-border-radius, 4px);
}
@media screen and (max-width: 768px) {
.is-12>.columns {
flex-wrap: wrap;

View File

@ -2,7 +2,6 @@
<aside
aria-labelledby="filters-label-landmark"
:aria-busy="isLoadingFilters">
<b-loading
:is-full-page="false"
:active.sync="isLoadingFilters"/>
@ -90,12 +89,6 @@
:filters-as-modal="filtersAsModal"
:is-mobile-screen="isMobileScreen"/>
</template>
<!-- <p
class="has-text-gray"
style="font-size: 0.75em;"
v-if="taxonomyFilter.length <= 0">
{{ $i18n.get('info_there_is_no_filter') }}
</p> -->
<hr v-if="taxonomyFilter.length > 1">
</div>
</template>
@ -140,12 +133,6 @@
:filters-as-modal="filtersAsModal"
:is-mobile-screen="isMobileScreen" />
</template>
<!-- <p
class="has-text-gray"
style="font-size: 0.75em;"
v-if="taxonomyFilter.length <= 0">
{{ $i18n.get('info_there_is_no_filter') }}
</p> -->
<hr v-if="taxonomyFilter.length > 1">
</div>
</template>
@ -194,12 +181,6 @@
:filters-as-modal="filtersAsModal"
:is-mobile-screen="isMobileScreen" />
</template>
<!-- <p
class="has-text-gray"
style="font-size: 0.75em;"
v-if="taxonomyFilter.length <= 0">
{{ $i18n.get('info_there_is_no_filter') }}
</p> -->
<hr v-if="repositoryCollectionFilters.length > 1">
</div>
</template>
@ -244,12 +225,6 @@
:filters-as-modal="filtersAsModal"
:is-mobile-screen="isMobileScreen" />
</template>
<!-- <p
class="has-text-gray"
style="font-size: 0.75em;"
v-if="taxonomyFilter.length <= 0">
{{ $i18n.get('info_there_is_no_filter') }}
</p> -->
<hr v-if="repositoryCollectionFilters.length > 1">
</div>
</template>
@ -271,9 +246,12 @@
</template>
</div>
<section
v-if="!isLoadingFilters &&
!((filters.length >= 0 && isRepositoryLevel) || filters.length > 0)"
class="is-grouped-centered section">
v-if="!isLoadingFilters && (
( taxonomy && taxonomyFilters && Object.keys(taxonomyFilters).length <= 0 ) ||
( isRepositoryLevel && !taxonomy && repositoryCollectionFilters && Object.keys(repositoryCollectionFilters).length <= 0 ) ||
( !isRepositoryLevel && !taxonomy && filters && filters.length <= 0 )
)"
class="is-grouped-centered">
<div class="content has-text-gray has-text-centered">
<p>
<span class="icon is-large">
@ -281,6 +259,7 @@
</span>
</p>
<p>{{ $i18n.get('info_there_is_no_filter' ) }}</p>
<p v-if="isRepositoryLevel && $route.name != null">{{ $i18n.get('info_collection_filter_on_repository_level') }}</p>
<router-link
v-if="!$adminOptions.hideItemsListFilterCreationButton && $route.name != null && ((isRepositoryLevel && $userCaps.hasCapability('tnc_rep_edit_filters')) || (!isRepositoryLevel && collection && collection.current_user_can_edit_filters))"
id="button-create-filter"
@ -431,7 +410,7 @@
this.isLoadingFilters = true;
// Normal filter loading, only collection ones
if (!this.taxonomy) {
if ( !this.taxonomy && !this.isRepositoryLevel ) {
this.fetchFilters({
collectionId: this.collectionId,
isRepositoryLevel: this.isRepositoryLevel,
@ -449,7 +428,7 @@
.catch(() => this.isLoadingFilters = false);
// Custom filter loading, get's from collections that have items with that taxonomy
} else {
} else if ( this.taxonomy ) {
let collectionsIds = [];
@ -466,20 +445,24 @@
this.fetchTaxonomyFilters({ taxonomyId: taxonomyId[taxonomyId.length - 1], collectionsIds: collectionsIds })
.catch(() => this.isLoadingFilters = false);
} else if ( this.isRepositoryLevel && !this.taxonomy ) {
// Cancels previous Request
if (this.repositoryFiltersSearchCancel != undefined)
this.repositoryFiltersSearchCancel.cancel('Repository Collection Filters search Canceled.');
this.fetchRepositoryCollectionFilters()
.then((anotherResp) => {
anotherResp.request
.then(() => this.isLoadingFilters = false)
.catch(() => this.isLoadingFilters = false);
this.repositoryFiltersSearchCancel = anotherResp.source;
})
.catch(() => this.isLoadingFilters = false);
}
// On repository level we also fetch collection filters
if ( !this.taxonomy && this.isRepositoryLevel ) {
// Cancels previous Request
if (this.repositoryFiltersSearchCancel != undefined)
this.repositoryFiltersSearchCancel.cancel('Repository Collection Filters search Canceled.');
this.fetchRepositoryCollectionFilters()
.then((source) => {
this.repositoryFiltersSearchCancel = source;
});
}
},
updateIsLoadingItems(isLoadingItems) {
this.$emit('updateIsLoadingItemsState', isLoadingItems);

View File

@ -213,7 +213,7 @@
}
.filter-tag {
border-radius: 3px;
border-radius: 4px;
padding: 3px 8px 2px 8px;
position: relative;
background-color: var(--tainacan-input-background-color);
@ -240,9 +240,13 @@
right: 2px;
top: 2px;
border-radius: 50px;
background-color: transparent;
&:not(:hover) {
background-color: transparent;
&:hover,
&:focus {
border: none;
background-color: var(--tainacan-item-hover-background-color);
color: var(--tainacan-secondary);
}
}
&.is-readonly {

View File

@ -48,6 +48,7 @@ import User from '../components/metadata-types/user/User.vue';
import GeoCoordinate from '../components/metadata-types/geocoordinate/GeoCoordinate.vue'
import FormText from '../components/metadata-types/text/FormText.vue';
import FormTextarea from '../components/metadata-types/textarea/FormTextarea.vue';
import FormRelationship from '../components/metadata-types/relationship/FormRelationship.vue';
import FormTaxonomy from '../components/metadata-types/taxonomy/FormTaxonomy.vue';
import FormSelectbox from '../components/metadata-types/selectbox/FormSelectbox.vue';
@ -81,7 +82,8 @@ import {
UserCapabilitiesPlugin,
StatusHelperPlugin,
CommentsStatusHelperPlugin,
AdminOptionsHelperPlugin
AdminOptionsHelperPlugin,
HtmlSanitizerPlugin
} from './admin-utilities';
import {
ThumbnailHelperPlugin,
@ -174,6 +176,7 @@ export default (element) => {
Vue.use(ThumbnailHelperPlugin);
Vue.use(OrderByHelperPlugin);
Vue.use(StatusHelperPlugin);
Vue.use(HtmlSanitizerPlugin);
Vue.use(ConsolePlugin, {visual: false});
Vue.use(VueTheMask);
Vue.use(CommentsStatusHelperPlugin);
@ -202,6 +205,7 @@ export default (element) => {
/* Metadata Option forms */
Vue.component('tainacan-form-text', FormText);
Vue.component('tainacan-form-textarea', FormTextarea);
Vue.component('tainacan-form-relationship', FormRelationship);
Vue.component('tainacan-form-taxonomy', FormTaxonomy);
Vue.component('tainacan-form-selectbox', FormSelectbox);

View File

@ -7,6 +7,21 @@ const wpApi = axios.create({
wpApi.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce;
const tainacanSanitize = function(htmlString) {
return htmlString.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/\//g, '&#x2F;')
}
// HTML SANITIZE PLUGIN - Helps sanitizing html string from javascript.
export const HtmlSanitizerPlugin = {};
HtmlSanitizerPlugin.install = function (Vue, options = {}) {
Vue.prototype.$htmlSanitizer = {
sanitize(htmlString) {
return tainacanSanitize(htmlString);
}
}
};
// CONSOLE PLUGIN - Allows custom use of console functions and avoids eslint warnings.
export const ConsolePlugin = {};
ConsolePlugin.install = function (Vue, options = { visual: false }) {
@ -15,7 +30,7 @@ ConsolePlugin.install = function (Vue, options = { visual: false }) {
log(something) {
if (options.visual) {
Vue.prototype.$buefy.snackbar.open({
message: something,
message: htmlString(something),
type: 'is-secondary',
position: 'is-bottom-right',
indefinite: true,
@ -28,7 +43,7 @@ ConsolePlugin.install = function (Vue, options = { visual: false }) {
info(someInfo) {
if (options.visual) {
Vue.prototype.$buefy.snackbar.open({
message: someInfo,
message: tainacanSanitize(someInfo),
type: 'is-primary',
position: 'is-bottom-right',
duration: 5000,
@ -41,7 +56,7 @@ ConsolePlugin.install = function (Vue, options = { visual: false }) {
error(someError) {
if (options.visual) {
Vue.prototype.$buefy.snackbar.open({
message: someError,
message: tainacanSanitize(someError),
type: 'is-danger',
position: 'is-bottom-right',
indefinite: true,
@ -142,6 +157,7 @@ UserPrefsPlugin.install = function (Vue, options = {}) {
'taxonomies_order_by': 'title',
'collections_order': 'desc',
'collections_order_by': 'date',
'collections_author_filter': '',
'map_view_mode_selected_geocoordinate_metadatum': 0
},
init() {
@ -636,7 +652,7 @@ AdminOptionsHelperPlugin.install = function (Vue, options = {}) {
* hideItemEditionMetadataTypes
* allowItemEditionModalInsideModal // Not recommended!
* itemEditionDocumentInsideTabs
* itemEditionAttachmentInsideTabs
* itemEditionAttachmentsInsideTabs
* hideBulkEditionPageTitle

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