Merge remote-tracking branch 'origin/develop' into issue-#92

This commit is contained in:
Jacson Passold 2018-08-21 01:49:19 -03:00
commit 9f6c111f83
47 changed files with 2556 additions and 329 deletions

View File

@ -2,12 +2,13 @@
Notes for a future documentation
Tainacan uses the ordinary WordPress template hierarchy for its templates. It adds only 2 additional templates in your hierarchy
Tainacan uses the ordinary WordPress template hierarchy for its templates. It adds only 3 additional templates in your hierarchy
* `tainacan/single-items.php` - Used in the single template for any item of any collection
* `tainacan/arhive-items.php` - Used in the list of items of any collection
* `tainacan/archive-taxonomy.php` - Used as a template for all Tainacan Taxonomies (list items based on a term)
Since each collection is a new custom post type, these 2 new templates are usefull to create a template that will be used by all collections.
Since each collection is a new custom post type, these templates are usefull to create a template that will be used by all collections.
Nevertheless, you are still able to create more specific templates, using the standar WordPress hierarchy.
@ -23,4 +24,12 @@ A template for a single specific item:
A template for the list of items of the collection with id 4
`archive-tnc_col_4_item.php`
`archive-tnc_col_4_item.php`
A template for a specific taxonomy
`taxonomy-tnc_tax_123.php`
A teplate for a specific term
`taxonomy-tnc_tax_123-term-name.php`

View File

@ -47,8 +47,25 @@ The URL of the Ontology or vocabulary. For example `http://schema.org` or `http
### Type
String $type
The Class of the ontology that this mapping refers to. For example `CreativeWork`, which is a class of Schema.org, if applied
### Header
String $header
The header to be append to API answer, like for Dublin Core, if we need to add RDF to xml header when using Dublin Core as mapper, so:
```
public $header = '<?xml version="1.0"?><!DOCTYPE rdf:RDF SYSTEM "http://dublincore.org/2000/12/01-dcmes-xml-dtd.dtd"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" ></rdf:RDF>';
```
### Prefix
String $prefix
The optional prefix for the key labels, like ```dc:``` for Dublin Core in XML exposing.
### Registering a new mapper
For register a new mapper, the action need to be added to `tainacan-register-exposer-mappers` hook, like:
```

181
package-lock.json generated
View File

@ -4,9 +4,9 @@
"lockfileVersion": 1,
"dependencies": {
"@vue/component-compiler-utils": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@vue/component-compiler-utils/-/component-compiler-utils-2.1.1.tgz",
"integrity": "sha512-iP+5zKyAwkDvRLZMEntCPbYzd6lWnbqYcpg5waHj0QPm4RC7zWt5PQ0EkbVZVSt5KHbAHxeWGlvEr2YmzGIpFw==",
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@vue/component-compiler-utils/-/component-compiler-utils-2.2.0.tgz",
"integrity": "sha512-pS4zlcdD7BvedyB+IfiTfrbi6C977UMIfulSk8r6uL0BU46ZE2+fUj/zbSNSfVxeaj9ElmnSni5OMwF9np+b+w==",
"dev": true,
"requires": {
"consolidate": "^0.15.1",
@ -15,7 +15,7 @@
"merge-source-map": "^1.1.0",
"postcss": "^6.0.20",
"postcss-selector-parser": "^3.1.1",
"prettier": "^1.13.7",
"prettier": "1.13.7",
"source-map": "^0.5.6",
"vue-template-es2015-compiler": "^1.6.0"
},
@ -575,13 +575,13 @@
"dev": true
},
"autoprefixer": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.1.1.tgz",
"integrity": "sha512-Q/2zhVEglXXCBNCOFfnihQcQystPYJt4GrIopeWhPjFxRPXya8eOstB89AafW0nWhSscByp+rSXp9EE5X4zgXQ==",
"version": "9.1.2",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.1.2.tgz",
"integrity": "sha512-deo8jkqEIQALuN4OMbVPmtH8BUTRUW2PtINom/ZZBX6MvDUPcFaxTVB2USkWyeLlfd9garISbhjGN5WDHgRH2w==",
"dev": true,
"requires": {
"browserslist": "^4.0.2",
"caniuse-lite": "^1.0.30000876",
"caniuse-lite": "^1.0.30000877",
"normalize-range": "^0.1.2",
"num2fraction": "^1.2.2",
"postcss": "^7.0.2",
@ -598,9 +598,9 @@
}
},
"caniuse-lite": {
"version": "1.0.30000876",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000876.tgz",
"integrity": "sha512-v+Q2afhJJ1oydQnEB4iHhxDz5x9lWPbRnQBQlM3FgtZxqLO8KDSdu4txUrFwC1Ws9I2kQi/QImkvj17NbVpNAg==",
"version": "1.0.30000877",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000877.tgz",
"integrity": "sha512-h04kV/lcuhItU1CZTJOxUEk/9R+1XeJqgc67E+XC8J9TjPM8kzVgOn27ZtRdDUo8O5F8U4QRCzDWJrVym3w3Cg==",
"dev": true
},
"chalk": {
@ -632,9 +632,9 @@
"dev": true
},
"supports-color": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
@ -1642,9 +1642,9 @@
},
"dependencies": {
"caniuse-lite": {
"version": "1.0.30000876",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000876.tgz",
"integrity": "sha512-v+Q2afhJJ1oydQnEB4iHhxDz5x9lWPbRnQBQlM3FgtZxqLO8KDSdu4txUrFwC1Ws9I2kQi/QImkvj17NbVpNAg==",
"version": "1.0.30000877",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000877.tgz",
"integrity": "sha512-h04kV/lcuhItU1CZTJOxUEk/9R+1XeJqgc67E+XC8J9TjPM8kzVgOn27ZtRdDUo8O5F8U4QRCzDWJrVym3w3Cg==",
"dev": true
}
}
@ -1668,6 +1668,12 @@
"isarray": "^1.0.0"
}
},
"buffer-from": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
"dev": true
},
"buffer-indexof": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.1.tgz",
@ -1969,6 +1975,12 @@
"delayed-stream": "~1.0.0"
}
},
"commander": {
"version": "2.13.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz",
"integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==",
"dev": true
},
"commondir": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
@ -2027,11 +2039,12 @@
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"concat-stream": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz",
"integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=",
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
"integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
"dev": true,
"requires": {
"buffer-from": "^1.0.0",
"inherits": "^2.0.3",
"readable-stream": "^2.2.2",
"typedarray": "^0.0.6"
@ -2629,9 +2642,9 @@
"dev": true
},
"electron-to-chromium": {
"version": "1.3.57",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.57.tgz",
"integrity": "sha512-YYpZlr6mzR8cK5VRmTZydEt5Mp+WMg1/syrO40PoQzl76vJ+oQchL2d3FmEcWzw3FYqJVYJP/kYYSzTa7FLXwg==",
"version": "1.3.58",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.58.tgz",
"integrity": "sha512-AGJxlBEn2wOohxqWZkISVsOjZueKTQljfEODTDSEiMqSpH0S+xzV+/5oEM9AGaqhu7DzrpKOgU7ocQRjj0nJmg==",
"dev": true
},
"element-theme-chalk": {
@ -2772,9 +2785,9 @@
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
},
"eslint": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-5.3.0.tgz",
"integrity": "sha512-N/tCqlMKkyNvAvLu+zI9AqDasnSLt00K+Hu8kdsERliC9jYEc8ck12XtjvOXrBKu8fK6RrBcN9bat6Xk++9jAg==",
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-5.4.0.tgz",
"integrity": "sha512-UIpL91XGex3qtL6qwyCQJar2j3osKxK9e3ano3OcGEIRM4oWIpCkDg9x95AXEC2wMs7PnxzOkPZ2gq+tsMS9yg==",
"dev": true,
"requires": {
"ajv": "^6.5.0",
@ -2811,7 +2824,6 @@
"regexpp": "^2.0.0",
"require-uncached": "^1.0.3",
"semver": "^5.5.0",
"string.prototype.matchall": "^2.0.0",
"strip-ansi": "^4.0.0",
"strip-json-comments": "^2.0.1",
"table": "^4.0.3",
@ -2819,15 +2831,15 @@
},
"dependencies": {
"ajv": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.2.tgz",
"integrity": "sha512-hOs7GfvI6tUI1LfZddH82ky6mOMyTuY0mk7kE2pWpmhhUSkumzaTO5vbVwij39MdwPQWCV4Zv57Eo06NtL/GVA==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.3.tgz",
"integrity": "sha512-LqZ9wY+fx3UMiiPd741yB2pj3hhil+hQc8taf4o2QGRFpWgZ2V5C8HA165DY9sS3fJwsk7uT7ZlFEyC3Ig3lLg==",
"dev": true,
"requires": {
"fast-deep-equal": "^2.0.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.1"
"uri-js": "^4.2.2"
}
},
"ansi-regex": {
@ -2903,9 +2915,9 @@
"dev": true
},
"semver": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",
"version": "5.5.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz",
"integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==",
"dev": true
},
"strip-ansi": {
@ -2918,9 +2930,9 @@
}
},
"supports-color": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
@ -4469,9 +4481,9 @@
"dev": true
},
"ignore": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.3.tgz",
"integrity": "sha512-Z/vAH2GGIEATQnBVXMclE2IGV6i0GyVngKThcGZ5kHgHMxLo9Ow2+XHRq1aEKEej5vOF1TPJNbvX6J/anT0M7A==",
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
"integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",
"dev": true
},
"import-cwd": {
@ -4620,9 +4632,9 @@
}
},
"supports-color": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
@ -6475,9 +6487,9 @@
"dev": true
},
"prettier": {
"version": "1.14.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.14.2.tgz",
"integrity": "sha512-McHPg0n1pIke+A/4VcaS2en+pTNjy4xF+Uuq86u/5dyDO59/TtFZtQ708QIRkEZ3qwKz3GVkVa6mpxK/CpB8Rg==",
"version": "1.13.7",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.13.7.tgz",
"integrity": "sha512-KIU72UmYPGk4MujZGYMFwinB7lOf2LsDNGSOC8ufevsrPLISrZbNJlWstRi3m0AMuszbH+EFSQ/r6w56RSPK6w==",
"dev": true
},
"private": {
@ -6747,15 +6759,6 @@
"safe-regex": "^1.1.0"
}
},
"regexp.prototype.flags": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.2.0.tgz",
"integrity": "sha512-ztaw4M1VqgMwl9HlPpOuiYgItcHlunW0He2fE6eNfT6E/CF2FtYi9ofOYe4mKntstYk0Fyh/rDRBdS3AnxjlrA==",
"dev": true,
"requires": {
"define-properties": "^1.1.2"
}
},
"regexpp": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.0.tgz",
@ -7625,9 +7628,9 @@
}
},
"stream-each": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.2.tgz",
"integrity": "sha512-mc1dbFhGBxvTM3bIWmAAINbqiuAk9TATcfIQC8P+/+HJefgaiTlMn2dHvkX8qlI12KeYKSQ1Ua9RrIqrn1VPoA==",
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz",
"integrity": "sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw==",
"dev": true,
"requires": {
"end-of-stream": "^1.1.0",
@ -7695,19 +7698,6 @@
"strip-ansi": "^3.0.0"
}
},
"string.prototype.matchall": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-2.0.0.tgz",
"integrity": "sha512-WoZ+B2ypng1dp4iFLF2kmZlwwlE19gmjgKuhL1FJfDgCREWb3ye3SDVHSzLH6bxfnvYmkCxbzkmWcQZHA4P//Q==",
"dev": true,
"requires": {
"define-properties": "^1.1.2",
"es-abstract": "^1.10.0",
"function-bind": "^1.1.1",
"has-symbols": "^1.0.0",
"regexp.prototype.flags": "^1.2.0"
}
},
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
@ -7773,6 +7763,11 @@
"integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=",
"dev": true
},
"t": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/t/-/t-0.5.1.tgz",
"integrity": "sha1-fZGSIB7X+Lv2FZisc2YNj/zDtXg="
},
"table": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/table/-/table-4.0.3.tgz",
@ -7788,15 +7783,15 @@
},
"dependencies": {
"ajv": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.2.tgz",
"integrity": "sha512-hOs7GfvI6tUI1LfZddH82ky6mOMyTuY0mk7kE2pWpmhhUSkumzaTO5vbVwij39MdwPQWCV4Zv57Eo06NtL/GVA==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.3.tgz",
"integrity": "sha512-LqZ9wY+fx3UMiiPd741yB2pj3hhil+hQc8taf4o2QGRFpWgZ2V5C8HA165DY9sS3fJwsk7uT7ZlFEyC3Ig3lLg==",
"dev": true,
"requires": {
"fast-deep-equal": "^2.0.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.1"
"uri-js": "^4.2.2"
}
},
"ansi-regex": {
@ -7869,9 +7864,9 @@
}
},
"supports-color": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
@ -8123,12 +8118,6 @@
"source-map": "~0.6.1"
},
"dependencies": {
"commander": {
"version": "2.13.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz",
"integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==",
"dev": true
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
@ -8138,9 +8127,9 @@
}
},
"uglifyjs-webpack-plugin": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.2.7.tgz",
"integrity": "sha512-1VicfKhCYHLS8m1DCApqBhoulnASsEoJ/BvpUpP4zoNAPpKzdH+ghk0olGJMmwX2/jprK2j3hAHdUbczBSy2FA==",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.3.0.tgz",
"integrity": "sha512-ovHIch0AMlxjD/97j9AYovZxG5wnHOPkL7T1GKochBADp/Zwc44pEWNqpKl1Loupp1WhFg7SlYmHZRUfdAacgw==",
"dev": true,
"requires": {
"cacache": "^10.0.4",
@ -8490,9 +8479,9 @@
"dev": true
},
"vue-loader": {
"version": "15.3.0",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.3.0.tgz",
"integrity": "sha512-cqoefQo1pocGEFY9l/SR6LsbmMpQ8JD374kFPL/1Et4uY4/C5DCY4Cq9Bevbf10ZuHAWS4Gf//szgxGZwdObIw==",
"version": "15.4.0",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.4.0.tgz",
"integrity": "sha512-qhc1fnflEVhFq5dYLDXXTXf3PoRiGxeMhBmGDeLqlg0XAaikZEU224ZLqsTkQQVUT2uA2PN9haYlBUqq/6iEtA==",
"dev": true,
"requires": {
"@vue/component-compiler-utils": "^2.0.0",
@ -8503,9 +8492,9 @@
}
},
"vue-masonry-css": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/vue-masonry-css/-/vue-masonry-css-1.0.2.tgz",
"integrity": "sha512-iiFW4laFhlsh3E5rrymX4SEvtFM8WknDFH0O09lqjqNaUO2iyVqRWT/6Js/pSKv38q4iLD0aoTmmnPanufJReQ=="
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/vue-masonry-css/-/vue-masonry-css-1.0.3.tgz",
"integrity": "sha512-viecHQiHVLez7HlYUQsv1wJb2MT/RDSzkDp6m3In41vPrk6OsBmT2qRE8LZqYIA4daIwrnx/Xm8h4fjOpuE3hw=="
},
"vue-resize": {
"version": "0.4.4",
@ -8518,9 +8507,9 @@
"integrity": "sha512-vLLoY452L+JBpALMP5UHum9+7nzR9PeIBCghU9ZtJ1eWm6ieUI8Zb/DI3MYxH32bxkjzYV1LRjNv4qr8d+uX/w=="
},
"vue-style-loader": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.1.tgz",
"integrity": "sha512-GD9a3G9k2dIGYl76IgwNQGCos3KnVbOVBIdXEIfjis0jNY34oEB2Tsrq2ZXl/KIzo/5Bdt7qAWjU1y+0TWcvIA==",
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.2.tgz",
"integrity": "sha512-0ip8ge6Gzz/Bk0iHovU9XAUQaFt/G2B61bnWa2tCcqqdgfHs1lF9xXorFbE55Gmy92okFT+8bfmySuUOu13vxQ==",
"dev": true,
"requires": {
"hash-sum": "^1.0.2",

View File

@ -17,16 +17,15 @@
"t": "^0.5.1",
"v-tooltip": "^2.0.0-rc.33",
"vue": "^2.5.17",
"vue-masonry-css": "^1.0.2",
"vue-masonry-css": "^1.0.3",
"vue-router": "^3.0.1",
"vue-the-mask": "^0.11.1",
"vue2-hammer": "^2.0.1",
"vue-masonry-css": "^1.0.2",
"vuedraggable": "^2.16.0",
"vuex": "^3.0.1"
},
"devDependencies": {
"autoprefixer": "^9.1.1",
"autoprefixer": "^9.1.2",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
@ -34,16 +33,16 @@
"cross-env": "^5.2.0",
"css-loader": "^1.0.0",
"element-theme-chalk": "^2.4.6",
"eslint": "^5.3.0",
"eslint": "^5.4.0",
"eslint-loader": "^2.1.0",
"eslint-plugin-vue": "^4.7.1",
"file-loader": "^1.1.11",
"postcss-loader": "^3.0.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.22.1",
"uglifyjs-webpack-plugin": "^1.2.7",
"uglifyjs-webpack-plugin": "^1.3.0",
"vue-custom-element": "^3.2.5",
"vue-loader": "^15.3.0",
"vue-loader": "^15.4.0",
"vue-template-compiler": "^2.5.17",
"webpack": "^4.16.5",
"webpack-cli": "^3.1.0",

View File

@ -73,7 +73,7 @@
}
.is-main-content {
padding: 0px;
padding: 0px !important;
margin: 0 auto;
position: relative;
overflow-y: auto;
@ -89,7 +89,7 @@
}
.is-secondary-content {
padding: 0px;
padding: 0px !important;
margin: 94px auto 0 auto;
position: relative;
overflow-y: hidden;

View File

@ -138,7 +138,7 @@
<a
@click="addSearchCriteria"
style="font-size: 12px;"
class="is-secondary">
class="has-text-secondary">
<b-icon
class="add-i"
icon="plus-circle"

View File

@ -171,7 +171,7 @@
<b-dropdown
class="two-columns-dropdown"
ref="enabledViewModesDropdown"
:mobile-modal="false"
:mobile-modal="true"
:disabled="Object.keys(registeredViewModes).length < 0">
<button
class="button is-white"

View File

@ -25,14 +25,14 @@
:class="{'is-disabled': isEditingTerm}">
<a
@click.prevent="editTerm()">
<b-icon
size="is-small"
icon="pencil"/>
<span class="icon">
<i class="mdi mdi-18px mdi-pencil"/>
</span>
</a>
<a @click.prevent="tryToRemoveTerm()">
<b-icon
size="is-small"
icon="delete"/>
<span class="icon">
<i class="mdi mdi-18px mdi-delete"/>
</span>
</a>
</span>
</div>
@ -62,19 +62,10 @@ export default {
'updateTerm',
'deleteTerm'
]),
editTerm() {
// Position edit form in a visible area
let container = document.getElementById('repository-container');
if (container && container.scrollTop && container.scrollTop > 80)
this.termEditionFormTop = container.scrollTop - 80;
else
this.termEditionFormTop = 0;
editTerm() {
this.term.opened = !this.term.opened;
this.$termsListBus.onEditTerm(this.term);
},
tryToRemoveTerm() {
@ -186,7 +177,7 @@ export default {
display: flex;
justify-content: space-between;
background-color: $gray2;
padding: 0.76rem 0.875rem;
padding: 0.5rem 0.875rem;
a {
display: flex;

View File

@ -11,7 +11,7 @@
</div>
<div class="field is-pulled-right">
<b-dropdown
:mobile-modal="false"
:mobile-modal="true"
position="is-bottom-left"
v-if="items.length > 0 && items[0].current_user_can_edit"
:disabled="!isSelectingItems"
@ -136,10 +136,13 @@
</div>
<!-- Thumbnail -->
<img
<div
@click="goToItemPage(item)"
v-if="item.thumbnail != undefined"
:src="item['thumbnail'].medium_large ? item['thumbnail'].medium_large : thumbPlaceholderPath">
class="thumbnail"
:style="{ backgroundImage: 'url(' + (item['thumbnail'].medium_large ? item['thumbnail'].medium_large : thumbPlaceholderPath) + ')' }">
<img :src="item['thumbnail'].medium_large ? item['thumbnail'].medium_large : thumbPlaceholderPath">
</div>
<!-- Actions -->
<div
@ -271,7 +274,9 @@
</div>
<!-- RECORDS VIEW MODE -->
<div
<masonry
:cols="{default: 4, 1919: 3, 1407: 2, 1215: 2, 1023: 1, 767: 1, 343: 1}"
:gutter="42"
class="tainacan-records-container"
v-if="viewMode == 'records'">
<div
@ -284,9 +289,15 @@
<div
:class="{ 'is-selecting': isSelectingItems }"
class="record-checkbox">
<b-checkbox
size="is-small"
v-model="selectedItems[index]"/>
<label
tabindex="0"
class="b-checkbox checkbox is-small">
<input
type="checkbox"
v-model="selectedItems[index]">
<span class="check" />
<span class="control-label" />
</label>
</div>
<!-- Title -->
@ -300,9 +311,21 @@
}"
v-for="(column, index) in tableMetadata"
:key="index"
v-if="column.display && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop == 'title')"
v-if="collectionId != undefined && column.display && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop == 'title')"
@click="goToItemPage(item)"
v-html="item.metadata != undefined ? renderMetadata(item.metadata, column) : ''" />
v-html="item.metadata != undefined ? renderMetadata(item.metadata, column) : ''" />
<p
v-tooltip="{
content: item.title != undefined ? item.title : '',
html: true,
autoHide: false,
placement: 'auto-start'
}"
v-for="(column, index) in tableMetadata"
:key="index"
v-if="collectionId == undefined && column.display && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop == 'title')"
@click="goToItemPage(item)"
v-html="item.title != undefined ? item.title : ''" />
</div>
<!-- Actions -->
<div
@ -331,31 +354,27 @@
<div
class="media"
@click="goToItemPage(item)">
<img
v-if="item.thumbnail != undefined"
:src="item['thumbnail'].medium_large ? item['thumbnail'].medium_large : thumbPlaceholderPath">
<div class="list-metadata media-body">
<div class="thumbnail">
<img
v-if="item.thumbnail != undefined"
:src="item['thumbnail'].medium_large ? item['thumbnail'].medium_large : thumbPlaceholderPath">
</div>
<span
v-for="(column, index) in tableMetadata"
:key="index"
v-if="collectionId == undefined && column.display && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop == 'description')">
<h3 class="metadata-label">{{ $i18n.get('label_description') }}</h3>
<p
v-html="item.description != undefined ? item.description : ''"
class="metadata-value"/>
</span>
<span
v-for="(column, index) in tableMetadata"
:key="index"
v-if="column.display && column.slug != 'thumbnail' && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop != 'title')">
<h3
v-tooltip="{
content: column.name,
html: false,
autoHide: false,
placement: 'auto-start'
}"
class="metadata-label">{{ column.name }}</h3>
<h3 class="metadata-label">{{ column.name }}</h3>
<p
v-tooltip="{
content: item.metadata != undefined ? renderMetadata(item.metadata, column) : '',
html: true,
autoHide: false,
placement: 'auto-start'
}"
v-html="item.metadata != undefined ? renderMetadata(item.metadata, column) : ''"
class="metadata-value"/>
</span>
@ -363,7 +382,7 @@
</div>
</div>
</div>
</masonry>
<!-- TABLE VIEW MODE -->
<table
@ -437,11 +456,28 @@
}"
@click="goToItemPage(item)">
<!-- <data-and-tooltip
v-if="column.metadatum !== 'row_thumbnail' &&
column.metadatum !== 'row_actions' &&
column.metadatum !== 'row_creation'"
:data="renderMetadata(item.metadata, column)"/> -->
<p
v-tooltip="{
content: item.title,
html: true,
autoHide: false,
placement: 'auto-start'
}"
v-if="collectionId == undefined &&
column.metadata_type_object != undefined &&
column.metadata_type_object.related_mapped_prop == 'title'"
v-html="item.title != undefined ? item.title : ''"/>
<p
v-tooltip="{
content: item.description,
html: true,
autoHide: false,
placement: 'auto-start'
}"
v-if="collectionId == undefined &&
column.metadata_type_object != undefined &&
column.metadata_type_object.related_mapped_prop == 'description'"
v-html="item.description != undefined ? item.description : ''"/>
<p
v-tooltip="{
content: renderMetadata(item.metadata, column),
@ -525,7 +561,7 @@ export default {
items: Array,
isLoading: false,
isOnTrash: false,
viewMode: 'table'
viewMode: 'card'
},
mounted() {
this.selectedItems = [];

View File

@ -50,7 +50,7 @@
<grip-icon/>
<span class="icon icon-level-identifier">
<i
:class="{ 'mdi-folder has-text-turquoise5': metadatum.collection_id == collectionId, 'mdi-folder-multiple has-text-blue5': metadatum.collection_id != collectionId }"
:class="{ 'mdi-folder has-text-turquoise5': (metadatum.collection_id == collectionId && !isRepositoryLevel), 'mdi-folder-multiple has-text-blue5': metadatum.collection_id != collectionId || isRepositoryLevel}"
class="mdi" />
</span>
<span

View File

@ -164,14 +164,7 @@ export default {
},
editTerm() {
// Position edit form in a visible area
let container = document.getElementById('repository-container');
if (container && container.scrollTop && container.scrollTop > 80)
this.termEditionFormTop = container.scrollTop - 80;
else
this.termEditionFormTop = 0;
this.term.opened = !this.term.opened;
this.$termsListBus.onEditTerm(this.term);
@ -256,7 +249,7 @@ export default {
// Term Item
.term-item {
font-size: 14px;
padding: 0 0 0 2.75rem;
padding: 0 0 0 1.75rem;
min-height: 40px;
display: flex;
position: relative;

View File

@ -357,6 +357,14 @@ export default {
this.loadTerms(0);
}
this.$termsListBus.$on('editTerm', (term) => {
// Position edit form in a visible area
let container = document.getElementById('repository-container');
if (container && container.scrollTop && container.scrollTop > 80)
this.termEditionFormTop = container.scrollTop - 80;
else
this.termEditionFormTop = 0;
this.editTerm = term;
this.isEditingTerm = true;
});

View File

@ -294,6 +294,15 @@ export default {
font-size: 12px;
line-height: 12px;
color: #1d1d1d;
span {
text-overflow: ellipsis;
white-space: nowrap;
overflow-x: hidden;
max-width: 115px;
margin: 0 0.1rem;
display: inline-block;
vertical-align: bottom;
}
}
.level {

View File

@ -145,12 +145,19 @@ export default {
.tainacan-page-title {
margin-bottom: 40px;
display: flex;
flex-wrap: wrap;
align-items: flex-end;
justify-content: space-between;
h1, h2 {
font-size: 20px;
font-weight: 500;
color: $gray5;
display: inline-block;
width: 80%;
flex-shrink: 1;
flex-grow: 1;
}
a.back-link{
font-weight: 500;
@ -161,9 +168,20 @@ export default {
margin: 3px 0px 4px 0px;
height: 1px;
background-color: $secondary;
width: 100%;
}
.breadcrumbs {
font-size: 12px;
width: 100%;
span {
text-overflow: ellipsis;
white-space: nowrap;
overflow-x: hidden;
max-width: 75%;
margin: 0 0.1rem;
display: inline-block;
vertical-align: bottom;
}
}
.level-left {
.level-item {

View File

@ -24,6 +24,7 @@
{{ $i18n.get('cancel') }}
</button>
<button
type="submit"
class="button is-success"
@click="onConfirm(); $parent.close();">
{{ $i18n.get('continue') }}

View File

@ -31,6 +31,7 @@ import FilterTaxonomySelectbox from '../../classes/filter-types/taxonomy/Selectb
import TaincanFormItem from '../../classes/metadata-types/tainacan-form-item.vue';
import TaincanFiltersList from '../../classes/filter-types/tainacan-filter-item.vue';
import ItemsPage from '../pages/lists/items-page.vue';
import TermItemsPage from '../pages/lists/term-items-page.vue';
import ViewModeTable from '../../theme-helper/view-mode-table.vue';
import ViewModeCards from '../../theme-helper/view-mode-cards.vue';
import ViewModeRecords from '../../theme-helper/view-mode-records.vue';
@ -83,6 +84,7 @@ Vue.component('tainacan-filter-taxonomy-selectbox', FilterTaxonomySelectbox);
Vue.component('help-button', HelpButton);
Vue.component('draggable', draggable);
Vue.component('items-page', ItemsPage);
Vue.component('term-items-page', TermItemsPage);
// Oficial view modes
Vue.component('view-mode-table', ViewModeTable);
@ -92,13 +94,16 @@ Vue.component('view-mode-masonry', ViewModeMasonry);
Vue.use(eventBusSearch, { store: store, router: routerTheme});
// THEME ITEMS LIST (COLLECTIONS)
import ThemeItemsList from '../theme-items-list.vue';
new Vue({
export const ThemeItemsListing = new Vue({
el: '#tainacan-items-page',
store,
router: routerTheme,
data: {
termId: '',
taxonomy: '',
collectionId: '',
defaultViewMode: '',
enabledViewModes: {}
@ -113,6 +118,10 @@ new Vue({
if (this.$el.attributes['enabled-view-modes'] != undefined)
this.enabledViewModes = this.$el.attributes['enabled-view-modes'].value.split(',');
if (this.$el.attributes['term-id'] != undefined)
this.termId = this.$el.attributes['term-id'].value;
if (this.$el.attributes['taxonomy'] != undefined)
this.taxonomy = this.$el.attributes['taxonomy'].value;
}
});

View File

@ -10,10 +10,22 @@
class="is-hidden-mobile"
id="filter-menu-compress-button"
:class="{'filter-menu-compress-button-top-repo': isRepositoryLevel}"
:style="{ top: !isOnTheme ? '120px' : (searchControlHeight - 15) + 'px' }"
:style="{ top: !isOnTheme ? '120px' : '76px' }"
@click="isFiltersMenuCompressed = !isFiltersMenuCompressed">
<b-icon :icon="isFiltersMenuCompressed ? 'menu-right' : 'menu-left'" />
</button>
<!-- Filters mobile modal button -->
<button
v-if="!openAdvancedSearch"
class="is-hidden-tablet"
id="filter-menu-compress-button"
:class="{'filter-menu-compress-button-top-repo': isRepositoryLevel}"
:style="{ top: !isOnTheme ? (searchControlHeight + 70) + 'px' : (searchControlHeight - 25) + 'px' }"
@click="isFilterModalActive = !isFilterModalActive">
<b-icon :icon="isFiltersMenuCompressed ? 'menu-right' : 'menu-left'" />
<span class="text">{{ $i18n.get('filters') }}</span>
</button>
<!-- Side bar with search and filters -->
<aside
:style="{ top: searchControlHeight + 'px' }"
@ -116,7 +128,7 @@
class="search-control-item"
v-if="!isOnTheme">
<b-dropdown
:mobile-modal="false"
:mobile-modal="true"
id="item-creation-options-dropdown">
<button
class="button is-secondary"
@ -158,7 +170,7 @@
class="search-control-item">
<b-dropdown
ref="displayedMetadataDropdown"
:mobile-modal="false"
:mobile-modal="true"
:disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards'"
class="show">
<button
@ -194,6 +206,7 @@
<div class="search-control-item">
<b-field>
<b-dropdown
:mobile-modal="true"
:disabled="totalItems <= 0"
@input="onChangeOrderBy($event)">
<button
@ -262,7 +275,7 @@
<b-field>
<b-dropdown
@change="onChangeViewMode($event)"
:mobile-modal="false"
:mobile-modal="true"
position="is-bottom-left"
:aria-label="$i18n.get('label_view_mode')">
<button
@ -295,7 +308,7 @@
<b-field>
<b-dropdown
@change="onChangeAdminViewMode($event)"
:mobile-modal="false"
:mobile-modal="true"
position="is-bottom-left"
:aria-label="$i18n.get('label_view_mode')">
<button
@ -359,13 +372,6 @@
</b-field>
</div>
<!-- Filters mobile modal button -->
<div class="search-control-item is-hidden-tablet">
<button
@click="isFilterModalActive = !isFilterModalActive"
class="button is-secondary">{{ $i18n.get('filters') }}</button>
</div>
<!-- Text simple search (used on mobile, instead of the one from filter list)-->
<div class="is-hidden-tablet search-control-item">
<div class="search-area">
@ -832,13 +838,17 @@
let thumbnailMetadatum = this.localDisplayedMetadata.find(metadatum => metadatum.slug == 'thumbnail');
let creationDateMetadatum = this.localDisplayedMetadata.find(metadatum => metadatum.slug == 'creation_date');
let authorNameMetadatum = this.localDisplayedMetadata.find(metadatum => metadatum.slug == 'author_name');
let descriptionMetadatum = this.localDisplayedMetadata.find(metadatum => metadatum.metadata_type_object != undefined ? metadatum.metadata_type_object.related_mapped_prop == 'description' : false);
// Updates Search
this.$eventBusSearch.addFetchOnly({
'0': thumbnailMetadatum.display ? 'thumbnail' : null,
'0': thumbnailMetadatum != undefined && thumbnailMetadatum.display ? 'thumbnail' : null,
'meta': fetchOnlyMetadatumIds,
'1': creationDateMetadatum.display ? 'creation_date' : null,
'2': authorNameMetadatum.display ? 'author_name': null
'1': creationDateMetadatum != undefined && creationDateMetadatum.display ? 'creation_date' : null,
'2': authorNameMetadatum != undefined && authorNameMetadatum.display ? 'author_name': null,
'3': (this.isRepositoryLevel ? 'title' : null),
'4': (this.isRepositoryLevel && descriptionMetadatum.display ? 'description' : null),
});
// Closes dropdown
@ -895,6 +905,28 @@
display: thumbnailMetadatumDisplay
});
// Repository Level always shows core metadata
if (this.isRepositoryLevel) {
metadata.push({
name: this.$i18n.get('label_title'),
metadatum: 'row_title',
metadata_type_object: {core: true, related_mapped_prop: 'title'},
metadata_type: undefined,
slug: 'title',
id: undefined,
display: true
});
metadata.push({
name: this.$i18n.get('label_description'),
metadatum: 'row_description',
metadata_type_object: {core: true, related_mapped_prop: 'description'},
metadata_type: undefined,
slug: 'description',
id: undefined,
display: true
});
}
let fetchOnlyMetadatumIds = [];
for (let metadatum of this.metadata) {
@ -938,6 +970,7 @@
let creationDateMetadatumDisplay = prefsFetchOnlyObject != undefined ? (prefsFetchOnlyObject['1'] != null) : true;
let authorNameMetadatumDisplay = prefsFetchOnlyObject != undefined ? (prefsFetchOnlyObject['2'] != null) : true;
// Creation date and author name should appear only on admin.
if (!this.isOnTheme) {
metadata.push({
@ -962,9 +995,23 @@
'0': (thumbnailMetadatumDisplay ? 'thumbnail' : null),
'meta': fetchOnlyMetadatumIds,
'1': (creationDateMetadatumDisplay ? 'creation_date' : null),
'2': (authorNameMetadatumDisplay ? 'author_name' : null)
'2': (authorNameMetadatumDisplay ? 'author_name' : null),
'3': (this.isRepositoryLevel ? 'title' : null),
'4': (this.isRepositoryLevel ? 'description' : null),
});
// Sorting metadata
if (this.isRepositoryLevel) {
this.sortingMetadata.push({
name: this.$i18n.get('label_title'),
metadatum: 'row_title',
metadata_type_object: {core: true, related_mapped_prop: 'title'},
metadata_type: undefined,
slug: 'title',
id: undefined,
display: true
});
}
this.sortingMetadata.push({
name: this.$i18n.get('label_creation_date'),
metadatum: 'row_creation',
@ -1024,7 +1071,7 @@
},
adjustSearchControlHeight() {
this.$nextTick(() => {
this.searchControlHeight = this.$refs['search-control'] ? this.$refs['search-control'].clientHeight : 0;
this.searchControlHeight = this.$refs['search-control'] ? this.$refs['search-control'].clientHeight + this.$refs['search-control'].offsetTop : 0;
this.isFiltersMenuCompressed = jQuery(window).width() <= 768;
});
}
@ -1043,6 +1090,7 @@
});
this.$eventBusSearch.$on('hasFiltered', hasFiltered => {
this.adjustSearchControlHeight();
this.hasFiltered = hasFiltered;
});
@ -1092,11 +1140,12 @@
}
// Watches window resize to adjust filter's top position and compression on mobile
window.addEventListener('resize', this.adjustSearchControlHeight());
this.adjustSearchControlHeight();
window.addEventListener('resize', this.adjustSearchControlHeight);
},
beforeDestroy() {
this.$off();
window.removeEventListener('resize', this.adjustSearchControlHeight());
window.removeEventListener('resize', this.adjustSearchControlHeight);
}
}
</script>
@ -1248,6 +1297,22 @@
.icon {
margin-top: -1px;
}
@media screen and (max-width: 768px) {
max-width: 100%;
width: auto;
padding: 3px 6px 3px 0px;
height: 24px;
.icon {
position: relative;
top: -3px;
}
.text {
position: relative;
top: -6px;
}
}
}
.spaced-to-right {

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
width: 12px;
height: 12px;
flex-shrink: 0;
border-radius: 0;
border-radius: 1px;
display: inline-block;
border: 1px solid $gray4;
transition: background 150ms ease-out;
@ -22,7 +22,7 @@
border-color: $gray4 !important;
}
input[type="checkbox"]:checked + .check {
background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1 1'%3E%3Cpath style='fill:%23000' d='M 0.04038059,0.6267767 0.14644661,0.52071068 0.42928932,0.80355339 0.3232233,0.90961941 z M 0.21715729,0.80355339 0.85355339,0.16715729 0.95961941,0.2732233 0.3232233,0.90961941 z'%3E%3C/path%3E%3C/svg%3E") no-repeat center center !important;
background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1 1'%3E%3Cpath style='fill:rgb(69,70,71)' d='M 0.04038059,0.6267767 0.14644661,0.52071068 0.42928932,0.80355339 0.3232233,0.90961941 z M 0.21715729,0.80355339 0.85355339,0.16715729 0.95961941,0.2732233 0.3232233,0.90961941 z'%3E%3C/path%3E%3C/svg%3E") no-repeat center center !important;
border-color: $gray4 !important;
}
}

View File

@ -41,6 +41,16 @@
}
}
}
&.is-mobile-modal {
@media screen and (max-width: 1088px) {
.dropdown-menu {
border-radius: 4px;
.dropdown-item {
padding: 0.75rem !important;
}
}
}
}
}
.taginput-container {

View File

@ -2,11 +2,8 @@
.modal-close {
right: calc(8.3333333% + 20px);
background-color: $gray1;
background-color: white;
&:hover {
background-color: $gray2;
}
&::before, &::after {
background-color: $secondary;
}

View File

@ -8,11 +8,19 @@
}
.tainacan-modal-title {
display: flex;
flex-wrap: wrap;
margin-bottom: 40px;
justify-content: space-between;
align-items: flex-end;
h1, h2 {
font-size: 20px;
font-weight: 500;
color: $blue5;
display: inline-block;
width: 90%;
margin-right: auto;
}
a.back-link{
font-weight: 500;
@ -24,8 +32,8 @@
height: 1px;
background-color: $secondary;
border-top: 0;
width: 100%;
}
margin-bottom: 40px;
}
.tainacan-modal-content {
background-color: white;
@ -44,13 +52,13 @@
padding: 40px 0em 0.4em 0em !important;
}
}
// Bulma modals customized for Tainacan
// Bulma modals customized for Tainacan (custom-dialog.vue)
.dialog {
.modal-background {
background-color: rgba(0, 0, 0, 0.70);
}
.modal-card {
background-color: $turquoise2;
background-color: white;
color: $secondary;
border-radius: 10px;
flex-wrap: wrap;
@ -59,13 +67,13 @@
margin: 0 auto !important;
.modal-card-head, .modal-card-body, .modal-card-foot {
background-color: $turquoise2;
color: $secondary;
background-color: white;
color: $gray5;
border: none;
padding-bottom: 12px;
}
.modal-custom-icon {
background-color: white;
background-color: $gray1;
border-radius: 50px;
height: 80px;
width: 80px;
@ -75,7 +83,7 @@
}
.modal-card-head {
h1 {
color: $secondary;
color: $gray5;
}
font-weight: normal;
padding: 0;

View File

@ -2,7 +2,7 @@
.tabs {
a {
font-size: 13px;
margin-bottom: -3px;
margin-bottom: -3px !important;
&:hover{
border-bottom-color: transparent;
text-decoration: none;

View File

@ -26,9 +26,14 @@
max-height: 218px;
cursor: pointer;
@media screen and (max-width: 768px) {
@media screen and (max-width: 450px) {
max-width: 100%;
min-width: 100%;
img {
width: 33.333333% !important;
height: 33.333333% !important;
}
}
&:hover {

View File

@ -20,6 +20,7 @@
margin-bottom: 30px;
text-align: center;
text-decoration: none;
transition: background-color 0.3s;
&:hover {
background-color: $gray2;
@ -59,14 +60,22 @@
}
}
img {
width: 100%;
height: auto;
.thumbnail {
background-size: cover;
background-color: #f6f6f6;
background-blend-mode: multiply;
border-radius: 2px;
margin-bottom: -5px;
transition: background-color 0.3s;
&:hover {
cursor: pointer;
background-color: white;
}
img {
width: 100%;
height: auto;
visibility: hidden;
}
}

View File

@ -19,11 +19,12 @@
.tainacan-record {
padding: 0px;
flex-basis: 0;
margin: 0.75rem;
max-width: 410px;
min-width: 410px;
min-height: 218px;
margin-bottom: 42px;
width: 100%;
min-height: 200px;
cursor: pointer;
text-decoration: none;
display: block;
@media screen and (max-width: 768px) {
max-width: 100%;
@ -64,8 +65,12 @@
opacity: 0;
visibility: hidden;
}
.thumbnail {
float: right;
margin: 0 0 1.5rem 1.5rem;
}
img {
width: 172px;
width: 120px;
height: auto;
border-radius: 2px;
}
@ -81,6 +86,8 @@
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
color: black;
p {
font-size: 0.875rem !important;
text-overflow: ellipsis;
@ -106,18 +113,13 @@
.metadata-label {
font-size: 0.75rem;
margin-bottom: 0.2rem;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
font-weight: 500;
color: $gray4;
font-weight: 700;
color: #454647;
}
.metadata-value {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
margin-bottom: 1rem;
color: $gray4;
}
}

View File

@ -1,9 +1,19 @@
<template>
<div>
<items-page
v-if="$root.collectionId != undefined && $root.collectionId != ''"
class="theme-items-list"
:enabled-view-modes="$root.enabledViewModes"
:default-view-mode="$root.defaultViewMode"
:collection-id="$root.collectionId" />
<term-items-page
v-if="$root.termId != undefined && $root.termId != ''"
class="theme-items-list"
:taxonomy="$root.taxonomy"
:enabled-view-modes="$root.enabledViewModes"
:default-view-mode="$root.defaultViewMode"
:term-id="$root.termId" />
</div>
</template>
<script>

View File

@ -2,6 +2,8 @@
namespace Tainacan\API\EndPoints;
use Tainacan\Repositories;
use Tainacan\Entities;
use \Tainacan\API\REST_Controller;
class REST_Facets_Controller extends REST_Controller {
@ -23,40 +25,31 @@ class REST_Facets_Controller extends REST_Controller {
$this->collection_repository = Repositories\Collections::get_instance();
$this->metadatum_repository = Repositories\Metadata::get_instance();
$this->filter_repository = Repositories\Filters::get_instance();
$this->filter_repository = Repositories\Filters::get_instance();
$this->terms_repository = Repositories\Terms::get_instance();
$this->taxonomy_repository = Repositories\Taxonomies::get_instance();
$this->items_repository = Repositories\Items::get_instance();
}
public function register_routes() {
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<facet_id>[\d]+)', array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_items'),
'permission_callback' => array($this, 'get_items_permissions_check'),
'args' => $this->get_collection_params()
)
));
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<facet_id>[\d]+)', array(
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<metadatum_id>[\d]+)', array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item'),
'permission_callback' => array($this, 'get_item_permissions_check'),
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)
'permission_callback' => array($this, 'get_items_permissions_check')
)
));
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<metadatum_id>[\d]+)', array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item'),
'permission_callback' => array($this, 'get_item_permissions_check')
)
));
}
/**
* @param mixed $item
* @param \WP_REST_Request $request
*
* @return mixed|\WP_Error|\WP_REST_Response
*/
public function prepare_item_for_response( $item, $request ) {
}
/**
* @param \WP_REST_Request $request
*
@ -64,14 +57,58 @@ class REST_Facets_Controller extends REST_Controller {
*/
public function get_item( $request ) {
$filter_id = $request['facet_id'];
$filter = $this->filter_repository->fetch($filter_id);
// TODO: get facets for the filter, if collection is specified retrieve
// only values from collection
$metadatum_id = $request['metadatum_id'];
$metadatum = $this->metadatum_repository->fetch($metadatum_id);
return new \WP_REST_Response($prepared, 200);
}
$response = $this->prepare_item_for_response($metadatum, $request );
return new \WP_REST_Response($response, 200);
}
/**
*
* Receive a \WP_Query or a metadatum object and return both in JSON
*
* @param mixed $metadatum
* @param \WP_REST_Request $request
*
* @return mixed|string|void|\WP_Error|\WP_REST_Response
*/
public function prepare_item_for_response($metadatum, $request){
$response = [];
if( !empty($metadatum) ){
$metadatum_type = $metadatum->get_metadata_type();
$options = $metadatum->get_metadata_type_options();
$args = $this->prepare_filters($request);
if( $metadatum_type === 'Tainacan\Metadata_Types\Relationship' ){
$response = $this->items_repository->fetch($args, $options['collection_id'], 'OBJECT');
} else if ( $metadatum_type === 'Tainacan\Metadata_Types\Taxonomy' ){
$taxonomy = $this->taxonomy_repository->fetch($options['taxonomy_id']);
$terms = $this->terms_repository->fetch($args, $taxonomy);
foreach ($terms as $term) {
array_push($response, $this->prepare_term_for_response( $term, $request ));
}
} else {
if($request['collection_id']) {
$response = $this->metadatum_repository->fetch_all_metadatum_values( $request['collection_id'], $metadatum->get_id() );
} else {
$response = $this->metadatum_repository->fetch_all_metadatum_values( null, $metadatum->get_id() );
}
}
}
return $response;
}
/**
* @param \WP_REST_Request $request
@ -81,6 +118,37 @@ class REST_Facets_Controller extends REST_Controller {
public function get_items_permissions_check( $request ) {
return true;
}
/**
* @param mixed $item
* @param \WP_REST_Request $request
*
* @return array|mixed|\WP_Error|\WP_REST_Response
*/
public function prepare_term_for_response( $item, $request ) {
if(!empty($item)){
if(!isset($request['fetch_only'])) {
$item_arr = $item->_toArray();
$children = get_terms([
'taxonomy' => $item_arr['taxonomy'],
'parent' => $item_arr['id'],
'fields' => 'ids',
'hide_empty' => false,
]);
$item_arr['total_children'] = count($children);
} else {
$attributes_to_filter = $request['fetch_only'];
$item_arr = $this->filter_object_by_attributes($item, $attributes_to_filter);
}
return $item_arr;
}
return $item;
}
}
?>

View File

@ -18,6 +18,7 @@ $rest_background_processes_controller = new \Tainacan\API\EndPoints\REST_Back
$rest_bulkedit_controller = new \Tainacan\API\EndPoints\REST_Bulkedit_Controller();
new \Tainacan\API\EndPoints\REST_Export_Controller();
new \Tainacan\API\EndPoints\REST_Metadatum_Mappers_Controller();
$rest_facets_controller = new \Tainacan\API\EndPoints\REST_Facets_Controller();
// Add here other endpoints imports
?>

View File

@ -122,6 +122,7 @@ class Collection extends Entity {
],
'map_meta_cap' => true,
'capabilities' => (array) $capabilities,
'show_in_nav_menus' => false,
'supports' => [
'title',
'editor',

View File

@ -78,22 +78,13 @@ class Taxonomy extends Entity {
],
);
$tax_cpts = [];
if (is_array($this->get_collections())){
foreach ($this->get_collections() as $tax_col){
$tax_cpts[] = $tax_col->get_db_identifier();
}
}
if (taxonomy_exists($this->get_db_identifier())){
unregister_taxonomy($this->get_db_identifier());
}
register_taxonomy(
$this->get_db_identifier(),
$tax_cpts,
null,
$args
);

View File

@ -221,10 +221,13 @@ class Collections extends Repository {
'edit_item' => __( 'Edit Collection', 'tainacan' ),
'new_item' => __( 'New Collection', 'tainacan' ),
'view_item' => __( 'View Collection', 'tainacan' ),
'view_items' => __( 'View Collections', 'tainacan' ),
'search_items' => __( 'Search Collections', 'tainacan' ),
'not_found' => __( 'No Collections found ', 'tainacan' ),
'not_found_in_trash' => __( 'No Collections found in trash', 'tainacan' ),
'parent_item_colon' => __( 'Parent Collection:', 'tainacan' ),
'all_items' => __( 'All Collections', 'tainacan' ),
'archives' => __( 'Collections Archive', 'tainacan' ),
'menu_name' => __( 'Collections', 'tainacan' )
);
}

View File

@ -139,6 +139,7 @@ class Filters extends Repository {
'can_export' => true,
'rewrite' => true,
'map_meta_cap' => true,
'show_in_nav_menus' => false,
'capability_type' => Entities\Metadatum::get_capability_type(),
'supports' => [
'title',

View File

@ -171,12 +171,16 @@ class Items extends Repository {
$collection->register_collection_item_post_type();
}
// register taxonomies
// register taxonomies
if ( is_array( $taxonomies ) && sizeof( $taxonomies ) > 0 ) {
foreach ( $taxonomies as $taxonomy ) {
$taxonomy->tainacan_register_taxonomy();
}
}
// register taxonomies to collections considering metadata inheritance
$Tainacan_Taxonomies->register_taxonomies_for_all_collections();
}
public function insert( $item ) {

View File

@ -241,6 +241,7 @@ class Metadata extends Repository {
'can_export' => true,
'rewrite' => true,
'map_meta_cap' => true,
'show_in_nav_menus' => false,
'capability_type' => Entities\Metadatum::get_capability_type(),
'supports' => [
'title',
@ -1095,7 +1096,7 @@ class Metadata extends Repository {
}
if ( $new_tax != $this->current_taxonomy ) {
$collection = $metadatum->get_collection();
$collection = $metadatum->get_collection_id();
if ( ! empty( $this->current_taxonomy ) && $collection ) {
do_action( 'tainacan-taxonomy-removed-from-collection', $this->current_taxonomy, $collection );
@ -1115,7 +1116,7 @@ class Metadata extends Repository {
if ( $metadata_type->get_primitive_type() == 'term' ) {
$removed_tax = $metadata_type->get_option( 'taxonomy_id' );
$collection = $metadatum->get_collection();
$collection = $metadatum->get_collection_id();
if ( ! empty( $removed_tax ) && $collection ) {
do_action( 'tainacan-taxonomy-removed-from-collection', $removed_tax, $collection );

View File

@ -900,6 +900,45 @@ abstract class Repository {
return $diffs;
}
/**
* Get IDs for all children, grand children till the depth parameter is reached
* @param int|\Tainacan\Entities\Entity $id The Entity ID or object
* @param bool|int $depth The maximum depth to llok for descendants. default is false = no limit
* @return array Array of IDs
*/
public function get_descendants_ids($id, $depth = false) {
$object = $id;
if (is_integer($id)) {
$object = $this->fetch($id);
}
if ( ! $object instanceof \Tainacan\Entities\Entity) {
return [];
}
global $wpdb;
$go_deeper = false === $depth || (is_integer($depth) && $depth > 1);
$new_depth = is_integer($depth) ? $depth - 1 : $depth;
$children = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = %s", $object->get_id(), $object->get_post_type() ) );
if ($go_deeper && sizeof($children) > 0) {
$gchildren = [];
foreach ($children as $child) {
$_gchildren = $this->get_descendants_ids((int) $child, $new_depth);
if (!empty($_gchildren)) {
$gchildren = array_merge($gchildren, $_gchildren);
}
}
$children = array_merge($children, $gchildren);
}
return $children;
}
}
?>

View File

@ -89,10 +89,13 @@ class Taxonomies extends Repository {
'edit_item' => __( 'Edit Taxonomy', 'tainacan' ),
'new_item' => __( 'New Taxonomy', 'tainacan' ),
'view_item' => __( 'View Taxonomy', 'tainacan' ),
'view_items' => __( 'View Taxonomies', 'tainacan' ),
'search_items' => __( 'Search Taxonomies', 'tainacan' ),
'not_found' => __( 'No Taxonomies found ', 'tainacan' ),
'not_found_in_trash' => __( 'No Taxonomies found in trash', 'tainacan' ),
'parent_item_colon' => __( 'Parent Taxonomy:', 'tainacan' ),
'all_items' => __( 'All Taxonomies', 'tainacan' ),
'archives' => __( 'Taxonomies Archive', 'tainacan' ),
'menu_name' => __( 'Taxonomies', 'tainacan' )
);
}
@ -181,6 +184,46 @@ class Taxonomies extends Repository {
return $this->fetch_output( $wp_query, $output );
}
}
/**
* fetch taxonomies by collection, considering inheritance
*
* @param Entities\Collection $collection
* @param array $args WP_Query args plus disabled_metadata
* @param string $output The desired output format (@see \Tainacan\Repositories\Repository::fetch_output() for possible values)
*
* @return array Entities\Metadatum
* @throws \Exception
*/
public function fetch_by_collection( Entities\Collection $collection, $args = [], $output = null ) {
$collection_id = $collection->get_id();
$Tainacan_Metadata = Metadata::get_instance();
// get all taxonomy metadata in this collection
$taxonomy_metas = $Tainacan_Metadata->fetch_by_collection($collection, ['metadata_type' => 'Tainacan\Metadata_Types\Taxonomy'], 'OBJECT');
$tax_ids = [];
foreach ( $taxonomy_metas as $taxonomy_meta ) {
$options = $taxonomy_meta->get_metadata_type_options();
if (isset($options['taxonomy_id'])) {
$tax_ids[] = $options['taxonomy_id'];
}
}
if (empty($tax_ids)) {
$tax_ids[] = 'please-return-nothing';
}
$newargs = [
'post__in' => $tax_ids
];
$args = array_merge($args, $newargs);
return $this->fetch($args, $output);
}
public function update( $object, $new_values = null ) {
return $this->insert( $object );
@ -235,26 +278,68 @@ class Taxonomies extends Repository {
return $trashed;
}
public function added_collection( $taxonomy_id, $collection ) {
public function added_collection( $taxonomy_id, $collection_id ) {
$id = $taxonomy_id;
if ( ! empty( $id ) && is_numeric( $id ) ) {
if ( ! empty( $id ) && is_numeric( $id ) && is_numeric($collection_id) ) {
$tax = $this->fetch( (int) $id );
$tax->add_collection_id( $collection->get_id() );
$tax->add_collection_id( $collection_id );
if ( $tax->validate() ) {
$this->insert( $tax );
}
}
$this->update_taxonomy_registry_for_collection($taxonomy_id, $collection_id);
}
public function removed_collection( $taxonomy_id, $collection ) {
public function removed_collection( $taxonomy_id, $collection_id ) {
$id = $taxonomy_id;
if ( ! empty( $id ) && is_numeric( $id ) ) {
if ( ! empty( $id ) && is_numeric( $id ) && is_numeric($collection_id) ) {
$tax = $this->fetch( (int) $id );
$tax->remove_collection_id( $collection->get_id() );
$tax->remove_collection_id( $collection_id );
if ( $tax->validate() ) {
$this->insert( $tax );
}
}
$this->update_taxonomy_registry_for_collection($taxonomy_id, $collection_id);
}
public function update_taxonomy_registry_for_collection($taxonomy_id, $collection_id) {
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
// if repository level metadatum, update all collections
if ( $collection_id = $Tainacan_Metadata->get_default_metadata_attribute() ) {
$this->register_taxonomies_for_all_collections();
} else {
// get all children, grand children, etc.
$Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance();
$children_ids = $Tainacan_Collections->get_descendants_ids($collection_id);
// register taxonomy for collection
$tax_slug = Entities\Taxonomy::$db_identifier_prefix . $taxonomy_id;
foreach ($children_ids as $child_id) {
$collection_slug = Entities\Collection::$db_identifier_prefix . $child_id . Entities\Collection::$db_identifier_sufix;
register_taxonomy_for_object_type( $tax_slug, $collection_slug );
}
}
}
public function register_taxonomies_for_all_collections() {
$Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance();
// TODO: This can be a problem in large repositories.
$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], 'OBJECT');
foreach ( $taxonomies as $taxonomy ) {
register_taxonomy_for_object_type( $taxonomy->get_db_identifier(), $collection->get_db_identifier() );
}
}
}

View File

@ -215,7 +215,8 @@ class Terms extends Repository {
}
if ( is_array( $args ) && ! empty( $cpt ) ) { // if an array of arguments is
$terms = get_terms( $cpt, $args );
$args['taxonomy'] = $cpt;
$terms = get_terms( $args );
$return = [];
foreach ( $terms as $term ) {

View File

@ -9,7 +9,9 @@ export default {
componentsTag: [],
errors : [],
query: {},
collectionId: undefined
collectionId: undefined,
taxonomy: undefined,
termId: undefined
},
created(){
@ -305,13 +307,15 @@ export default {
} else {
this.$emit( 'isLoadingItems', true);
this.$store.dispatch('collection/fetchItems', {
'collectionId': this.collectionId,
'isOnTheme': (this.$route.name == null)
'isOnTheme': (this.$route.name == null),
'termId': this.termId,
'taxonomy': this.taxonomy
})
.then((res) => {
this.$emit( 'isLoadingItems', false);
this.$emit( 'hasFiltered', res.hasFiltered);
@ -324,10 +328,15 @@ export default {
this.$emit( 'isLoadingItems', false);
});
}
},
setCollectionId(collectionId) {
this.collectionId = collectionId;
},
setTerm(termId, taxonomy) {
this.termId = termId;
this.taxonomy = taxonomy;
},
clearAllFilters() {
this.$store.dispatch('search/cleanFilterTags');
this.$store.dispatch('search/cleanMetaQueries');

View File

@ -1,13 +1,13 @@
import axios from '../../../axios/axios';
import qs from 'qs';
export const fetchItems = ({ rootGetters, dispatch, commit }, { collectionId, isOnTheme }) => {
export const fetchItems = ({ rootGetters, dispatch, commit }, { collectionId, isOnTheme, termId, taxonomy }) => {
commit('cleanItems');
return new Promise ((resolve, reject) => {
// Adds queries for filtering
let postQueries = rootGetters['search/getPostQuery'];
let postQueries = JSON.parse(JSON.stringify(rootGetters['search/getPostQuery']));
// Sets a flag to inform components that an empty sate is or not due to filtering
let hasFiltered = false;
@ -26,6 +26,19 @@ export const fetchItems = ({ rootGetters, dispatch, commit }, { collectionId, is
}
}
// Sets term query in case it's on a term items page
if (termId != undefined && taxonomy != undefined) {
if (postQueries.taxquery == undefined)
postQueries.taxquery = [];
postQueries.taxquery.push({
taxonomy: taxonomy,
terms:[ termId ],
compare: 'IN'
});
}
let query = qs.stringify(postQueries);
// Guarantees at least empty fetch_only are passed in case none is found
@ -52,7 +65,7 @@ export const fetchItems = ({ rootGetters, dispatch, commit }, { collectionId, is
} else {
if (postQueries.admin_view_mode != undefined)
postQueries.admin_view_mode = null;
}
}
axios.tainacan.get(endpoint+query)
.then(res => {

View File

@ -41,6 +41,7 @@ class Theme_Helper {
add_action('pre_get_posts', array($this, 'tax_archive_pre_get_posts'));
add_action('archive_template_hierarchy', array($this, 'items_template_hierachy'));
add_action('taxonomy_template_hierarchy', array($this, 'tax_template_hierachy'));
add_action('single_template_hierarchy', array($this, 'items_template_hierachy'));
add_filter('theme_mod_header_image', array($this, 'header_image'));
@ -80,7 +81,7 @@ class Theme_Helper {
public function enqueue_scripts($force = false) {
global $TAINACAN_BASE_URL;
if ( $force || is_post_type_archive( \Tainacan\Repositories\Repository::get_collections_db_identifiers() ) ) {
if ( $force || is_post_type_archive( \Tainacan\Repositories\Repository::get_collections_db_identifiers() ) || tainacan_get_term() ) {
//\Tainacan\Admin::get_instance()->add_admin_js();
wp_enqueue_script('tainacan-search', $TAINACAN_BASE_URL . '/assets/user_search-components.js' , [] , null, true);
wp_localize_script('tainacan-search', 'tainacan_plugin', \Tainacan\Admin::get_instance()->get_admin_js_localization_params());
@ -252,6 +253,28 @@ class Theme_Helper {
}
function tax_template_hierachy($templates) {
if (is_tax()) {
$term = get_queried_object();
if ( isset($term->taxonomy) && $this->is_taxonomy_a_tainacan_tax($term->taxonomy)) {
$last_template = array_pop($templates);
array_push($templates, 'tainacan/archive-taxonomy.php');
array_push($templates, $last_template);
}
}
return $templates;
}
function header_image($image) {
$object = false;
@ -282,7 +305,7 @@ class Theme_Helper {
$atts = shortcode_atts(
array(
'collection-id' => '',
'term' => '',
'term-id' => '',
),
$atts
);
@ -291,6 +314,9 @@ class Theme_Helper {
if (isset($atts['collection-id'])) {
$params = "collection-id=" . $atts['collection-id'];
}
if (isset($atts['term-id'])) {
$params = "term-id=" . $atts['term-id'];
}
$this->enqueue_scripts(true);

View File

@ -181,6 +181,7 @@ function tainacan_the_collection_description() {
function tainacan_the_faceted_search() {
$props = ' ';
$id = '';
// if in a collection page
$collection_id = tainacan_get_collection_id();
@ -189,20 +190,33 @@ function tainacan_the_faceted_search() {
$collection = new \Tainacan\Entities\Collection($collection_id);
$props .= 'default-view-mode="' . $collection->get_default_view_mode() . '" ';
$props .= 'enabled-view-modes="' . implode(',', $collection->get_enabled_view_modes()) . '" ';
$id = 'tainacan-items-page';
}
// if in a tainacan taxonomy
$term = tainacan_get_term();
if ($term) {
$props .= 'term-id="' . $term->term_id . '" ';
$props .= 'taxonomy="' . $term->taxonomy . '" ';
$id = 'tainacan-items-page';
}
echo '<div id="tainacan-items-page" ', $props, '></div>';
echo "<div id='$id' $props ></div>";
}
/**
* When visiting a term archive, returns the current term object
* When visiting a term archive, returns the current term object if it belongs to a Tainacan taxonomy
*
* @return false|\WP_Term
*/
function tainacan_get_term() {
if ( is_tax() ) {
return get_queried_object();
$term = get_queried_object();
$theme_helper = \Tainacan\Theme_Helper::get_instance();
if ( isset($term->taxonomy) && $theme_helper->is_taxonomy_a_tainacan_tax($term->taxonomy) ) {
return $term;
}
}
return false;
}

View File

@ -30,10 +30,13 @@
<p>{{ item.title != undefined ? item.title : '' }}</p>
</div>
<!-- Thumbnail -->
<img
<!-- Thumbnail -->
<div
v-if="item.thumbnail != undefined"
:src="item['thumbnail'].medium_large ? item['thumbnail'].medium_large : thumbPlaceholderPath">
class="thumbnail"
:style="{ backgroundImage: 'url(' + (item['thumbnail'].medium_large ? item['thumbnail'].medium_large : thumbPlaceholderPath) + ')' }">
<img :src="item['thumbnail'].medium_large ? item['thumbnail'].medium_large : thumbPlaceholderPath">
</div>
</a>
</masonry>
</div>

View File

@ -15,12 +15,16 @@
</div>
</section>
<!-- RECORDS VIEW MODE -->
<div class="tainacan-records-container">
<div
<masonry
:cols="{default: 4, 1919: 3, 1407: 2, 1215: 2, 1023: 1, 767: 1, 343: 1}"
:gutter="42"
class="tainacan-records-container">
<a
:href="item.url"
:key="index"
v-for="(item, index) of items"
class="tainacan-record">
<!-- <a :href="item.url"> -->
<!-- <div :href="item.url"> -->
<!-- Title -->
<p
v-tooltip="{
@ -32,48 +36,52 @@
v-for="(column, index) in displayedMetadata"
:key="index"
class="metadata-title"
v-if="column.display && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop == 'title')"
@click="goToItemPage(item)"
v-if="collectionId != undefined && column.display && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop == 'title')"
v-html="item.metadata != undefined ? renderMetadata(item.metadata, column) : ''" />
<p
v-tooltip="{
content: item.title != undefined ? item.title : '',
html: true,
autoHide: false,
placement: 'auto-start'
}"
v-for="(column, index) in tableMetadata"
:key="index"
v-if="collectionId == undefined && column.display && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop == 'title')"
v-html="item.title != undefined ? item.title : ''" />
<!-- Remaining metadata -->
<div
class="media"
@click="goToItemPage(item)">
<a
v-if="item.thumbnail != undefined"
@click="goToItemPage(item)">
<img :src="item['thumbnail'].medium_large ? item['thumbnail'].medium_large : thumbPlaceholderPath">
</a>
<div class="media">
<div class="list-metadata media-body">
<div
class="thumbnail"
v-if="item.thumbnail != undefined">
<img :src="item['thumbnail'].medium_large ? item['thumbnail'].medium_large : thumbPlaceholderPath">
</div>
<span
v-for="(column, index) in tableMetadata"
:key="index"
v-if="collectionId == undefined && column.display && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop == 'description')">
<h3 class="metadata-label">{{ $i18n.get('label_description') }}</h3>
<p
v-html="item.description != undefined ? item.description : ''"
class="metadata-value"/>
</span>
<span
v-for="(column, index) in displayedMetadata"
:key="index"
v-if="column.display && column.slug != 'thumbnail' && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop != 'title')">
<h3
v-tooltip="{
content: column.name,
html: false,
autoHide: false,
placement: 'auto-start'
}"
class="metadata-label">{{ column.name }}</h3>
<p
v-tooltip="{
content: item.metadata != undefined ? renderMetadata(item.metadata, column) : '',
html: true,
autoHide: false,
placement: 'auto-start'
}"
<h3 class="metadata-label">{{ column.name }}</h3>
<p
v-html="item.metadata != undefined ? renderMetadata(item.metadata, column) : ''"
class="metadata-value"/>
</span>
</div>
</div>
<!-- </a> -->
</div>
</div>
</a>
<!-- </div> -->
</masonry>
</div>
</div>
</template>

View File

@ -67,11 +67,28 @@
}"
@click="goToItemPage(item)">
<!-- <data-and-tooltip
v-if="column.metadatum !== 'row_thumbnail' &&
column.metadatum !== 'row_actions' &&
column.metadatum !== 'row_creation'"
:data="renderMetadata( item.metadata[column.slug] )"/> -->
<p
v-tooltip="{
content: item.title,
html: true,
autoHide: false,
placement: 'auto-start'
}"
v-if="collectionId == undefined &&
column.metadata_type_object != undefined &&
column.metadata_type_object.related_mapped_prop == 'title'"
v-html="item.title != undefined ? item.title : ''"/>
<p
v-tooltip="{
content: item.description,
html: true,
autoHide: false,
placement: 'auto-start'
}"
v-if="collectionId == undefined &&
column.metadata_type_object != undefined &&
column.metadata_type_object.related_mapped_prop == 'description'"
v-html="item.description != undefined ? item.description : ''"/>
<p
v-tooltip="{
content: renderMetadata( item.metadata[column.slug] ),

View File

@ -142,6 +142,7 @@ class TaxonomyMetadatumTypes extends TAINACAN_UnitTestCase {
'collection',
array(
'name' => 'test',
'status' => 'publish',
),
true
);
@ -150,6 +151,7 @@ class TaxonomyMetadatumTypes extends TAINACAN_UnitTestCase {
'taxonomy',
array(
'name' => 'tax_test',
'status' => 'publish',
),
true
);
@ -158,10 +160,22 @@ class TaxonomyMetadatumTypes extends TAINACAN_UnitTestCase {
'taxonomy',
array(
'name' => 'tax_test2',
'status' => 'publish',
),
true
);
$tax3 = $this->tainacan_entity_factory->create_entity(
'taxonomy',
array(
'name' => 'tax_test3',
'status' => 'publish',
),
true
);
$this->assertNotContains($tax->get_db_identifier(), get_object_taxonomies($collection->get_db_identifier()), 'Collection must be added to taxonomy when metadatum is created');
$metadatum = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
@ -177,10 +191,14 @@ class TaxonomyMetadatumTypes extends TAINACAN_UnitTestCase {
),
true
);
$this->assertContains($tax->get_db_identifier(), get_object_taxonomies($collection->get_db_identifier()), 'Collection must be added to taxonomy when metadatum is created');
$checkTax = $Tainacan_Taxonomies->fetch($tax->get_id());
$this->assertContains($collection->get_id(), $checkTax->get_collections_ids(), 'Collection must be added to taxonomy when metadatum is created');
$metadatum->set_metadata_type_options([
'taxonomy_id' => $tax2->get_id(),
'allow_new_terms' => false
@ -201,11 +219,193 @@ class TaxonomyMetadatumTypes extends TAINACAN_UnitTestCase {
$this->assertNotContains($collection->get_id(), $checkTax2->get_collections_ids(), 'Collection must be removed from taxonomy when metadatum is deleted');
$metadatum_repo = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'meta_repo',
'description' => 'description',
'collection_id' => 'default',
'metadata_type' => 'Tainacan\Metadata_Types\Taxonomy',
'status' => 'publish',
'metadata_type_options' => [
'taxonomy_id' => $tax3->get_id(),
'allow_new_terms' => false
]
),
true
);
$this->assertContains($tax3->get_db_identifier(), get_object_taxonomies($collection->get_db_identifier()), 'Taxonommy used by repository level metadatum must be assigned to all collections post types');
}
/**
* @group fetch_by_collection
*/
function test_fetch_by_collection() {
$Tainacan_Taxonomies = \Tainacan\Repositories\Taxonomies::get_instance();
$collection = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'test',
'status' => 'publish',
),
true
);
$collection2 = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'test',
'status' => 'publish',
),
true
);
$collection2_c = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'test',
'parent' => $collection2->get_id(),
'status' => 'publish',
),
true
);
$collection2_gc = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'test',
'parent' => $collection2_c->get_id(),
'status' => 'publish',
),
true
);
$tax = $this->tainacan_entity_factory->create_entity(
'taxonomy',
array(
'name' => 'tax_test',
'status' => 'publish',
),
true
);
$tax2 = $this->tainacan_entity_factory->create_entity(
'taxonomy',
array(
'name' => 'tax_test2',
'status' => 'publish',
),
true
);
$tax3 = $this->tainacan_entity_factory->create_entity(
'taxonomy',
array(
'name' => 'tax_test3',
'status' => 'publish',
),
true
);
$tax4 = $this->tainacan_entity_factory->create_entity(
'taxonomy',
array(
'name' => 'tax_test4',
'status' => 'publish',
),
true
);
// metadata 1 in repo level for every one
$metadatum_repo = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'meta_repo',
'description' => 'description',
'collection_id' => 'default',
'metadata_type' => 'Tainacan\Metadata_Types\Taxonomy',
'status' => 'publish',
'metadata_type_options' => [
'taxonomy_id' => $tax->get_id(),
'allow_new_terms' => false
]
),
true
);
// meta 2 in collection 1 just for it
$metadatum2 = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'meta_repo',
'description' => 'description',
'collection' => $collection,
'metadata_type' => 'Tainacan\Metadata_Types\Taxonomy',
'status' => 'publish',
'metadata_type_options' => [
'taxonomy_id' => $tax2->get_id(),
'allow_new_terms' => false
]
),
true
);
// meta 3 in collection 2 for it and chidlren and grand children
$metadatum3 = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'meta_repo',
'description' => 'description',
'collection' => $collection2,
'metadata_type' => 'Tainacan\Metadata_Types\Taxonomy',
'status' => 'publish',
'metadata_type_options' => [
'taxonomy_id' => $tax3->get_id(),
'allow_new_terms' => false
]
),
true
);
// meta 4 in collection 2c only for children and grand children
$metadatum4 = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'meta_repo',
'description' => 'description',
'collection' => $collection2_c,
'metadata_type' => 'Tainacan\Metadata_Types\Taxonomy',
'status' => 'publish',
'metadata_type_options' => [
'taxonomy_id' => $tax4->get_id(),
'allow_new_terms' => false
]
),
true
);
$taxonomies_1 = $Tainacan_Taxonomies->fetch_by_collection($collection, [], 'OBJECT');
$this->assertEquals(2, sizeof($taxonomies_1));
$taxonomies_2 = $Tainacan_Taxonomies->fetch_by_collection($collection2, [], 'OBJECT');
$this->assertEquals(2, sizeof($taxonomies_2));
$taxonomies_3 = $Tainacan_Taxonomies->fetch_by_collection($collection2_c, [], 'OBJECT');
$this->assertEquals(3, sizeof($taxonomies_3));
$taxonomies_4 = $Tainacan_Taxonomies->fetch_by_collection($collection2_gc, [], 'OBJECT');
$this->assertEquals(3, sizeof($taxonomies_4));
}
function test_values_and_html() {
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
$Tainacan_Taxonomies = \Tainacan\Repositories\Taxonomies::get_instance();

View File

@ -43,8 +43,94 @@ class TestUtilities extends TAINACAN_UnitTestCase {
$this->assertEquals('', tainacan_get_initials($string));
}
function test_get_descendants_ids() {
$collection = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'test',
'status' => 'publish',
),
true
);
$collection2 = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'test',
'status' => 'publish',
),
true
);
$collection2_c = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'test',
'parent' => $collection2->get_id(),
'status' => 'publish',
),
true
);
$collection2_gc = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'test',
'parent' => $collection2_c->get_id(),
'status' => 'publish',
),
true
);
$collection2_gc2 = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'test',
'parent' => $collection2_c->get_id(),
'status' => 'publish',
),
true
);
$collection2_ggc = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'test',
'parent' => $collection2_gc->get_id(),
'status' => 'publish',
),
true
);
$Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance();
$test = $Tainacan_Collections->get_descendants_ids($collection2);
$this->assertEquals(4, sizeof($test));
$test = $Tainacan_Collections->get_descendants_ids($collection2_c);
$this->assertEquals(3, sizeof($test));
$test = $Tainacan_Collections->get_descendants_ids($collection2_gc);
$this->assertEquals(1, sizeof($test));
$test = $Tainacan_Collections->get_descendants_ids($collection2_ggc);
$this->assertEquals(0, sizeof($test));
$test = $Tainacan_Collections->get_descendants_ids($collection);
$this->assertEquals(0, sizeof($test));
$test = $Tainacan_Collections->get_descendants_ids($collection2, 2);
$this->assertEquals(3, sizeof($test));
$test = $Tainacan_Collections->get_descendants_ids($collection2, 1);
$this->assertEquals(1, sizeof($test));
$test = $Tainacan_Collections->get_descendants_ids($collection2_c, 1);
$this->assertEquals(2, sizeof($test));
}
}