Merge branch 'develop' into continuousintegration
This commit is contained in:
commit
5ec1604416
4
build.sh
4
build.sh
|
@ -67,7 +67,9 @@ rm -rf $wp_plugin_dir
|
||||||
|
|
||||||
mkdir $wp_plugin_dir
|
mkdir $wp_plugin_dir
|
||||||
|
|
||||||
rsync -axz --exclude='vendor/bin/phpc*' --exclude='vendor/squizlabs' --exclude='vendor/wimg' src/* $wp_plugin_dir/
|
rsync -axz --exclude='vendor/bin/phpc*' --exclude='vendor/squizlabs' --exclude='vendor/wimg' \
|
||||||
|
--exclude='vendor/respect/validation/.git' --exclude='pdf-viewer/pdfjs-dist/web/compressed.tracemonkey-pldi-09.pdf' \
|
||||||
|
src/* $wp_plugin_dir/
|
||||||
|
|
||||||
rm -rf $wp_plugin_dir/scss
|
rm -rf $wp_plugin_dir/scss
|
||||||
|
|
||||||
|
|
|
@ -109,9 +109,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@vue/component-compiler-utils": {
|
"@vue/component-compiler-utils": {
|
||||||
"version": "1.2.1",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@vue/component-compiler-utils/-/component-compiler-utils-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/@vue/component-compiler-utils/-/component-compiler-utils-1.3.0.tgz",
|
||||||
"integrity": "sha512-l3GdahBgXlp/SoY5KU7mqMqg/BNiJAndpw/6nMfGzFooCGUkq49CT3pCMiSYy0g/2a6iBD37cHBYlsg4nulIwQ==",
|
"integrity": "sha512-CerIPMzE6y4J4v68nUh2NFPjOO8zr2r8UDh/yi63E4bf7YB5Aqhm7Fv90zzTF+sOQgsqTb9dgryvpeDY1/7m9g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"consolidate": "0.15.1",
|
"consolidate": "0.15.1",
|
||||||
|
@ -430,7 +430,6 @@
|
||||||
"version": "5.5.2",
|
"version": "5.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
|
||||||
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
|
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"co": "4.6.0",
|
"co": "4.6.0",
|
||||||
"fast-deep-equal": "1.0.0",
|
"fast-deep-equal": "1.0.0",
|
||||||
|
@ -471,12 +470,14 @@
|
||||||
"ansi-regex": {
|
"ansi-regex": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
||||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
|
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"ansi-styles": {
|
"ansi-styles": {
|
||||||
"version": "2.2.1",
|
"version": "2.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
|
||||||
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4="
|
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"any-observable": {
|
"any-observable": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
|
@ -620,7 +621,8 @@
|
||||||
"assert-plus": {
|
"assert-plus": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz",
|
||||||
"integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ="
|
"integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"assign-symbols": {
|
"assign-symbols": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
@ -731,7 +733,8 @@
|
||||||
"aws-sign2": {
|
"aws-sign2": {
|
||||||
"version": "0.6.0",
|
"version": "0.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz",
|
||||||
"integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8="
|
"integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"aws4": {
|
"aws4": {
|
||||||
"version": "1.6.0",
|
"version": "1.6.0",
|
||||||
|
@ -1774,6 +1777,7 @@
|
||||||
"version": "2.10.1",
|
"version": "2.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz",
|
"resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz",
|
||||||
"integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=",
|
"integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"hoek": "2.16.3"
|
"hoek": "2.16.3"
|
||||||
}
|
}
|
||||||
|
@ -2166,14 +2170,15 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"caseless": {
|
"caseless": {
|
||||||
"version": "0.11.0",
|
"version": "0.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
|
||||||
"integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c="
|
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
|
||||||
},
|
},
|
||||||
"chalk": {
|
"chalk": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
|
||||||
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
|
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-styles": "2.2.1",
|
"ansi-styles": "2.2.1",
|
||||||
"escape-string-regexp": "1.0.5",
|
"escape-string-regexp": "1.0.5",
|
||||||
|
@ -2460,8 +2465,7 @@
|
||||||
"co": {
|
"co": {
|
||||||
"version": "4.6.0",
|
"version": "4.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
|
||||||
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=",
|
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"coa": {
|
"coa": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
|
@ -2549,9 +2553,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"commander": {
|
"commander": {
|
||||||
"version": "2.14.1",
|
"version": "2.15.1",
|
||||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.14.1.tgz",
|
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
|
||||||
"integrity": "sha512-+YR16o3rK53SmWHU3rEM3tPAh2rwb1yPcQX5irVn7mb0gXbwuCCrnkbV5+PBfETdfg1vui07nM6PCG1zndcjQw=="
|
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"common-tags": {
|
"common-tags": {
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
|
@ -2805,6 +2810,7 @@
|
||||||
"version": "2.0.5",
|
"version": "2.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz",
|
||||||
"integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=",
|
"integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"boom": "2.10.1"
|
"boom": "2.10.1"
|
||||||
}
|
}
|
||||||
|
@ -3219,7 +3225,7 @@
|
||||||
"performance-now": "0.2.0",
|
"performance-now": "0.2.0",
|
||||||
"qs": "6.4.0",
|
"qs": "6.4.0",
|
||||||
"safe-buffer": "5.1.1",
|
"safe-buffer": "5.1.1",
|
||||||
"stringstream": "0.0.5",
|
"stringstream": "0.0.6",
|
||||||
"tough-cookie": "2.3.3",
|
"tough-cookie": "2.3.3",
|
||||||
"tunnel-agent": "0.6.0",
|
"tunnel-agent": "0.6.0",
|
||||||
"uuid": "3.2.1"
|
"uuid": "3.2.1"
|
||||||
|
@ -3824,7 +3830,8 @@
|
||||||
"escape-string-regexp": {
|
"escape-string-regexp": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
|
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"eslint": {
|
"eslint": {
|
||||||
"version": "4.19.1",
|
"version": "4.19.1",
|
||||||
|
@ -4425,8 +4432,7 @@
|
||||||
"fast-deep-equal": {
|
"fast-deep-equal": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz",
|
||||||
"integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=",
|
"integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"fast-glob": {
|
"fast-glob": {
|
||||||
"version": "2.2.1",
|
"version": "2.2.1",
|
||||||
|
@ -4444,8 +4450,7 @@
|
||||||
"fast-json-stable-stringify": {
|
"fast-json-stable-stringify": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
|
||||||
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",
|
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"fast-levenshtein": {
|
"fast-levenshtein": {
|
||||||
"version": "2.0.6",
|
"version": "2.0.6",
|
||||||
|
@ -4694,6 +4699,7 @@
|
||||||
"version": "2.1.4",
|
"version": "2.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz",
|
||||||
"integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=",
|
"integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"asynckit": "0.4.0",
|
"asynckit": "0.4.0",
|
||||||
"combined-stream": "1.0.6",
|
"combined-stream": "1.0.6",
|
||||||
|
@ -5341,12 +5347,14 @@
|
||||||
"generate-function": {
|
"generate-function": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz",
|
||||||
"integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ="
|
"integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"generate-object-property": {
|
"generate-object-property": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz",
|
||||||
"integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=",
|
"integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"is-property": "1.0.2"
|
"is-property": "1.0.2"
|
||||||
}
|
}
|
||||||
|
@ -5705,14 +5713,19 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"har-validator": {
|
"har-validator": {
|
||||||
"version": "2.0.6",
|
"version": "5.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
|
||||||
"integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=",
|
"integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"chalk": "1.1.3",
|
"ajv": "5.5.2",
|
||||||
"commander": "2.14.1",
|
"har-schema": "2.0.0"
|
||||||
"is-my-json-valid": "2.17.2",
|
},
|
||||||
"pinkie-promise": "2.0.1"
|
"dependencies": {
|
||||||
|
"har-schema": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI="
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"has": {
|
"has": {
|
||||||
|
@ -5728,6 +5741,7 @@
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
|
||||||
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
|
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-regex": "2.1.1"
|
"ansi-regex": "2.1.1"
|
||||||
}
|
}
|
||||||
|
@ -5833,6 +5847,7 @@
|
||||||
"version": "3.1.3",
|
"version": "3.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz",
|
||||||
"integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=",
|
"integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"boom": "2.10.1",
|
"boom": "2.10.1",
|
||||||
"cryptiles": "2.0.5",
|
"cryptiles": "2.0.5",
|
||||||
|
@ -5860,7 +5875,8 @@
|
||||||
"hoek": {
|
"hoek": {
|
||||||
"version": "2.16.3",
|
"version": "2.16.3",
|
||||||
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz",
|
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz",
|
||||||
"integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0="
|
"integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"home-or-tmp": {
|
"home-or-tmp": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
|
@ -5919,7 +5935,7 @@
|
||||||
"bluebird": "3.5.1",
|
"bluebird": "3.5.1",
|
||||||
"cheerio": "0.19.0",
|
"cheerio": "0.19.0",
|
||||||
"lodash": "3.10.1",
|
"lodash": "3.10.1",
|
||||||
"request": "2.79.0"
|
"request": "2.87.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lodash": {
|
"lodash": {
|
||||||
|
@ -6035,6 +6051,7 @@
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz",
|
||||||
"integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=",
|
"integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"assert-plus": "0.2.0",
|
"assert-plus": "0.2.0",
|
||||||
"jsprim": "1.4.1",
|
"jsprim": "1.4.1",
|
||||||
|
@ -6523,12 +6540,14 @@
|
||||||
"is-my-ip-valid": {
|
"is-my-ip-valid": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz",
|
||||||
"integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ=="
|
"integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"is-my-json-valid": {
|
"is-my-json-valid": {
|
||||||
"version": "2.17.2",
|
"version": "2.17.2",
|
||||||
"resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz",
|
"resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz",
|
||||||
"integrity": "sha512-IBhBslgngMQN8DDSppmgDv7RNrlFotuuDsKcrCP3+HbFaVivIBU7u9oiiErw8sH4ynx3+gOGQ3q2otkgiSi6kg==",
|
"integrity": "sha512-IBhBslgngMQN8DDSppmgDv7RNrlFotuuDsKcrCP3+HbFaVivIBU7u9oiiErw8sH4ynx3+gOGQ3q2otkgiSi6kg==",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"generate-function": "2.0.0",
|
"generate-function": "2.0.0",
|
||||||
"generate-object-property": "1.2.0",
|
"generate-object-property": "1.2.0",
|
||||||
|
@ -6663,7 +6682,8 @@
|
||||||
"is-property": {
|
"is-property": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz",
|
||||||
"integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ="
|
"integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"is-regex": {
|
"is-regex": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
|
@ -6963,8 +6983,7 @@
|
||||||
"json-schema-traverse": {
|
"json-schema-traverse": {
|
||||||
"version": "0.3.1",
|
"version": "0.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
|
||||||
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=",
|
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"json-stable-stringify": {
|
"json-stable-stringify": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
|
@ -7016,7 +7035,8 @@
|
||||||
"jsonpointer": {
|
"jsonpointer": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz",
|
||||||
"integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk="
|
"integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"jsprim": {
|
"jsprim": {
|
||||||
"version": "1.4.1",
|
"version": "1.4.1",
|
||||||
|
@ -7906,7 +7926,7 @@
|
||||||
"nopt": "3.0.6",
|
"nopt": "3.0.6",
|
||||||
"npmlog": "4.1.2",
|
"npmlog": "4.1.2",
|
||||||
"osenv": "0.1.5",
|
"osenv": "0.1.5",
|
||||||
"request": "2.79.0",
|
"request": "2.87.0",
|
||||||
"rimraf": "2.6.2",
|
"rimraf": "2.6.2",
|
||||||
"semver": "5.3.0",
|
"semver": "5.3.0",
|
||||||
"tar": "2.2.1",
|
"tar": "2.2.1",
|
||||||
|
@ -7979,6 +7999,12 @@
|
||||||
"true-case-path": "1.0.2"
|
"true-case-path": "1.0.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"caseless": {
|
||||||
|
"version": "0.11.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz",
|
||||||
|
"integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"cross-spawn": {
|
"cross-spawn": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz",
|
||||||
|
@ -7988,6 +8014,58 @@
|
||||||
"lru-cache": "4.1.1",
|
"lru-cache": "4.1.1",
|
||||||
"which": "1.3.0"
|
"which": "1.3.0"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"har-validator": {
|
||||||
|
"version": "2.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz",
|
||||||
|
"integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"chalk": "1.1.3",
|
||||||
|
"commander": "2.15.1",
|
||||||
|
"is-my-json-valid": "2.17.2",
|
||||||
|
"pinkie-promise": "2.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"qs": {
|
||||||
|
"version": "6.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz",
|
||||||
|
"integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"request": {
|
||||||
|
"version": "2.79.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz",
|
||||||
|
"integrity": "sha1-Tf5b9r6LjNw3/Pk+BLZVd3InEN4=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"aws-sign2": "0.6.0",
|
||||||
|
"aws4": "1.6.0",
|
||||||
|
"caseless": "0.11.0",
|
||||||
|
"combined-stream": "1.0.6",
|
||||||
|
"extend": "3.0.1",
|
||||||
|
"forever-agent": "0.6.1",
|
||||||
|
"form-data": "2.1.4",
|
||||||
|
"har-validator": "2.0.6",
|
||||||
|
"hawk": "3.1.3",
|
||||||
|
"http-signature": "1.1.1",
|
||||||
|
"is-typedarray": "1.0.0",
|
||||||
|
"isstream": "0.1.2",
|
||||||
|
"json-stringify-safe": "5.0.1",
|
||||||
|
"mime-types": "2.1.17",
|
||||||
|
"oauth-sign": "0.8.2",
|
||||||
|
"qs": "6.3.2",
|
||||||
|
"stringstream": "0.0.6",
|
||||||
|
"tough-cookie": "2.3.3",
|
||||||
|
"tunnel-agent": "0.4.3",
|
||||||
|
"uuid": "3.2.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tunnel-agent": {
|
||||||
|
"version": "0.4.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz",
|
||||||
|
"integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=",
|
||||||
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -8594,12 +8672,14 @@
|
||||||
"pinkie": {
|
"pinkie": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
|
||||||
"integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA="
|
"integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"pinkie-promise": {
|
"pinkie-promise": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
|
||||||
"integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
|
"integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"pinkie": "2.0.4"
|
"pinkie": "2.0.4"
|
||||||
}
|
}
|
||||||
|
@ -10321,36 +10401,66 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"request": {
|
"request": {
|
||||||
"version": "2.79.0",
|
"version": "2.87.0",
|
||||||
"resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz",
|
"resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz",
|
||||||
"integrity": "sha1-Tf5b9r6LjNw3/Pk+BLZVd3InEN4=",
|
"integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"aws-sign2": "0.6.0",
|
"aws-sign2": "0.7.0",
|
||||||
"aws4": "1.6.0",
|
"aws4": "1.6.0",
|
||||||
"caseless": "0.11.0",
|
"caseless": "0.12.0",
|
||||||
"combined-stream": "1.0.6",
|
"combined-stream": "1.0.6",
|
||||||
"extend": "3.0.1",
|
"extend": "3.0.1",
|
||||||
"forever-agent": "0.6.1",
|
"forever-agent": "0.6.1",
|
||||||
"form-data": "2.1.4",
|
"form-data": "2.3.2",
|
||||||
"har-validator": "2.0.6",
|
"har-validator": "5.0.3",
|
||||||
"hawk": "3.1.3",
|
"http-signature": "1.2.0",
|
||||||
"http-signature": "1.1.1",
|
|
||||||
"is-typedarray": "1.0.0",
|
"is-typedarray": "1.0.0",
|
||||||
"isstream": "0.1.2",
|
"isstream": "0.1.2",
|
||||||
"json-stringify-safe": "5.0.1",
|
"json-stringify-safe": "5.0.1",
|
||||||
"mime-types": "2.1.17",
|
"mime-types": "2.1.17",
|
||||||
"oauth-sign": "0.8.2",
|
"oauth-sign": "0.8.2",
|
||||||
"qs": "6.3.2",
|
"performance-now": "2.1.0",
|
||||||
"stringstream": "0.0.5",
|
"qs": "6.5.2",
|
||||||
|
"safe-buffer": "5.1.1",
|
||||||
"tough-cookie": "2.3.3",
|
"tough-cookie": "2.3.3",
|
||||||
"tunnel-agent": "0.4.3",
|
"tunnel-agent": "0.6.0",
|
||||||
"uuid": "3.2.1"
|
"uuid": "3.2.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"qs": {
|
"assert-plus": {
|
||||||
"version": "6.3.2",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
|
||||||
"integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw="
|
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
|
||||||
|
},
|
||||||
|
"aws-sign2": {
|
||||||
|
"version": "0.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
|
||||||
|
"integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg="
|
||||||
|
},
|
||||||
|
"form-data": {
|
||||||
|
"version": "2.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz",
|
||||||
|
"integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=",
|
||||||
|
"requires": {
|
||||||
|
"asynckit": "0.4.0",
|
||||||
|
"combined-stream": "1.0.6",
|
||||||
|
"mime-types": "2.1.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"http-signature": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
|
||||||
|
"integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
|
||||||
|
"requires": {
|
||||||
|
"assert-plus": "1.0.0",
|
||||||
|
"jsprim": "1.4.1",
|
||||||
|
"sshpk": "1.14.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"performance-now": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
|
||||||
|
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -10534,8 +10644,7 @@
|
||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.1.1",
|
"version": "5.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
|
||||||
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
|
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"safe-regex": {
|
"safe-regex": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
|
@ -10992,6 +11101,7 @@
|
||||||
"version": "1.0.9",
|
"version": "1.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz",
|
"resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz",
|
||||||
"integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=",
|
"integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"hoek": "2.16.3"
|
"hoek": "2.16.3"
|
||||||
}
|
}
|
||||||
|
@ -11327,14 +11437,16 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"stringstream": {
|
"stringstream": {
|
||||||
"version": "0.0.5",
|
"version": "0.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz",
|
||||||
"integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg="
|
"integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"strip-ansi": {
|
"strip-ansi": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
||||||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-regex": "2.1.1"
|
"ansi-regex": "2.1.1"
|
||||||
}
|
}
|
||||||
|
@ -11392,7 +11504,8 @@
|
||||||
"supports-color": {
|
"supports-color": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
|
||||||
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc="
|
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"svgo": {
|
"svgo": {
|
||||||
"version": "0.7.2",
|
"version": "0.7.2",
|
||||||
|
@ -11710,9 +11823,12 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"tunnel-agent": {
|
"tunnel-agent": {
|
||||||
"version": "0.4.3",
|
"version": "0.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz",
|
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
||||||
"integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us="
|
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
|
||||||
|
"requires": {
|
||||||
|
"safe-buffer": "5.1.1"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"tweetnacl": {
|
"tweetnacl": {
|
||||||
"version": "0.14.5",
|
"version": "0.14.5",
|
||||||
|
@ -12214,12 +12330,12 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"vue-loader": {
|
"vue-loader": {
|
||||||
"version": "15.0.11",
|
"version": "15.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.2.0.tgz",
|
||||||
"integrity": "sha512-wyCwG/mbMWfW4hIYJbUWEkfPTVj4aMp/8G8qqnbnIsEZJqqCVBQ+pOO59NPQWjub8VAYMBeIB7crHlWsWS2Ufw==",
|
"integrity": "sha512-vJuybfEVtYU2HZUqUHMiqBU1/9K2HFplbsRJMca6B2hPNQt5Kx24mrVK9Ej+vlgM+3zf+7WIKKQPjJwvdHbkdA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@vue/component-compiler-utils": "1.2.1",
|
"@vue/component-compiler-utils": "1.3.0",
|
||||||
"hash-sum": "1.0.2",
|
"hash-sum": "1.0.2",
|
||||||
"loader-utils": "1.1.0",
|
"loader-utils": "1.1.0",
|
||||||
"vue-hot-reload-api": "2.3.0",
|
"vue-hot-reload-api": "2.3.0",
|
||||||
|
@ -13249,7 +13365,8 @@
|
||||||
"xtend": {
|
"xtend": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
|
||||||
"integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68="
|
"integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"y18n": {
|
"y18n": {
|
||||||
"version": "3.2.1",
|
"version": "3.2.1",
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
"style-loader": "^0.21.0",
|
"style-loader": "^0.21.0",
|
||||||
"uglifyjs-webpack-plugin": "^1.2.5",
|
"uglifyjs-webpack-plugin": "^1.2.5",
|
||||||
"vue-custom-element": "^3.0.6",
|
"vue-custom-element": "^3.0.6",
|
||||||
"vue-loader": "^15.0.11",
|
"vue-loader": "^15.1.0",
|
||||||
"vue-template-compiler": "^2.5.16",
|
"vue-template-compiler": "^2.5.16",
|
||||||
"webpack": "^4.8.3",
|
"webpack": "^4.8.3",
|
||||||
"webpack-cli": "^2.1.3",
|
"webpack-cli": "^2.1.3",
|
||||||
|
|
|
@ -177,6 +177,7 @@ class Admin {
|
||||||
'base_url' => $TAINACAN_BASE_URL,
|
'base_url' => $TAINACAN_BASE_URL,
|
||||||
'admin_url' => admin_url(),
|
'admin_url' => admin_url(),
|
||||||
'custom_header_support' => get_theme_support('custom-header'),
|
'custom_header_support' => get_theme_support('custom-header'),
|
||||||
|
'registered_view_modes' => \Tainacan\Theme_Helper::get_instance()->get_registered_view_modes(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$maps = [
|
$maps = [
|
||||||
|
|
|
@ -195,14 +195,17 @@
|
||||||
|
|
||||||
if (formNotSaved) {
|
if (formNotSaved) {
|
||||||
this.$dialog.confirm({
|
this.$dialog.confirm({
|
||||||
|
title: this.$i18n.get('label_warning'),
|
||||||
message: this.$i18n.get('info_warning_category_not_saved'),
|
message: this.$i18n.get('info_warning_category_not_saved'),
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
next();
|
next();
|
||||||
},
|
},
|
||||||
cancelText: this.$i18n.get('cancel'),
|
icon: 'alert-circle',
|
||||||
confirmText: this.$i18n.get('continue'),
|
hasIcon: true,
|
||||||
type: 'is-secondary'
|
cancelText: this.$i18n.get('cancel'),
|
||||||
});
|
confirmText: this.$i18n.get('continue'),
|
||||||
|
type: 'is-success'
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,6 +276,64 @@
|
||||||
</b-select>
|
</b-select>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
|
<!-- Enabled View Modes ------------------------------- -->
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">{{ $i18n.get('label_view_modes_available') }}</label>
|
||||||
|
<help-button
|
||||||
|
:title="$i18n.getHelperTitle('collections', 'enabled_view_modes')"
|
||||||
|
:message="$i18n.getHelperMessage('collections', 'enabled_view_modes')"/>
|
||||||
|
<div class="control">
|
||||||
|
<b-dropdown
|
||||||
|
ref="enabledViewModesDropdown"
|
||||||
|
:mobile-modal="false"
|
||||||
|
:disabled="Object.keys(registeredViewModes).length < 0">
|
||||||
|
<button
|
||||||
|
class="button is-white"
|
||||||
|
slot="trigger"
|
||||||
|
position="is-top-right"
|
||||||
|
type="button">
|
||||||
|
<span>{{ $i18n.get('label_enabled_view_modes') }}</span>
|
||||||
|
<b-icon icon="menu-down"/>
|
||||||
|
</button>
|
||||||
|
<b-dropdown-item
|
||||||
|
v-for="(viewMode, index) in Object.keys(registeredViewModes)"
|
||||||
|
:key="index"
|
||||||
|
class="control"
|
||||||
|
custom>
|
||||||
|
<b-checkbox
|
||||||
|
v-if="registeredViewModes[viewMode] != undefined"
|
||||||
|
@input="updateViewModeslist(viewMode)"
|
||||||
|
:value="checkIfViewModeEnabled(viewMode)">
|
||||||
|
{{ registeredViewModes[viewMode].label }}
|
||||||
|
</b-checkbox>
|
||||||
|
</b-dropdown-item>
|
||||||
|
</b-dropdown>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Default View Mode -------------------------------- -->
|
||||||
|
<b-field
|
||||||
|
v-if="form.enabled_view_modes.length > 0"
|
||||||
|
:addons="false"
|
||||||
|
:label="$i18n.get('label_default_view_mode')"
|
||||||
|
:type="editFormErrors['default_view_mode'] != undefined ? 'is-danger' : ''"
|
||||||
|
:message="editFormErrors['default_view_mode'] != undefined ? editFormErrors['default_view_mode'] : ''">
|
||||||
|
<help-button
|
||||||
|
:title="$i18n.getHelperTitle('collections', 'default_view_mode')"
|
||||||
|
:message="$i18n.getHelperMessage('collections', 'default_view_mode')"/>
|
||||||
|
<b-select
|
||||||
|
id="tainacan-select-default_view_mode"
|
||||||
|
v-model="form.default_view_mode"
|
||||||
|
@focus="clearErrors('default_view_mode')">
|
||||||
|
<option
|
||||||
|
v-for="(viewMode, index) of form.enabled_view_modes"
|
||||||
|
v-if="registeredViewModes[viewMode] != undefined"
|
||||||
|
:key="index"
|
||||||
|
:value="viewMode">{{ registeredViewModes[viewMode].label }}
|
||||||
|
</option>
|
||||||
|
</b-select>
|
||||||
|
</b-field>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -324,7 +382,9 @@ export default {
|
||||||
thumbnail: '',
|
thumbnail: '',
|
||||||
header_image: '',
|
header_image: '',
|
||||||
files:[],
|
files:[],
|
||||||
moderators_ids: []
|
moderators_ids: [],
|
||||||
|
enabled_view_modes: [],
|
||||||
|
default_view_mode: []
|
||||||
},
|
},
|
||||||
thumbnail: {},
|
thumbnail: {},
|
||||||
cover: {},
|
cover: {},
|
||||||
|
@ -358,7 +418,9 @@ export default {
|
||||||
collections: [],
|
collections: [],
|
||||||
isFetchingCollections: true,
|
isFetchingCollections: true,
|
||||||
thumbnailMediaFrame: undefined,
|
thumbnailMediaFrame: undefined,
|
||||||
headerImageMediaFrame: undefined
|
headerImageMediaFrame: undefined,
|
||||||
|
registeredViewModes: tainacan_plugin.registered_view_modes,
|
||||||
|
viewModesList: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -393,7 +455,9 @@ export default {
|
||||||
slug: this.form.slug,
|
slug: this.form.slug,
|
||||||
status: this.form.status,
|
status: this.form.status,
|
||||||
moderators_ids: this.form.moderators_ids,
|
moderators_ids: this.form.moderators_ids,
|
||||||
parent: this.form.parent
|
parent: this.form.parent,
|
||||||
|
enabled_view_modes: this.form.enabled_view_modes,
|
||||||
|
default_view_mode: this.form.default_view_mode
|
||||||
};
|
};
|
||||||
this.updateCollection(data).then(updatedCollection => {
|
this.updateCollection(data).then(updatedCollection => {
|
||||||
|
|
||||||
|
@ -406,6 +470,8 @@ export default {
|
||||||
this.form.status = this.collection.status;
|
this.form.status = this.collection.status;
|
||||||
this.form.cover_page_id = this.collection.cover_page_id;
|
this.form.cover_page_id = this.collection.cover_page_id;
|
||||||
this.form.enable_cover_page = this.collection.enable_cover_page;
|
this.form.enable_cover_page = this.collection.enable_cover_page;
|
||||||
|
this.form.enabled_view_modes = this.collection.enabled_view_modes;
|
||||||
|
this.form.default_view_mode = this.collection.default_view_mode;
|
||||||
|
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.formErrorMessage = '';
|
this.formErrorMessage = '';
|
||||||
|
@ -444,6 +510,8 @@ export default {
|
||||||
this.form.cover_page_id = this.collection.cover_page_id;
|
this.form.cover_page_id = this.collection.cover_page_id;
|
||||||
this.form.slug = this.collection.slug;
|
this.form.slug = this.collection.slug;
|
||||||
this.form.parent = this.collection.parent;
|
this.form.parent = this.collection.parent;
|
||||||
|
this.form.default_view_mode = this.collection.default_view_mode;
|
||||||
|
this.form.enabled_view_modes = [];
|
||||||
this.moderators = [];
|
this.moderators = [];
|
||||||
|
|
||||||
// Pre-fill status with publish to incentivate it
|
// Pre-fill status with publish to incentivate it
|
||||||
|
@ -472,6 +540,18 @@ export default {
|
||||||
cancelBack(){
|
cancelBack(){
|
||||||
this.$router.push(this.$routerHelper.getCollectionsPath());
|
this.$router.push(this.$routerHelper.getCollectionsPath());
|
||||||
},
|
},
|
||||||
|
updateViewModeslist(viewMode) {
|
||||||
|
|
||||||
|
let index = this.form.enabled_view_modes.findIndex(aViewMode => aViewMode == viewMode);
|
||||||
|
if (index > -1)
|
||||||
|
this.form.enabled_view_modes.splice(index, 1);
|
||||||
|
else
|
||||||
|
this.form.enabled_view_modes.push(viewMode);
|
||||||
|
},
|
||||||
|
checkIfViewModeEnabled(viewMode) {
|
||||||
|
let index = this.form.enabled_view_modes.findIndex(aViewMode => aViewMode == viewMode);
|
||||||
|
return index > -1;
|
||||||
|
},
|
||||||
fecthCoverPages(search) {
|
fecthCoverPages(search) {
|
||||||
this.isFetchingPages = true;
|
this.isFetchingPages = true;
|
||||||
this.fetchPages(search)
|
this.fetchPages(search)
|
||||||
|
@ -601,7 +681,8 @@ export default {
|
||||||
this.form.enable_cover_page = this.collection.enable_cover_page;
|
this.form.enable_cover_page = this.collection.enable_cover_page;
|
||||||
this.form.cover_page_id = this.collection.cover_page_id;
|
this.form.cover_page_id = this.collection.cover_page_id;
|
||||||
this.form.parent = this.collection.parent;
|
this.form.parent = this.collection.parent;
|
||||||
|
this.form.default_view_mode = this.collection.default_view_mode;
|
||||||
|
this.form.enabled_view_modes = JSON.parse(JSON.stringify(this.collection.enabled_view_modes));
|
||||||
this.moderators = JSON.parse(JSON.stringify(this.collection.moderators));
|
this.moderators = JSON.parse(JSON.stringify(this.collection.moderators));
|
||||||
|
|
||||||
// Generates CoverPage from current cover_page_id info
|
// Generates CoverPage from current cover_page_id info
|
||||||
|
@ -639,6 +720,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
||||||
if (this.$route.fullPath.split("/").pop() != "new") {
|
if (this.$route.fullPath.split("/").pop() != "new") {
|
||||||
document.getElementById('collection-page-container').addEventListener('scroll', ($event) => {
|
document.getElementById('collection-page-container').addEventListener('scroll', ($event) => {
|
||||||
this.$emit('onShrinkHeader', ($event.originalTarget.scrollTop > 53));
|
this.$emit('onShrinkHeader', ($event.originalTarget.scrollTop > 53));
|
||||||
|
@ -653,12 +735,11 @@ export default {
|
||||||
|
|
||||||
@import "../../scss/_variables.scss";
|
@import "../../scss/_variables.scss";
|
||||||
|
|
||||||
.tainacan-form>.columns>.column {
|
|
||||||
overflow: auto;
|
.field {
|
||||||
.field {
|
position: relative;
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumbnail-field {
|
.thumbnail-field {
|
||||||
max-height: 128px;
|
max-height: 128px;
|
||||||
margin-bottom: 96px;
|
margin-bottom: 96px;
|
||||||
|
|
|
@ -459,6 +459,7 @@ export default {
|
||||||
this.form.document_type = this.item.document_type;
|
this.form.document_type = this.item.document_type;
|
||||||
|
|
||||||
this.loadMetadata();
|
this.loadMetadata();
|
||||||
|
this.fetchAttachments(this.itemId);
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch(error => this.$console.error(error));
|
.catch(error => this.$console.error(error));
|
||||||
|
@ -675,14 +676,17 @@ export default {
|
||||||
beforeRouteLeave ( to, from, next ) {
|
beforeRouteLeave ( to, from, next ) {
|
||||||
if (this.item.status == 'auto-draft') {
|
if (this.item.status == 'auto-draft') {
|
||||||
this.$dialog.confirm({
|
this.$dialog.confirm({
|
||||||
|
title: this.$i18n.get('label_warning'),
|
||||||
message: this.$i18n.get('info_warning_item_not_saved'),
|
message: this.$i18n.get('info_warning_item_not_saved'),
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
next();
|
next();
|
||||||
},
|
},
|
||||||
cancelText: this.$i18n.get('cancel'),
|
icon: 'alert-circle',
|
||||||
confirmText: this.$i18n.get('continue'),
|
hasIcon: true,
|
||||||
type: 'is-secondary'
|
cancelText: this.$i18n.get('cancel'),
|
||||||
});
|
confirmText: this.$i18n.get('continue'),
|
||||||
|
type: 'is-success'
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,104 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="cards-container">
|
|
||||||
<div
|
|
||||||
class="tainacan-card"
|
|
||||||
v-for="(item, index) of items"
|
|
||||||
:key="index"
|
|
||||||
@click="goToItemPage(item)">
|
|
||||||
|
|
||||||
<img
|
|
||||||
class="card-image"
|
|
||||||
:src="item.thumbnail.medium_large">
|
|
||||||
<div class="card-metadata">
|
|
||||||
<span
|
|
||||||
:key="index"
|
|
||||||
v-for="(field, index) of tableFields">
|
|
||||||
<p
|
|
||||||
v-if="field.display && field.id"
|
|
||||||
:class="{ 'field-main-content': field.field_type_object != undefined ? (field.field_type_object.related_mapped_prop == 'title') : false }"
|
|
||||||
v-html="(field.field == 'row_author' || field.field == 'row_creation') ? item[field.slug] : renderMetadata(item.metadata[field.slug])"/>
|
|
||||||
<p
|
|
||||||
v-if="field.field == 'row_author'">
|
|
||||||
{{ $i18n.get('label_created_by') + ": " + item[field.slug] }}
|
|
||||||
</p>
|
|
||||||
<p
|
|
||||||
v-if="field.field == 'row_creation'">
|
|
||||||
{{ $i18n.get('label_creation_date') + ": " + item[field.slug] }}
|
|
||||||
</p>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'TainacanCardsList',
|
|
||||||
data(){
|
|
||||||
return {
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
tableFields: Array,
|
|
||||||
items: Array,
|
|
||||||
isLoading: false,
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
renderMetadata(metadata) {
|
|
||||||
|
|
||||||
if (!metadata) {
|
|
||||||
return '';
|
|
||||||
} else if (metadata.date_i18n) {
|
|
||||||
return metadata.date_i18n;
|
|
||||||
} else {
|
|
||||||
return metadata.value_as_html;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
goToItemPage(item) {
|
|
||||||
window.location.href = item.url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
|
|
||||||
@import "../../scss/_variables.scss";
|
|
||||||
|
|
||||||
.cards-container {
|
|
||||||
padding: 20px calc(8.333333% - 12px);
|
|
||||||
position: relative;
|
|
||||||
margin-bottom: 40px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
flex-flow: wrap;
|
|
||||||
|
|
||||||
.tainacan-card {
|
|
||||||
cursor: pointer;
|
|
||||||
padding: 12px;
|
|
||||||
width: 50%; //258px;
|
|
||||||
|
|
||||||
@media screen and (min-width: 769px) and (max-width: 1216px) { width: 33.33333%; }
|
|
||||||
|
|
||||||
@media screen and (min-width: 1217px) { width: 25%; }
|
|
||||||
|
|
||||||
img.card-image {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.card-metadata {
|
|
||||||
padding: 8px 0px;
|
|
||||||
background: white;
|
|
||||||
font-size: 11px;
|
|
||||||
color: $gray-light;
|
|
||||||
|
|
||||||
p.field-main-content {
|
|
||||||
font-size: 14px;
|
|
||||||
color: $tainacan-input-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
|
|
@ -1,123 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="list-container">
|
|
||||||
<div
|
|
||||||
class="tainacan-list"
|
|
||||||
v-for="(item, index) of items"
|
|
||||||
:key="index"
|
|
||||||
@click="goToItemPage(item)">
|
|
||||||
|
|
||||||
<p class="field-main-content">{{ getTitle(item) }}</p>
|
|
||||||
<div>
|
|
||||||
<div class="list-image">
|
|
||||||
<img :src="item.thumbnail.medium">
|
|
||||||
</div>
|
|
||||||
<div class="list-metadata">
|
|
||||||
<span
|
|
||||||
v-for="(field, index) of tableFields"
|
|
||||||
:key="index">
|
|
||||||
<p
|
|
||||||
v-if="field.display && field.id && (field.field_type_object != undefined && field.field_type_object.related_mapped_prop != 'title')"
|
|
||||||
v-html="renderMetadata(item.metadata[field.slug])"/>
|
|
||||||
<p
|
|
||||||
v-if="field.field == 'row_author'">
|
|
||||||
{{ $i18n.get('label_created_by') + ": " + item[field.slug] }}
|
|
||||||
</p>
|
|
||||||
<p
|
|
||||||
v-if="field.field == 'row_creation'">
|
|
||||||
{{ $i18n.get('label_creation_date') + ": " + item[field.slug] }}
|
|
||||||
</p>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'TainacanListList',
|
|
||||||
data(){
|
|
||||||
return {
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
tableFields: Array,
|
|
||||||
items: Array,
|
|
||||||
isLoading: false,
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getTitle(item) {
|
|
||||||
for (let field of this.tableFields) {
|
|
||||||
if (field.field_type_object != undefined && field.field_type_object.related_mapped_prop == 'title')
|
|
||||||
return this.renderMetadata(item.metadata[field.slug]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
renderMetadata(metadata) {
|
|
||||||
|
|
||||||
if (!metadata) {
|
|
||||||
return '';
|
|
||||||
} else if (metadata.date_i18n) {
|
|
||||||
return metadata.date_i18n;
|
|
||||||
} else {
|
|
||||||
return metadata.value_as_html;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
goToItemPage(item) {
|
|
||||||
window.location.href = item.url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
|
|
||||||
@import "../../scss/_variables.scss";
|
|
||||||
|
|
||||||
.list-container {
|
|
||||||
padding: 20px calc(8.333333% - 12px);
|
|
||||||
position: relative;
|
|
||||||
margin-bottom: 40px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
flex-flow: wrap;
|
|
||||||
|
|
||||||
.tainacan-list {
|
|
||||||
cursor: pointer;
|
|
||||||
align-items: flex-start;
|
|
||||||
display: flex;
|
|
||||||
flex-flow: column;
|
|
||||||
text-align: left;
|
|
||||||
padding: 16px 12px;
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
@media screen and (min-width: 769px) and (max-width: 1216px) { width: 50%; }
|
|
||||||
|
|
||||||
@media screen and (min-width: 1217px) { width: 33.333333%; }
|
|
||||||
|
|
||||||
p.field-main-content {
|
|
||||||
font-size: 14px;
|
|
||||||
color: $tainacan-input-color;
|
|
||||||
}
|
|
||||||
&>div {
|
|
||||||
display: flex;
|
|
||||||
|
|
||||||
.list-image {
|
|
||||||
width: 25%;
|
|
||||||
|
|
||||||
img { width: 100%; }
|
|
||||||
}
|
|
||||||
.list-metadata {
|
|
||||||
width: 75%;
|
|
||||||
padding: 0px 16px;
|
|
||||||
background: white;
|
|
||||||
font-size: 11px;
|
|
||||||
color: $gray-light;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,7 @@
|
||||||
},
|
},
|
||||||
deleteOneCategory(categoryId) {
|
deleteOneCategory(categoryId) {
|
||||||
this.$dialog.confirm({
|
this.$dialog.confirm({
|
||||||
|
title: this.$i18n.get('label_warning'),
|
||||||
message: this.$i18n.get('info_warning_category_delete'),
|
message: this.$i18n.get('info_warning_category_delete'),
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
this.deleteCategory(categoryId)
|
this.deleteCategory(categoryId)
|
||||||
|
@ -205,11 +206,15 @@
|
||||||
// queue: true
|
// queue: true
|
||||||
// });
|
// });
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
icon: 'alert-circle',
|
||||||
|
hasIcon: true,
|
||||||
|
type: 'is-success'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
deleteSelectedCategories() {
|
deleteSelectedCategories() {
|
||||||
this.$dialog.confirm({
|
this.$dialog.confirm({
|
||||||
|
title: this.$i18n.get('label_warning'),
|
||||||
message: this.$i18n.get('info_warning_selected_categories_delete'),
|
message: this.$i18n.get('info_warning_selected_categories_delete'),
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
|
|
||||||
|
@ -237,7 +242,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.allCategoriesOnPageSelected = false;
|
this.allCategoriesOnPageSelected = false;
|
||||||
}
|
},
|
||||||
|
icon: 'alert-circle',
|
||||||
|
hasIcon: true,
|
||||||
|
type: 'is-success'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goToCategoryPage(categoryId) {
|
goToCategoryPage(categoryId) {
|
||||||
|
|
|
@ -169,7 +169,7 @@
|
||||||
@click.prevent.stop="deleteOneCollection(collection.id)">
|
@click.prevent.stop="deleteOneCollection(collection.id)">
|
||||||
<b-icon
|
<b-icon
|
||||||
type="is-secondary"
|
type="is-secondary"
|
||||||
icon="delete"/>
|
:icon="!isOnTrash ? 'delete' : 'delete-forever'"/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
@ -197,7 +197,8 @@ export default {
|
||||||
totalCollections: 0,
|
totalCollections: 0,
|
||||||
page: 1,
|
page: 1,
|
||||||
collectionsPerPage: 12,
|
collectionsPerPage: 12,
|
||||||
collections: Array
|
collections: Array,
|
||||||
|
isOnTrash: false
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
collections() {
|
collections() {
|
||||||
|
@ -229,9 +230,10 @@ export default {
|
||||||
},
|
},
|
||||||
deleteOneCollection(collectionId) {
|
deleteOneCollection(collectionId) {
|
||||||
this.$dialog.confirm({
|
this.$dialog.confirm({
|
||||||
message: this.$i18n.get('info_warning_collection_delete'),
|
title: this.$i18n.get('label_warning'),
|
||||||
|
message: this.isOnTrash ? this.$i18n.get('info_warning_collection_delete') : this.$i18n.get('info_warning_collection_trash'),
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
this.deleteCollection(collectionId)
|
this.deleteCollection({ collectionId: collectionId, isPermanently: this.isOnTrash })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// this.$toast.open({
|
// this.$toast.open({
|
||||||
// duration: 3000,
|
// duration: 3000,
|
||||||
|
@ -241,7 +243,7 @@ export default {
|
||||||
// queue: true
|
// queue: true
|
||||||
// });
|
// });
|
||||||
for (let i = 0; i < this.selectedCollections.length; i++) {
|
for (let i = 0; i < this.selectedCollections.length; i++) {
|
||||||
if (this.selectedCollections[i].id == this.collectionId)
|
if (this.selectedCollections[i].id == collectionId)
|
||||||
this.selectedCollections.splice(i, 1);
|
this.selectedCollections.splice(i, 1);
|
||||||
}
|
}
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
@ -253,17 +255,21 @@ export default {
|
||||||
// queue: true
|
// queue: true
|
||||||
// })
|
// })
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
icon: 'alert-circle',
|
||||||
|
hasIcon: true,
|
||||||
|
type: 'is-success'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
deleteSelectedCollections() {
|
deleteSelectedCollections() {
|
||||||
this.$dialog.confirm({
|
this.$dialog.confirm({
|
||||||
message: this.$i18n.get('info_warning_selected_collections_delete'),
|
title: this.$i18n.get('label_warning'),
|
||||||
|
message: this.isOnTrash ? this.$i18n.get('info_warning_selected_collections_delete') : this.$i18n.get('info_warning_selected_collections_trash'),
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
|
|
||||||
for (let i = 0; i < this.collections.length; i++) {
|
for (let i = 0; i < this.collections.length; i++) {
|
||||||
if (this.selectedCollections[i]) {
|
if (this.selectedCollections[i]) {
|
||||||
this.deleteCollection(this.collections[i].id)
|
this.deleteCollection({ collectionId: this.collections[i].id, isPermanently: this.isOnTrash })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// this.loadCollections();
|
// this.loadCollections();
|
||||||
// this.$toast.open({
|
// this.$toast.open({
|
||||||
|
@ -285,7 +291,10 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.allCollectionsOnPageSelected = false;
|
this.allCollectionsOnPageSelected = false;
|
||||||
}
|
},
|
||||||
|
icon: 'alert-circle',
|
||||||
|
hasIcon: true,
|
||||||
|
type: 'is-success'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goToCollectionPage(collectionId) {
|
goToCollectionPage(collectionId) {
|
||||||
|
|
|
@ -195,15 +195,18 @@ export default {
|
||||||
}
|
}
|
||||||
if ((this.openedFieldId != '' && this.openedFieldId != undefined) || hasUnsavedForms ) {
|
if ((this.openedFieldId != '' && this.openedFieldId != undefined) || hasUnsavedForms ) {
|
||||||
this.$dialog.confirm({
|
this.$dialog.confirm({
|
||||||
|
title: this.$i18n.get('label_warning'),
|
||||||
message: this.$i18n.get('info_warning_fields_not_saved'),
|
message: this.$i18n.get('info_warning_fields_not_saved'),
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
this.onEditionCanceled();
|
this.onEditionCanceled();
|
||||||
next();
|
next();
|
||||||
},
|
},
|
||||||
cancelText: this.$i18n.get('cancel'),
|
icon: 'alert-circle',
|
||||||
confirmText: this.$i18n.get('continue'),
|
hasIcon: true,
|
||||||
type: 'is-secondary'
|
cancelText: this.$i18n.get('cancel'),
|
||||||
});
|
confirmText: this.$i18n.get('continue'),
|
||||||
|
type: 'is-success'
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,14 +69,14 @@
|
||||||
v-model="filter.enabled"
|
v-model="filter.enabled"
|
||||||
@input="onChangeEnable($event, index)"/>
|
@input="onChangeEnable($event, index)"/>
|
||||||
<a
|
<a
|
||||||
:style="{ visibility: filter.collection_id != collectionId ? 'hidden' : 'visible' }"
|
:style="{ visibility: filter.collection_id != collectionId && !isRepositoryLevel? 'hidden' : 'visible' }"
|
||||||
@click.prevent="editFilter(filter)">
|
@click.prevent="editFilter(filter)">
|
||||||
<b-icon
|
<b-icon
|
||||||
type="is-gray"
|
type="is-gray"
|
||||||
icon="pencil"/>
|
icon="pencil"/>
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
:style="{ visibility: filter.collection_id != collectionId ? 'hidden' : 'visible' }"
|
:style="{ visibility: filter.collection_id != collectionId && !isRepositoryLevel ? 'hidden' : 'visible' }"
|
||||||
@click.prevent="removeFilter(filter)">
|
@click.prevent="removeFilter(filter)">
|
||||||
<b-icon
|
<b-icon
|
||||||
type="is-gray"
|
type="is-gray"
|
||||||
|
@ -222,15 +222,18 @@ export default {
|
||||||
}
|
}
|
||||||
if ((this.openedFilterId != '' && this.openedFilterId != undefined) || hasUnsavedForms ) {
|
if ((this.openedFilterId != '' && this.openedFilterId != undefined) || hasUnsavedForms ) {
|
||||||
this.$dialog.confirm({
|
this.$dialog.confirm({
|
||||||
|
title: this.$i18n.get('label_warning'),
|
||||||
message: this.$i18n.get('info_warning_filters_not_saved'),
|
message: this.$i18n.get('info_warning_filters_not_saved'),
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
this.onEditionCanceled();
|
this.onEditionCanceled();
|
||||||
next();
|
next();
|
||||||
},
|
},
|
||||||
cancelText: this.$i18n.get('cancel'),
|
icon: 'alert-circle',
|
||||||
confirmText: this.$i18n.get('continue'),
|
hasIcon: true,
|
||||||
type: 'is-secondary'
|
cancelText: this.$i18n.get('cancel'),
|
||||||
});
|
confirmText: this.$i18n.get('continue'),
|
||||||
|
type: 'is-success'
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
|
|
||||||
<div
|
<div class="selection-control">
|
||||||
v-if="!isOnTheme"
|
|
||||||
class="selection-control">
|
|
||||||
<div class="field select-all is-pulled-left">
|
<div class="field select-all is-pulled-left">
|
||||||
<span>
|
<span>
|
||||||
<b-checkbox
|
<b-checkbox
|
||||||
|
@ -37,13 +35,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="table-wrapper">
|
<div class="table-wrapper">
|
||||||
<table
|
<table class="tainacan-table">
|
||||||
:class="{'selectable-table': !isOnTheme }"
|
|
||||||
class="tainacan-table">
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<!-- Checking list -->
|
<!-- Checking list -->
|
||||||
<th v-if="!isOnTheme">
|
<th>
|
||||||
|
|
||||||
<!-- nothing to show on header for checkboxes -->
|
<!-- nothing to show on header for checkboxes -->
|
||||||
</th>
|
</th>
|
||||||
|
@ -62,9 +58,7 @@
|
||||||
:custom-key="column.slug">
|
:custom-key="column.slug">
|
||||||
<div class="th-wrap">{{ column.name }}</div>
|
<div class="th-wrap">{{ column.name }}</div>
|
||||||
</th>
|
</th>
|
||||||
<th
|
<th class="actions-header">
|
||||||
class="actions-header"
|
|
||||||
v-if="!isOnTheme">
|
|
||||||
|
|
||||||
<!-- nothing to show on header for actions cell-->
|
<!-- nothing to show on header for actions cell-->
|
||||||
</th>
|
</th>
|
||||||
|
@ -77,7 +71,6 @@
|
||||||
v-for="(item, index) of items">
|
v-for="(item, index) of items">
|
||||||
<!-- Checking list -->
|
<!-- Checking list -->
|
||||||
<td
|
<td
|
||||||
v-if="!isOnTheme"
|
|
||||||
:class="{ 'is-selecting': isSelectingItems }"
|
:class="{ 'is-selecting': isSelectingItems }"
|
||||||
class="checkbox-cell">
|
class="checkbox-cell">
|
||||||
<b-checkbox
|
<b-checkbox
|
||||||
|
@ -108,10 +101,10 @@
|
||||||
v-if="column.field !== 'row_thumbnail' &&
|
v-if="column.field !== 'row_thumbnail' &&
|
||||||
column.field !== 'row_actions' &&
|
column.field !== 'row_actions' &&
|
||||||
column.field !== 'row_creation'"
|
column.field !== 'row_creation'"
|
||||||
:data="renderMetadata( item.metadata[column.slug] )"/> -->
|
:data="renderMetadata(item.metadata, column)"/> -->
|
||||||
<p
|
<p
|
||||||
v-tooltip="{
|
v-tooltip="{
|
||||||
content: renderMetadata( item.metadata[column.slug] ),
|
content: renderMetadata(item.metadata, column),
|
||||||
html: true,
|
html: true,
|
||||||
autoHide: false,
|
autoHide: false,
|
||||||
placement: 'auto-start'
|
placement: 'auto-start'
|
||||||
|
@ -121,7 +114,7 @@
|
||||||
column.field !== 'row_actions' &&
|
column.field !== 'row_actions' &&
|
||||||
column.field !== 'row_creation' &&
|
column.field !== 'row_creation' &&
|
||||||
column.field !== 'row_author'"
|
column.field !== 'row_author'"
|
||||||
v-html="renderMetadata( item.metadata[column.slug] )"/>
|
v-html="renderMetadata(item.metadata, column)"/>
|
||||||
|
|
||||||
<span v-if="column.field == 'row_thumbnail'">
|
<span v-if="column.field == 'row_thumbnail'">
|
||||||
<img
|
<img
|
||||||
|
@ -143,7 +136,7 @@
|
||||||
|
|
||||||
<!-- Actions -->
|
<!-- Actions -->
|
||||||
<td
|
<td
|
||||||
v-if="!isOnTheme && item.current_user_can_edit"
|
v-if="item.current_user_can_edit"
|
||||||
class="actions-cell"
|
class="actions-cell"
|
||||||
:label="$i18n.get('label_actions')">
|
:label="$i18n.get('label_actions')">
|
||||||
<div class="actions-container">
|
<div class="actions-container">
|
||||||
|
@ -161,7 +154,7 @@
|
||||||
@click.prevent.stop="deleteOneItem(item.id)">
|
@click.prevent.stop="deleteOneItem(item.id)">
|
||||||
<b-icon
|
<b-icon
|
||||||
type="is-secondary"
|
type="is-secondary"
|
||||||
icon="delete"/>
|
:icon="!isOnTrash ? 'delete' : 'delete-forever'"/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
@ -189,7 +182,7 @@ export default {
|
||||||
tableFields: Array,
|
tableFields: Array,
|
||||||
items: Array,
|
items: Array,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isOnTheme: false
|
isOnTrash: false
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.selectedItems = [];
|
this.selectedItems = [];
|
||||||
|
@ -221,9 +214,10 @@ export default {
|
||||||
},
|
},
|
||||||
deleteOneItem(itemId) {
|
deleteOneItem(itemId) {
|
||||||
this.$dialog.confirm({
|
this.$dialog.confirm({
|
||||||
message: this.$i18n.get('info_warning_item_delete'),
|
title: this.$i18n.get('label_warning'),
|
||||||
|
message: this.isOnTrash ? this.$i18n.get('info_warning_item_delete') : this.$i18n.get('info_warning_item_trash'),
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
this.deleteItem(itemId)
|
this.deleteItem({ itemId: itemId, isPermanently: this.isOnTrash })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// this.$toast.open({
|
// this.$toast.open({
|
||||||
// duration: 3000,
|
// duration: 3000,
|
||||||
|
@ -233,7 +227,7 @@ export default {
|
||||||
// queue: true
|
// queue: true
|
||||||
// });
|
// });
|
||||||
for (let i = 0; i < this.selectedItems.length; i++) {
|
for (let i = 0; i < this.selectedItems.length; i++) {
|
||||||
if (this.selectedItems[i].id == this.itemId)
|
if (this.selectedItems[i].id == itemId)
|
||||||
this.selectedItems.splice(i, 1);
|
this.selectedItems.splice(i, 1);
|
||||||
}
|
}
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
@ -246,17 +240,21 @@ export default {
|
||||||
// queue: true
|
// queue: true
|
||||||
// })
|
// })
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
icon: 'alert-circle',
|
||||||
|
hasIcon: true,
|
||||||
|
type: 'is-success'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
deleteSelectedItems() {
|
deleteSelectedItems() {
|
||||||
this.$dialog.confirm({
|
this.$dialog.confirm({
|
||||||
message: this.$i18n.get('info_warning_selected_items_delete'),
|
title: this.$i18n.get('label_warning'),
|
||||||
|
message: this.isOnTrash ? this.$i18n.get('info_warning_selected_items_delete') : this.$i18n.get('info_warning_selected_items_trash'),
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
|
|
||||||
for (let i = 0; i < this.selectedItems.length; i++) {
|
for (let i = 0; i < this.selectedItems.length; i++) {
|
||||||
if (this.selectedItems[i]) {
|
if (this.selectedItems[i]) {
|
||||||
this.deleteItem(this.items[i].id)
|
this.deleteItem({ itemId: this.items[i].id, isPermanently: this.isOnTrash })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// this.$toast.open({
|
// this.$toast.open({
|
||||||
// duration: 3000,
|
// duration: 3000,
|
||||||
|
@ -282,19 +280,21 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.allItemsOnPageSelected = false;
|
this.allItemsOnPageSelected = false;
|
||||||
}
|
},
|
||||||
|
icon: 'alert-circle',
|
||||||
|
hasIcon: true,
|
||||||
|
type: 'is-success'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goToItemPage(item) {
|
goToItemPage(item) {
|
||||||
if (this.isOnTheme)
|
this.$router.push(this.$routerHelper.getItemPath(this.collectionId, item.id));
|
||||||
window.location.href = item.url;
|
|
||||||
else
|
|
||||||
this.$router.push(this.$routerHelper.getItemPath(this.collectionId, item.id));
|
|
||||||
},
|
},
|
||||||
goToItemEditPage(itemId) {
|
goToItemEditPage(itemId) {
|
||||||
this.$router.push(this.$routerHelper.getItemEditPath(this.collectionId, itemId));
|
this.$router.push(this.$routerHelper.getItemEditPath(this.collectionId, itemId));
|
||||||
},
|
},
|
||||||
renderMetadata(metadata) {
|
renderMetadata(itemMetadata, column) {
|
||||||
|
|
||||||
|
let metadata = itemMetadata[column.slug] != undefined ? itemMetadata[column.slug] : false;
|
||||||
|
|
||||||
if (!metadata) {
|
if (!metadata) {
|
||||||
return '';
|
return '';
|
||||||
|
|
|
@ -213,13 +213,16 @@ export default {
|
||||||
// Checks if user is deleting a term with unsaved info.
|
// Checks if user is deleting a term with unsaved info.
|
||||||
if (term.id == 'new' || !term.saved || term.opened) {
|
if (term.id == 'new' || !term.saved || term.opened) {
|
||||||
this.$dialog.confirm({
|
this.$dialog.confirm({
|
||||||
|
title: this.$i18n.get('label_warning'),
|
||||||
message: this.$i18n.get('info_warning_terms_not_saved'),
|
message: this.$i18n.get('info_warning_terms_not_saved'),
|
||||||
onCancel: () => { return },
|
onCancel: () => { return },
|
||||||
onConfirm: () => { this.removeTerm(term);},
|
onConfirm: () => { this.removeTerm(term); },
|
||||||
cancelText: this.$i18n.get('cancel'),
|
icon: 'alert-circle',
|
||||||
confirmText: this.$i18n.get('continue'),
|
hasIcon: true,
|
||||||
type: 'is-secondary'
|
cancelText: this.$i18n.get('cancel'),
|
||||||
});
|
confirmText: this.$i18n.get('continue'),
|
||||||
|
type: 'is-success'
|
||||||
|
});
|
||||||
} else{
|
} else{
|
||||||
this.removeTerm(term);
|
this.removeTerm(term);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,67 +8,87 @@
|
||||||
<aside class="menu">
|
<aside class="menu">
|
||||||
|
|
||||||
<ul class="menu-list">
|
<ul class="menu-list">
|
||||||
<li><router-link
|
<li>
|
||||||
tag="a"
|
<router-link
|
||||||
to="/collections"
|
tag="a"
|
||||||
:class="activeRoute == 'CollectionsPage' || $route.params.collectionId != undefined ? 'is-active':''">
|
to="/collections"
|
||||||
<b-icon
|
:class="activeRoute == 'CollectionsPage' || $route.params.collectionId != undefined ? 'is-active':''">
|
||||||
size="is-small"
|
<b-icon
|
||||||
icon="folder-multiple"/> <span class="menu-text">{{ $i18n.getFrom('collections', 'name') }}</span>
|
size="is-small"
|
||||||
</router-link></li>
|
icon="folder-multiple"/>
|
||||||
<!-- <li><router-link
|
<span class="menu-text">{{ $i18n.getFrom('collections', 'name') }}</span>
|
||||||
tag="a"
|
</router-link>
|
||||||
to="/items"
|
</li>
|
||||||
:class="activeRoute == 'ItemsPage' ? 'is-active':''">
|
<li>
|
||||||
<b-icon
|
<router-link
|
||||||
size="is-small"
|
tag="a"
|
||||||
icon="file-multiple"/> <span class="menu-text">{{ $i18n.getFrom('items', 'name') }}</span>
|
to="/items"
|
||||||
</router-link></li> -->
|
:class="activeRoute == 'ItemsPage' ? 'is-active':''">
|
||||||
|
<b-icon
|
||||||
|
size="is-small"
|
||||||
|
icon="file-multiple"/>
|
||||||
|
<span class="menu-text">{{ $i18n.getFrom('items', 'name') }}</span>
|
||||||
|
</router-link>
|
||||||
|
</li>
|
||||||
<li class="separator"/>
|
<li class="separator"/>
|
||||||
<li><router-link
|
<li>
|
||||||
tag="a"
|
<router-link
|
||||||
to="/fields"
|
tag="a"
|
||||||
:class="activeRoute == 'FieldsPage' ? 'is-active':''">
|
to="/fields"
|
||||||
<b-icon
|
:class="activeRoute == 'FieldsPage' ? 'is-active':''">
|
||||||
size="is-small"
|
<b-icon
|
||||||
icon="format-list-bulleted-type"/> <span class="menu-text">{{ $i18n.getFrom('fields', 'name') }}</span>
|
size="is-small"
|
||||||
</router-link></li>
|
icon="format-list-bulleted-type"/>
|
||||||
<li><router-link
|
<span class="menu-text">{{ $i18n.getFrom('fields', 'name') }}</span>
|
||||||
tag="a"
|
</router-link>
|
||||||
to="/filters"
|
</li>
|
||||||
:class="activeRoute == 'FiltersPage' ? 'is-active':''">
|
<li>
|
||||||
<b-icon
|
<router-link
|
||||||
size="is-small"
|
tag="a"
|
||||||
icon="filter"/> <span class="menu-text">{{ $i18n.getFrom('filters', 'name') }}</span>
|
to="/filters"
|
||||||
</router-link></li>
|
:class="activeRoute == 'FiltersPage' ? 'is-active':''">
|
||||||
<li><router-link
|
<b-icon
|
||||||
tag="a"
|
size="is-small"
|
||||||
to="/taxonomies"
|
icon="filter"/>
|
||||||
:class="activeRoute == 'CategoriesPage' ? 'is-active':''">
|
<span class="menu-text">{{ $i18n.getFrom('filters', 'name') }}</span>
|
||||||
<b-icon
|
</router-link>
|
||||||
size="is-small"
|
</li>
|
||||||
icon="shape"/> <span class="menu-text">{{ $i18n.getFrom('categories', 'name') }}</span>
|
<li>
|
||||||
</router-link></li>
|
<router-link
|
||||||
<li><router-link
|
tag="a"
|
||||||
tag="a"
|
to="/taxonomies"
|
||||||
to="/events"
|
:class="activeRoute == 'CategoriesPage' ? 'is-active':''">
|
||||||
:class="activeRoute == 'EventsPage' ? 'is-active':''">
|
<b-icon
|
||||||
<b-icon
|
size="is-small"
|
||||||
size="is-small"
|
icon="shape"/>
|
||||||
icon="flash"/> <span class="menu-text">{{ $i18n.get('events') }}</span>
|
<span class="menu-text">{{ $i18n.getFrom('categories', 'name') }}</span>
|
||||||
</router-link></li>
|
</router-link>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<router-link
|
||||||
|
tag="a"
|
||||||
|
to="/events"
|
||||||
|
:class="activeRoute == 'EventsPage' ? 'is-active':''">
|
||||||
|
<activities-icon />
|
||||||
|
<span class="menu-text">{{ $i18n.get('events') }}</span>
|
||||||
|
</router-link>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
</nav>
|
</nav>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import ActivitiesIcon from '../other/activities-icon.vue';
|
||||||
export default {
|
export default {
|
||||||
name: 'PrimaryMenu',
|
name: 'PrimaryMenu',
|
||||||
props: {
|
props: {
|
||||||
isMenuCompressed: false,
|
isMenuCompressed: false,
|
||||||
activeRoute: '/collections'
|
activeRoute: '/collections'
|
||||||
}
|
},
|
||||||
|
components: {
|
||||||
|
ActivitiesIcon
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -84,13 +104,16 @@ export default {
|
||||||
max-width: $side-menu-width;
|
max-width: $side-menu-width;
|
||||||
z-index: 99;
|
z-index: 99;
|
||||||
|
|
||||||
|
.menu {
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
.separator {
|
.separator {
|
||||||
height: 2px;
|
height: 2px;
|
||||||
background-color: $separator-color;
|
background-color: $separator-color;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 24px 0;
|
margin: 24px 0;
|
||||||
}
|
}
|
||||||
li{
|
li {
|
||||||
a {
|
a {
|
||||||
color: white;
|
color: white;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
@ -100,12 +123,21 @@ export default {
|
||||||
border-radius: 0px;
|
border-radius: 0px;
|
||||||
-webkit-transition: padding 0.2s linear; /* Safari */
|
-webkit-transition: padding 0.2s linear; /* Safari */
|
||||||
transition: padding 0.2s linear;
|
transition: padding 0.2s linear;
|
||||||
|
|
||||||
|
.activities-icon {
|
||||||
|
fill: white;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover, a.is-active {
|
a:hover, a.is-active {
|
||||||
background-color: $primary;
|
background-color: $primary;
|
||||||
color: $tertiary;
|
color: $tertiary;
|
||||||
|
|
||||||
|
.activities-icon {
|
||||||
|
fill: $tertiary;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
a:focus{
|
a:focus {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
.menu-text {
|
.menu-text {
|
||||||
|
@ -133,7 +165,7 @@ export default {
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
max-width: 100% !important;
|
max-width: 100% !important;
|
||||||
padding-top: $header-height;
|
padding-top: $header-height;
|
||||||
.menu{
|
.menu {
|
||||||
padding-top: 0px;
|
padding-top: 0px;
|
||||||
}
|
}
|
||||||
ul {
|
ul {
|
||||||
|
@ -141,8 +173,10 @@ export default {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
justify-content: space-evenly;
|
justify-content: space-evenly;
|
||||||
.separator { display: none; }
|
.separator {
|
||||||
a{
|
display: none;
|
||||||
|
}
|
||||||
|
a {
|
||||||
padding: 0.8em !important;
|
padding: 0.8em !important;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
{{ arrayViewPath[index] }}
|
{{ arrayViewPath[index] }}
|
||||||
</router-link>
|
</router-link>
|
||||||
<span v-if="index == arrayRealPath.length - 1">{{ arrayViewPath[index] }}</span>
|
<span v-if="index == arrayRealPath.length - 1">{{ arrayViewPath[index] }}</span>
|
||||||
<span v-if="index != arrayRealPath.length - 1"> > </span>
|
<span v-if="index != arrayRealPath.length - 1 && arrayViewPath[index]"> > </span>
|
||||||
</span>
|
</span>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
@ -83,9 +83,7 @@
|
||||||
:to="{ path: $routerHelper.getCollectionEventsPath(id) }"
|
:to="{ path: $routerHelper.getCollectionEventsPath(id) }"
|
||||||
:class="activeRoute == 'CollectionEventsPage' ? 'is-active':''"
|
:class="activeRoute == 'CollectionEventsPage' ? 'is-active':''"
|
||||||
:aria-label="$i18n.get('label_collection_events')">
|
:aria-label="$i18n.get('label_collection_events')">
|
||||||
<b-icon
|
<activities-icon />
|
||||||
size="is-small"
|
|
||||||
icon="flash"/>
|
|
||||||
<br>
|
<br>
|
||||||
<span class="menu-text">{{ $i18n.get('events') }}</span>
|
<span class="menu-text">{{ $i18n.get('events') }}</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
@ -97,6 +95,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
import { mapActions, mapGetters } from 'vuex';
|
||||||
|
import ActivitiesIcon from '../other/activities-icon.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TainacanSubheader',
|
name: 'TainacanSubheader',
|
||||||
|
@ -109,6 +108,9 @@ export default {
|
||||||
activeRouteName: '',
|
activeRouteName: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
components: {
|
||||||
|
ActivitiesIcon
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
id: Number,
|
id: Number,
|
||||||
},
|
},
|
||||||
|
@ -130,7 +132,8 @@ export default {
|
||||||
'fetchCollectionName'
|
'fetchCollectionName'
|
||||||
]),
|
]),
|
||||||
...mapGetters('collection', [
|
...mapGetters('collection', [
|
||||||
'getCollectionName'
|
'getCollectionName',
|
||||||
|
'getCollection'
|
||||||
]),
|
]),
|
||||||
...mapActions('item', [
|
...mapActions('item', [
|
||||||
'fetchItemTitle'
|
'fetchItemTitle'
|
||||||
|
@ -160,6 +163,7 @@ export default {
|
||||||
this.fetchCollectionName(this.arrayRealPath[i])
|
this.fetchCollectionName(this.arrayRealPath[i])
|
||||||
.then(collectionName => this.arrayViewPath.splice(i, 1, collectionName))
|
.then(collectionName => this.arrayViewPath.splice(i, 1, collectionName))
|
||||||
.catch((error) => this.$console.error(error));
|
.catch((error) => this.$console.error(error));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'items':
|
case 'items':
|
||||||
this.fetchItemTitle(this.arrayRealPath[i])
|
this.fetchItemTitle(this.arrayRealPath[i])
|
||||||
|
@ -179,7 +183,11 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.arrayViewPath.splice(i, 1, this.$i18n.get(this.arrayRealPath[i]));
|
if(this.arrayRealPath[i] == 'undefined'){
|
||||||
|
this.arrayViewPath.splice(i, 1, '');
|
||||||
|
} else {
|
||||||
|
this.arrayViewPath.splice(i, 1, this.$i18n.get(this.arrayRealPath[i]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -262,7 +270,6 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
.level-left {
|
.level-left {
|
||||||
margin-left: 5px;
|
|
||||||
.level-item {
|
.level-item {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
@ -342,9 +349,6 @@ export default {
|
||||||
|
|
||||||
.level-left {
|
.level-left {
|
||||||
margin-left: 0px !important;
|
margin-left: 0px !important;
|
||||||
.level-item {
|
|
||||||
margin-left: 30px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
top: 206px;
|
top: 206px;
|
||||||
margin-bottom: 0px !important;
|
margin-bottom: 0px !important;
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<template>
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
width="20"
|
||||||
|
height="20"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
class="activities-icon"
|
||||||
|
xml:space="preserve">
|
||||||
|
<path
|
||||||
|
d="M20,11c0,1-0.2,2.1-0.5,3h-2.2c0.4-0.9,0.7-1.9,0.7-3c0-3.9-3.1-7-7-7s-7,3.1-7,7c0,3.5,2.6,6.5,6,6.9v2
|
||||||
|
c-4.5-0.5-8-4.3-8-8.9c0-5,4-9,9-9S20,6,20,11z M14,22h-2v-2h2V22z M14,18h-2v-2h2V18z M22,22h-6v-2h6V22z M22,18h-6v-2h6V18z M12,6
|
||||||
|
h-2l0,6l2.7,2H16l-4-3V6z"/>
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'ActivitiesIcon'
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style type="text/scss">
|
||||||
|
|
||||||
|
svg.activities-icon {
|
||||||
|
margin-bottom: -5px;
|
||||||
|
fill:#1E2F56;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
|
@ -31,6 +31,7 @@ export default {
|
||||||
|
|
||||||
.help-wrapper {
|
.help-wrapper {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
margin-top: -2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.help-button .icon {
|
a.help-button .icon {
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
<template>
|
||||||
|
<b-field class="filter-item-forms">
|
||||||
|
<b-collapse
|
||||||
|
class="show"
|
||||||
|
:open="open">
|
||||||
|
<label
|
||||||
|
class="label"
|
||||||
|
slot="trigger"
|
||||||
|
slot-scope="props">
|
||||||
|
<b-icon
|
||||||
|
:icon="props.open ? 'menu-down' : 'menu-right'"
|
||||||
|
/>
|
||||||
|
{{ $i18n.get('collections') }}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="block overflow-at">
|
||||||
|
<div
|
||||||
|
v-for="(collection, key) in collections"
|
||||||
|
:key="key"
|
||||||
|
class="control">
|
||||||
|
<b-checkbox
|
||||||
|
v-model="collectionsIdsToFilter"
|
||||||
|
:native-value="collection.id"
|
||||||
|
@input="apply_filter">
|
||||||
|
{{ collection.name }}
|
||||||
|
</b-checkbox>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</b-collapse>
|
||||||
|
</b-field>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapActions, mapGetters } from 'vuex';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'CollectionFilter',
|
||||||
|
props: {
|
||||||
|
query: Object,
|
||||||
|
open: false,
|
||||||
|
},
|
||||||
|
created(){
|
||||||
|
this.fetchCollections({page: 1, collectionsPerPage: -1, status: null});
|
||||||
|
},
|
||||||
|
mounted(){
|
||||||
|
let routeQueries = this.$route.query;
|
||||||
|
|
||||||
|
if(routeQueries.metaquery &&
|
||||||
|
routeQueries.metaquery[0] &&
|
||||||
|
Array.isArray(routeQueries.metaquery[0].value)){
|
||||||
|
this.collectionsIdsToFilter = routeQueries.metaquery[0].value;
|
||||||
|
|
||||||
|
this.apply_filter();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
inputs: [],
|
||||||
|
collectionsIdsToFilter: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
collections(){
|
||||||
|
return this.getCollections();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions('search', [
|
||||||
|
'setPage'
|
||||||
|
]),
|
||||||
|
...mapActions('collection', [
|
||||||
|
'fetchCollections'
|
||||||
|
]),
|
||||||
|
...mapGetters('collection', [
|
||||||
|
'getCollections',
|
||||||
|
]),
|
||||||
|
apply_filter(){
|
||||||
|
this.$eventBusSearch.$emit( 'input', {
|
||||||
|
filter: 'checkbox',
|
||||||
|
field_id: 'collection_id',
|
||||||
|
value: this.collectionsIdsToFilter,
|
||||||
|
compare: 'IN',
|
||||||
|
collection_id: this.collectionsIdsToFilter,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
.overflow-at {
|
||||||
|
overflow: auto;
|
||||||
|
max-height: 125px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -1,22 +1,29 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<collections-filter
|
||||||
|
:open="collapsed"
|
||||||
|
:query="getQuery"
|
||||||
|
v-if="isRepositoryLevel"/>
|
||||||
<tainacan-filter-item
|
<tainacan-filter-item
|
||||||
v-show="!isMenuCompressed"
|
v-show="!isMenuCompressed"
|
||||||
:query="getQuery"
|
:query="getQuery"
|
||||||
v-for="(filter, index) in filters"
|
v-for="(filter, index) in filters"
|
||||||
:key="index"
|
:key="index"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
:open="collapsed"/>
|
:open="collapsed"
|
||||||
|
:is-repository-level="isRepositoryLevel"/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
|
import CollectionsFilter from '../repository/collection-filter/collection-filter.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
filters: Array,
|
filters: Array,
|
||||||
collapsed: Boolean,
|
collapsed: Boolean,
|
||||||
|
isRepositoryLevel: Boolean,
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapGetters('search',[
|
...mapGetters('search',[
|
||||||
|
@ -27,6 +34,9 @@
|
||||||
getQuery() {
|
getQuery() {
|
||||||
return this.getPostQuery();
|
return this.getPostQuery();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
CollectionsFilter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
|
@ -1,286 +0,0 @@
|
||||||
<template>
|
|
||||||
<span>
|
|
||||||
<div class="sub-header">
|
|
||||||
<div
|
|
||||||
class="header-item"
|
|
||||||
v-if="!isOnTheme">
|
|
||||||
<b-dropdown
|
|
||||||
:mobile-modal="false"
|
|
||||||
id="item-creation-options-dropdown">
|
|
||||||
<button
|
|
||||||
class="button is-secondary"
|
|
||||||
slot="trigger">
|
|
||||||
<span>{{ $i18n.getFrom('items','add_new') }}</span>
|
|
||||||
<b-icon icon="menu-down"/>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<b-dropdown-item>
|
|
||||||
<router-link
|
|
||||||
id="a-create-item"
|
|
||||||
tag="div"
|
|
||||||
:to="{ path: $routerHelper.getNewItemPath(collectionId) }">
|
|
||||||
{{ $i18n.get('add_one_item') }}
|
|
||||||
</router-link>
|
|
||||||
</b-dropdown-item>
|
|
||||||
<b-dropdown-item disabled>
|
|
||||||
{{ $i18n.get('add_items_bulk') + ' (Not ready)' }}
|
|
||||||
</b-dropdown-item>
|
|
||||||
<b-dropdown-item disabled>
|
|
||||||
{{ $i18n.get('add_items_external_source') + ' (Not ready)' }}
|
|
||||||
</b-dropdown-item>
|
|
||||||
</b-dropdown>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="header-item">
|
|
||||||
<b-dropdown
|
|
||||||
ref="displayedFieldsDropdown"
|
|
||||||
:mobile-modal="false"
|
|
||||||
:disabled="!hasResults"
|
|
||||||
class="show">
|
|
||||||
<button
|
|
||||||
class="button is-white"
|
|
||||||
slot="trigger">
|
|
||||||
<span>{{ $i18n.get('label_table_fields') }}</span>
|
|
||||||
<b-icon icon="menu-down"/>
|
|
||||||
</button>
|
|
||||||
<div class="metadata-options-container">
|
|
||||||
<b-dropdown-item
|
|
||||||
v-for="(column, index) in localTableFields"
|
|
||||||
:key="index"
|
|
||||||
class="control"
|
|
||||||
custom>
|
|
||||||
<b-checkbox
|
|
||||||
v-model="column.display"
|
|
||||||
:native-value="column.display">
|
|
||||||
{{ column.name }}
|
|
||||||
</b-checkbox>
|
|
||||||
</b-dropdown-item>
|
|
||||||
</div>
|
|
||||||
<div class="dropdown-item-apply">
|
|
||||||
<button
|
|
||||||
@click="onChangeDisplayedFields()"
|
|
||||||
class="button is-success">
|
|
||||||
{{ $i18n.get('label_apply_changes') }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</b-dropdown>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
v-if="isOnTheme"
|
|
||||||
class="header-item">
|
|
||||||
<b-field>
|
|
||||||
<b-dropdown
|
|
||||||
@change="$emit('onChangeViewMode', $event)"
|
|
||||||
:value="viewMode">
|
|
||||||
<button
|
|
||||||
class="button is-white"
|
|
||||||
slot="trigger">
|
|
||||||
<span>View (tests)</span>
|
|
||||||
<b-icon icon="menu-down" />
|
|
||||||
</button>
|
|
||||||
<b-dropdown-item :value="'table'">
|
|
||||||
<b-icon icon="table"/>
|
|
||||||
Table
|
|
||||||
</b-dropdown-item>
|
|
||||||
<b-dropdown-item :value="'cards'">
|
|
||||||
<b-icon icon="view-grid"/>
|
|
||||||
Cards
|
|
||||||
</b-dropdown-item>
|
|
||||||
<b-dropdown-item :value="'list'">
|
|
||||||
<b-icon icon="view-list"/>
|
|
||||||
List
|
|
||||||
</b-dropdown-item>
|
|
||||||
</b-dropdown>
|
|
||||||
</b-field>
|
|
||||||
</div>
|
|
||||||
<div class="header-item">
|
|
||||||
<b-field>
|
|
||||||
<b-select
|
|
||||||
:disabled="!hasResults"
|
|
||||||
@input="onChangeOrderBy($event)"
|
|
||||||
:placeholder="$i18n.get('label_sorting')">
|
|
||||||
<option
|
|
||||||
v-for="field in tableFields"
|
|
||||||
v-if="
|
|
||||||
field.id === 'creation_date' ||
|
|
||||||
field.id === 'author_name' || (
|
|
||||||
field.id !== undefined &&
|
|
||||||
field.field_type_object.related_mapped_prop !== 'description' &&
|
|
||||||
field.field_type_object.primitive_type !== 'term' &&
|
|
||||||
field.field_type_object.primitive_type !== 'item' &&
|
|
||||||
field.field_type_object.primitive_type !== 'compound'
|
|
||||||
)"
|
|
||||||
:value="field"
|
|
||||||
:key="field.id">
|
|
||||||
{{ field.name }}
|
|
||||||
</option>
|
|
||||||
</b-select>
|
|
||||||
<button
|
|
||||||
:disabled="!hasResults"
|
|
||||||
class="button is-white is-small"
|
|
||||||
@click="onChangeOrder()">
|
|
||||||
<b-icon :icon="order === 'ASC' ? 'sort-ascending' : 'sort-descending'"/>
|
|
||||||
</button>
|
|
||||||
</b-field>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
v-if="!isOnTheme"
|
|
||||||
class="tabs">
|
|
||||||
<ul>
|
|
||||||
<li
|
|
||||||
@click="onChangeTab('')"
|
|
||||||
:class="{ 'is-active': status == undefined || status == ''}"><a>{{ $i18n.get('label_all_items') }}</a></li>
|
|
||||||
<li
|
|
||||||
@click="onChangeTab('draft')"
|
|
||||||
:class="{ 'is-active': status == 'draft'}"><a>{{ $i18n.get('label_draft_items') }}</a></li>
|
|
||||||
<li
|
|
||||||
@click="onChangeTab('trash')"
|
|
||||||
:class="{ 'is-active': status == 'trash'}"><a>{{ $i18n.get('label_trash_items') }}</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import {mapGetters} from 'vuex';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'SearchControl',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
prefTableFields: [],
|
|
||||||
localTableFields: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
collectionId: Number,
|
|
||||||
tableFields: Array,
|
|
||||||
isOnTheme: false,
|
|
||||||
status: '',
|
|
||||||
hasResults: false ,
|
|
||||||
viewMode: 'table'
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
tableFields() {
|
|
||||||
this.localTableFields = JSON.parse(JSON.stringify(this.tableFields));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
orderBy() {
|
|
||||||
return this.getOrderBy();
|
|
||||||
},
|
|
||||||
order() {
|
|
||||||
return this.getOrder();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.localTableFields = JSON.parse(JSON.stringify(this.tableFields));
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
...mapGetters('search', [
|
|
||||||
'getOrderBy',
|
|
||||||
'getOrder',
|
|
||||||
'getStatus'
|
|
||||||
]),
|
|
||||||
onChangeOrderBy(field) {
|
|
||||||
this.$eventBusSearch.setOrderBy(field);
|
|
||||||
},
|
|
||||||
onChangeOrder() {
|
|
||||||
this.order == 'DESC' ? this.$eventBusSearch.setOrder('ASC') : this.$eventBusSearch.setOrder('DESC');
|
|
||||||
},
|
|
||||||
onChangeTab(status) {
|
|
||||||
this.$eventBusSearch.setStatus(status);
|
|
||||||
},
|
|
||||||
onChangeDisplayedFields() {
|
|
||||||
let fetchOnlyFieldIds = [];
|
|
||||||
|
|
||||||
for (let i = 0; i < this.localTableFields.length; i++) {
|
|
||||||
|
|
||||||
this.tableFields[i].display = this.localTableFields[i].display;
|
|
||||||
if (this.tableFields[i].id != undefined) {
|
|
||||||
if (this.tableFields[i].display) {
|
|
||||||
fetchOnlyFieldIds.push(this.tableFields[i].id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.$eventBusSearch.addFetchOnly({
|
|
||||||
'0': 'thumbnail',
|
|
||||||
'meta': fetchOnlyFieldIds,
|
|
||||||
'1': 'creation_date',
|
|
||||||
'2': 'author_name'
|
|
||||||
});
|
|
||||||
this.$refs.displayedFieldsDropdown.toggle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
|
|
||||||
@import '../../scss/_variables.scss';
|
|
||||||
|
|
||||||
.sub-header {
|
|
||||||
min-height: $subheader-height;
|
|
||||||
height: $subheader-height;
|
|
||||||
padding-top: $page-small-top-padding;
|
|
||||||
padding-left: $page-side-padding;
|
|
||||||
padding-right: $page-side-padding;
|
|
||||||
border-bottom: 0.5px solid #ddd;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
@media screen and (max-width: 769px) {
|
|
||||||
height: 60px;
|
|
||||||
margin-top: 0;
|
|
||||||
|
|
||||||
.header-item {
|
|
||||||
padding-right: 0.5em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-item {
|
|
||||||
display: inline-block;
|
|
||||||
|
|
||||||
.field {
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
#item-creation-options-dropdown {
|
|
||||||
margin-right: 80px;
|
|
||||||
}
|
|
||||||
.dropdown-menu {
|
|
||||||
display: block;
|
|
||||||
|
|
||||||
div.dropdown-content {
|
|
||||||
padding: 0;
|
|
||||||
|
|
||||||
.metadata-options-container {
|
|
||||||
max-height: 240px;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-item-apply {
|
|
||||||
width: 100%;
|
|
||||||
border-top: 1px solid #efefef;
|
|
||||||
padding: 8px 12px;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
.dropdown-item-apply .button {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.tabs {
|
|
||||||
padding-top: 20px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
padding-left: $page-side-padding;
|
|
||||||
padding-right: $page-side-padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ import draggable from 'vuedraggable'
|
||||||
import store from '../../js/store/store'
|
import store from '../../js/store/store'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
import eventBusSearch from '../../js/event-bus-search';
|
import eventBusSearch from '../../js/event-bus-search';
|
||||||
import { I18NPlugin, UserPrefsPlugin, RouterHelperPlugin, ConsolePlugin } from './utilities';
|
import { I18NPlugin, UserPrefsPlugin, RouterHelperPlugin, ConsolePlugin, UserCapabilitiesPlugin } from './utilities';
|
||||||
import VueMask from 'v-mask';
|
import VueMask from 'v-mask';
|
||||||
|
|
||||||
// Configure and Register Plugins
|
// Configure and Register Plugins
|
||||||
|
@ -50,6 +50,7 @@ Vue.use(VTooltip)
|
||||||
Vue.use(I18NPlugin);
|
Vue.use(I18NPlugin);
|
||||||
Vue.use(UserPrefsPlugin);
|
Vue.use(UserPrefsPlugin);
|
||||||
Vue.use(RouterHelperPlugin);
|
Vue.use(RouterHelperPlugin);
|
||||||
|
Vue.use(UserCapabilitiesPlugin);
|
||||||
Vue.use(ConsolePlugin, {visual: false});
|
Vue.use(ConsolePlugin, {visual: false});
|
||||||
Vue.use(VueMask);
|
Vue.use(VueMask);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ Vue.use(VueRouter);
|
||||||
|
|
||||||
const i18nGet = function (key) {
|
const i18nGet = function (key) {
|
||||||
let string = tainacan_plugin.i18n[key];
|
let string = tainacan_plugin.i18n[key];
|
||||||
return (string != undefined && string != null && string != '' ) ? string : "ERROR: Invalid i18n key!";
|
return (string !== undefined && string !== null && string !== '' ) ? string : "ERROR: Invalid i18n key!";
|
||||||
};
|
};
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
|
@ -50,8 +50,8 @@ const routes = [
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
// { path: '/items', name: 'ItemsPage', component: ItemsPage, meta: {title: i18nGet('title_items_page'), icon: 'file-multiple'} },
|
{ path: '/items', name: 'ItemsPage', component: ItemsPage, meta: {title: i18nGet('title_items_page'), icon: 'file-multiple'} },
|
||||||
// { path: '/items/new', name: 'ItemCreationForm', component: ItemEditionForm, meta: {title: i18nGet('title_create_item'), icon: 'file-multiple'} },
|
{ path: '/items/new', name: 'ItemCreationForm', component: ItemEditionForm, meta: {title: i18nGet('title_create_item'), icon: 'file-multiple'} },
|
||||||
|
|
||||||
{ path: '/filters', name: 'FiltersPage', component: FiltersPage, meta: {title: i18nGet('title_repository_filters_page'), icon: 'filter'} },
|
{ path: '/filters', name: 'FiltersPage', component: FiltersPage, meta: {title: i18nGet('title_repository_filters_page'), icon: 'filter'} },
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ import FilterCategorySelectbox from '../../classes/filter-types/category/Selectb
|
||||||
import TaincanFormItem from '../../classes/field-types/tainacan-form-item.vue';
|
import TaincanFormItem from '../../classes/field-types/tainacan-form-item.vue';
|
||||||
import TaincanFiltersList from '../../classes/filter-types/tainacan-filter-item.vue';
|
import TaincanFiltersList from '../../classes/filter-types/tainacan-filter-item.vue';
|
||||||
import ItemsPage from '../pages/lists/items-page.vue';
|
import ItemsPage from '../pages/lists/items-page.vue';
|
||||||
|
import TableViewMode from '../../theme-helper/table-view-mode.vue';
|
||||||
|
|
||||||
// Remaining imports
|
// Remaining imports
|
||||||
import HelpButton from '../components/other/help-button.vue';
|
import HelpButton from '../components/other/help-button.vue';
|
||||||
|
@ -76,6 +77,8 @@ Vue.component('help-button', HelpButton);
|
||||||
Vue.component('draggable', draggable);
|
Vue.component('draggable', draggable);
|
||||||
Vue.component('items-page', ItemsPage);
|
Vue.component('items-page', ItemsPage);
|
||||||
|
|
||||||
|
Vue.component('table-view-mode', TableViewMode);
|
||||||
|
|
||||||
Vue.use(eventBusSearch, { store: store, router: routerTheme});
|
Vue.use(eventBusSearch, { store: store, router: routerTheme});
|
||||||
|
|
||||||
import ThemeItemsList from '../theme-items-list.vue';
|
import ThemeItemsList from '../theme-items-list.vue';
|
||||||
|
@ -85,12 +88,20 @@ new Vue({
|
||||||
store,
|
store,
|
||||||
router: routerTheme,
|
router: routerTheme,
|
||||||
data: {
|
data: {
|
||||||
collectionId: ''
|
collectionId: '',
|
||||||
|
defaultViewMode: '',
|
||||||
|
enabledViewModes: {}
|
||||||
},
|
},
|
||||||
render: h => h(ThemeItemsList),
|
render: h => h(ThemeItemsList),
|
||||||
beforeMount () {
|
beforeMount () {
|
||||||
|
|
||||||
if (this.$el.attributes['collection-id'] != undefined)
|
if (this.$el.attributes['collection-id'] != undefined)
|
||||||
this.collectionId = this.$el.attributes['collection-id'].value;
|
this.collectionId = this.$el.attributes['collection-id'].value;
|
||||||
|
if (this.$el.attributes['default-view-mode'] != undefined)
|
||||||
|
this.defaultViewMode = this.$el.attributes['default-view-mode'].value;
|
||||||
|
if (this.$el.attributes['enabled-view-modes'] != undefined)
|
||||||
|
this.enabledViewModes = this.$el.attributes['enabled-view-modes'].value.split(',');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
|
@ -255,7 +255,19 @@ RouterHelperPlugin.install = function (Vue, options = {}) {
|
||||||
getEventEditPath(id) {
|
getEventEditPath(id) {
|
||||||
return '/events/' + id + '/edit';
|
return '/events/' + id + '/edit';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// USER CAPABILITIES PLUGIN - Allows easy checking of user capabilities.
|
||||||
|
export const UserCapabilitiesPlugin = {};
|
||||||
|
UserCapabilitiesPlugin.install = function (Vue, options = {}) {
|
||||||
|
|
||||||
|
Vue.prototype.$userCaps = {
|
||||||
|
hasCapability(key) {
|
||||||
|
for (let i = 0; i < tainacan_plugin.user_caps.length; i++)
|
||||||
|
if (tainacan_plugin.user_caps[i] == key)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
<tainacan-title />
|
<tainacan-title />
|
||||||
<div
|
<div
|
||||||
class="sub-header"
|
class="sub-header"
|
||||||
v-if="checkIfUserCanEdit()">
|
v-if="$userCaps.hasCapability('edit_tainacan-taxonomies')">
|
||||||
<div class="header-item">
|
<div class="header-item">
|
||||||
<router-link
|
<router-link
|
||||||
id="button-create-category"
|
id="button-create-category"
|
||||||
|
@ -135,13 +135,6 @@
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.loadCategories();
|
this.loadCategories();
|
||||||
},
|
},
|
||||||
checkIfUserCanEdit() {
|
|
||||||
for (let capability of tainacan_plugin.user_caps) {
|
|
||||||
if (capability == 'edit_tainacan-taxonomies')
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
onChangeCategoriesPerPage(value) {
|
onChangeCategoriesPerPage(value) {
|
||||||
let prevValue = this.categoriesPerPage;
|
let prevValue = this.categoriesPerPage;
|
||||||
this.categoriesPerPage = value;
|
this.categoriesPerPage = value;
|
||||||
|
@ -205,7 +198,7 @@
|
||||||
padding-top: $page-small-top-padding;
|
padding-top: $page-small-top-padding;
|
||||||
padding-left: $page-side-padding;
|
padding-left: $page-side-padding;
|
||||||
padding-right: $page-side-padding;
|
padding-right: $page-side-padding;
|
||||||
border-bottom: 0.5px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
|
|
||||||
.header-item {
|
.header-item {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<tainacan-title />
|
<tainacan-title />
|
||||||
<div
|
<div
|
||||||
class="sub-header"
|
class="sub-header"
|
||||||
v-if="checkIfUserCanEdit()">
|
v-if="$userCaps.hasCapability('edit_tainacan-collections')">
|
||||||
<div class="header-item">
|
<div class="header-item">
|
||||||
<b-dropdown id="collection-creation-options-dropdown">
|
<b-dropdown id="collection-creation-options-dropdown">
|
||||||
<button
|
<button
|
||||||
|
@ -50,7 +50,8 @@
|
||||||
:total-collections="totalCollections"
|
:total-collections="totalCollections"
|
||||||
:page="page"
|
:page="page"
|
||||||
:collections-per-page="collectionsPerPage"
|
:collections-per-page="collectionsPerPage"
|
||||||
:collections="collections"/>
|
:collections="collections"
|
||||||
|
:is-on-trash="status == 'trash'"/>
|
||||||
|
|
||||||
<!-- Empty state image -->
|
<!-- Empty state image -->
|
||||||
<div v-if="totalCollections <= 0 && !isLoading">
|
<div v-if="totalCollections <= 0 && !isLoading">
|
||||||
|
@ -148,13 +149,6 @@ export default {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.loadCollections();
|
this.loadCollections();
|
||||||
},
|
},
|
||||||
checkIfUserCanEdit() {
|
|
||||||
for (let capability of tainacan_plugin.user_caps) {
|
|
||||||
if (capability == 'edit_tainacan-collections')
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
onChangeCollectionsPerPage(value) {
|
onChangeCollectionsPerPage(value) {
|
||||||
let prevValue = this.collectionsPerPage;
|
let prevValue = this.collectionsPerPage;
|
||||||
this.collectionsPerPage = value;
|
this.collectionsPerPage = value;
|
||||||
|
@ -215,7 +209,7 @@ export default {
|
||||||
padding-top: $page-small-top-padding;
|
padding-top: $page-small-top-padding;
|
||||||
padding-left: $page-side-padding;
|
padding-left: $page-side-padding;
|
||||||
padding-right: $page-side-padding;
|
padding-right: $page-side-padding;
|
||||||
border-bottom: 0.5px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
|
|
||||||
.header-item {
|
.header-item {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
|
@ -167,7 +167,7 @@
|
||||||
padding-top: $page-small-top-padding;
|
padding-top: $page-small-top-padding;
|
||||||
padding-left: $page-small-side-padding;
|
padding-left: $page-small-side-padding;
|
||||||
padding-right: $page-small-side-padding;
|
padding-right: $page-small-side-padding;
|
||||||
border-bottom: 0.5px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
|
|
||||||
.header-item {
|
.header-item {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
|
@ -3,24 +3,28 @@
|
||||||
:class="{'primary-page': isRepositoryLevel}">
|
:class="{'primary-page': isRepositoryLevel}">
|
||||||
|
|
||||||
<!-- SEARCH AND FILTERS --------------------- -->
|
<!-- SEARCH AND FILTERS --------------------- -->
|
||||||
|
<!-- Filter menu compress button -->
|
||||||
<button
|
<button
|
||||||
id="filter-menu-compress-button"
|
id="filter-menu-compress-button"
|
||||||
|
:class="{'filter-menu-compress-button-top-repo': isRepositoryLevel}"
|
||||||
:style="{ top: isHeaderShrinked ? '125px' : '152px'}"
|
:style="{ top: isHeaderShrinked ? '125px' : '152px'}"
|
||||||
@click="isFiltersMenuCompressed = !isFiltersMenuCompressed">
|
@click="isFiltersMenuCompressed = !isFiltersMenuCompressed">
|
||||||
<b-icon :icon="isFiltersMenuCompressed ? 'menu-right' : 'menu-left'" />
|
<b-icon :icon="isFiltersMenuCompressed ? 'menu-right' : 'menu-left'" />
|
||||||
</button>
|
</button>
|
||||||
|
<!-- Side bar with search and filters -->
|
||||||
<aside
|
<aside
|
||||||
v-show="!isFiltersMenuCompressed"
|
v-show="!isFiltersMenuCompressed"
|
||||||
class="filters-menu">
|
class="filters-menu"
|
||||||
|
:class="{ 'tainacan-form': isOnTheme }">
|
||||||
<b-loading
|
<b-loading
|
||||||
:is-full-page="false"
|
:is-full-page="false"
|
||||||
:active.sync="isLoadingFilters"/>
|
:active.sync="isLoadingFilters"/>
|
||||||
|
|
||||||
<b-field class="margin-1">
|
<b-field>
|
||||||
<div class="control is-small is-clearfix">
|
<div class="control is-small is-clearfix">
|
||||||
<input
|
<input
|
||||||
class="input is-small"
|
class="input is-small"
|
||||||
:placeholder=" $i18n.get('instruction_search_collection') "
|
:placeholder="$i18n.get('instruction_search')"
|
||||||
type="search"
|
type="search"
|
||||||
autocomplete="on"
|
autocomplete="on"
|
||||||
:value="searchQuery"
|
:value="searchQuery"
|
||||||
|
@ -42,12 +46,11 @@
|
||||||
</b-field>
|
</b-field>
|
||||||
<!-- <a class="is-size-7 is-secondary is-pulled-right">Busca avançada</a> -->
|
<!-- <a class="is-size-7 is-secondary is-pulled-right">Busca avançada</a> -->
|
||||||
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<h3 class="has-text-weight-semibold">{{ $i18n.get('filters') }}</h3>
|
<h3 class="has-text-weight-semibold">{{ $i18n.get('filters') }}</h3>
|
||||||
<a
|
<a
|
||||||
v-if="!isLoadingFilters && filters.length > 0"
|
v-if="!isLoadingFilters &&
|
||||||
|
((filters.length >= 0 &&
|
||||||
|
isRepositoryLevel) || filters.length > 0)"
|
||||||
class="collapse-all is-size-7"
|
class="collapse-all is-size-7"
|
||||||
@click="collapseAll = !collapseAll">
|
@click="collapseAll = !collapseAll">
|
||||||
{{ collapseAll ? $i18n.get('label_collapse_all') : $i18n.get('label_expand_all') }}
|
{{ collapseAll ? $i18n.get('label_collapse_all') : $i18n.get('label_expand_all') }}
|
||||||
|
@ -61,9 +64,12 @@
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<filters-items-list
|
<filters-items-list
|
||||||
v-if="!isLoadingFilters && filters.length > 0"
|
v-if="!isLoadingFilters &&
|
||||||
|
((filters.length >= 0 &&
|
||||||
|
isRepositoryLevel) || filters.length > 0)"
|
||||||
:filters="filters"
|
:filters="filters"
|
||||||
:collapsed="collapseAll"/>
|
:collapsed="collapseAll"
|
||||||
|
:is-repository-level="isRepositoryLevel"/>
|
||||||
|
|
||||||
<section
|
<section
|
||||||
v-else
|
v-else
|
||||||
|
@ -71,11 +77,12 @@
|
||||||
<div class="content has-text-gray has-text-centered">
|
<div class="content has-text-gray has-text-centered">
|
||||||
<p>
|
<p>
|
||||||
<b-icon
|
<b-icon
|
||||||
icon="filter-outline"
|
icon="filter"
|
||||||
size="is-large"/>
|
size="is-large"/>
|
||||||
</p>
|
</p>
|
||||||
<p>{{ $i18n.get('info_there_is_no_filter' ) }}</p>
|
<p>{{ $i18n.get('info_there_is_no_filter' ) }}</p>
|
||||||
<router-link
|
<router-link
|
||||||
|
v-if="!isOnTheme"
|
||||||
id="button-create-filter"
|
id="button-create-filter"
|
||||||
:to="isRepositoryLevel ? $routerHelper.getNewFilterPath() : $routerHelper.getNewCollectionFilterPath(collectionId)"
|
:to="isRepositoryLevel ? $routerHelper.getNewFilterPath() : $routerHelper.getNewCollectionFilterPath(collectionId)"
|
||||||
tag="button"
|
tag="button"
|
||||||
|
@ -86,54 +93,211 @@
|
||||||
</section>
|
</section>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
|
<!-- ITEMS LIST AREA (ASIDE THE ASIDE) ------------------------- -->
|
||||||
<div
|
<div
|
||||||
id="items-list-area"
|
id="items-list-area"
|
||||||
class="items-list-area"
|
class="items-list-area"
|
||||||
:class="{ 'spaced-to-right': !isFiltersMenuCompressed }">
|
:class="{ 'spaced-to-right': !isFiltersMenuCompressed }">
|
||||||
<!-- SEARCH CONTROL ------------------------- -->
|
|
||||||
<b-loading
|
<b-loading
|
||||||
:is-full-page="false"
|
:is-full-page="false"
|
||||||
:active.sync="isLoadingFields"/>
|
:active.sync="isLoadingItems"/>
|
||||||
<search-control
|
|
||||||
:collection-id="collectionId"
|
|
||||||
:table-fields="tableFields"
|
|
||||||
:pref-table-fields="prefTableFields"
|
|
||||||
:is-on-theme="isOnTheme"
|
|
||||||
:status="status"
|
|
||||||
:has-results="items.length > 0"
|
|
||||||
:view-mode="viewMode"
|
|
||||||
@onChangeViewMode="viewMode = $event"/>
|
|
||||||
|
|
||||||
<!-- <div
|
<!-- SEARCH CONTROL ------------------------- -->
|
||||||
:items="items"
|
<div class="search-control">
|
||||||
id="theme-items-list" /> -->
|
|
||||||
<!-- LISTING RESULTS ------------------------- -->
|
|
||||||
<div class="above-subheader">
|
|
||||||
<b-loading
|
<b-loading
|
||||||
:is-full-page="false"
|
:is-full-page="false"
|
||||||
:active.sync="isLoadingItems"/>
|
:active.sync="isLoadingFields"/>
|
||||||
|
<!-- Item Creation Dropdown, only on Admin -->
|
||||||
|
<div
|
||||||
|
class="search-control-item"
|
||||||
|
v-if="!isOnTheme">
|
||||||
|
<b-dropdown
|
||||||
|
:mobile-modal="false"
|
||||||
|
id="item-creation-options-dropdown">
|
||||||
|
<button
|
||||||
|
class="button is-secondary"
|
||||||
|
slot="trigger">
|
||||||
|
<span>{{ $i18n.getFrom('items','add_new') }}</span>
|
||||||
|
<b-icon icon="menu-down"/>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<b-dropdown-item>
|
||||||
|
<router-link
|
||||||
|
id="a-create-item"
|
||||||
|
tag="div"
|
||||||
|
:to="{ path: $routerHelper.getNewItemPath(collectionId) }">
|
||||||
|
{{ $i18n.get('add_one_item') }}
|
||||||
|
</router-link>
|
||||||
|
</b-dropdown-item>
|
||||||
|
<b-dropdown-item disabled>
|
||||||
|
{{ $i18n.get('add_items_bulk') + ' (Not ready)' }}
|
||||||
|
</b-dropdown-item>
|
||||||
|
<b-dropdown-item disabled>
|
||||||
|
{{ $i18n.get('add_items_external_source') + ' (Not ready)' }}
|
||||||
|
</b-dropdown-item>
|
||||||
|
</b-dropdown>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- Displayed Fields Dropdown -->
|
||||||
|
<div
|
||||||
|
v-if="!isOnTheme || registeredViewModes[viewMode].dynamic_metadata"
|
||||||
|
class="search-control-item">
|
||||||
|
<b-dropdown
|
||||||
|
ref="displayedFieldsDropdown"
|
||||||
|
:mobile-modal="false"
|
||||||
|
:disabled="totalItems <= 0"
|
||||||
|
class="show">
|
||||||
|
<button
|
||||||
|
class="button is-white"
|
||||||
|
slot="trigger">
|
||||||
|
<span>{{ $i18n.get('label_table_fields') }}</span>
|
||||||
|
<b-icon icon="menu-down"/>
|
||||||
|
</button>
|
||||||
|
<div class="metadata-options-container">
|
||||||
|
<b-dropdown-item
|
||||||
|
v-for="(column, index) in localTableFields"
|
||||||
|
:key="index"
|
||||||
|
class="control"
|
||||||
|
custom>
|
||||||
|
<b-checkbox
|
||||||
|
v-model="column.display"
|
||||||
|
:native-value="column.display">
|
||||||
|
{{ column.name }}
|
||||||
|
</b-checkbox>
|
||||||
|
</b-dropdown-item>
|
||||||
|
</div>
|
||||||
|
<div class="dropdown-item-apply">
|
||||||
|
<button
|
||||||
|
@click="onChangeDisplayedFields()"
|
||||||
|
class="button is-success">
|
||||||
|
{{ $i18n.get('label_apply_changes') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</b-dropdown>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Change OrderBy Select and Order Button-->
|
||||||
|
<div class="search-control-item">
|
||||||
|
<b-field>
|
||||||
|
<b-select
|
||||||
|
:disabled="totalItems <= 0"
|
||||||
|
@input="onChangeOrderBy($event)"
|
||||||
|
:placeholder="$i18n.get('label_sorting')">
|
||||||
|
<option
|
||||||
|
v-for="field in tableFields"
|
||||||
|
v-if="
|
||||||
|
field.id === 'creation_date' ||
|
||||||
|
field.id === 'author_name' || (
|
||||||
|
field.id !== undefined &&
|
||||||
|
field.field_type_object.related_mapped_prop !== 'description' &&
|
||||||
|
field.field_type_object.primitive_type !== 'term' &&
|
||||||
|
field.field_type_object.primitive_type !== 'item' &&
|
||||||
|
field.field_type_object.primitive_type !== 'compound'
|
||||||
|
)"
|
||||||
|
:value="field"
|
||||||
|
:key="field.id">
|
||||||
|
{{ field.name }}
|
||||||
|
</option>
|
||||||
|
</b-select>
|
||||||
|
<button
|
||||||
|
:disabled="totalItems <= 0"
|
||||||
|
class="button is-white is-small"
|
||||||
|
@click="onChangeOrder()">
|
||||||
|
<b-icon :icon="order === 'ASC' ? 'sort-ascending' : 'sort-descending'"/>
|
||||||
|
</button>
|
||||||
|
</b-field>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- View Modes Dropdown -->
|
||||||
|
<div
|
||||||
|
v-if="isOnTheme"
|
||||||
|
class="search-control-item">
|
||||||
|
<b-field>
|
||||||
|
<b-dropdown
|
||||||
|
@change="onChangeViewMode($event)"
|
||||||
|
:mobile-modal="false"
|
||||||
|
position="is-bottom-left"
|
||||||
|
:aria-label="$i18n.get('label_view_mode')">
|
||||||
|
<button
|
||||||
|
class="button is-white"
|
||||||
|
slot="trigger">
|
||||||
|
<span
|
||||||
|
v-if="registeredViewModes[viewMode] != undefined"
|
||||||
|
v-html="registeredViewModes[viewMode].icon"/>
|
||||||
|
<b-icon icon="menu-down" />
|
||||||
|
</button>
|
||||||
|
<b-dropdown-item
|
||||||
|
v-for="(viewModeOption, index) of enabledViewModes"
|
||||||
|
:key="index"
|
||||||
|
:value="viewModeOption"
|
||||||
|
v-if="registeredViewModes[viewModeOption] != undefined">
|
||||||
|
<span v-html="registeredViewModes[viewModeOption].icon"/>
|
||||||
|
{{ registeredViewModes[viewModeOption].label }}
|
||||||
|
</b-dropdown-item>
|
||||||
|
</b-dropdown>
|
||||||
|
</b-field>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ADVANCED SEARCH
|
||||||
|
<advanced-search /> -->
|
||||||
|
|
||||||
|
<!-- --------------- -->
|
||||||
|
|
||||||
|
<!-- STATUS TABS, only on Admin -------- -->
|
||||||
|
<div
|
||||||
|
v-if="!isOnTheme"
|
||||||
|
class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li
|
||||||
|
@click="onChangeTab('')"
|
||||||
|
:class="{ 'is-active': status == undefined || status == ''}"><a>{{ $i18n.get('label_all_items') }}</a></li>
|
||||||
|
<li
|
||||||
|
@click="onChangeTab('draft')"
|
||||||
|
:class="{ 'is-active': status == 'draft'}"><a>{{ $i18n.get('label_draft_items') }}</a></li>
|
||||||
|
<li
|
||||||
|
@click="onChangeTab('trash')"
|
||||||
|
:class="{ 'is-active': status == 'trash'}"><a>{{ $i18n.get('label_trash_items') }}</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ITEMS LISTING RESULTS ------------------------- -->
|
||||||
|
<div class="above-search-control">
|
||||||
|
|
||||||
|
<!-- Admin Table -->
|
||||||
<items-list
|
<items-list
|
||||||
v-if="viewMode == 'table' && !isLoadingItems && items.length > 0"
|
v-if="!isOnTheme &&
|
||||||
|
!isLoadingItems &&
|
||||||
|
totalItems > 0"
|
||||||
:collection-id="collectionId"
|
:collection-id="collectionId"
|
||||||
:table-fields="tableFields"
|
:table-fields="tableFields"
|
||||||
:items="items"
|
:items="items"
|
||||||
:is-loading="isLoading"
|
:is-loading="isLoadingItems"
|
||||||
:is-on-theme="isOnTheme"/>
|
:is-on-trash="status == 'trash'"/>
|
||||||
|
|
||||||
<tainacan-cards-list
|
<!-- Theme View Modes -->
|
||||||
v-if="viewMode == 'cards' && !isLoadingItems && items.length > 0"
|
<div
|
||||||
|
v-if="isOnTheme &&
|
||||||
|
!isLoadingItems &&
|
||||||
|
registeredViewModes[viewMode] != undefined &&
|
||||||
|
registeredViewModes[viewMode].type == 'template'"
|
||||||
|
v-html="itemsListTemplate"/>
|
||||||
|
<component
|
||||||
|
v-if="isOnTheme &&
|
||||||
|
!isLoadingItems &&
|
||||||
|
registeredViewModes[viewMode] != undefined &&
|
||||||
|
registeredViewModes[viewMode].type == 'component'"
|
||||||
|
:collection-id="collectionId"
|
||||||
:table-fields="tableFields"
|
:table-fields="tableFields"
|
||||||
:items="items"
|
:items="items"
|
||||||
:is-loading="isLoading"/>
|
:is-loading="isLoadingItems"
|
||||||
|
:is="'table-view-mode'"/>
|
||||||
<tainacan-list-list
|
|
||||||
v-if="viewMode == 'list' && !isLoadingItems && items.length > 0"
|
|
||||||
:table-fields="tableFields"
|
|
||||||
:items="items"
|
|
||||||
:is-loading="isLoading"/>
|
|
||||||
|
|
||||||
|
<!-- Empty Placeholder (only used in Admin) -->
|
||||||
<section
|
<section
|
||||||
v-if="!isLoadingItems && items.length <= 0"
|
v-if="!isOnTheme && !isLoadingItems && totalItems <= 0"
|
||||||
class="section">
|
class="section">
|
||||||
<div class="content has-text-grey has-text-centered">
|
<div class="content has-text-grey has-text-centered">
|
||||||
<p>
|
<p>
|
||||||
|
@ -155,8 +319,9 @@
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<!-- Pagination Footer -->
|
|
||||||
<pagination v-if="items.length > 0"/>
|
<!-- Pagination -->
|
||||||
|
<pagination v-if="totalItems > 0 && (!isOnTheme || registeredViewModes[viewMode].show_pagination)"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -164,14 +329,11 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import SearchControl from '../../components/search/search-control.vue'
|
|
||||||
import ItemsList from '../../components/lists/items-list.vue';
|
import ItemsList from '../../components/lists/items-list.vue';
|
||||||
import FiltersItemsList from '../../components/search/filters-items-list.vue';
|
import FiltersItemsList from '../../components/search/filters-items-list.vue';
|
||||||
import Pagination from '../../components/search/pagination.vue'
|
import Pagination from '../../components/search/pagination.vue'
|
||||||
import {mapActions, mapGetters} from 'vuex';
|
// import AdvancedSearch from '../../components/advanced-search/advanced-search.vue';
|
||||||
|
import { mapActions, mapGetters } from 'vuex';
|
||||||
import TainacanCardsList from '../../components/item-view-modes/tainacan-cards-list.vue';
|
|
||||||
import TainacanListList from '../../components/item-view-modes/tainacan-list-list.vue';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ItemsPage',
|
name: 'ItemsPage',
|
||||||
|
@ -189,23 +351,62 @@
|
||||||
isOnTheme: false,
|
isOnTheme: false,
|
||||||
futureSearchQuery: '',
|
futureSearchQuery: '',
|
||||||
isHeaderShrinked: false,
|
isHeaderShrinked: false,
|
||||||
viewMode: 'table'
|
localTableFields: [],
|
||||||
|
registeredViewModes: tainacan_plugin.registered_view_modes
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
collectionId: Number
|
collectionId: Number,
|
||||||
|
defaultViewMode: String, // Used only on theme
|
||||||
|
enabledViewModes: Object // Used only on theme
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
items() {
|
||||||
|
return this.getItems();
|
||||||
|
},
|
||||||
|
itemsListTemplate() {
|
||||||
|
return this.getItemsListTemplate();
|
||||||
|
},
|
||||||
|
totalItems() {
|
||||||
|
return this.getTotalItems();
|
||||||
|
},
|
||||||
|
filters() {
|
||||||
|
return this.getFilters();
|
||||||
|
},
|
||||||
|
fields() {
|
||||||
|
return this.getFields();
|
||||||
|
},
|
||||||
|
searchQuery() {
|
||||||
|
return this.getSearchQuery();
|
||||||
|
},
|
||||||
|
status() {
|
||||||
|
return this.getStatus();
|
||||||
|
},
|
||||||
|
viewMode() {
|
||||||
|
return this.getViewMode();
|
||||||
|
},
|
||||||
|
orderBy() {
|
||||||
|
return this.getOrderBy();
|
||||||
|
},
|
||||||
|
order() {
|
||||||
|
return this.getOrder();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
SearchControl,
|
|
||||||
ItemsList,
|
ItemsList,
|
||||||
FiltersItemsList,
|
FiltersItemsList,
|
||||||
Pagination,
|
Pagination,
|
||||||
TainacanCardsList,
|
// AdvancedSearch,
|
||||||
TainacanListList
|
},
|
||||||
|
watch: {
|
||||||
|
tableFields() {
|
||||||
|
this.localTableFields = JSON.parse(JSON.stringify(this.tableFields));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapGetters('collection', [
|
...mapGetters('collection', [
|
||||||
'getItems'
|
'getItems',
|
||||||
|
'getItemsListTemplate'
|
||||||
]),
|
]),
|
||||||
...mapActions('fields', [
|
...mapActions('fields', [
|
||||||
'fetchFields'
|
'fetchFields'
|
||||||
|
@ -221,11 +422,47 @@
|
||||||
]),
|
]),
|
||||||
...mapGetters('search', [
|
...mapGetters('search', [
|
||||||
'getSearchQuery',
|
'getSearchQuery',
|
||||||
'getStatus'
|
'getStatus',
|
||||||
|
'getOrderBy',
|
||||||
|
'getOrder',
|
||||||
|
'getViewMode',
|
||||||
|
'getTotalItems'
|
||||||
]),
|
]),
|
||||||
updateSearch() {
|
updateSearch() {
|
||||||
this.$eventBusSearch.setSearchQuery(this.futureSearchQuery);
|
this.$eventBusSearch.setSearchQuery(this.futureSearchQuery);
|
||||||
},
|
},
|
||||||
|
onChangeOrderBy(field) {
|
||||||
|
this.$eventBusSearch.setOrderBy(field);
|
||||||
|
},
|
||||||
|
onChangeOrder() {
|
||||||
|
this.order == 'DESC' ? this.$eventBusSearch.setOrder('ASC') : this.$eventBusSearch.setOrder('DESC');
|
||||||
|
},
|
||||||
|
onChangeTab(status) {
|
||||||
|
this.$eventBusSearch.setStatus(status);
|
||||||
|
},
|
||||||
|
onChangeViewMode(viewMode) {
|
||||||
|
this.$eventBusSearch.setViewMode(viewMode);
|
||||||
|
},
|
||||||
|
onChangeDisplayedFields() {
|
||||||
|
let fetchOnlyFieldIds = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < this.localTableFields.length; i++) {
|
||||||
|
|
||||||
|
this.tableFields[i].display = this.localTableFields[i].display;
|
||||||
|
if (this.tableFields[i].id != undefined) {
|
||||||
|
if (this.tableFields[i].display) {
|
||||||
|
fetchOnlyFieldIds.push(this.tableFields[i].id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$eventBusSearch.addFetchOnly({
|
||||||
|
'0': 'thumbnail',
|
||||||
|
'meta': fetchOnlyFieldIds,
|
||||||
|
'1': 'creation_date',
|
||||||
|
'2': 'author_name'
|
||||||
|
});
|
||||||
|
this.$refs.displayedFieldsDropdown.toggle();
|
||||||
|
},
|
||||||
prepareFieldsAndFilters() {
|
prepareFieldsAndFilters() {
|
||||||
|
|
||||||
this.isLoadingFilters = true;
|
this.isLoadingFilters = true;
|
||||||
|
@ -233,7 +470,7 @@
|
||||||
this.fetchFilters({
|
this.fetchFilters({
|
||||||
collectionId: this.collectionId,
|
collectionId: this.collectionId,
|
||||||
isRepositoryLevel: this.isRepositoryLevel,
|
isRepositoryLevel: this.isRepositoryLevel,
|
||||||
isContextEdit: true,
|
isContextEdit: !this.isOnTheme,
|
||||||
includeDisabled: 'no',
|
includeDisabled: 'no',
|
||||||
})
|
})
|
||||||
.then(() => this.isLoadingFilters = false)
|
.then(() => this.isLoadingFilters = false)
|
||||||
|
@ -245,7 +482,7 @@
|
||||||
this.fetchFields({
|
this.fetchFields({
|
||||||
collectionId: this.collectionId,
|
collectionId: this.collectionId,
|
||||||
isRepositoryLevel: this.isRepositoryLevel,
|
isRepositoryLevel: this.isRepositoryLevel,
|
||||||
isContextEdit: false
|
isContextEdit: !this.isOnTheme
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
||||||
|
@ -256,19 +493,19 @@
|
||||||
slug: 'thumbnail',
|
slug: 'thumbnail',
|
||||||
id: undefined,
|
id: undefined,
|
||||||
display: true
|
display: true
|
||||||
})
|
});
|
||||||
;
|
|
||||||
let fetchOnlyFieldIds = [];
|
let fetchOnlyFieldIds = [];
|
||||||
|
|
||||||
for (let field of this.fields) {
|
for (let field of this.fields) {
|
||||||
if (field.display !== 'never') {
|
if (field.display !== 'never') {
|
||||||
// Will be pushed on array
|
|
||||||
|
|
||||||
let display = true;
|
let display;
|
||||||
|
|
||||||
if (field.display === 'no') {
|
if (field.display == 'no')
|
||||||
display = false;
|
display = false;
|
||||||
}
|
else if (field.display == 'yes')
|
||||||
|
display = true;
|
||||||
|
|
||||||
this.tableFields.push(
|
this.tableFields.push(
|
||||||
{
|
{
|
||||||
|
@ -281,7 +518,8 @@
|
||||||
display: display
|
display: display
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
fetchOnlyFieldIds.push(field.id);
|
if (display)
|
||||||
|
fetchOnlyFieldIds.push(field.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,37 +562,11 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
items() {
|
|
||||||
return this.getItems();
|
|
||||||
},
|
|
||||||
filters() {
|
|
||||||
return this.getFilters();
|
|
||||||
},
|
|
||||||
fields() {
|
|
||||||
return this.getFields();
|
|
||||||
},
|
|
||||||
searchQuery() {
|
|
||||||
return this.getSearchQuery();
|
|
||||||
},
|
|
||||||
status() {
|
|
||||||
return this.getStatus();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
created() {
|
||||||
/*
|
|
||||||
document.addEventListener('tainacan-items-change', () => {
|
|
||||||
var themeList = document.getElementById('theme-items-list');
|
|
||||||
var items = themeList.attributes.items.value;
|
|
||||||
|
|
||||||
var e = document.createElement('p');
|
this.isOnTheme = (this.$route.name === null);
|
||||||
e.innerHTML = items;
|
|
||||||
|
|
||||||
themeList.appendChild(e);
|
this.isRepositoryLevel = (this.collectionId === undefined);
|
||||||
}); */
|
|
||||||
|
|
||||||
this.isOnTheme = (this.$route.name == null);
|
|
||||||
this.isRepositoryLevel = (this.collectionId == undefined);
|
|
||||||
|
|
||||||
this.$eventBusSearch.setCollectionId(this.collectionId);
|
this.$eventBusSearch.setCollectionId(this.collectionId);
|
||||||
|
|
||||||
|
@ -366,17 +578,24 @@
|
||||||
this.hasFiltered = hasFiltered;
|
this.hasFiltered = hasFiltered;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$eventBusSearch.$on('hasToPrepareFieldsAndFilters', () => {
|
this.$eventBusSearch.$on('hasToPrepareFieldsAndFilters', (to) => {
|
||||||
this.prepareFieldsAndFilters();
|
/* This condition is to prevent a incorrect fetch by filter or fields when we come from items
|
||||||
|
* at collection level to items page at repository level
|
||||||
|
*/
|
||||||
|
if(this.collectionId === to.params.collectionId) {
|
||||||
|
this.prepareFieldsAndFilters();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.$eventBusSearch.setViewMode(this.defaultViewMode);
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
//this.$eventBusSearch.updateStoreFromURL();
|
|
||||||
//this.$eventBusSearch.loadItems();
|
|
||||||
|
|
||||||
this.prepareFieldsAndFilters();
|
this.prepareFieldsAndFilters();
|
||||||
|
this.localTableFields = JSON.parse(JSON.stringify(this.tableFields));
|
||||||
|
|
||||||
|
// Watch Scroll for shrinking header, only on Admin at collection level
|
||||||
if (!this.isRepositoryLevel && !this.isOnTheme) {
|
if (!this.isRepositoryLevel && !this.isOnTheme) {
|
||||||
document.getElementById('items-list-area').addEventListener('scroll', ($event) => {
|
document.getElementById('items-list-area').addEventListener('scroll', ($event) => {
|
||||||
this.isHeaderShrinked = ($event.originalTarget.scrollTop > 53);
|
this.isHeaderShrinked = ($event.originalTarget.scrollTop > 53);
|
||||||
|
@ -391,39 +610,10 @@
|
||||||
|
|
||||||
@import '../../scss/_variables.scss';
|
@import '../../scss/_variables.scss';
|
||||||
|
|
||||||
.margin-1 {
|
|
||||||
margin-bottom: 0.1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-container {
|
.page-container {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.above-subheader {
|
|
||||||
margin-bottom: 0;
|
|
||||||
margin-top: 0;
|
|
||||||
height: calc(100% - 184px);
|
|
||||||
}
|
|
||||||
.pagination-area {
|
|
||||||
margin-left: $page-side-padding;
|
|
||||||
margin-right: $page-side-padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table-container {
|
|
||||||
padding-left: 8.333333%;
|
|
||||||
padding-right: 8.333333%;
|
|
||||||
//height: calc(100% - 82px);
|
|
||||||
}
|
|
||||||
|
|
||||||
#collection-search-button {
|
|
||||||
border-radius: 0px !important;
|
|
||||||
padding: 0px 8px !important;
|
|
||||||
border-color: $tainacan-input-background;
|
|
||||||
&:focus, &:active {
|
|
||||||
border-color: none !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.filters-menu {
|
.filters-menu {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: $filter-menu-width;
|
width: $filter-menu-width;
|
||||||
|
@ -434,12 +624,24 @@
|
||||||
padding: $page-small-side-padding;
|
padding: $page-small-side-padding;
|
||||||
float: left;
|
float: left;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
display: block;
|
display: block;
|
||||||
transition: visibility ease 0.5s, display ease 0.5s;
|
transition: visibility ease 0.5s, display ease 0.5s;
|
||||||
|
margin-bottom: -0.1rem;
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
|
margin-top: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#collection-search-button {
|
||||||
|
border-radius: 0 !important;
|
||||||
|
padding: 0 8px !important;
|
||||||
|
border-color: $tainacan-input-background;
|
||||||
|
&:focus, &:active {
|
||||||
|
border-color: none !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
|
@ -448,29 +650,21 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
.filter-menu-compress-button-top-repo {
|
||||||
.items-list-area {
|
top: 123px !important;
|
||||||
margin-left: 0;
|
|
||||||
transition: margin-left ease 0.5s;
|
|
||||||
height: 100%;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
}
|
||||||
.spaced-to-right {
|
|
||||||
margin-left: $filter-menu-width;
|
|
||||||
}
|
|
||||||
|
|
||||||
#filter-menu-compress-button {
|
#filter-menu-compress-button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 9;
|
z-index: 9;
|
||||||
top: 152px;
|
top: 152px;
|
||||||
left: 0px;
|
left: 0;
|
||||||
max-width: 23px;
|
max-width: 23px;
|
||||||
height: 21px;
|
height: 21px;
|
||||||
width: 23px;
|
width: 23px;
|
||||||
border: none;
|
border: none;
|
||||||
background-color: $primary-lighter;
|
background-color: $primary-lighter;
|
||||||
color: $tertiary;
|
color: $tertiary;
|
||||||
padding: 0px;
|
padding: 0;
|
||||||
border-top-right-radius: 2px;
|
border-top-right-radius: 2px;
|
||||||
border-bottom-right-radius: 2px;
|
border-bottom-right-radius: 2px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@ -481,6 +675,90 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.spaced-to-right {
|
||||||
|
margin-left: $filter-menu-width;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-control {
|
||||||
|
min-height: $subheader-height;
|
||||||
|
height: auto;
|
||||||
|
padding-top: $page-small-top-padding;
|
||||||
|
padding-left: $page-side-padding;
|
||||||
|
padding-right: $page-side-padding;
|
||||||
|
border-bottom: 0.5px solid #ddd;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-control-item {
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
.field {
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#item-creation-options-dropdown {
|
||||||
|
margin-right: 80px;
|
||||||
|
}
|
||||||
|
.dropdown-menu {
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
div.dropdown-content {
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
.metadata-options-container {
|
||||||
|
max-height: 240px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-item-apply {
|
||||||
|
width: 100%;
|
||||||
|
border-top: 1px solid #efefef;
|
||||||
|
padding: 8px 12px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.dropdown-item-apply .button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.above-search-control {
|
||||||
|
margin-bottom: 0;
|
||||||
|
margin-top: 0;
|
||||||
|
height: calc(100% - 184px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabs {
|
||||||
|
padding-top: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding-left: $page-side-padding;
|
||||||
|
padding-right: $page-side-padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
.items-list-area {
|
||||||
|
margin-left: 0;
|
||||||
|
transition: margin-left ease 0.5s;
|
||||||
|
height: 100%;
|
||||||
|
overflow: auto;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-container {
|
||||||
|
padding-left: 8.333333%;
|
||||||
|
padding-right: 8.333333%;
|
||||||
|
min-height: 200px;
|
||||||
|
//height: calc(100% - 82px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-area {
|
||||||
|
margin-left: $page-side-padding;
|
||||||
|
margin-right: $page-side-padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
height: inherit !important;
|
height: inherit !important;
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
display: inline-flex !important;
|
display: inline-flex !important;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: white;
|
||||||
|
|
||||||
&.is-secondary:hover, &.is-secondary:focus {
|
&.is-secondary:hover, &.is-secondary:focus {
|
||||||
background: $secondary !important;
|
background: $secondary !important;
|
||||||
|
|
|
@ -14,16 +14,18 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.dropdown-menu {
|
.dropdown-menu {
|
||||||
|
padding: 0;
|
||||||
|
border-radius: 0px;
|
||||||
.dropdown-content {
|
.dropdown-content {
|
||||||
|
padding: 0;
|
||||||
border-radius: 0px !important;
|
border-radius: 0px !important;
|
||||||
.dropdown-item {
|
.dropdown-item {
|
||||||
|
padding: 0.375rem 1rem;
|
||||||
|
label { margin-bottom: 0; }
|
||||||
|
&.control { font-size: 13px !important; }
|
||||||
.b-checkbox { width: 100% };
|
.b-checkbox { width: 100% };
|
||||||
&:hover {
|
&:hover { background-color: $primary-lighter; }
|
||||||
background-color: $primary-lighter;
|
.is-small { color: gray; }
|
||||||
}
|
|
||||||
.is-small {
|
|
||||||
color: gray;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
// Tainacan modals
|
// Tainacan modals
|
||||||
.tainacan-modal-title {
|
.tainacan-modal-title {
|
||||||
h1, h2 {
|
h1, h2 {
|
||||||
|
@ -35,9 +34,64 @@
|
||||||
padding: 80px 0em 0.4em 0em !important;
|
padding: 80px 0em 0.4em 0em !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Bulma modals customized for Tainacan
|
||||||
|
.dialog{
|
||||||
|
.modal-background {
|
||||||
|
background-color: rgba(0, 0, 0, 0.70);
|
||||||
|
}
|
||||||
|
.modal-card {
|
||||||
|
background-color: $modal-backgound-color;
|
||||||
|
color: $secondary;
|
||||||
|
border-radius: 10px;
|
||||||
|
|
||||||
.modal-background {
|
.modal-card-head, .modal-card-body, .modal-card-foot {
|
||||||
background-color: rgba(0, 0, 0, 0.70);
|
background-color: $modal-backgound-color;
|
||||||
|
color: $secondary;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.modal-card-head {
|
||||||
|
p { color: $secondary; }
|
||||||
|
font-weight: normal;
|
||||||
|
padding: 30px 35px 0px 35px;
|
||||||
|
}
|
||||||
|
.modal-card-body {
|
||||||
|
padding: 16px 35px;
|
||||||
|
|
||||||
|
i {
|
||||||
|
color: white !important;
|
||||||
|
&::before {
|
||||||
|
background-color: $danger;
|
||||||
|
border-radius: 55px;
|
||||||
|
display: initial;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.modal-card-foot {
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0px 35px 30px 35px;
|
||||||
|
|
||||||
|
.button {
|
||||||
|
border-radius: 6px !important;
|
||||||
|
font-weight: normal;
|
||||||
|
padding: 2px 15px !important;
|
||||||
|
margin-top: 0px !important;
|
||||||
|
margin-bottom: 0px !important;
|
||||||
|
height: inherit !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
display: inline-flex !important;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 13px !important;
|
||||||
|
}
|
||||||
|
.button.is-success {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.button:not(.is-success) {
|
||||||
|
background-color: white;
|
||||||
|
color: $tertiary;
|
||||||
|
border: 1px solid $gray-light;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WordPress Media Modal customization
|
// WordPress Media Modal customization
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
border: none !important;
|
border: none !important;
|
||||||
transform: none !important;
|
transform: none !important;
|
||||||
margin-top: -15px !important;
|
margin-top: -15px !important;
|
||||||
right: 10px !important;
|
right: 15px !important;
|
||||||
color: $primary;
|
color: $secondary;
|
||||||
display: flex !important;
|
display: flex !important;
|
||||||
align-items: initial;
|
align-items: initial;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
color: $tainacan-input-color;
|
color: $tainacan-input-color;
|
||||||
|
|
||||||
.form-submit {
|
.form-submit {
|
||||||
justify-content: start !important;
|
justify-content: space-between !important;
|
||||||
padding: 1em 1.2em 0.4em 1.2em;
|
padding: 12px 30px;
|
||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
.button {
|
.button {
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
|
@ -67,7 +67,6 @@
|
||||||
.select {
|
.select {
|
||||||
|
|
||||||
select {
|
select {
|
||||||
font-size: 14px;
|
|
||||||
color: $tainacan-input-color;
|
color: $tainacan-input-color;
|
||||||
background-color: white !important;
|
background-color: white !important;
|
||||||
border: 1px solid $tainacan-input-background;
|
border: 1px solid $tainacan-input-background;
|
||||||
|
@ -78,10 +77,12 @@
|
||||||
&.is-empty select{
|
&.is-empty select{
|
||||||
background-color: $tainacan-input-background !important;
|
background-color: $tainacan-input-background !important;
|
||||||
}
|
}
|
||||||
&:not(.is-multiple)::after {
|
}
|
||||||
margin-top: -0.6em;
|
.dropdown {
|
||||||
right: 0.95em;
|
.button {
|
||||||
color: $primary;
|
border: 1px solid $tainacan-input-background !important;
|
||||||
|
border-radius: 0 !important;
|
||||||
|
padding: 2px 20px !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,6 +18,7 @@ $primary-darker: darken($primary-dark, 5%);
|
||||||
$success: #25a189;
|
$success: #25a189;
|
||||||
$success-invert: findColorInvert($success);
|
$success-invert: findColorInvert($success);
|
||||||
|
|
||||||
|
$modal-backgound-color: #bfd8dd;
|
||||||
$separator-color: #2b98a4;
|
$separator-color: #2b98a4;
|
||||||
$tainacan-input-color: #1d1d1d;
|
$tainacan-input-color: #1d1d1d;
|
||||||
$tainacan-input-background: #e5e5e5;
|
$tainacan-input-background: #e5e5e5;
|
||||||
|
|
|
@ -5,3 +5,4 @@
|
||||||
@import "../../../node_modules/bulma/sass/elements/icon.sass"
|
@import "../../../node_modules/bulma/sass/elements/icon.sass"
|
||||||
@import "../../../node_modules/bulma/sass/elements/tag.sass"
|
@import "../../../node_modules/bulma/sass/elements/tag.sass"
|
||||||
@import "../../../node_modules/bulma/sass/components/tabs.sass"
|
@import "../../../node_modules/bulma/sass/components/tabs.sass"
|
||||||
|
@import "../../../node_modules/bulma/sass/elements/button.sass"
|
||||||
|
|
|
@ -193,6 +193,12 @@ return [
|
||||||
'label_dublin_core' => __( 'Dublin Core', 'tainacan' ),
|
'label_dublin_core' => __( 'Dublin Core', 'tainacan' ),
|
||||||
'label_created_by' => __( 'Created by', 'tainacan' ),
|
'label_created_by' => __( 'Created by', 'tainacan' ),
|
||||||
'label_apply_changes' => __( 'Apply changes', 'tainacan' ),
|
'label_apply_changes' => __( 'Apply changes', 'tainacan' ),
|
||||||
|
'label_view_mode' => __( 'View mode', 'tainacan' ),
|
||||||
|
'label_default_view_mode' => __( 'Default view mode', 'tainacan' ),
|
||||||
|
'label_enabled_view_modes' => __( 'Enabled view modes', 'tainacan' ),
|
||||||
|
'label_view_modes_available' => __( 'View modes available on theme', 'tainacan' ),
|
||||||
|
'label_warning' => __( 'Warning', 'tainacan' ),
|
||||||
|
'label_error' => __( 'Erro', 'tainacan' ),
|
||||||
|
|
||||||
// Instructions. More complex sentences to guide user and placeholders
|
// Instructions. More complex sentences to guide user and placeholders
|
||||||
'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),
|
'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),
|
||||||
|
@ -213,8 +219,7 @@ return [
|
||||||
'instruction_select_document_file_for_item' => __( 'Select a document file for item', 'tainacan' ),
|
'instruction_select_document_file_for_item' => __( 'Select a document file for item', 'tainacan' ),
|
||||||
'instruction_insert_url' => __( 'Insert URL', 'tainacan' ),
|
'instruction_insert_url' => __( 'Insert URL', 'tainacan' ),
|
||||||
'instruction_write_text' => __( 'Write Text', 'tainacan' ),
|
'instruction_write_text' => __( 'Write Text', 'tainacan' ),
|
||||||
'instruction_search_repository' => __( 'Search on repository', 'tainacan' ),
|
'instruction_search' => __( 'Search', 'tainacan' ),
|
||||||
'instruction_search_collection' => __( 'Search on collection', 'tainacan' ),
|
|
||||||
|
|
||||||
// Info. Other feedback to user.
|
// Info. Other feedback to user.
|
||||||
'info_name_is_required' => __( 'Name is required.', 'tainacan' ),
|
'info_name_is_required' => __( 'Name is required.', 'tainacan' ),
|
||||||
|
@ -237,11 +242,15 @@ return [
|
||||||
'info_collection_deleted' => __( 'Collection deleted.', 'tainacan' ),
|
'info_collection_deleted' => __( 'Collection deleted.', 'tainacan' ),
|
||||||
'info_item_deleted' => __( 'Item deleted.', 'tainacan' ),
|
'info_item_deleted' => __( 'Item deleted.', 'tainacan' ),
|
||||||
'info_category_deleted' => __( 'Taxonomy deleted', 'tainacan' ),
|
'info_category_deleted' => __( 'Taxonomy deleted', 'tainacan' ),
|
||||||
'info_warning_collection_delete' => __( 'Do you really want to delete this collection?', 'tainacan' ),
|
'info_warning_collection_delete' => __( 'Do you really want to permanently delete this collection?', 'tainacan' ),
|
||||||
'info_warning_item_delete' => __( 'Do you really want to delete this item?', 'tainacan' ),
|
'info_warning_collection_trash' => __( 'Do you really want to trash this collection?', 'tainacan' ),
|
||||||
|
'info_warning_item_delete' => __( 'Do you really want to permanently delete this item?', 'tainacan' ),
|
||||||
|
'info_warning_item_trash' => __( 'Do you really want to trash this item?', 'tainacan' ),
|
||||||
'info_warning_category_delete' => __( 'Do you really want to delete this taxonomy?', 'tainacan' ),
|
'info_warning_category_delete' => __( 'Do you really want to delete this taxonomy?', 'tainacan' ),
|
||||||
'info_warning_selected_collections_delete' => __( 'Do you really want to delete the selected collections?', 'tainacan' ),
|
'info_warning_selected_collections_delete' => __( 'Do you really want to permanently delete the selected collections?', 'tainacan' ),
|
||||||
'info_warning_selected_items_delete' => __( 'Do you really want to delete the selected items?', 'tainacan' ),
|
'info_warning_selected_collections_trash' => __( 'Do you really want to trash the selected collections?', 'tainacan' ),
|
||||||
|
'info_warning_selected_items_delete' => __( 'Do you really want to permanently delete the selected items?', 'tainacan' ),
|
||||||
|
'info_warning_selected_items_trash' => __( 'Do you really want to trash the selected items?', 'tainacan' ),
|
||||||
'info_warning_selected_categories_delete' => __( 'Do you really want to delete the selected categories?', 'tainacan' ),
|
'info_warning_selected_categories_delete' => __( 'Do you really want to delete the selected categories?', 'tainacan' ),
|
||||||
'info_warning_collection_related' => __( 'The metadata Collection related is required', 'tainacan' ),
|
'info_warning_collection_related' => __( 'The metadata Collection related is required', 'tainacan' ),
|
||||||
'info_warning_no_fields_found' => __( 'No metadata found in this collection', 'tainacan' ),
|
'info_warning_no_fields_found' => __( 'No metadata found in this collection', 'tainacan' ),
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<items-page
|
<items-page
|
||||||
class="theme-items-list"
|
class="theme-items-list"
|
||||||
|
:enabled-view-modes="$root.enabledViewModes"
|
||||||
|
:default-view-mode="$root.defaultViewMode"
|
||||||
:collection-id="$root.collectionId" />
|
:collection-id="$root.collectionId" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -12,50 +14,31 @@ export default {
|
||||||
|
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
@import "../admin/scss/_variables.scss";
|
||||||
|
|
||||||
|
// Bulma imports
|
||||||
@import "./scss/theme-basics.sass";
|
@import "./scss/theme-basics.sass";
|
||||||
|
|
||||||
|
// Buefy imports
|
||||||
@import "../../node_modules/buefy/src/scss/components/_datepicker.scss";
|
@import "../../node_modules/buefy/src/scss/components/_datepicker.scss";
|
||||||
$speed-slow: 0.5s;
|
$speed-slow: 0.5s;
|
||||||
@import "../../node_modules/buefy/src/scss/utils/_functions.scss";
|
@import "../../node_modules/buefy/src/scss/utils/_functions.scss";
|
||||||
@import "../../node_modules/buefy/src/scss/components/_checkbox.scss";
|
@import "../../node_modules/buefy/src/scss/components/_checkbox.scss";
|
||||||
@import "../../node_modules/buefy/src/scss/components/_radio.scss";
|
@import "../../node_modules/buefy/src/scss/components/_radio.scss";
|
||||||
@import "../../node_modules/buefy/src/scss/components/_tag.scss";
|
@import "../../node_modules/buefy/src/scss/components/_tag.scss";
|
||||||
|
@import "../../node_modules/buefy/src/scss/components/_loading.scss";
|
||||||
|
@import "../../node_modules/buefy/src/scss/components/_dropdown.scss";
|
||||||
|
|
||||||
// Tainacan custom colors
|
// Tainacan imports
|
||||||
$primary: #2cb4c1;
|
|
||||||
$primary-invert: findColorInvert($primary);
|
|
||||||
$secondary: #298596;
|
|
||||||
$secondary-invert: findColorInvert($secondary);
|
|
||||||
$tertiary: #01295c;
|
|
||||||
$tertiary-invert: findColorInvert($tertiary);
|
|
||||||
|
|
||||||
$primary-light:#c1dae0;
|
|
||||||
$primary-lighter: #e6f6f8;
|
|
||||||
$primary-dark: #55A0AF;
|
|
||||||
$primary-darker: darken($primary-dark, 5%);
|
|
||||||
|
|
||||||
$success: #25a189;
|
|
||||||
$success-invert: findColorInvert($success);
|
|
||||||
|
|
||||||
$separator-color: #2b98a4;
|
|
||||||
$tainacan-input-color: #1d1d1d;
|
|
||||||
$tainacan-input-background: #e5e5e5;
|
|
||||||
$tainacan-placeholder-color: #898d8f;
|
|
||||||
$draggable-border-color: #d8d8d8;
|
|
||||||
|
|
||||||
$gray: #b1b1b1;
|
|
||||||
$gray-invert: findColorInvert($gray);
|
|
||||||
$gray-light: #898d8f;
|
|
||||||
$gray-light-invert: findColorInvert($gray-light);
|
|
||||||
|
|
||||||
$danger: #a23939;
|
|
||||||
$danger-invert: findColorInvert($danger);
|
|
||||||
|
|
||||||
$table-side-padding: 4.166666667%;
|
|
||||||
|
|
||||||
@import "../admin/scss/_tables.scss";
|
@import "../admin/scss/_tables.scss";
|
||||||
|
@import "../admin/scss/_selects.scss";
|
||||||
|
@import "../admin/scss/_dropdown-and-autocomplete.scss";
|
||||||
@import "../admin/scss/_tooltips.scss";
|
@import "../admin/scss/_tooltips.scss";
|
||||||
|
@import "../admin/scss/_tainacan-form.scss";
|
||||||
|
|
||||||
.theme-items-list {
|
.theme-items-list {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
|
||||||
a{ color: $secondary !important }
|
a{ color: $secondary !important }
|
||||||
a:hover {
|
a:hover {
|
||||||
|
@ -76,11 +59,8 @@ export default {
|
||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
color: #1d1d1d;
|
|
||||||
font-size: 1.0em;
|
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background-color: white;
|
|
||||||
|
|
||||||
&.is-secondary:hover, &.is-secondary:focus {
|
&.is-secondary:hover, &.is-secondary:focus {
|
||||||
background: $secondary !important;
|
background: $secondary !important;
|
||||||
|
@ -117,38 +97,21 @@ export default {
|
||||||
font-size: 14px !important;
|
font-size: 14px !important;
|
||||||
}
|
}
|
||||||
#collection-search-button {
|
#collection-search-button {
|
||||||
height: 25px !important;
|
border: 1px solid $secondary !important;
|
||||||
|
height: 32px !important;
|
||||||
|
background-color: $secondary;
|
||||||
|
color: white;
|
||||||
}
|
}
|
||||||
.select {
|
.input, .textarea {
|
||||||
padding-top: 0px !important;
|
font-size: 14px;
|
||||||
select {
|
border: none;
|
||||||
border: none;
|
border-radius: 1px !important;
|
||||||
border-radius: 1px !important;
|
box-shadow: none !important;
|
||||||
font-weight: normal;
|
|
||||||
font-size: 14px !important;
|
&:focus, &:active {
|
||||||
height: 30px !important;
|
box-shadow: none !important;
|
||||||
padding: 2px 25px 2px 15px!important;
|
background-color: white;
|
||||||
margin-top: 0px !important;
|
border: 1px solid $tainacan-input-background !important;
|
||||||
margin-bottom: 0px !important;
|
|
||||||
color: $tainacan-input-color;
|
|
||||||
option:checked, option:hover {
|
|
||||||
background-color: $primary-lighter !important;
|
|
||||||
}
|
|
||||||
&:focus, &:active {
|
|
||||||
box-shadow: none !important;
|
|
||||||
text-decoration: none !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&:not(.is-multiple)::after {
|
|
||||||
content: "\F35D" !important;
|
|
||||||
font: normal normal normal 24px/1 "Material Design Icons" !important;
|
|
||||||
border: none !important;
|
|
||||||
transform: none !important;
|
|
||||||
margin-top: -15px !important;
|
|
||||||
right: 10px !important;
|
|
||||||
color: $primary;
|
|
||||||
display: flex !important;
|
|
||||||
align-items: initial;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.dropdown {
|
.dropdown {
|
||||||
|
@ -156,159 +119,8 @@ export default {
|
||||||
position: relative;
|
position: relative;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
.dropdown, .autocomplete {
|
.dropdown-menu {
|
||||||
.dropdown-trigger{
|
display: block;
|
||||||
.button {
|
|
||||||
border: none;
|
|
||||||
.icon {
|
|
||||||
color: $secondary;
|
|
||||||
align-items: start;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.button.is-primary, .button.is-secondary, .button.is-success {
|
|
||||||
.icon {
|
|
||||||
color: $white;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.dropdown-menu {
|
|
||||||
display: block;
|
|
||||||
.dropdown-content {
|
|
||||||
font-size: 13px !important;
|
|
||||||
border-radius: 0px !important;
|
|
||||||
.dropdown-item {
|
|
||||||
.b-checkbox { width: 100% };
|
|
||||||
&:hover {
|
|
||||||
background-color: $primary-lighter;
|
|
||||||
}
|
|
||||||
.is-small {
|
|
||||||
color: gray;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.taginput-container {
|
|
||||||
padding: 0 !important;
|
|
||||||
background-color: white !important;
|
|
||||||
|
|
||||||
&:focus, &:active {
|
|
||||||
border: none !important;
|
|
||||||
}
|
|
||||||
.input { margin-bottom: 0px !important; }
|
|
||||||
.input.has-selected, .input:focus, .input:active {
|
|
||||||
background-color: white;
|
|
||||||
border: 1px solid $tainacan-input-background !important;
|
|
||||||
}
|
|
||||||
.tag {
|
|
||||||
background: white;
|
|
||||||
padding-right: 0;
|
|
||||||
padding-left: 0.5em;
|
|
||||||
|
|
||||||
&.is-delete {
|
|
||||||
color: $gray-light;
|
|
||||||
&::after {
|
|
||||||
height: 30% !important;
|
|
||||||
width: 1px !important;
|
|
||||||
}
|
|
||||||
&::before {
|
|
||||||
width: 30% !important;
|
|
||||||
height: 1px !important;
|
|
||||||
}
|
|
||||||
&:hover, &:focus {
|
|
||||||
background-color: white;
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.selected-list-box {
|
|
||||||
padding: 4px 0px;
|
|
||||||
border: 1px solid $tainacan-input-background;
|
|
||||||
background-color: white;
|
|
||||||
display: flex;
|
|
||||||
|
|
||||||
.tags {
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
.tag {
|
|
||||||
background: white;
|
|
||||||
padding-right: 0;
|
|
||||||
padding-left: 0.5em;
|
|
||||||
|
|
||||||
&.is-delete {
|
|
||||||
color: $gray-light;
|
|
||||||
&::after {
|
|
||||||
height: 30% !important;
|
|
||||||
width: 1px !important;
|
|
||||||
}
|
|
||||||
&::before {
|
|
||||||
width: 30% !important;
|
|
||||||
height: 1px !important;
|
|
||||||
}
|
|
||||||
&:hover, &:focus {
|
|
||||||
background-color: white;
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.switch {
|
|
||||||
input[type="checkbox"] + .check {
|
|
||||||
background-color: $gray-light;
|
|
||||||
border: 2px solid $gray-light;
|
|
||||||
width: 2.7em;
|
|
||||||
height: 1.7em;
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
background-color: white;
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&:hover input[type="checkbox"]:checked + .check {
|
|
||||||
background-color: $primary-light;
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type="checkbox"]:checked + .check {
|
|
||||||
border: 2px solid $secondary;
|
|
||||||
background-color: transparent;
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
background-color: $secondary;
|
|
||||||
transform: translate3d(78%, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&:hover input[type="checkbox"] + .check {
|
|
||||||
background-color: $gray-light;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:focus input[type="checkbox"] + .check,
|
|
||||||
&:focus input[type="checkbox"]:checked + .check {
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.is-small {
|
|
||||||
font-size: 9px;
|
|
||||||
|
|
||||||
input[type="checkbox"] + .check {
|
|
||||||
border: 1.5px solid $gray-light;
|
|
||||||
width: 2.55em;
|
|
||||||
height: 1.7em;
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
width: 1.0em;
|
|
||||||
height: 1.0em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
input[type="checkbox"]:checked + .check {
|
|
||||||
border: 1.5px solid $secondary;
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
transform: translate3d(84%, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.b-checkbox.checkbox {
|
.b-checkbox.checkbox {
|
||||||
|
|
||||||
|
@ -470,5 +282,21 @@ export default {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#filter-menu-compress-button {
|
||||||
|
top: 70px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filters-menu {
|
||||||
|
height: auto;
|
||||||
|
min-width: $filter-menu-width;
|
||||||
|
background-color: unset;
|
||||||
|
border-right: 1px solid $tainacan-input-background;
|
||||||
|
}
|
||||||
|
|
||||||
|
#items-list-area {
|
||||||
|
width: 100%;
|
||||||
|
overflow-y: unset;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -375,12 +375,8 @@ class REST_Controller extends \WP_REST_Controller {
|
||||||
|
|
||||||
$query_params['perpage'] = array(
|
$query_params['perpage'] = array(
|
||||||
'description' => __( "Maximum number of $object_name to be returned in result set." ),
|
'description' => __( "Maximum number of $object_name to be returned in result set." ),
|
||||||
'type' => 'integer',
|
'type' => 'numeric',
|
||||||
'default' => 10,
|
'default' => 10,
|
||||||
'minimum' => 1,
|
|
||||||
'maximum' => 100,
|
|
||||||
'sanitize_callback' => 'absint',
|
|
||||||
'validate_callback' => 'rest_validate_request_arg',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$query_params['paged'] = array(
|
$query_params['paged'] = array(
|
||||||
|
|
|
@ -110,6 +110,12 @@ class REST_Fields_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'update_item_permissions_check'),
|
'permission_callback' => array($this, 'update_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE)
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE)
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
|
'callback' => array($this, 'get_item'),
|
||||||
|
'permission' => array($this, 'get_item_permissions_check'),
|
||||||
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -120,15 +126,24 @@ class REST_Fields_Controller extends REST_Controller {
|
||||||
* @return \WP_Error|\WP_REST_Response
|
* @return \WP_Error|\WP_REST_Response
|
||||||
*/
|
*/
|
||||||
public function get_item( $request ) {
|
public function get_item( $request ) {
|
||||||
$collection_id = $request['collection_id'];
|
$collection_id = isset($request['collection_id']) ? $request['collection_id'] : false;
|
||||||
$field_id = $request['field_id'];
|
$field_id = $request['field_id'];
|
||||||
|
|
||||||
if($request['fetch'] === 'all_field_values' && $request['search']){
|
if($request['fetch'] === 'all_field_values' && $request['search']){
|
||||||
$results = $this->field_repository->fetch_all_field_values($collection_id, $field_id, $request['search']);
|
if($collection_id) {
|
||||||
|
$results = $this->field_repository->fetch_all_field_values( $collection_id, $field_id, $request['search'] );
|
||||||
|
} else {
|
||||||
|
$results = $this->field_repository->fetch_all_field_values( null, $field_id, $request['search']);
|
||||||
|
}
|
||||||
|
|
||||||
return new \WP_REST_Response($results, 200);
|
return new \WP_REST_Response($results, 200);
|
||||||
|
|
||||||
} elseif($request['fetch'] === 'all_field_values') {
|
} elseif($request['fetch'] === 'all_field_values') {
|
||||||
$results = $this->field_repository->fetch_all_field_values($collection_id, $field_id);
|
if($collection_id) {
|
||||||
|
$results = $this->field_repository->fetch_all_field_values( $collection_id, $field_id );
|
||||||
|
} else {
|
||||||
|
$results = $this->field_repository->fetch_all_field_values( null, $field_id);
|
||||||
|
}
|
||||||
|
|
||||||
return new \WP_REST_Response($results, 200);
|
return new \WP_REST_Response($results, 200);
|
||||||
}
|
}
|
||||||
|
@ -145,14 +160,28 @@ class REST_Fields_Controller extends REST_Controller {
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function get_item_permissions_check( $request ) {
|
public function get_item_permissions_check( $request ) {
|
||||||
$collection = $this->collection_repository->fetch($request['collection_id']);
|
$collection_id = isset($request['collection_id']) ? $request['collection_id'] : false;
|
||||||
|
|
||||||
if($collection instanceof Entities\Collection) {
|
if($collection_id) {
|
||||||
if ($request['context'] === 'edit' && ! $collection->can_read()) {
|
$collection = $this->collection_repository->fetch( $collection_id );
|
||||||
return false;
|
|
||||||
|
if ( $collection instanceof Entities\Collection ) {
|
||||||
|
if ( $request['context'] === 'edit' && ! $collection->can_read() ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
} elseif($request['field_id']) {
|
||||||
|
$field = $this->field_repository->fetch($request['field_id']);
|
||||||
|
|
||||||
return true;
|
if ( $field instanceof Entities\Field ) {
|
||||||
|
if ( $request['context'] === 'edit' && ! $field->can_read() ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -116,7 +116,7 @@ class REST_Filters_Controller extends REST_Controller {
|
||||||
$received_type = $body['filter_type'];
|
$received_type = $body['filter_type'];
|
||||||
|
|
||||||
if(empty($received_type)){
|
if(empty($received_type)){
|
||||||
throw new \InvalidArgument\Exception('The type can\'t be empty');
|
throw new \InvalidArgumentException('The type can\'t be empty');
|
||||||
} elseif(!strrchr($received_type, '_')){
|
} elseif(!strrchr($received_type, '_')){
|
||||||
$received_type = ucfirst(strtolower($received_type));
|
$received_type = ucfirst(strtolower($received_type));
|
||||||
} else {
|
} else {
|
||||||
|
@ -141,10 +141,20 @@ class REST_Filters_Controller extends REST_Controller {
|
||||||
$collection_id = $request['collection_id'];
|
$collection_id = $request['collection_id'];
|
||||||
|
|
||||||
$filter_obj->set_collection_id( $collection_id );
|
$filter_obj->set_collection_id( $collection_id );
|
||||||
$filter_obj->set_field('');
|
|
||||||
|
if(!isset($body['field'])){
|
||||||
|
throw new \InvalidArgumentException('You need provide a field id');
|
||||||
|
}
|
||||||
|
|
||||||
|
$filter_obj->set_field($body['field']);
|
||||||
} else {
|
} else {
|
||||||
$filter_obj->set_collection_id( 'filter_in_repository' );
|
$filter_obj->set_collection_id( 'filter_in_repository' );
|
||||||
$filter_obj->set_field('');
|
|
||||||
|
if(!isset($body['field'])){
|
||||||
|
throw new \InvalidArgumentException('You need provide a field id');
|
||||||
|
}
|
||||||
|
|
||||||
|
$filter_obj->set_field($body['field']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$filter_obj->set_filter_type($filter_type);
|
$filter_obj->set_filter_type($filter_type);
|
||||||
|
@ -314,10 +324,11 @@ class REST_Filters_Controller extends REST_Controller {
|
||||||
|
|
||||||
if($request['context'] === 'edit'){
|
if($request['context'] === 'edit'){
|
||||||
$item_arr['current_user_can_edit'] = $item->can_edit();
|
$item_arr['current_user_can_edit'] = $item->can_edit();
|
||||||
$item_arr['filter_type_object'] = $item->get_filter_type_object()->_toArray();
|
|
||||||
$item_arr['enabled'] = $item->get_enabled_for_collection();
|
$item_arr['enabled'] = $item->get_enabled_for_collection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$item_arr['filter_type_object'] = $item->get_filter_type_object()->_toArray();
|
||||||
|
|
||||||
return $item_arr;
|
return $item_arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace Tainacan\API\EndPoints;
|
||||||
use \Tainacan\API\REST_Controller;
|
use \Tainacan\API\REST_Controller;
|
||||||
use Tainacan\Repositories;
|
use Tainacan\Repositories;
|
||||||
use Tainacan\Entities;
|
use Tainacan\Entities;
|
||||||
|
use Tainacan\Tests\Collections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the Items REST Controller
|
* Represents the Items REST Controller
|
||||||
|
@ -86,6 +87,17 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
register_rest_route(
|
||||||
|
$this->namespace, '/' . $this->rest_base,
|
||||||
|
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(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -199,22 +211,58 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
public function get_items( $request ) {
|
public function get_items( $request ) {
|
||||||
$args = $this->prepare_filters($request);
|
$args = $this->prepare_filters($request);
|
||||||
|
|
||||||
$collection_id = $request['collection_id'];
|
$collection_id = [];
|
||||||
|
if($request['collection_id']) {
|
||||||
|
$collection_id = $request['collection_id'];
|
||||||
|
}
|
||||||
|
|
||||||
$items = $this->items_repository->fetch($args, $collection_id, 'WP_Query');
|
$items = $this->items_repository->fetch($args, $collection_id, 'WP_Query');
|
||||||
|
|
||||||
$response = [];
|
$response = [];
|
||||||
if ($items->have_posts()) {
|
|
||||||
while ( $items->have_posts() ) {
|
|
||||||
$items->the_post();
|
|
||||||
|
|
||||||
$item = new Entities\Item($items->post);
|
$return_template = false;
|
||||||
|
|
||||||
$prepared_item = $this->prepare_item_for_response($item, $request);
|
if ( isset($request['view_mode']) ) {
|
||||||
|
|
||||||
array_push($response, $prepared_item);
|
// TODO: Check if requested view mode is really enabled for current collection
|
||||||
|
$view_mode = \Tainacan\Theme_Helper::get_instance()->get_view_mode($request['view_mode']);
|
||||||
|
|
||||||
|
if ($view_mode && $view_mode['type'] == 'template' && isset($view_mode['template']) && file_exists($view_mode['template'])) {
|
||||||
|
$return_template = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $return_template ) {
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
global $wp_query, $view_mode_displayed_fields;
|
||||||
|
$wp_query = $items;
|
||||||
|
$displayed_metadata = array_map(function($el) { return (int) $el; }, $request['fetch_only']['meta']);
|
||||||
|
$view_mode_displayed_fields = $request['fetch_only'];
|
||||||
|
$view_mode_displayed_fields['meta'] = $displayed_metadata;
|
||||||
|
|
||||||
|
include $view_mode['template'];
|
||||||
|
|
||||||
|
$response = ob_get_clean();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if ($items->have_posts()) {
|
||||||
|
while ( $items->have_posts() ) {
|
||||||
|
$items->the_post();
|
||||||
|
|
||||||
|
$item = new Entities\Item($items->post);
|
||||||
|
|
||||||
|
$prepared_item = $this->prepare_item_for_response($item, $request);
|
||||||
|
|
||||||
|
array_push($response, $prepared_item);
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_reset_postdata();
|
||||||
}
|
}
|
||||||
|
|
||||||
wp_reset_postdata();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$total_items = $items->found_posts;
|
$total_items = $items->found_posts;
|
||||||
|
@ -261,9 +309,13 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
|
if('edit' === $request['context'] && !$this->collections_repository->can_read(new Entities\Collection())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -25,7 +25,8 @@ class Collection extends Entity {
|
||||||
$default_order,
|
$default_order,
|
||||||
$default_orderby,
|
$default_orderby,
|
||||||
$columns,
|
$columns,
|
||||||
$default_view_mode,
|
$default_view_mode,
|
||||||
|
$enabled_view_modes,
|
||||||
$fields_order,
|
$fields_order,
|
||||||
$filters_order,
|
$filters_order,
|
||||||
$enable_cover_page,
|
$enable_cover_page,
|
||||||
|
@ -354,6 +355,15 @@ class Collection extends Entity {
|
||||||
return $this->get_mapped_property( 'default_view_mode' );
|
return $this->get_mapped_property( 'default_view_mode' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get collection enabled_view_modes option
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function get_enabled_view_modes() {
|
||||||
|
return $this->get_mapped_property( 'enabled_view_modes' );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get collection fields ordination
|
* Get collection fields ordination
|
||||||
*
|
*
|
||||||
|
@ -444,6 +454,73 @@ class Collection extends Entity {
|
||||||
return $Tainacan_Fields->fetch_by_collection( $this, [], 'OBJECT' );
|
return $Tainacan_Fields->fetch_by_collection( $this, [], 'OBJECT' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the two core fields of the collection (title and description)
|
||||||
|
*
|
||||||
|
* @return array[\Tainacan\Entities\Field]
|
||||||
|
*/
|
||||||
|
function get_core_fields() {
|
||||||
|
$repo = \Tainacan\Repositories\Fields::get_instance();
|
||||||
|
|
||||||
|
return $repo->fetch_by_collection($this, [
|
||||||
|
'meta_query' => [
|
||||||
|
[
|
||||||
|
'key' => 'field_type',
|
||||||
|
'value' => ['Tainacan\Field_Types\Core_Title', 'Tainacan\Field_Types\Core_Description'],
|
||||||
|
'compare' => 'IN'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
], 'OBJECT');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Core Title Field for this collection
|
||||||
|
*
|
||||||
|
* @return \Tainacan\Entities\Field The Core Title Field
|
||||||
|
*/
|
||||||
|
function get_core_title_field() {
|
||||||
|
$repo = \Tainacan\Repositories\Fields::get_instance();
|
||||||
|
|
||||||
|
$results = $repo->fetch_by_collection($this, [
|
||||||
|
'meta_query' => [
|
||||||
|
[
|
||||||
|
'key' => 'field_type',
|
||||||
|
'value' => 'Tainacan\Field_Types\Core_Title',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'posts_per_page' => 1
|
||||||
|
], 'OBJECT');
|
||||||
|
|
||||||
|
if (is_array($results) && sizeof($results) == 1 && $results[0] instanceof \Tainacan\Entities\Field) {
|
||||||
|
return $results[0];
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Core Description Field for this collection
|
||||||
|
*
|
||||||
|
* @return \Tainacan\Entities\Field The Core Description Field
|
||||||
|
*/
|
||||||
|
function get_core_description_field() {
|
||||||
|
$repo = \Tainacan\Repositories\Fields::get_instance();
|
||||||
|
|
||||||
|
$results = $repo->fetch_by_collection($this, [
|
||||||
|
'meta_query' => [
|
||||||
|
[
|
||||||
|
'key' => 'field_type',
|
||||||
|
'value' => 'Tainacan\Field_Types\Core_Description',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'posts_per_page' => 1
|
||||||
|
], 'OBJECT');
|
||||||
|
|
||||||
|
if (is_array($results) && sizeof($results) == 1 && $results[0] instanceof \Tainacan\Entities\Field) {
|
||||||
|
return $results[0];
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the collection name
|
* Set the collection name
|
||||||
*
|
*
|
||||||
|
@ -549,6 +626,17 @@ class Collection extends Entity {
|
||||||
$this->set_mapped_property( 'default_view_mode', $value );
|
$this->set_mapped_property( 'default_view_mode', $value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set collection enabled_view_modes option
|
||||||
|
*
|
||||||
|
* @param [array] $value
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function set_enabled_view_modes( $value ) {
|
||||||
|
$this->set_mapped_property( 'enabled_view_modes', $value );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set collection fields ordination
|
* Set collection fields ordination
|
||||||
*
|
*
|
||||||
|
|
|
@ -451,29 +451,40 @@ class Item extends Entity {
|
||||||
*
|
*
|
||||||
* Each metadata is a label with the field name and the value.
|
* Each metadata is a label with the field name and the value.
|
||||||
*
|
*
|
||||||
* If an ID, a slug or a Tainacan\Entities\Field object is passed, it returns only one metadata, otherwise
|
* If an ID, a slug or a Tainacan\Entities\Field object is passed in the 'metadata' argument, it returns only one metadata, otherwise
|
||||||
* it returns all metadata
|
* it returns all metadata
|
||||||
*
|
*
|
||||||
* @param int|string|Tainacan\Entities\Field $field Field object, ID or slug to retrieve only one field. empty returns all fields
|
* @param array|string $args {
|
||||||
* @param array|string $args {
|
* Optional. Array or string of arguments.
|
||||||
* Optional. Array or string of arguments.
|
*
|
||||||
*
|
* @type mixed $metadata Field object, ID or slug to retrieve only one field. empty returns all metadata
|
||||||
* @type bool $hide_empty Wether to hide or not fields the item has no value to
|
*
|
||||||
* Default: true
|
* @type array $metadata__in Array of metadata IDs or Slugs to be retrieved. Default none
|
||||||
* @type string $before_title String to be added before each metadata title
|
*
|
||||||
* Default '<h3>'
|
* @type array $metadata__not_in Array of metadata IDs (slugs not accepted) to excluded. Default none
|
||||||
* @type string $after_title String to be added after each metadata title
|
*
|
||||||
* Default '</h3>'
|
* @type bool $exclude_title Exclude the Core Title Metadata from result. Default false
|
||||||
* @type string $before_value String to be added before each metadata value
|
*
|
||||||
* Default '<p>'
|
* @type bool $exclude_description Exclude the Core Description Metadata from result. Default false
|
||||||
* @type string $after_value String to be added after each metadata value
|
*
|
||||||
* Default '</p>'
|
* @type bool $exclude_core Exclude Core Metadata (title and description) from result. Default false
|
||||||
* }
|
*
|
||||||
|
* @type bool $hide_empty Wether to hide or not fields the item has no value to
|
||||||
|
* Default: true
|
||||||
|
* @type string $before_title String to be added before each metadata title
|
||||||
|
* Default '<h3>'
|
||||||
|
* @type string $after_title String to be added after each metadata title
|
||||||
|
* Default '</h3>'
|
||||||
|
* @type string $before_value String to be added before each metadata value
|
||||||
|
* Default '<p>'
|
||||||
|
* @type string $after_value String to be added after each metadata value
|
||||||
|
* Default '</p>'
|
||||||
|
* }
|
||||||
*
|
*
|
||||||
* @return string The HTML output
|
* @return string The HTML output
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function get_metadata_as_html($field = null, $args = array()) {
|
public function get_metadata_as_html($args = array()) {
|
||||||
|
|
||||||
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
|
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
|
||||||
$Tainacan_Fields = \Tainacan\Repositories\Fields::get_instance();
|
$Tainacan_Fields = \Tainacan\Repositories\Fields::get_instance();
|
||||||
|
@ -481,6 +492,12 @@ class Item extends Entity {
|
||||||
$return = '';
|
$return = '';
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
|
'metadata' => null,
|
||||||
|
'metadata__in' => null,
|
||||||
|
'metadata__not_in' => null,
|
||||||
|
'exclude_title' => false,
|
||||||
|
'exclude_description' => false,
|
||||||
|
'exclude_core' => false,
|
||||||
'hide_empty' => true,
|
'hide_empty' => true,
|
||||||
'before_title' => '<h3>',
|
'before_title' => '<h3>',
|
||||||
'after_title' => '</h3>',
|
'after_title' => '</h3>',
|
||||||
|
@ -489,7 +506,7 @@ class Item extends Entity {
|
||||||
);
|
);
|
||||||
$args = wp_parse_args($args, $defaults);
|
$args = wp_parse_args($args, $defaults);
|
||||||
|
|
||||||
if (!is_null($field)) {
|
if (!is_null($args['metadata'])) {
|
||||||
|
|
||||||
$field_object = null;
|
$field_object = null;
|
||||||
|
|
||||||
|
@ -505,6 +522,16 @@ class Item extends Entity {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $field_object instanceof \Tainacan\Entities\Field ) {
|
if ( $field_object instanceof \Tainacan\Entities\Field ) {
|
||||||
|
|
||||||
|
if ( is_array($args['metadata__not_in'])
|
||||||
|
&& (
|
||||||
|
in_array($field_object->get_slug(), $args['metadata__not_in']) ||
|
||||||
|
in_array($field_object->get_id(), $args['metadata__not_in'])
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
$item_meta = new \Tainacan\Entities\Item_Metadata_Entity($this, $field_object);
|
$item_meta = new \Tainacan\Entities\Item_Metadata_Entity($this, $field_object);
|
||||||
if ($item_meta->has_value() || !$args['hide_empty']) {
|
if ($item_meta->has_value() || !$args['hide_empty']) {
|
||||||
$return .= $args['before_title'] . $field_object->get_name() . $args['after_title'];
|
$return .= $args['before_title'] . $field_object->get_name() . $args['after_title'];
|
||||||
|
@ -517,9 +544,56 @@ class Item extends Entity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields = $this->get_fields();
|
|
||||||
|
|
||||||
|
$query_args = [];
|
||||||
|
$post__in = [];
|
||||||
|
$post__not_in = [];
|
||||||
|
$post__name_in = [];
|
||||||
|
if (is_array($args['metadata__in'])) {
|
||||||
|
foreach ($args['metadata__in'] as $meta) {
|
||||||
|
if (is_string($meta)) {
|
||||||
|
$post__name_in[] = $meta;
|
||||||
|
} elseif (is_integer($meta)) {
|
||||||
|
$post__in[] = $meta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_array($args['metadata__not_in'])) {
|
||||||
|
foreach ($args['metadata__not_in'] as $meta) {
|
||||||
|
if (is_integer($meta)) {
|
||||||
|
$post__not_in[] = $meta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sizeof($post__in) > 0) {
|
||||||
|
$query_args['post__in'] = $post__in;
|
||||||
|
}
|
||||||
|
if (sizeof($post__not_in) > 0) {
|
||||||
|
$query_args['post__not_in'] = $post__not_in;
|
||||||
|
}
|
||||||
|
if (sizeof($post__name_in) > 0) {
|
||||||
|
$query_args['post__name_in'] = $post__name_in;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$fields = $this->get_fields($query_args);
|
||||||
|
|
||||||
foreach ( $fields as $item_meta ) {
|
foreach ( $fields as $item_meta ) {
|
||||||
|
|
||||||
|
$fto = $item_meta->get_field()->get_field_type_object();
|
||||||
|
|
||||||
|
if ( $fto->get_core() ) {
|
||||||
|
if ( $args['exclude_core'] ) {
|
||||||
|
continue;
|
||||||
|
} elseif ( $args['exclude_title'] && $fto->get_related_mapped_prop() == 'title' ) {
|
||||||
|
continue;
|
||||||
|
} elseif ( $args['exclude_description'] && $fto->get_related_mapped_prop() == 'description' ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($item_meta->has_value() || !$args['hide_empty']) {
|
if ($item_meta->has_value() || !$args['hide_empty']) {
|
||||||
$return .= $args['before_title'] . $item_meta->get_field()->get_name() . $args['after_title'];
|
$return .= $args['before_title'] . $item_meta->get_field()->get_name() . $args['after_title'];
|
||||||
$return .= $args['before_value'] . $item_meta->get_value_as_html() . $args['after_value'];
|
$return .= $args['before_value'] . $item_meta->get_value_as_html() . $args['after_value'];
|
||||||
|
|
|
@ -48,7 +48,10 @@ class Core_Description extends Field_Type {
|
||||||
*
|
*
|
||||||
* @param TainacanEntitiesItem_Metadata_Entity $item_metadata
|
* @param TainacanEntitiesItem_Metadata_Entity $item_metadata
|
||||||
* @return bool Valid or not
|
* @return bool Valid or not
|
||||||
*/
|
*
|
||||||
|
* Quarantine - Core metadata should be validated as any other metadata
|
||||||
|
* and item title is no longer mandatory
|
||||||
|
|
||||||
public function validate(\Tainacan\Entities\Item_Metadata_Entity $item_metadata) {
|
public function validate(\Tainacan\Entities\Item_Metadata_Entity $item_metadata) {
|
||||||
|
|
||||||
$item = $item_metadata->get_item();
|
$item = $item_metadata->get_item();
|
||||||
|
@ -62,6 +65,8 @@ class Core_Description extends Field_Type {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
public function validate_options( Field $field ) {
|
public function validate_options( Field $field ) {
|
||||||
|
|
||||||
if ( !in_array($field->get_status(), apply_filters('tainacan-status-require-validation', ['publish','future','private'])) )
|
if ( !in_array($field->get_status(), apply_filters('tainacan-status-require-validation', ['publish','future','private'])) )
|
||||||
|
|
|
@ -49,7 +49,10 @@ class Core_Title extends Field_Type {
|
||||||
*
|
*
|
||||||
* @param TainacanEntitiesItem_Metadata_Entity $item_metadata
|
* @param TainacanEntitiesItem_Metadata_Entity $item_metadata
|
||||||
* @return bool Valid or not
|
* @return bool Valid or not
|
||||||
*/
|
*
|
||||||
|
* Quarantine - Core metadata should be validated as any other metadata
|
||||||
|
* and item title is no longer mandatory
|
||||||
|
|
||||||
public function validate(\Tainacan\Entities\Item_Metadata_Entity $item_metadata) {
|
public function validate(\Tainacan\Entities\Item_Metadata_Entity $item_metadata) {
|
||||||
|
|
||||||
$item = $item_metadata->get_item();
|
$item = $item_metadata->get_item();
|
||||||
|
@ -62,6 +65,7 @@ class Core_Title extends Field_Type {
|
||||||
return $item->validate_prop('title');
|
return $item->validate_prop('title');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public function validate_options( Field $field ) {
|
public function validate_options( Field $field ) {
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
:type="fieldTypeMessage">
|
:type="fieldTypeMessage">
|
||||||
<span
|
<span
|
||||||
class="collapse-handle"
|
class="collapse-handle"
|
||||||
@click="$emit('changeCollapse', !isCollapsed)">
|
@click="$emit('changeCollapse', fieldTypeMessage != 'is-danger' ? !isCollapsed : true)">
|
||||||
<b-icon
|
<b-icon
|
||||||
type="is-secondary"
|
type="is-secondary"
|
||||||
:icon="isCollapsed ? 'menu-down' : 'menu-right'" />
|
:icon="isCollapsed || fieldTypeMessage == 'is-danger' ? 'menu-down' : 'menu-right'" />
|
||||||
<label class="label">{{ field.field.name }}</label>
|
<label class="label">{{ field.field.name }}</label>
|
||||||
<span
|
<span
|
||||||
v-if="field.field.required == 'yes'"
|
v-if="field.field.required == 'yes'"
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
:message="field.field.description"/>
|
:message="field.field.description"/>
|
||||||
</span>
|
</span>
|
||||||
<div
|
<div
|
||||||
v-show="isCollapsed"
|
v-show="isCollapsed || fieldTypeMessage == 'is-danger'"
|
||||||
v-if="isTextInputComponent( field.field.field_type_object.component )">
|
v-if="isTextInputComponent( field.field.field_type_object.component )">
|
||||||
<component
|
<component
|
||||||
:id="field.field.field_type_object.component + '-' + field.field.slug"
|
:id="field.field.field_type_object.component + '-' + field.field.slug"
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
this.setFieldTypeMessage('is-danger');
|
this.setFieldTypeMessage('is-danger');
|
||||||
for (let error of errors) {
|
for (let error of errors) {
|
||||||
for (let index of Object.keys(error)) {
|
for (let index of Object.keys(error)) {
|
||||||
//this.$console.log(index);
|
// this.$console.log(index);
|
||||||
msg += error[index] + '\n';
|
msg += error[index] + '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,8 +133,6 @@
|
||||||
},
|
},
|
||||||
setFieldTypeMessage( message ){
|
setFieldTypeMessage( message ){
|
||||||
this.fieldTypeMessage = message;
|
this.fieldTypeMessage = message;
|
||||||
if (message != '')
|
|
||||||
this.$emit('changeCollapse', true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,14 @@
|
||||||
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
|
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
|
||||||
this.field = ( this.field_id ) ? this.field_id : this.filter.field.field_id;
|
this.field = ( this.field_id ) ? this.field_id : this.filter.field.field_id;
|
||||||
const vm = this;
|
const vm = this;
|
||||||
axios.get('/collection/' + this.collection + '/fields/' + this.field )
|
|
||||||
|
let in_route = '/collection/' + this.collection + '/fields/' + this.field;
|
||||||
|
|
||||||
|
if(this.isRepositoryLevel){
|
||||||
|
in_route = '/fields/'+ this.field;
|
||||||
|
}
|
||||||
|
|
||||||
|
axios.get(in_route)
|
||||||
.then( res => {
|
.then( res => {
|
||||||
let result = res.data;
|
let result = res.data;
|
||||||
if( result && result.field_type ){
|
if( result && result.field_type ){
|
||||||
|
@ -75,6 +82,9 @@
|
||||||
label: ''
|
label: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
isRepositoryLevel: Boolean,
|
||||||
|
},
|
||||||
mixins: [filter_type_mixin],
|
mixins: [filter_type_mixin],
|
||||||
methods: {
|
methods: {
|
||||||
setResults(option){
|
setResults(option){
|
||||||
|
@ -101,7 +111,7 @@
|
||||||
promise = this.getValuesRelationship( collectionTarget );
|
promise = this.getValuesRelationship( collectionTarget );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
promise = this.getValuesPlainText( this.field, query );
|
promise = this.getValuesPlainText( this.field, query, this.isRepositoryLevel );
|
||||||
}
|
}
|
||||||
|
|
||||||
promise.then( () => {
|
promise.then( () => {
|
||||||
|
|
|
@ -22,7 +22,13 @@
|
||||||
this.field = ( this.field_id ) ? this.field_id : this.filter.field.field_id ;
|
this.field = ( this.field_id ) ? this.field_id : this.filter.field.field_id ;
|
||||||
this.type = ( this.filter_type ) ? this.filter_type : this.filter.field.field_type;
|
this.type = ( this.filter_type ) ? this.filter_type : this.filter.field.field_type;
|
||||||
|
|
||||||
axios.get('/collection/'+ this.collection +'/fields/' + this.field + '?context=edit')
|
let in_route = '/collection/' + this.isRepositoryLevel + '/fields/' + this.field +'?context=edit';
|
||||||
|
|
||||||
|
if(this.isRepositoryLevel){
|
||||||
|
in_route = '/fields?context=edit';
|
||||||
|
}
|
||||||
|
|
||||||
|
axios.get(in_route)
|
||||||
.then( res => {
|
.then( res => {
|
||||||
let field = res.data;
|
let field = res.data;
|
||||||
this.selectedValues( field.field_type_options.taxonomy_id );
|
this.selectedValues( field.field_type_options.taxonomy_id );
|
||||||
|
@ -50,7 +56,8 @@
|
||||||
id: '',
|
id: '',
|
||||||
query: {
|
query: {
|
||||||
type: Object // concentrate all attributes field id and type
|
type: Object // concentrate all attributes field id and type
|
||||||
}
|
},
|
||||||
|
isRepositoryLevel: Boolean,
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selected( value ){
|
selected( value ){
|
||||||
|
|
|
@ -21,7 +21,14 @@
|
||||||
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
|
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
|
||||||
this.field = ( this.field_id ) ? this.field_id : this.filter.field.field_id;
|
this.field = ( this.field_id ) ? this.field_id : this.filter.field.field_id;
|
||||||
const vm = this;
|
const vm = this;
|
||||||
axios.get('/collection/' + this.collection + '/fields/' + this.field + '?nopaging=1')
|
|
||||||
|
let in_route = '/collection/' + this.collection + '/fields/' + this.field +'?nopaging=1';
|
||||||
|
|
||||||
|
if(this.isRepositoryLevel){
|
||||||
|
in_route = '/fields?nopaging=1';
|
||||||
|
}
|
||||||
|
|
||||||
|
axios.get(in_route)
|
||||||
.then( res => {
|
.then( res => {
|
||||||
let result = res.data;
|
let result = res.data;
|
||||||
if( result && result.field_type ){
|
if( result && result.field_type ){
|
||||||
|
@ -34,6 +41,9 @@
|
||||||
this.$console.log(error);
|
this.$console.log(error);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
isRepositoryLevel: Boolean,
|
||||||
|
},
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
|
@ -63,7 +73,7 @@
|
||||||
promise = this.getValuesRelationship( collectionTarget );
|
promise = this.getValuesRelationship( collectionTarget );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
promise = this.getValuesPlainText( this.field );
|
promise = this.getValuesPlainText( this.field, null, this.isRepositoryLevel );
|
||||||
}
|
}
|
||||||
|
|
||||||
promise.then(() => {
|
promise.then(() => {
|
||||||
|
|
|
@ -66,7 +66,13 @@
|
||||||
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
|
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
|
||||||
this.field = ( this.field_id ) ? this.field_id : this.filter.field.field_id;
|
this.field = ( this.field_id ) ? this.field_id : this.filter.field.field_id;
|
||||||
|
|
||||||
axios.get('/collection/' + this.collection + '/fields/' + this.field )
|
let in_route = '/collection/' + this.collection + '/fields/' + this.field;
|
||||||
|
|
||||||
|
if(this.isRepositoryLevel){
|
||||||
|
in_route = '/fields/'+ this.field;
|
||||||
|
}
|
||||||
|
|
||||||
|
axios.get(in_route)
|
||||||
.then( res => {
|
.then( res => {
|
||||||
let result = res.data;
|
let result = res.data;
|
||||||
if( result && result.field_type ){
|
if( result && result.field_type ){
|
||||||
|
@ -101,7 +107,8 @@
|
||||||
field_id: [Number], // not required, but overrides the filter field id if is set
|
field_id: [Number], // not required, but overrides the filter field id if is set
|
||||||
collection_id: [Number], // not required, but overrides the filter field id if is set
|
collection_id: [Number], // not required, but overrides the filter field id if is set
|
||||||
id: '',
|
id: '',
|
||||||
query: Object
|
query: Object,
|
||||||
|
isRepositoryLevel: Boolean,
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
isTouched( val ){
|
isTouched( val ){
|
||||||
|
|
|
@ -12,9 +12,14 @@ export const filter_type_mixin = {
|
||||||
query: {}
|
query: {}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getValuesPlainText(fieldId, search) {
|
getValuesPlainText(fieldId, search, isRepositoryLevel) {
|
||||||
|
|
||||||
let url = '/collection/' + this.collection + '/fields/' + fieldId + '?fetch=all_field_values&nopaging=1';
|
let url = '/collection/' + this.collection + '/fields/' + fieldId + '?fetch=all_field_values&nopaging=1';
|
||||||
|
|
||||||
|
if(isRepositoryLevel){
|
||||||
|
url = '/fields/' + fieldId + '?fetch=all_field_values&nopaging=1';
|
||||||
|
}
|
||||||
|
|
||||||
if( search ){
|
if( search ){
|
||||||
url += "&search=" + search;
|
url += "&search=" + search;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,14 @@
|
||||||
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
|
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
|
||||||
this.field = ( this.field_id ) ? this.field_id : this.filter.field.field_id;
|
this.field = ( this.field_id ) ? this.field_id : this.filter.field.field_id;
|
||||||
const vm = this;
|
const vm = this;
|
||||||
axios.get('/collection/' + this.collection + '/fields/' + this.field )
|
|
||||||
|
let in_route = '/collection/' + this.collection + '/fields/' + this.field;
|
||||||
|
|
||||||
|
if(this.isRepositoryLevel){
|
||||||
|
in_route = '/fields/'+ this.field;
|
||||||
|
}
|
||||||
|
|
||||||
|
axios.get(in_route)
|
||||||
.then( res => {
|
.then( res => {
|
||||||
let result = res.data;
|
let result = res.data;
|
||||||
if( result && result.field_type ){
|
if( result && result.field_type ){
|
||||||
|
@ -40,6 +47,9 @@
|
||||||
this.$console.error(error);
|
this.$console.error(error);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
isRepositoryLevel: Boolean,
|
||||||
|
},
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
|
@ -68,7 +78,7 @@
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
|
|
||||||
let promise = null;
|
let promise = null;
|
||||||
promise = this.getValuesPlainText( this.field );
|
promise = this.getValuesPlainText( this.field, null, this.isRepositoryLevel );
|
||||||
|
|
||||||
promise.then(() => {
|
promise.then(() => {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
|
|
|
@ -23,7 +23,14 @@
|
||||||
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
|
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
|
||||||
this.field = ( this.field_id ) ? this.field_id : this.filter.field.field_id;
|
this.field = ( this.field_id ) ? this.field_id : this.filter.field.field_id;
|
||||||
const vm = this;
|
const vm = this;
|
||||||
axios.get('/collection/' + this.collection + '/fields/' + this.field )
|
|
||||||
|
let in_route = '/collection/' + this.collection + '/fields/' + this.field;
|
||||||
|
|
||||||
|
if(this.isRepositoryLevel){
|
||||||
|
in_route = '/fields?nopaging=1';
|
||||||
|
}
|
||||||
|
|
||||||
|
axios.get(in_route)
|
||||||
.then( res => {
|
.then( res => {
|
||||||
let result = res.data;
|
let result = res.data;
|
||||||
if( result && result.field_type ){
|
if( result && result.field_type ){
|
||||||
|
@ -48,6 +55,9 @@
|
||||||
field_object: {}
|
field_object: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
isRepositoryLevel: Boolean
|
||||||
|
},
|
||||||
mixins: [filter_type_mixin],
|
mixins: [filter_type_mixin],
|
||||||
watch: {
|
watch: {
|
||||||
selected( value ){
|
selected( value ){
|
||||||
|
@ -77,7 +87,7 @@
|
||||||
promise = this.getValuesRelationship( collectionTarget, query );
|
promise = this.getValuesRelationship( collectionTarget, query );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
promise = this.getValuesPlainText( this.field, query );
|
promise = this.getValuesPlainText( this.field, query, this.isRepositoryLevel );
|
||||||
}
|
}
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
promise.then(() => {
|
promise.then(() => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<b-field
|
<b-field
|
||||||
id="filter-item-forms"
|
class="filter-item-forms"
|
||||||
:message="getErrorMessage"
|
:message="getErrorMessage"
|
||||||
:type="filterTypeMessage">
|
:type="filterTypeMessage">
|
||||||
<b-collapse
|
<b-collapse
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
:is="filter.filter_type_object.component"
|
:is="filter.filter_type_object.component"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
:query="query"
|
:query="query"
|
||||||
|
:is-repository-level="isRepositoryLevel"
|
||||||
@input="listen( $event )"/>
|
@input="listen( $event )"/>
|
||||||
</div>
|
</div>
|
||||||
</b-collapse>
|
</b-collapse>
|
||||||
|
@ -36,6 +37,7 @@
|
||||||
props: {
|
props: {
|
||||||
filter: Object,
|
filter: Object,
|
||||||
query: Object,
|
query: Object,
|
||||||
|
isRepositoryLevel: Boolean,
|
||||||
open: true,
|
open: true,
|
||||||
},
|
},
|
||||||
data(){
|
data(){
|
||||||
|
@ -76,7 +78,7 @@
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import "../../../src/admin/scss/_variables.scss";
|
@import "../../../src/admin/scss/_variables.scss";
|
||||||
|
|
||||||
#filter-item-forms {
|
.filter-item-forms {
|
||||||
|
|
||||||
.datepicker {
|
.datepicker {
|
||||||
|
|
||||||
|
@ -251,12 +253,6 @@
|
||||||
height: 2em !important;
|
height: 2em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.autocomplete {
|
|
||||||
.dropdown-content {
|
|
||||||
position: fixed !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.b-checkbox.checkbox {
|
.b-checkbox.checkbox {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|
|
@ -127,6 +127,15 @@ class Collections extends Repository {
|
||||||
'title' => __( 'Default view mode', 'tainacan' ),
|
'title' => __( 'Default view mode', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'Collection default visualization mode', 'tainacan' ),
|
'description' => __( 'Collection default visualization mode', 'tainacan' ),
|
||||||
|
'default' => 'table',
|
||||||
|
//'validation' => v::stringType(),
|
||||||
|
],
|
||||||
|
'enabled_view_modes' => [
|
||||||
|
'map' => 'meta',
|
||||||
|
'title' => __( 'Enabled view modes', 'tainacan' ),
|
||||||
|
'type' => 'array',
|
||||||
|
'description' => __( 'Which visualization modes will be available for the public to choose from', 'tainacan' ),
|
||||||
|
'default' => [],
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'fields_order' => [
|
'fields_order' => [
|
||||||
|
@ -257,6 +266,7 @@ class Collections extends Repository {
|
||||||
|
|
||||||
$Tainacan_Fields->register_core_fields( $new_collection );
|
$Tainacan_Fields->register_core_fields( $new_collection );
|
||||||
$collection->register_collection_item_post_type();
|
$collection->register_collection_item_post_type();
|
||||||
|
flush_rewrite_rules(false); // needed to activate items post type archive url
|
||||||
$this->update_moderators( $new_collection );
|
$this->update_moderators( $new_collection );
|
||||||
|
|
||||||
return $new_collection;
|
return $new_collection;
|
||||||
|
@ -272,7 +282,7 @@ class Collections extends Repository {
|
||||||
* @return mixed|Collection
|
* @return mixed|Collection
|
||||||
*/
|
*/
|
||||||
public function delete( $args ) {
|
public function delete( $args ) {
|
||||||
if ( ! empty( $args[1] ) && $args[1] === true ) {
|
if ( ! empty( $args[1] ) && $args[1] == true ) {
|
||||||
$deleted = new Entities\Collection( wp_delete_post( $args[0], $args[1] ) );
|
$deleted = new Entities\Collection( wp_delete_post( $args[0], $args[1] ) );
|
||||||
|
|
||||||
if($deleted) {
|
if($deleted) {
|
||||||
|
|
|
@ -318,7 +318,7 @@ class Fields extends Repository {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fetch field by collection, searches all field available
|
* fetch field by collection, considering inheritance
|
||||||
*
|
*
|
||||||
* @param Entities\Collection $collection
|
* @param Entities\Collection $collection
|
||||||
* @param array $args WP_Query args plus disabled_fields
|
* @param array $args WP_Query args plus disabled_fields
|
||||||
|
@ -642,8 +642,11 @@ class Fields extends Repository {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Fetch all field value for repository level
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch all values of a field from a collection in all it collection items
|
* Fetch all values of a field from a collection or repository
|
||||||
*
|
*
|
||||||
* @param $collection_id
|
* @param $collection_id
|
||||||
* @param $field_id
|
* @param $field_id
|
||||||
|
@ -722,8 +725,9 @@ class Fields extends Repository {
|
||||||
|
|
||||||
foreach ($post_statuses as $post_status) {
|
foreach ($post_statuses as $post_status) {
|
||||||
|
|
||||||
$sql_string = $wpdb->prepare(
|
if($collection_id) {
|
||||||
"SELECT item_id, field_id, mvalue
|
$sql_string = $wpdb->prepare(
|
||||||
|
"SELECT item_id, field_id, mvalue
|
||||||
FROM (
|
FROM (
|
||||||
SELECT ID as item_id
|
SELECT ID as item_id
|
||||||
FROM $wpdb->posts
|
FROM $wpdb->posts
|
||||||
|
@ -734,8 +738,24 @@ class Fields extends Repository {
|
||||||
FROM $wpdb->postmeta $search_query
|
FROM $wpdb->postmeta $search_query
|
||||||
) metas
|
) metas
|
||||||
ON items.item_id = metas.post_id AND metas.field_id = %d",
|
ON items.item_id = metas.post_id AND metas.field_id = %d",
|
||||||
$item_post_type, $post_status, $field_id
|
$item_post_type, $post_status, $field_id
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
$sql_string = $wpdb->prepare(
|
||||||
|
"SELECT item_id, field_id, mvalue
|
||||||
|
FROM (
|
||||||
|
SELECT ID as item_id
|
||||||
|
FROM $wpdb->posts
|
||||||
|
WHERE post_status = %s
|
||||||
|
) items
|
||||||
|
JOIN (
|
||||||
|
SELECT meta_key as field_id, meta_value as mvalue, post_id
|
||||||
|
FROM $wpdb->postmeta $search_query
|
||||||
|
) metas
|
||||||
|
ON items.item_id = metas.post_id AND metas.field_id = %d",
|
||||||
|
$post_status, $field_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$pre_result = $wpdb->get_results( $sql_string, ARRAY_A );
|
$pre_result = $wpdb->get_results( $sql_string, ARRAY_A );
|
||||||
if (!empty($pre_result)) {
|
if (!empty($pre_result)) {
|
||||||
|
@ -750,8 +770,10 @@ class Fields extends Repository {
|
||||||
$post_statuses = get_post_stati( $args, 'names', 'and' );
|
$post_statuses = get_post_stati( $args, 'names', 'and' );
|
||||||
|
|
||||||
foreach ($post_statuses as $post_status) {
|
foreach ($post_statuses as $post_status) {
|
||||||
$sql_string = $wpdb->prepare(
|
|
||||||
"SELECT item_id, field_id, mvalue
|
if($collection_id) {
|
||||||
|
$sql_string = $wpdb->prepare(
|
||||||
|
"SELECT item_id, field_id, mvalue
|
||||||
FROM (
|
FROM (
|
||||||
SELECT ID as item_id
|
SELECT ID as item_id
|
||||||
FROM $wpdb->posts
|
FROM $wpdb->posts
|
||||||
|
@ -762,8 +784,24 @@ class Fields extends Repository {
|
||||||
FROM $wpdb->postmeta $search_query
|
FROM $wpdb->postmeta $search_query
|
||||||
) metas
|
) metas
|
||||||
ON items.item_id = metas.post_id AND metas.field_id = %d",
|
ON items.item_id = metas.post_id AND metas.field_id = %d",
|
||||||
$item_post_type, $post_status, $field_id
|
$item_post_type, $post_status, $field_id
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
$sql_string = $wpdb->prepare(
|
||||||
|
"SELECT item_id, field_id, mvalue
|
||||||
|
FROM (
|
||||||
|
SELECT ID as item_id
|
||||||
|
FROM $wpdb->posts
|
||||||
|
WHERE post_status = %s
|
||||||
|
) items
|
||||||
|
JOIN (
|
||||||
|
SELECT meta_key as field_id, meta_value as mvalue, post_id
|
||||||
|
FROM $wpdb->postmeta $search_query
|
||||||
|
) metas
|
||||||
|
ON items.item_id = metas.post_id AND metas.field_id = %d",
|
||||||
|
$post_status, $field_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$pre_result = $wpdb->get_results( $sql_string, ARRAY_A );
|
$pre_result = $wpdb->get_results( $sql_string, ARRAY_A );
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ class Filters extends Repository {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function delete($args){
|
public function delete($args){
|
||||||
if(!empty($args[1]) && $args[1] === true){
|
if(!empty($args[1]) && $args[1] == true){
|
||||||
|
|
||||||
$deleted = new Entities\Filter(wp_delete_post($args[0], $args[1]));
|
$deleted = new Entities\Filter(wp_delete_post($args[0], $args[1]));
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Items extends Repository {
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'Title of the item', 'tainacan' ),
|
'description' => __( 'Title of the item', 'tainacan' ),
|
||||||
'on_error' => __( 'The title should be a text value and not empty', 'tainacan' ),
|
'on_error' => __( 'The title should be a text value and not empty', 'tainacan' ),
|
||||||
'validation' => v::stringType()->notEmpty(),
|
//'validation' => v::stringType()->notEmpty(),
|
||||||
],
|
],
|
||||||
'status' => [
|
'status' => [
|
||||||
'map' => 'post_status',
|
'map' => 'post_status',
|
||||||
|
@ -289,7 +289,7 @@ class Items extends Repository {
|
||||||
* @return mixed|Entities\Item
|
* @return mixed|Entities\Item
|
||||||
*/
|
*/
|
||||||
public function delete( $args ) {
|
public function delete( $args ) {
|
||||||
if ( ! empty( $args[1] ) && $args[1] === true ) {
|
if ( ! empty( $args[1] ) && $args[1] == true ) {
|
||||||
|
|
||||||
$deleted = new Entities\Item( wp_delete_post( $args[0], $args[1] ) );
|
$deleted = new Entities\Item( wp_delete_post( $args[0], $args[1] ) );
|
||||||
|
|
||||||
|
|
|
@ -510,6 +510,31 @@ abstract class Repository {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch one Entity based on query args.
|
||||||
|
*
|
||||||
|
* Note: Does not work with Item_Metadata Repository
|
||||||
|
*
|
||||||
|
* @param array $args Query Args as expected by fetch
|
||||||
|
*
|
||||||
|
* @return false|\Tainacan\Entities The entity or false if none was found
|
||||||
|
*/
|
||||||
|
public function fetch_one($args) {
|
||||||
|
if ($this->get_name() == 'Item_Metadata') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$args['posts_per_page'] = 1;
|
||||||
|
|
||||||
|
$results = $this->fetch($args, 'OBJECT');
|
||||||
|
|
||||||
|
if (is_array($results) && sizeof($results) > 0 && $results[0] instanceof \Tainacan\Entities\Entity) {
|
||||||
|
return $results[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $object
|
* @param $object
|
||||||
*
|
*
|
||||||
|
|
|
@ -186,7 +186,7 @@ class Taxonomies extends Repository {
|
||||||
$taxonomy_name = $args[1];
|
$taxonomy_name = $args[1];
|
||||||
$permanently = $args[2];
|
$permanently = $args[2];
|
||||||
|
|
||||||
if($permanently === true){
|
if($permanently == true){
|
||||||
$unregistered = unregister_taxonomy($taxonomy_name);
|
$unregistered = unregister_taxonomy($taxonomy_name);
|
||||||
|
|
||||||
if($unregistered instanceof \WP_Error){
|
if($unregistered instanceof \WP_Error){
|
||||||
|
|
|
@ -765,6 +765,10 @@ class Old_Tainacan extends Importer
|
||||||
*/
|
*/
|
||||||
public function get_total_items_from_source()
|
public function get_total_items_from_source()
|
||||||
{
|
{
|
||||||
|
if(!isset($this->tmp_file)){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
$file = new \SplFileObject( $this->tmp_file, 'r' );
|
$file = new \SplFileObject( $this->tmp_file, 'r' );
|
||||||
$file_content = unserialize($file->fread($file->getSize()));
|
$file_content = unserialize($file->fread($file->getSize()));
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$route' () {
|
'$route' (to, from) {
|
||||||
if (this.$route.params.collectionId)
|
if (this.$route.params.collectionId)
|
||||||
this.collectionId = parseInt(this.$route.params.collectionId);
|
this.collectionId = parseInt(this.$route.params.collectionId);
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ export default {
|
||||||
|
|
||||||
this.$store.dispatch('search/set_postquery', this.$route.query);
|
this.$store.dispatch('search/set_postquery', this.$route.query);
|
||||||
|
|
||||||
this.loadItems();
|
this.loadItems(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,10 @@ export default {
|
||||||
this.$store.dispatch('search/setSearchQuery', searchQuery);
|
this.$store.dispatch('search/setSearchQuery', searchQuery);
|
||||||
this.updateURLQueries();
|
this.updateURLQueries();
|
||||||
},
|
},
|
||||||
|
setViewMode(viewMode) {
|
||||||
|
this.$store.dispatch('search/setViewMode', viewMode);
|
||||||
|
this.updateURLQueries();
|
||||||
|
},
|
||||||
updateURLQueries() {
|
updateURLQueries() {
|
||||||
this.$router.push({ query: {}});
|
this.$router.push({ query: {}});
|
||||||
this.$router.push({ query: this.$store.getters['search/getPostQuery'] });
|
this.$router.push({ query: this.$store.getters['search/getPostQuery'] });
|
||||||
|
@ -115,18 +119,20 @@ export default {
|
||||||
updateStoreFromURL() {
|
updateStoreFromURL() {
|
||||||
this.$store.dispatch('search/set_postquery', this.$route.query);
|
this.$store.dispatch('search/set_postquery', this.$route.query);
|
||||||
},
|
},
|
||||||
loadItems() {
|
loadItems(to) {
|
||||||
|
|
||||||
// Foreces fetch_only to be filled before any search happens
|
// Forces fetch_only to be filled before any search happens
|
||||||
if (this.$store.getters['search/getFetchOnly'] == undefined)
|
if (this.$store.getters['search/getFetchOnly'] == undefined)
|
||||||
this.$emit( 'hasToPrepareFieldsAndFilters');
|
this.$emit( 'hasToPrepareFieldsAndFilters', to);
|
||||||
else {
|
else {
|
||||||
this.$emit( 'isLoadingItems', true);
|
this.$emit( 'isLoadingItems', true);
|
||||||
this.$store.dispatch('collection/fetchItems', { 'collectionId': this.collectionId, 'isOnTheme': (this.$route.name == null) }).then((res) => {
|
this.$store.dispatch('collection/fetchItems',
|
||||||
|
{ 'collectionId': this.collectionId,
|
||||||
|
'isOnTheme': (this.$route.name == null)
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
this.$emit( 'isLoadingItems', false);
|
this.$emit( 'isLoadingItems', false);
|
||||||
this.$emit( 'hasFiltered', res.hasFiltered);
|
this.$emit( 'hasFiltered', res.hasFiltered);
|
||||||
//var event = new Event('tainacan-items-change')
|
|
||||||
//document.dispatchEvent(event);
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$emit( 'isLoadingItems', false);
|
this.$emit( 'isLoadingItems', false);
|
||||||
|
|
|
@ -36,6 +36,7 @@ export const eventBus = new Vue({
|
||||||
},
|
},
|
||||||
updateValue(data){
|
updateValue(data){
|
||||||
if ( data.item_id ){
|
if ( data.item_id ){
|
||||||
|
|
||||||
let values = ( Array.isArray( data.values[0] ) ) ? data.values[0] : data.values ;
|
let values = ( Array.isArray( data.values[0] ) ) ? data.values[0] : data.values ;
|
||||||
const promisse = this.$store.dispatch('item/updateMetadata',
|
const promisse = this.$store.dispatch('item/updateMetadata',
|
||||||
{ item_id: data.item_id, field_id: data.field_id, values: values });
|
{ item_id: data.item_id, field_id: data.field_id, values: values });
|
||||||
|
@ -62,7 +63,7 @@ export const eventBus = new Vue({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getErrors(field_id){
|
getErrors(field_id) {
|
||||||
let error = this.errors.find( errorItem => errorItem.field_id == field_id );
|
let error = this.errors.find( errorItem => errorItem.field_id == field_id );
|
||||||
return ( error ) ? error.errors : false
|
return ( error ) ? error.errors : false
|
||||||
},
|
},
|
||||||
|
|
|
@ -22,22 +22,39 @@ export const fetchItems = ({ rootGetters, dispatch, commit }, { collectionId, is
|
||||||
if (!isOnTheme)
|
if (!isOnTheme)
|
||||||
endpoint = endpoint + 'context=edit&'
|
endpoint = endpoint + 'context=edit&'
|
||||||
|
|
||||||
axios.tainacan.get(endpoint + qs.stringify(postQueries) )
|
if (qs.stringify(postQueries.fetch_only['meta']) != '') {
|
||||||
.then(res => {
|
axios.tainacan.get(endpoint + qs.stringify(postQueries))
|
||||||
let items = res.data;
|
.then(res => {
|
||||||
commit('setItems', items );
|
|
||||||
dispatch('search/setTotalItems', res.headers['x-wp-total'], { root: true } );
|
let items = res.data;
|
||||||
resolve({'items': items, 'total': res.headers['x-wp-total'], hasFiltered: hasFiltered});
|
let viewModeObject = tainacan_plugin.registered_view_modes[postQueries.view_mode];
|
||||||
})
|
|
||||||
.catch(error => reject(error));
|
if (isOnTheme && viewModeObject != undefined && viewModeObject.type == 'template') {
|
||||||
|
commit('setItemsListTemplate', items );
|
||||||
|
resolve({'itemsListTemplate': items, 'total': res.headers['x-wp-total'], hasFiltered: hasFiltered});
|
||||||
|
} else {
|
||||||
|
commit('setItems', items );
|
||||||
|
resolve({'items': items, 'total': res.headers['x-wp-total'], hasFiltered: hasFiltered});
|
||||||
|
}
|
||||||
|
dispatch('search/setTotalItems', res.headers['x-wp-total'], { root: true } );
|
||||||
|
})
|
||||||
|
.catch(error => reject(error));
|
||||||
|
} else {
|
||||||
|
reject("No fecth_only meta was found.");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const deleteItem = ({ commit }, item_id ) => {
|
export const deleteItem = ({ commit }, { itemId, isPermanently }) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios.tainacan.delete('/items/' + item_id)
|
let endpoint = '/items/' + itemId;
|
||||||
|
if (isPermanently)
|
||||||
|
endpoint = endpoint + '?permanently=1'
|
||||||
|
|
||||||
|
axios.tainacan.delete(endpoint)
|
||||||
.then( res => {
|
.then( res => {
|
||||||
commit('deleteItem', { id: item_id });
|
commit('deleteItem', { id: itemId });
|
||||||
resolve( res );
|
resolve( res );
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
reject( error );
|
reject( error );
|
||||||
|
@ -97,9 +114,13 @@ export const fetchCollectionName = ({ commit }, id) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export const deleteCollection = ({ commit }, id) => {
|
export const deleteCollection = ({ commit }, { collectionId, isPermanently }) => {
|
||||||
return new Promise((resolve, reject) =>{
|
return new Promise((resolve, reject) => {
|
||||||
axios.tainacan.delete('/collections/' + id)
|
let endpoint = '/collections/' + collectionId;
|
||||||
|
if (isPermanently)
|
||||||
|
endpoint = endpoint + '?permanently=true'
|
||||||
|
|
||||||
|
axios.tainacan.delete(endpoint)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
let collection = res.data;
|
let collection = res.data;
|
||||||
commit('deleteCollection', collection);
|
commit('deleteCollection', collection);
|
||||||
|
@ -111,7 +132,19 @@ export const deleteCollection = ({ commit }, id) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export const updateCollection = ({ commit }, { collection_id, name, description, slug, status, enable_cover_page, cover_page_id, moderators_ids, parent }) => {
|
export const updateCollection = ({ commit }, {
|
||||||
|
collection_id,
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
slug,
|
||||||
|
status,
|
||||||
|
enable_cover_page,
|
||||||
|
cover_page_id,
|
||||||
|
moderators_ids,
|
||||||
|
parent,
|
||||||
|
enabled_view_modes,
|
||||||
|
default_view_mode
|
||||||
|
}) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios.tainacan.patch('/collections/' + collection_id, {
|
axios.tainacan.patch('/collections/' + collection_id, {
|
||||||
name: name,
|
name: name,
|
||||||
|
@ -121,7 +154,9 @@ export const updateCollection = ({ commit }, { collection_id, name, description,
|
||||||
cover_page_id: "" + cover_page_id,
|
cover_page_id: "" + cover_page_id,
|
||||||
enable_cover_page: enable_cover_page,
|
enable_cover_page: enable_cover_page,
|
||||||
moderators_ids: moderators_ids,
|
moderators_ids: moderators_ids,
|
||||||
parent: parent
|
parent: parent,
|
||||||
|
enabled_view_modes: enabled_view_modes,
|
||||||
|
default_view_mode: default_view_mode
|
||||||
}).then( res => {
|
}).then( res => {
|
||||||
commit('setCollection', {
|
commit('setCollection', {
|
||||||
id: collection_id,
|
id: collection_id,
|
||||||
|
@ -132,7 +167,9 @@ export const updateCollection = ({ commit }, { collection_id, name, description,
|
||||||
enable_cover_page: enable_cover_page,
|
enable_cover_page: enable_cover_page,
|
||||||
cover_page_id: cover_page_id,
|
cover_page_id: cover_page_id,
|
||||||
moderators_ids: moderators_ids,
|
moderators_ids: moderators_ids,
|
||||||
parent: parent
|
parent: parent,
|
||||||
|
enabled_view_modes: enabled_view_modes,
|
||||||
|
default_view_mode: default_view_mode
|
||||||
});
|
});
|
||||||
resolve( res.data );
|
resolve( res.data );
|
||||||
}).catch( error => {
|
}).catch( error => {
|
||||||
|
|
|
@ -2,6 +2,10 @@ export const getItems = state => {
|
||||||
return state.items;
|
return state.items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getItemsListTemplate = state => {
|
||||||
|
return state.itemsListTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
export const getCollections = state => {
|
export const getCollections = state => {
|
||||||
return state.collections;
|
return state.collections;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import * as mutations from './mutations';
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
items: [],
|
items: [],
|
||||||
|
itemsListTemplate: '',
|
||||||
collections: [],
|
collections: [],
|
||||||
collection: null,
|
collection: null,
|
||||||
collectionName: '',
|
collectionName: '',
|
||||||
|
|
|
@ -3,6 +3,9 @@ import Vue from 'vue';
|
||||||
export const setItems = ( state, items ) => {
|
export const setItems = ( state, items ) => {
|
||||||
state.items = items;
|
state.items = items;
|
||||||
}
|
}
|
||||||
|
export const setItemsListTemplate = ( state, items ) => {
|
||||||
|
state.itemsListTemplate = items;
|
||||||
|
}
|
||||||
|
|
||||||
export const cleanItems = (state) => {
|
export const cleanItems = (state) => {
|
||||||
state.items = [];
|
state.items = [];
|
||||||
|
|
|
@ -9,7 +9,7 @@ export const fetchFilters = ({ commit }, {collectionId, isRepositoryLevel, isCon
|
||||||
else
|
else
|
||||||
endpoint = '/filters/';
|
endpoint = '/filters/';
|
||||||
|
|
||||||
endpoint += '?nopaging=1'
|
endpoint += '?nopaging=1';
|
||||||
|
|
||||||
if (isContextEdit) {
|
if (isContextEdit) {
|
||||||
endpoint += '&context=edit';
|
endpoint += '&context=edit';
|
||||||
|
@ -39,12 +39,14 @@ export const sendFilter = ( { commit }, { collectionId, fieldId, name, filterTyp
|
||||||
endpoint = '/collection/' + collectionId + '/field/' + fieldId +'/filters/';
|
endpoint = '/collection/' + collectionId + '/field/' + fieldId +'/filters/';
|
||||||
else
|
else
|
||||||
endpoint = '/filters/';
|
endpoint = '/filters/';
|
||||||
|
|
||||||
axios.tainacan.post(endpoint + '?context=edit', {
|
axios.tainacan.post(endpoint + '?context=edit', {
|
||||||
filter_type: filterType,
|
filter_type: filterType,
|
||||||
filter: {
|
filter: {
|
||||||
name: name,
|
name: name,
|
||||||
status: status
|
status: status
|
||||||
}
|
},
|
||||||
|
field: fieldId,
|
||||||
})
|
})
|
||||||
.then( res => {
|
.then( res => {
|
||||||
let filter = res.data;
|
let filter = res.data;
|
||||||
|
|
|
@ -96,3 +96,8 @@ export const setOrder = ({ commit }, order ) => {
|
||||||
export const setSearchQuery = ({ commit }, searchQuery ) => {
|
export const setSearchQuery = ({ commit }, searchQuery ) => {
|
||||||
commit('setSearchQuery', searchQuery );
|
commit('setSearchQuery', searchQuery );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Set ViewMode (view_mode)
|
||||||
|
export const setViewMode = ({ commit }, viewMode ) => {
|
||||||
|
commit('setViewMode', viewMode );
|
||||||
|
};
|
|
@ -44,6 +44,10 @@ export const getStatus = state => {
|
||||||
return state.postquery.status;
|
return state.postquery.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getViewMode = state => {
|
||||||
|
return state.postquery.view_mode;
|
||||||
|
}
|
||||||
|
|
||||||
export const getFetchOnly = state => {
|
export const getFetchOnly = state => {
|
||||||
return state.postquery.fetch_only;
|
return state.postquery.fetch_only;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ const state = {
|
||||||
'1': 'creation_date',
|
'1': 'creation_date',
|
||||||
'2': 'author_name'
|
'2': 'author_name'
|
||||||
},
|
},
|
||||||
|
view_mode: 'table'
|
||||||
},
|
},
|
||||||
totalItems: 0
|
totalItems: 0
|
||||||
};
|
};
|
||||||
|
|
|
@ -111,5 +111,9 @@ export const setSearchQuery = ( state, searchQuery ) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setStatus = ( state, status ) => {
|
export const setStatus = ( state, status ) => {
|
||||||
state.status = status;
|
state.postquery.status = status;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const setViewMode = ( state, viewMode ) => {
|
||||||
|
state.postquery.view_mode = viewMode;
|
||||||
};
|
};
|
|
@ -10,6 +10,11 @@ class Theme_Helper {
|
||||||
|
|
||||||
public $visiting_collection_cover = false;
|
public $visiting_collection_cover = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores view modes available to be used by the theme
|
||||||
|
*/
|
||||||
|
private $registered_view_modes = [];
|
||||||
|
|
||||||
public static function get_instance() {
|
public static function get_instance() {
|
||||||
if ( ! isset( self::$instance ) ) {
|
if ( ! isset( self::$instance ) ) {
|
||||||
self::$instance = new self();
|
self::$instance = new self();
|
||||||
|
@ -44,6 +49,13 @@ class Theme_Helper {
|
||||||
|
|
||||||
add_shortcode( 'tainacan-search', array($this, 'search_shortcode'));
|
add_shortcode( 'tainacan-search', array($this, 'search_shortcode'));
|
||||||
|
|
||||||
|
$this->register_view_mode('table', [
|
||||||
|
'label' => __('Table', 'tainacan'),
|
||||||
|
'dynamic_metadata' => true,
|
||||||
|
'icon' => '<span class="icon"><i class="mdi mdi-table mdi-24px"></i></span>',
|
||||||
|
'type' => 'component',
|
||||||
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enqueue_scripts($force = false) {
|
public function enqueue_scripts($force = false) {
|
||||||
|
@ -266,5 +278,77 @@ class Theme_Helper {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a new View Mode
|
||||||
|
*
|
||||||
|
* View Modes are used to display items in the faceted search when browsing a collection using
|
||||||
|
* the current active theme. It can be a php/html template or a web component.
|
||||||
|
*
|
||||||
|
* Collection managers can choose from registered view modes which will be the default mode and what others modes will be available
|
||||||
|
* for the visitors to choose from for each collection
|
||||||
|
*
|
||||||
|
* @param string $slug a unique slug for the view mode
|
||||||
|
* @param array|string $args {
|
||||||
|
* Optional. Array of arguments
|
||||||
|
*
|
||||||
|
* @type string $label Label, visible to users. Default to $slug
|
||||||
|
* @type string $description Description, visible only to editors in the admin. Default none.
|
||||||
|
* @type string $type Type. Accepted values are 'template' or 'component'. Defautl 'template'
|
||||||
|
* @type string $template Full path to the template file to be used. Required if $type is set to template.
|
||||||
|
* Default: theme-path/tainacan/view-mode-{$slug}.php
|
||||||
|
* @type string $component Component tag name. The web component js must be included and must accept two props:
|
||||||
|
* * items - the list of items to be rendered
|
||||||
|
* * displayed_metadata - list of metadata to be displayed
|
||||||
|
* 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 $dynamic_metadata Wether to display or not (and use or not) the "displayed metadata" selector. Default false.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register_view_mode($slug, $args = []) {
|
||||||
|
|
||||||
|
$defaults = array(
|
||||||
|
'label' => $slug,
|
||||||
|
'description' => '',
|
||||||
|
'type' => 'template',
|
||||||
|
'template' => get_stylesheet_directory() . '/tainacan/view-mode-' . $slug . '.php',
|
||||||
|
'component' => 'view-mode-' . $slug,
|
||||||
|
'thumbnail' => '', // get_stylesheet_directory() . '/tainacan/view-mode-' . $slug . '.png',
|
||||||
|
'icon' => '', //
|
||||||
|
'show_pagination' => true,
|
||||||
|
'dynamic_metadata' => false,
|
||||||
|
|
||||||
|
);
|
||||||
|
$args = wp_parse_args($args, $defaults);
|
||||||
|
|
||||||
|
$this->registered_view_modes[$slug] = $args;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all registered view modes
|
||||||
|
*
|
||||||
|
* @return array The list of registered view modes
|
||||||
|
*/
|
||||||
|
public function get_registered_view_modes() {
|
||||||
|
return $this->registered_view_modes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get one specific view mode by its slug
|
||||||
|
*
|
||||||
|
* @param string $slug The view mode slug
|
||||||
|
*
|
||||||
|
* @return array|false The view mode definition or false if it is not found
|
||||||
|
*/
|
||||||
|
public function get_view_mode($slug) {
|
||||||
|
return isset($this->registered_view_modes[$slug]) ? $this->registered_view_modes[$slug] : false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,123 @@
|
||||||
|
<template>
|
||||||
|
<div class="table-container">
|
||||||
|
<div class="table-wrapper">
|
||||||
|
<table class="tainacan-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<!-- Displayed Fields -->
|
||||||
|
<th
|
||||||
|
v-for="(column, index) in tableFields"
|
||||||
|
:key="index"
|
||||||
|
v-if="column.display"
|
||||||
|
class="column-default-width"
|
||||||
|
:class="{
|
||||||
|
'thumbnail-cell': column.field == 'row_thumbnail',
|
||||||
|
'column-small-width' : column.field_type_object != undefined ? (column.field_type_object.className == 'Tainacan\\Field_Types\\Date' || column.field_type_object.className == 'Tainacan\\Field_Types\\Numeric') : false,
|
||||||
|
'column-medium-width' : column.field_type_object != undefined ? (column.field_type_object.className == 'Tainacan\\Field_Types\\Selectbox' || column.field_type_object.className == 'Tainacan\\Field_Types\\Category' || column.field_type_object.className == 'Tainacan\\Field_Types\\Compound') : false,
|
||||||
|
'column-large-width' : column.field_type_object != undefined ? (column.field_type_object.className == 'Tainacan\\Field_Types\\Textarea') : false,
|
||||||
|
}"
|
||||||
|
:custom-key="column.slug">
|
||||||
|
<div class="th-wrap">{{ column.name }}</div>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr
|
||||||
|
:key="index"
|
||||||
|
v-for="(item, index) of items">
|
||||||
|
|
||||||
|
<!-- Item Displayed Metadata -->
|
||||||
|
<td
|
||||||
|
:key="index"
|
||||||
|
v-for="(column, index) in tableFields"
|
||||||
|
v-if="column.display"
|
||||||
|
:label="column.name"
|
||||||
|
:aria-label="(column.field != 'row_thumbnail' && column.field != 'row_creation' && column.field != 'row_author')
|
||||||
|
? column.name + '' + (item.metadata ? item.metadata[column.slug].value_as_string : '') : ''"
|
||||||
|
class="column-default-width"
|
||||||
|
:class="{
|
||||||
|
'thumbnail-cell': column.field == 'row_thumbnail',
|
||||||
|
'column-main-content' : column.field_type_object != undefined ? (column.field_type_object.related_mapped_prop == 'title') : false,
|
||||||
|
'column-needed-width column-align-right' : column.field_type_object != undefined ? (column.field_type_object.className == 'Tainacan\\Field_Types\\Numeric') : false,
|
||||||
|
'column-small-width' : column.field_type_object != undefined ? (column.field_type_object.className == 'Tainacan\\Field_Types\\Date' || column.field_type_object.className == 'Tainacan\\Field_Types\\Numeric') : false,
|
||||||
|
'column-medium-width' : column.field_type_object != undefined ? (column.field_type_object.className == 'Tainacan\\Field_Types\\Selectbox' || column.field_type_object.className == 'Tainacan\\Field_Types\\Category' || column.field_type_object.className == 'Tainacan\\Field_Types\\Compound') : false,
|
||||||
|
'column-large-width' : column.field_type_object != undefined ? (column.field_type_object.className == 'Tainacan\\Field_Types\\Textarea') : false,
|
||||||
|
}"
|
||||||
|
@click="goToItemPage(item)">
|
||||||
|
|
||||||
|
<!-- <data-and-tooltip
|
||||||
|
v-if="column.field !== 'row_thumbnail' &&
|
||||||
|
column.field !== 'row_actions' &&
|
||||||
|
column.field !== 'row_creation'"
|
||||||
|
:data="renderMetadata( item.metadata[column.slug] )"/> -->
|
||||||
|
<p
|
||||||
|
v-tooltip="{
|
||||||
|
content: renderMetadata( item.metadata[column.slug] ),
|
||||||
|
html: true,
|
||||||
|
autoHide: false,
|
||||||
|
placement: 'auto-start'
|
||||||
|
}"
|
||||||
|
v-if="item.metadata != undefined &&
|
||||||
|
column.field !== 'row_thumbnail' &&
|
||||||
|
column.field !== 'row_actions' &&
|
||||||
|
column.field !== 'row_creation' &&
|
||||||
|
column.field !== 'row_author'"
|
||||||
|
v-html="renderMetadata( item.metadata[column.slug] )"/>
|
||||||
|
|
||||||
|
<span v-if="column.field == 'row_thumbnail'">
|
||||||
|
<img
|
||||||
|
class="table-thumb"
|
||||||
|
:src="item[column.slug].thumb">
|
||||||
|
</span>
|
||||||
|
<p
|
||||||
|
v-tooltip="{
|
||||||
|
content: item[column.slug],
|
||||||
|
html: true,
|
||||||
|
autoHide: false,
|
||||||
|
placement: 'auto-start'
|
||||||
|
}"
|
||||||
|
v-if="column.field == 'row_author' || column.field == 'row_creation'">
|
||||||
|
{{ item[column.slug] }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'TableViewMode',
|
||||||
|
props: {
|
||||||
|
collectionId: Number,
|
||||||
|
tableFields: Array,
|
||||||
|
items: Array,
|
||||||
|
isLoading: false
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
goToItemPage(item) {
|
||||||
|
window.location.href = item.url;
|
||||||
|
},
|
||||||
|
renderMetadata(metadata) {
|
||||||
|
|
||||||
|
if (!metadata) {
|
||||||
|
return '';
|
||||||
|
} else if (metadata.date_i18n) {
|
||||||
|
return metadata.date_i18n;
|
||||||
|
} else {
|
||||||
|
return metadata.value_as_html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
|
@ -10,37 +10,46 @@ use \Tainacan\Repositories;
|
||||||
*
|
*
|
||||||
* Each metadata is a label with the field name and the value.
|
* Each metadata is a label with the field name and the value.
|
||||||
*
|
*
|
||||||
* If an ID, a slug or a Tainacan\Entities\Field object is passed, it returns only one metadata, otherwise
|
* If an ID, a slug or a Tainacan\Entities\Field object is passed in 'metadata' parameter, it returns only one metadata, otherwise
|
||||||
* it returns all metadata
|
* it returns all metadata
|
||||||
*
|
*
|
||||||
* @param int|string|Tainacan\Entities\Field $field Field object, ID or slug to retrieve only one field. empty returns all fields
|
|
||||||
* @param array|string $args
|
|
||||||
* @param array|string $args {
|
* @param array|string $args {
|
||||||
* Optional. Array or string of arguments.
|
* Optional. Array or string of arguments.
|
||||||
*
|
*
|
||||||
* @type bool $hide_empty Wether to hide or not fields the item has no value to
|
* @type mixed $metadata Field object, ID or slug to retrieve only one field. empty returns all metadata
|
||||||
* Default: true
|
*
|
||||||
* @type string $before_title String to be added before each metadata title
|
* @type array $metadata__in Array of metadata IDs or Slugs to be retrieved. Default none
|
||||||
* Default '<h3>'
|
*
|
||||||
* @type string $after_title String to be added after each metadata title
|
* @type array $metadata__not_in Array of metadata IDs (slugs not accepted) to excluded. Default none
|
||||||
* Default '</h3>'
|
*
|
||||||
* @type string $before_value String to be added before each metadata value
|
* @type bool $exclude_title Exclude the Core Title Metadata from result. Default false
|
||||||
* Default '<p>'
|
*
|
||||||
* @type string $after_value String to be added after each metadata value
|
* @type bool $exclude_description Exclude the Core Description Metadata from result. Default false
|
||||||
* Default '</p>'
|
*
|
||||||
* }
|
* @type bool $exclude_core Exclude Core Metadata (title and description) from result. Default false
|
||||||
|
*
|
||||||
|
* @type bool $hide_empty Wether to hide or not fields the item has no value to
|
||||||
|
* Default: true
|
||||||
|
* @type string $before_title String to be added before each metadata title
|
||||||
|
* Default '<h3>'
|
||||||
|
* @type string $after_title String to be added after each metadata title
|
||||||
|
* Default '</h3>'
|
||||||
|
* @type string $before_value String to be added before each metadata value
|
||||||
|
* Default '<p>'
|
||||||
|
* @type string $after_value String to be added after each metadata value
|
||||||
|
* Default '</p>'
|
||||||
|
* }
|
||||||
* @return string The HTML output
|
* @return string The HTML output
|
||||||
*/
|
*/
|
||||||
function tainacan_get_the_metadata($field = null, $args = array()) {
|
function tainacan_get_the_metadata($args = array()) {
|
||||||
$post = get_post();
|
|
||||||
$theme_helper = \Tainacan\Theme_Helper::get_instance();
|
|
||||||
|
|
||||||
if (!$theme_helper->is_post_an_item($post))
|
$item = tainacan_get_item();
|
||||||
return;
|
|
||||||
|
|
||||||
$item = new Entities\Item($post);
|
if ($item instanceof \Tainacan\Entities\Item) {
|
||||||
|
return $item->get_metadata_as_html($args);
|
||||||
|
}
|
||||||
|
|
||||||
return $item->get_metadata_as_html($field, $args);
|
return '';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,6 +161,26 @@ function tainacan_the_collection_description() {
|
||||||
echo tainacan_get_the_collection_description();
|
echo tainacan_get_the_collection_description();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Outputs the div used by Vue to render the faceted search
|
||||||
|
*/
|
||||||
|
function tainacan_the_faceted_search() {
|
||||||
|
|
||||||
|
$props = ' ';
|
||||||
|
|
||||||
|
// if in a collection page
|
||||||
|
$collection_id = tainacan_get_collection_id();
|
||||||
|
if ($collection_id) {
|
||||||
|
$props .= 'collection-id="' . $collection_id . '" ';
|
||||||
|
$collection = new \Tainacan\Entities\Collection($collection_id);
|
||||||
|
$props .= 'default-view-mode="' . $collection->get_default_view_mode() . '" ';
|
||||||
|
$props .= 'enabled-view-modes="' . implode(',', $collection->get_enabled_view_modes()) . '" ';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<div id="tainacan-items-page" ', $props, '></div>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When visiting a term archive, returns the current term object
|
* When visiting a term archive, returns the current term object
|
||||||
*
|
*
|
||||||
|
@ -163,3 +192,59 @@ function tainacan_get_term() {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \Tainacan\Theme_Helper->register_view_mode()
|
||||||
|
*/
|
||||||
|
function tainacan_register_view_mode($slug, $args = []) {
|
||||||
|
\Tainacan\Theme_Helper::get_instance()->register_view_mode($slug, $args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Tainacan Item Entity object
|
||||||
|
*
|
||||||
|
* If used inside the Loop of items, will get the Item object for the current post
|
||||||
|
*/
|
||||||
|
function tainacan_get_item($post_id = 0) {
|
||||||
|
$post = get_post( $post_id );
|
||||||
|
|
||||||
|
$theme_helper = \Tainacan\Theme_Helper::get_instance();
|
||||||
|
|
||||||
|
if (!$theme_helper->is_post_an_item($post))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
$item = new Entities\Item($post);
|
||||||
|
|
||||||
|
return $item;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
* selected to be displayed
|
||||||
|
*
|
||||||
|
* @param string|integer The property to be checked. If a string is passed, it will check against
|
||||||
|
* one of the native property of the item, such as title, description and creation_date.
|
||||||
|
* If an integer is passed, it will check against the IDs of the metadata.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function tainacan_current_view_displays($property) {
|
||||||
|
global $view_mode_displayed_fields;
|
||||||
|
|
||||||
|
// Core fields appear in fetch_only as metadata
|
||||||
|
if ($property == 'title' || $property == 'description') {
|
||||||
|
$item = tainacan_get_item();
|
||||||
|
$core_getter_method = "get_core_{$property}_field";
|
||||||
|
$property = $item->get_collection()->$core_getter_method()->get_id();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_string($property)) {
|
||||||
|
return in_array($property, $view_mode_displayed_fields);
|
||||||
|
} elseif (is_integer($property)) {
|
||||||
|
return in_array($property, $view_mode_displayed_fields['meta']);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -257,13 +257,46 @@ class TAINACAN_REST_Terms_Controller extends TAINACAN_UnitApiTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_create_and_fetch_filter_in_repository(){
|
public function test_create_and_fetch_filter_in_repository(){
|
||||||
|
|
||||||
|
$collection = $this->tainacan_entity_factory->create_entity(
|
||||||
|
'collection',
|
||||||
|
array(
|
||||||
|
'name' => 'Collection filtered',
|
||||||
|
'description' => 'Is filtered',
|
||||||
|
),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$field = $this->tainacan_entity_factory->create_entity(
|
||||||
|
'field',
|
||||||
|
array(
|
||||||
|
'name' => 'Field filtered',
|
||||||
|
'description' => 'Is filtered',
|
||||||
|
'collection_id' => $collection->get_id(),
|
||||||
|
'field_type' => 'Tainacan\Field_Types\Text'
|
||||||
|
),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$field2 = $this->tainacan_entity_factory->create_entity(
|
||||||
|
'field',
|
||||||
|
array(
|
||||||
|
'name' => 'Field filtered',
|
||||||
|
'description' => 'Is filtered',
|
||||||
|
'collection_id' => 'default',
|
||||||
|
'field_type' => 'Tainacan\Field_Types\Text'
|
||||||
|
),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$filter_attr = json_encode([
|
$filter_attr = json_encode([
|
||||||
'filter_type' => 'autocomplete',
|
'filter_type' => 'autocomplete',
|
||||||
'filter' => [
|
'filter' => [
|
||||||
'name' => '2x Filter',
|
'name' => '2x Filter',
|
||||||
'description' => 'Description of 2x Filter',
|
'description' => 'Description of 2x Filter',
|
||||||
'status' => 'publish'
|
'status' => 'publish'
|
||||||
]
|
],
|
||||||
|
'field' => $field2->get_id()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$filter_attr2 = json_encode([
|
$filter_attr2 = json_encode([
|
||||||
|
@ -272,7 +305,8 @@ class TAINACAN_REST_Terms_Controller extends TAINACAN_UnitApiTestCase {
|
||||||
'name' => '4x Filter',
|
'name' => '4x Filter',
|
||||||
'description' => 'Description of 4x Filter',
|
'description' => 'Description of 4x Filter',
|
||||||
'status' => 'publish'
|
'status' => 'publish'
|
||||||
]
|
],
|
||||||
|
'field' => $field->get_id()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
#### CREATE A FILTER IN REPOSITORY ####
|
#### CREATE A FILTER IN REPOSITORY ####
|
||||||
|
|
|
@ -171,4 +171,45 @@ class CoreFieldTypes extends TAINACAN_UnitTestCase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_collection_getters() {
|
||||||
|
|
||||||
|
$Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance();
|
||||||
|
|
||||||
|
$collection = $this->tainacan_entity_factory->create_entity(
|
||||||
|
'collection',
|
||||||
|
array(
|
||||||
|
'name' => 'test',
|
||||||
|
),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$fieldDescription = $this->tainacan_entity_factory->create_entity(
|
||||||
|
'field',
|
||||||
|
array(
|
||||||
|
'name' => 'just to confuse',
|
||||||
|
'description' => 'description',
|
||||||
|
'collection' => $collection,
|
||||||
|
'field_type' => 'Tainacan\Field_Types\Text'
|
||||||
|
),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$core_fields = $collection->get_core_fields();
|
||||||
|
|
||||||
|
$this->assertEquals(2, sizeof($core_fields));
|
||||||
|
|
||||||
|
$this->assertNotEquals('Tainacan\Field_Types\Text', $core_fields[0]->get_field_type());
|
||||||
|
$this->assertNotEquals('Tainacan\Field_Types\Text', $core_fields[1]->get_field_type());
|
||||||
|
|
||||||
|
$title = $collection->get_core_title_field();
|
||||||
|
|
||||||
|
$this->assertEquals('Tainacan\Field_Types\Core_Title', $title->get_field_type());
|
||||||
|
|
||||||
|
$description = $collection->get_core_description_field();
|
||||||
|
|
||||||
|
$this->assertEquals('Tainacan\Field_Types\Core_Description', $description->get_field_type());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -5,6 +5,7 @@ use Tainacan\Importer;
|
||||||
/**
|
/**
|
||||||
* Class Importer
|
* Class Importer
|
||||||
*
|
*
|
||||||
|
* @group importer
|
||||||
* @package Test_Tainacan
|
* @package Test_Tainacan
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -45,8 +46,9 @@ class ImporterTests extends TAINACAN_UnitTestCase {
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//$_SESSION['tainacan_importer'][$id]->set_file( './tests/attachment/json_old_tainacan.txt' );
|
//$_SESSION['tainacan_importer'][$id]->set_file( './tests/attachment/json_old_tainacan.txt' );
|
||||||
$url = 'http://localhost/';
|
$url = 'http://localhost/wordpress_tainacan/';
|
||||||
$_SESSION['tainacan_importer'][$id]->set_url($url);
|
$_SESSION['tainacan_importer'][$id]->set_url($url);
|
||||||
|
$_SESSION['tainacan_importer'][$id]->set_repository();
|
||||||
|
|
||||||
while (!$_SESSION['tainacan_importer'][$id]->is_finished())
|
while (!$_SESSION['tainacan_importer'][$id]->is_finished())
|
||||||
{
|
{
|
||||||
|
|
|
@ -131,5 +131,46 @@ class Objects extends TAINACAN_UnitTestCase {
|
||||||
$this->assertEquals('', $newCol->get_name());
|
$this->assertEquals('', $newCol->get_name());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_fetch_one() {
|
||||||
|
|
||||||
|
|
||||||
|
$collection = $this->tainacan_entity_factory->create_entity(
|
||||||
|
'collection',
|
||||||
|
array(
|
||||||
|
'name' => 'teste',
|
||||||
|
'status' => 'publish'
|
||||||
|
),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$collection2 = $this->tainacan_entity_factory->create_entity(
|
||||||
|
'collection',
|
||||||
|
array(
|
||||||
|
'name' => 'teste2',
|
||||||
|
'status' => 'publish'
|
||||||
|
),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$collection3 = $this->tainacan_entity_factory->create_entity(
|
||||||
|
'collection',
|
||||||
|
array(
|
||||||
|
'name' => 'teste3',
|
||||||
|
'status' => 'publish'
|
||||||
|
),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance();
|
||||||
|
|
||||||
|
$one = $Tainacan_Collections->fetch_one(['name' => 'teste2']);
|
||||||
|
|
||||||
|
$this->assertTrue( $one instanceof \Tainacan\Entities\Collection );
|
||||||
|
$this->assertEquals( 'teste2', $one->get_name() );
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue