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
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -109,9 +109,9 @@
|
|||
}
|
||||
},
|
||||
"@vue/component-compiler-utils": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@vue/component-compiler-utils/-/component-compiler-utils-1.2.1.tgz",
|
||||
"integrity": "sha512-l3GdahBgXlp/SoY5KU7mqMqg/BNiJAndpw/6nMfGzFooCGUkq49CT3pCMiSYy0g/2a6iBD37cHBYlsg4nulIwQ==",
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@vue/component-compiler-utils/-/component-compiler-utils-1.3.0.tgz",
|
||||
"integrity": "sha512-CerIPMzE6y4J4v68nUh2NFPjOO8zr2r8UDh/yi63E4bf7YB5Aqhm7Fv90zzTF+sOQgsqTb9dgryvpeDY1/7m9g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"consolidate": "0.15.1",
|
||||
|
@ -430,7 +430,6 @@
|
|||
"version": "5.5.2",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
|
||||
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"co": "4.6.0",
|
||||
"fast-deep-equal": "1.0.0",
|
||||
|
@ -471,12 +470,14 @@
|
|||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
|
||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
|
||||
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4="
|
||||
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
|
||||
"dev": true
|
||||
},
|
||||
"any-observable": {
|
||||
"version": "0.2.0",
|
||||
|
@ -620,7 +621,8 @@
|
|||
"assert-plus": {
|
||||
"version": "0.2.0",
|
||||
"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": {
|
||||
"version": "1.0.0",
|
||||
|
@ -731,7 +733,8 @@
|
|||
"aws-sign2": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz",
|
||||
"integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8="
|
||||
"integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=",
|
||||
"dev": true
|
||||
},
|
||||
"aws4": {
|
||||
"version": "1.6.0",
|
||||
|
@ -1774,6 +1777,7 @@
|
|||
"version": "2.10.1",
|
||||
"resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz",
|
||||
"integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"hoek": "2.16.3"
|
||||
}
|
||||
|
@ -2166,14 +2170,15 @@
|
|||
"dev": true
|
||||
},
|
||||
"caseless": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz",
|
||||
"integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c="
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
|
||||
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
|
||||
},
|
||||
"chalk": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
|
||||
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "2.2.1",
|
||||
"escape-string-regexp": "1.0.5",
|
||||
|
@ -2460,8 +2465,7 @@
|
|||
"co": {
|
||||
"version": "4.6.0",
|
||||
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
|
||||
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=",
|
||||
"dev": true
|
||||
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="
|
||||
},
|
||||
"coa": {
|
||||
"version": "1.0.4",
|
||||
|
@ -2549,9 +2553,10 @@
|
|||
}
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.14.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.14.1.tgz",
|
||||
"integrity": "sha512-+YR16o3rK53SmWHU3rEM3tPAh2rwb1yPcQX5irVn7mb0gXbwuCCrnkbV5+PBfETdfg1vui07nM6PCG1zndcjQw=="
|
||||
"version": "2.15.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
|
||||
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
|
||||
"dev": true
|
||||
},
|
||||
"common-tags": {
|
||||
"version": "1.4.0",
|
||||
|
@ -2805,6 +2810,7 @@
|
|||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz",
|
||||
"integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"boom": "2.10.1"
|
||||
}
|
||||
|
@ -3219,7 +3225,7 @@
|
|||
"performance-now": "0.2.0",
|
||||
"qs": "6.4.0",
|
||||
"safe-buffer": "5.1.1",
|
||||
"stringstream": "0.0.5",
|
||||
"stringstream": "0.0.6",
|
||||
"tough-cookie": "2.3.3",
|
||||
"tunnel-agent": "0.6.0",
|
||||
"uuid": "3.2.1"
|
||||
|
@ -3824,7 +3830,8 @@
|
|||
"escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"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": {
|
||||
"version": "4.19.1",
|
||||
|
@ -4425,8 +4432,7 @@
|
|||
"fast-deep-equal": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz",
|
||||
"integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=",
|
||||
"dev": true
|
||||
"integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8="
|
||||
},
|
||||
"fast-glob": {
|
||||
"version": "2.2.1",
|
||||
|
@ -4444,8 +4450,7 @@
|
|||
"fast-json-stable-stringify": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
|
||||
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",
|
||||
"dev": true
|
||||
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="
|
||||
},
|
||||
"fast-levenshtein": {
|
||||
"version": "2.0.6",
|
||||
|
@ -4694,6 +4699,7 @@
|
|||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz",
|
||||
"integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"asynckit": "0.4.0",
|
||||
"combined-stream": "1.0.6",
|
||||
|
@ -5341,12 +5347,14 @@
|
|||
"generate-function": {
|
||||
"version": "2.0.0",
|
||||
"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": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz",
|
||||
"integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-property": "1.0.2"
|
||||
}
|
||||
|
@ -5705,14 +5713,19 @@
|
|||
"dev": true
|
||||
},
|
||||
"har-validator": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz",
|
||||
"integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=",
|
||||
"version": "5.0.3",
|
||||
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
|
||||
"integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=",
|
||||
"requires": {
|
||||
"chalk": "1.1.3",
|
||||
"commander": "2.14.1",
|
||||
"is-my-json-valid": "2.17.2",
|
||||
"pinkie-promise": "2.0.1"
|
||||
"ajv": "5.5.2",
|
||||
"har-schema": "2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"har-schema": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
|
||||
"integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI="
|
||||
}
|
||||
}
|
||||
},
|
||||
"has": {
|
||||
|
@ -5728,6 +5741,7 @@
|
|||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
|
||||
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-regex": "2.1.1"
|
||||
}
|
||||
|
@ -5833,6 +5847,7 @@
|
|||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz",
|
||||
"integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"boom": "2.10.1",
|
||||
"cryptiles": "2.0.5",
|
||||
|
@ -5860,7 +5875,8 @@
|
|||
"hoek": {
|
||||
"version": "2.16.3",
|
||||
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz",
|
||||
"integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0="
|
||||
"integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=",
|
||||
"dev": true
|
||||
},
|
||||
"home-or-tmp": {
|
||||
"version": "2.0.0",
|
||||
|
@ -5919,7 +5935,7 @@
|
|||
"bluebird": "3.5.1",
|
||||
"cheerio": "0.19.0",
|
||||
"lodash": "3.10.1",
|
||||
"request": "2.79.0"
|
||||
"request": "2.87.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash": {
|
||||
|
@ -6035,6 +6051,7 @@
|
|||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz",
|
||||
"integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"assert-plus": "0.2.0",
|
||||
"jsprim": "1.4.1",
|
||||
|
@ -6523,12 +6540,14 @@
|
|||
"is-my-ip-valid": {
|
||||
"version": "1.0.0",
|
||||
"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": {
|
||||
"version": "2.17.2",
|
||||
"resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz",
|
||||
"integrity": "sha512-IBhBslgngMQN8DDSppmgDv7RNrlFotuuDsKcrCP3+HbFaVivIBU7u9oiiErw8sH4ynx3+gOGQ3q2otkgiSi6kg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"generate-function": "2.0.0",
|
||||
"generate-object-property": "1.2.0",
|
||||
|
@ -6663,7 +6682,8 @@
|
|||
"is-property": {
|
||||
"version": "1.0.2",
|
||||
"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": {
|
||||
"version": "1.0.4",
|
||||
|
@ -6963,8 +6983,7 @@
|
|||
"json-schema-traverse": {
|
||||
"version": "0.3.1",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
|
||||
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=",
|
||||
"dev": true
|
||||
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A="
|
||||
},
|
||||
"json-stable-stringify": {
|
||||
"version": "1.0.1",
|
||||
|
@ -7016,7 +7035,8 @@
|
|||
"jsonpointer": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz",
|
||||
"integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk="
|
||||
"integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=",
|
||||
"dev": true
|
||||
},
|
||||
"jsprim": {
|
||||
"version": "1.4.1",
|
||||
|
@ -7906,7 +7926,7 @@
|
|||
"nopt": "3.0.6",
|
||||
"npmlog": "4.1.2",
|
||||
"osenv": "0.1.5",
|
||||
"request": "2.79.0",
|
||||
"request": "2.87.0",
|
||||
"rimraf": "2.6.2",
|
||||
"semver": "5.3.0",
|
||||
"tar": "2.2.1",
|
||||
|
@ -7979,6 +7999,12 @@
|
|||
"true-case-path": "1.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"caseless": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz",
|
||||
"integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=",
|
||||
"dev": true
|
||||
},
|
||||
"cross-spawn": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz",
|
||||
|
@ -7988,6 +8014,58 @@
|
|||
"lru-cache": "4.1.1",
|
||||
"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": {
|
||||
"version": "2.0.4",
|
||||
"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": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
|
||||
"integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"pinkie": "2.0.4"
|
||||
}
|
||||
|
@ -10321,36 +10401,66 @@
|
|||
"dev": true
|
||||
},
|
||||
"request": {
|
||||
"version": "2.79.0",
|
||||
"resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz",
|
||||
"integrity": "sha1-Tf5b9r6LjNw3/Pk+BLZVd3InEN4=",
|
||||
"version": "2.87.0",
|
||||
"resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz",
|
||||
"integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==",
|
||||
"requires": {
|
||||
"aws-sign2": "0.6.0",
|
||||
"aws-sign2": "0.7.0",
|
||||
"aws4": "1.6.0",
|
||||
"caseless": "0.11.0",
|
||||
"caseless": "0.12.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",
|
||||
"form-data": "2.3.2",
|
||||
"har-validator": "5.0.3",
|
||||
"http-signature": "1.2.0",
|
||||
"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.5",
|
||||
"performance-now": "2.1.0",
|
||||
"qs": "6.5.2",
|
||||
"safe-buffer": "5.1.1",
|
||||
"tough-cookie": "2.3.3",
|
||||
"tunnel-agent": "0.4.3",
|
||||
"tunnel-agent": "0.6.0",
|
||||
"uuid": "3.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"qs": {
|
||||
"version": "6.3.2",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz",
|
||||
"integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw="
|
||||
"assert-plus": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
|
||||
"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": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
|
||||
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
|
||||
"dev": true
|
||||
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
|
||||
},
|
||||
"safe-regex": {
|
||||
"version": "1.1.0",
|
||||
|
@ -10992,6 +11101,7 @@
|
|||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz",
|
||||
"integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"hoek": "2.16.3"
|
||||
}
|
||||
|
@ -11327,14 +11437,16 @@
|
|||
}
|
||||
},
|
||||
"stringstream": {
|
||||
"version": "0.0.5",
|
||||
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
|
||||
"integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg="
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz",
|
||||
"integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==",
|
||||
"dev": true
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
||||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-regex": "2.1.1"
|
||||
}
|
||||
|
@ -11392,7 +11504,8 @@
|
|||
"supports-color": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
|
||||
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc="
|
||||
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
|
||||
"dev": true
|
||||
},
|
||||
"svgo": {
|
||||
"version": "0.7.2",
|
||||
|
@ -11710,9 +11823,12 @@
|
|||
"dev": true
|
||||
},
|
||||
"tunnel-agent": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz",
|
||||
"integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us="
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
||||
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
}
|
||||
},
|
||||
"tweetnacl": {
|
||||
"version": "0.14.5",
|
||||
|
@ -12214,12 +12330,12 @@
|
|||
"dev": true
|
||||
},
|
||||
"vue-loader": {
|
||||
"version": "15.0.11",
|
||||
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.0.11.tgz",
|
||||
"integrity": "sha512-wyCwG/mbMWfW4hIYJbUWEkfPTVj4aMp/8G8qqnbnIsEZJqqCVBQ+pOO59NPQWjub8VAYMBeIB7crHlWsWS2Ufw==",
|
||||
"version": "15.2.0",
|
||||
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.2.0.tgz",
|
||||
"integrity": "sha512-vJuybfEVtYU2HZUqUHMiqBU1/9K2HFplbsRJMca6B2hPNQt5Kx24mrVK9Ej+vlgM+3zf+7WIKKQPjJwvdHbkdA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@vue/component-compiler-utils": "1.2.1",
|
||||
"@vue/component-compiler-utils": "1.3.0",
|
||||
"hash-sum": "1.0.2",
|
||||
"loader-utils": "1.1.0",
|
||||
"vue-hot-reload-api": "2.3.0",
|
||||
|
@ -13249,7 +13365,8 @@
|
|||
"xtend": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
|
||||
"integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68="
|
||||
"integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=",
|
||||
"dev": true
|
||||
},
|
||||
"y18n": {
|
||||
"version": "3.2.1",
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
"style-loader": "^0.21.0",
|
||||
"uglifyjs-webpack-plugin": "^1.2.5",
|
||||
"vue-custom-element": "^3.0.6",
|
||||
"vue-loader": "^15.0.11",
|
||||
"vue-loader": "^15.1.0",
|
||||
"vue-template-compiler": "^2.5.16",
|
||||
"webpack": "^4.8.3",
|
||||
"webpack-cli": "^2.1.3",
|
||||
|
|
|
@ -177,6 +177,7 @@ class Admin {
|
|||
'base_url' => $TAINACAN_BASE_URL,
|
||||
'admin_url' => admin_url(),
|
||||
'custom_header_support' => get_theme_support('custom-header'),
|
||||
'registered_view_modes' => \Tainacan\Theme_Helper::get_instance()->get_registered_view_modes(),
|
||||
];
|
||||
|
||||
$maps = [
|
||||
|
|
|
@ -195,14 +195,17 @@
|
|||
|
||||
if (formNotSaved) {
|
||||
this.$dialog.confirm({
|
||||
title: this.$i18n.get('label_warning'),
|
||||
message: this.$i18n.get('info_warning_category_not_saved'),
|
||||
onConfirm: () => {
|
||||
next();
|
||||
},
|
||||
cancelText: this.$i18n.get('cancel'),
|
||||
confirmText: this.$i18n.get('continue'),
|
||||
type: 'is-secondary'
|
||||
});
|
||||
onConfirm: () => {
|
||||
next();
|
||||
},
|
||||
icon: 'alert-circle',
|
||||
hasIcon: true,
|
||||
cancelText: this.$i18n.get('cancel'),
|
||||
confirmText: this.$i18n.get('continue'),
|
||||
type: 'is-success'
|
||||
});
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
|
|
|
@ -276,6 +276,64 @@
|
|||
</b-select>
|
||||
</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>
|
||||
|
||||
|
@ -324,7 +382,9 @@ export default {
|
|||
thumbnail: '',
|
||||
header_image: '',
|
||||
files:[],
|
||||
moderators_ids: []
|
||||
moderators_ids: [],
|
||||
enabled_view_modes: [],
|
||||
default_view_mode: []
|
||||
},
|
||||
thumbnail: {},
|
||||
cover: {},
|
||||
|
@ -358,7 +418,9 @@ export default {
|
|||
collections: [],
|
||||
isFetchingCollections: true,
|
||||
thumbnailMediaFrame: undefined,
|
||||
headerImageMediaFrame: undefined
|
||||
headerImageMediaFrame: undefined,
|
||||
registeredViewModes: tainacan_plugin.registered_view_modes,
|
||||
viewModesList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -393,7 +455,9 @@ export default {
|
|||
slug: this.form.slug,
|
||||
status: this.form.status,
|
||||
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 => {
|
||||
|
||||
|
@ -406,6 +470,8 @@ export default {
|
|||
this.form.status = this.collection.status;
|
||||
this.form.cover_page_id = this.collection.cover_page_id;
|
||||
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.formErrorMessage = '';
|
||||
|
@ -444,8 +510,10 @@ export default {
|
|||
this.form.cover_page_id = this.collection.cover_page_id;
|
||||
this.form.slug = this.collection.slug;
|
||||
this.form.parent = this.collection.parent;
|
||||
this.form.default_view_mode = this.collection.default_view_mode;
|
||||
this.form.enabled_view_modes = [];
|
||||
this.moderators = [];
|
||||
|
||||
|
||||
// Pre-fill status with publish to incentivate it
|
||||
this.form.status = 'publish';
|
||||
|
||||
|
@ -472,6 +540,18 @@ export default {
|
|||
cancelBack(){
|
||||
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) {
|
||||
this.isFetchingPages = true;
|
||||
this.fetchPages(search)
|
||||
|
@ -601,7 +681,8 @@ export default {
|
|||
this.form.enable_cover_page = this.collection.enable_cover_page;
|
||||
this.form.cover_page_id = this.collection.cover_page_id;
|
||||
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));
|
||||
|
||||
// Generates CoverPage from current cover_page_id info
|
||||
|
@ -639,6 +720,7 @@ export default {
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
if (this.$route.fullPath.split("/").pop() != "new") {
|
||||
document.getElementById('collection-page-container').addEventListener('scroll', ($event) => {
|
||||
this.$emit('onShrinkHeader', ($event.originalTarget.scrollTop > 53));
|
||||
|
@ -653,12 +735,11 @@ export default {
|
|||
|
||||
@import "../../scss/_variables.scss";
|
||||
|
||||
.tainacan-form>.columns>.column {
|
||||
overflow: auto;
|
||||
.field {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.field {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.thumbnail-field {
|
||||
max-height: 128px;
|
||||
margin-bottom: 96px;
|
||||
|
|
|
@ -459,6 +459,7 @@ export default {
|
|||
this.form.document_type = this.item.document_type;
|
||||
|
||||
this.loadMetadata();
|
||||
this.fetchAttachments(this.itemId);
|
||||
|
||||
})
|
||||
.catch(error => this.$console.error(error));
|
||||
|
@ -675,14 +676,17 @@ export default {
|
|||
beforeRouteLeave ( to, from, next ) {
|
||||
if (this.item.status == 'auto-draft') {
|
||||
this.$dialog.confirm({
|
||||
title: this.$i18n.get('label_warning'),
|
||||
message: this.$i18n.get('info_warning_item_not_saved'),
|
||||
onConfirm: () => {
|
||||
next();
|
||||
},
|
||||
cancelText: this.$i18n.get('cancel'),
|
||||
confirmText: this.$i18n.get('continue'),
|
||||
type: 'is-secondary'
|
||||
});
|
||||
onConfirm: () => {
|
||||
next();
|
||||
},
|
||||
icon: 'alert-circle',
|
||||
hasIcon: true,
|
||||
cancelText: this.$i18n.get('cancel'),
|
||||
confirmText: this.$i18n.get('continue'),
|
||||
type: 'is-success'
|
||||
});
|
||||
} else {
|
||||
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) {
|
||||
this.$dialog.confirm({
|
||||
title: this.$i18n.get('label_warning'),
|
||||
message: this.$i18n.get('info_warning_category_delete'),
|
||||
onConfirm: () => {
|
||||
this.deleteCategory(categoryId)
|
||||
|
@ -205,11 +206,15 @@
|
|||
// queue: true
|
||||
// });
|
||||
});
|
||||
}
|
||||
},
|
||||
icon: 'alert-circle',
|
||||
hasIcon: true,
|
||||
type: 'is-success'
|
||||
});
|
||||
},
|
||||
deleteSelectedCategories() {
|
||||
this.$dialog.confirm({
|
||||
title: this.$i18n.get('label_warning'),
|
||||
message: this.$i18n.get('info_warning_selected_categories_delete'),
|
||||
onConfirm: () => {
|
||||
|
||||
|
@ -237,7 +242,10 @@
|
|||
}
|
||||
}
|
||||
this.allCategoriesOnPageSelected = false;
|
||||
}
|
||||
},
|
||||
icon: 'alert-circle',
|
||||
hasIcon: true,
|
||||
type: 'is-success'
|
||||
});
|
||||
},
|
||||
goToCategoryPage(categoryId) {
|
||||
|
|
|
@ -169,7 +169,7 @@
|
|||
@click.prevent.stop="deleteOneCollection(collection.id)">
|
||||
<b-icon
|
||||
type="is-secondary"
|
||||
icon="delete"/>
|
||||
:icon="!isOnTrash ? 'delete' : 'delete-forever'"/>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -197,7 +197,8 @@ export default {
|
|||
totalCollections: 0,
|
||||
page: 1,
|
||||
collectionsPerPage: 12,
|
||||
collections: Array
|
||||
collections: Array,
|
||||
isOnTrash: false
|
||||
},
|
||||
watch: {
|
||||
collections() {
|
||||
|
@ -229,9 +230,10 @@ export default {
|
|||
},
|
||||
deleteOneCollection(collectionId) {
|
||||
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: () => {
|
||||
this.deleteCollection(collectionId)
|
||||
this.deleteCollection({ collectionId: collectionId, isPermanently: this.isOnTrash })
|
||||
.then(() => {
|
||||
// this.$toast.open({
|
||||
// duration: 3000,
|
||||
|
@ -241,7 +243,7 @@ export default {
|
|||
// queue: true
|
||||
// });
|
||||
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);
|
||||
}
|
||||
}).catch(() => {
|
||||
|
@ -253,17 +255,21 @@ export default {
|
|||
// queue: true
|
||||
// })
|
||||
});
|
||||
}
|
||||
},
|
||||
icon: 'alert-circle',
|
||||
hasIcon: true,
|
||||
type: 'is-success'
|
||||
});
|
||||
},
|
||||
deleteSelectedCollections() {
|
||||
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: () => {
|
||||
|
||||
for (let i = 0; i < this.collections.length; i++) {
|
||||
if (this.selectedCollections[i]) {
|
||||
this.deleteCollection(this.collections[i].id)
|
||||
this.deleteCollection({ collectionId: this.collections[i].id, isPermanently: this.isOnTrash })
|
||||
.then(() => {
|
||||
// this.loadCollections();
|
||||
// this.$toast.open({
|
||||
|
@ -285,7 +291,10 @@ export default {
|
|||
}
|
||||
}
|
||||
this.allCollectionsOnPageSelected = false;
|
||||
}
|
||||
},
|
||||
icon: 'alert-circle',
|
||||
hasIcon: true,
|
||||
type: 'is-success'
|
||||
});
|
||||
},
|
||||
goToCollectionPage(collectionId) {
|
||||
|
|
|
@ -195,15 +195,18 @@ export default {
|
|||
}
|
||||
if ((this.openedFieldId != '' && this.openedFieldId != undefined) || hasUnsavedForms ) {
|
||||
this.$dialog.confirm({
|
||||
title: this.$i18n.get('label_warning'),
|
||||
message: this.$i18n.get('info_warning_fields_not_saved'),
|
||||
onConfirm: () => {
|
||||
this.onEditionCanceled();
|
||||
next();
|
||||
},
|
||||
cancelText: this.$i18n.get('cancel'),
|
||||
confirmText: this.$i18n.get('continue'),
|
||||
type: 'is-secondary'
|
||||
});
|
||||
onConfirm: () => {
|
||||
this.onEditionCanceled();
|
||||
next();
|
||||
},
|
||||
icon: 'alert-circle',
|
||||
hasIcon: true,
|
||||
cancelText: this.$i18n.get('cancel'),
|
||||
confirmText: this.$i18n.get('continue'),
|
||||
type: 'is-success'
|
||||
});
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
|
|
|
@ -69,14 +69,14 @@
|
|||
v-model="filter.enabled"
|
||||
@input="onChangeEnable($event, index)"/>
|
||||
<a
|
||||
:style="{ visibility: filter.collection_id != collectionId ? 'hidden' : 'visible' }"
|
||||
:style="{ visibility: filter.collection_id != collectionId && !isRepositoryLevel? 'hidden' : 'visible' }"
|
||||
@click.prevent="editFilter(filter)">
|
||||
<b-icon
|
||||
type="is-gray"
|
||||
icon="pencil"/>
|
||||
</a>
|
||||
<a
|
||||
:style="{ visibility: filter.collection_id != collectionId ? 'hidden' : 'visible' }"
|
||||
:style="{ visibility: filter.collection_id != collectionId && !isRepositoryLevel ? 'hidden' : 'visible' }"
|
||||
@click.prevent="removeFilter(filter)">
|
||||
<b-icon
|
||||
type="is-gray"
|
||||
|
@ -222,15 +222,18 @@ export default {
|
|||
}
|
||||
if ((this.openedFilterId != '' && this.openedFilterId != undefined) || hasUnsavedForms ) {
|
||||
this.$dialog.confirm({
|
||||
title: this.$i18n.get('label_warning'),
|
||||
message: this.$i18n.get('info_warning_filters_not_saved'),
|
||||
onConfirm: () => {
|
||||
this.onEditionCanceled();
|
||||
next();
|
||||
},
|
||||
cancelText: this.$i18n.get('cancel'),
|
||||
confirmText: this.$i18n.get('continue'),
|
||||
type: 'is-secondary'
|
||||
});
|
||||
onConfirm: () => {
|
||||
this.onEditionCanceled();
|
||||
next();
|
||||
},
|
||||
icon: 'alert-circle',
|
||||
hasIcon: true,
|
||||
cancelText: this.$i18n.get('cancel'),
|
||||
confirmText: this.$i18n.get('continue'),
|
||||
type: 'is-success'
|
||||
});
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<template>
|
||||
<div class="table-container">
|
||||
|
||||
<div
|
||||
v-if="!isOnTheme"
|
||||
class="selection-control">
|
||||
<div class="selection-control">
|
||||
<div class="field select-all is-pulled-left">
|
||||
<span>
|
||||
<b-checkbox
|
||||
|
@ -37,13 +35,11 @@
|
|||
</div>
|
||||
|
||||
<div class="table-wrapper">
|
||||
<table
|
||||
:class="{'selectable-table': !isOnTheme }"
|
||||
class="tainacan-table">
|
||||
<table class="tainacan-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- Checking list -->
|
||||
<th v-if="!isOnTheme">
|
||||
<th>
|
||||
|
||||
<!-- nothing to show on header for checkboxes -->
|
||||
</th>
|
||||
|
@ -62,9 +58,7 @@
|
|||
:custom-key="column.slug">
|
||||
<div class="th-wrap">{{ column.name }}</div>
|
||||
</th>
|
||||
<th
|
||||
class="actions-header"
|
||||
v-if="!isOnTheme">
|
||||
<th class="actions-header">
|
||||
|
||||
<!-- nothing to show on header for actions cell-->
|
||||
</th>
|
||||
|
@ -77,7 +71,6 @@
|
|||
v-for="(item, index) of items">
|
||||
<!-- Checking list -->
|
||||
<td
|
||||
v-if="!isOnTheme"
|
||||
:class="{ 'is-selecting': isSelectingItems }"
|
||||
class="checkbox-cell">
|
||||
<b-checkbox
|
||||
|
@ -108,10 +101,10 @@
|
|||
v-if="column.field !== 'row_thumbnail' &&
|
||||
column.field !== 'row_actions' &&
|
||||
column.field !== 'row_creation'"
|
||||
:data="renderMetadata( item.metadata[column.slug] )"/> -->
|
||||
:data="renderMetadata(item.metadata, column)"/> -->
|
||||
<p
|
||||
v-tooltip="{
|
||||
content: renderMetadata( item.metadata[column.slug] ),
|
||||
content: renderMetadata(item.metadata, column),
|
||||
html: true,
|
||||
autoHide: false,
|
||||
placement: 'auto-start'
|
||||
|
@ -121,7 +114,7 @@
|
|||
column.field !== 'row_actions' &&
|
||||
column.field !== 'row_creation' &&
|
||||
column.field !== 'row_author'"
|
||||
v-html="renderMetadata( item.metadata[column.slug] )"/>
|
||||
v-html="renderMetadata(item.metadata, column)"/>
|
||||
|
||||
<span v-if="column.field == 'row_thumbnail'">
|
||||
<img
|
||||
|
@ -143,7 +136,7 @@
|
|||
|
||||
<!-- Actions -->
|
||||
<td
|
||||
v-if="!isOnTheme && item.current_user_can_edit"
|
||||
v-if="item.current_user_can_edit"
|
||||
class="actions-cell"
|
||||
:label="$i18n.get('label_actions')">
|
||||
<div class="actions-container">
|
||||
|
@ -161,7 +154,7 @@
|
|||
@click.prevent.stop="deleteOneItem(item.id)">
|
||||
<b-icon
|
||||
type="is-secondary"
|
||||
icon="delete"/>
|
||||
:icon="!isOnTrash ? 'delete' : 'delete-forever'"/>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -189,7 +182,7 @@ export default {
|
|||
tableFields: Array,
|
||||
items: Array,
|
||||
isLoading: false,
|
||||
isOnTheme: false
|
||||
isOnTrash: false
|
||||
},
|
||||
mounted() {
|
||||
this.selectedItems = [];
|
||||
|
@ -221,9 +214,10 @@ export default {
|
|||
},
|
||||
deleteOneItem(itemId) {
|
||||
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: () => {
|
||||
this.deleteItem(itemId)
|
||||
this.deleteItem({ itemId: itemId, isPermanently: this.isOnTrash })
|
||||
.then(() => {
|
||||
// this.$toast.open({
|
||||
// duration: 3000,
|
||||
|
@ -233,7 +227,7 @@ export default {
|
|||
// queue: true
|
||||
// });
|
||||
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);
|
||||
}
|
||||
}).catch(() => {
|
||||
|
@ -246,17 +240,21 @@ export default {
|
|||
// queue: true
|
||||
// })
|
||||
});
|
||||
}
|
||||
},
|
||||
icon: 'alert-circle',
|
||||
hasIcon: true,
|
||||
type: 'is-success'
|
||||
});
|
||||
},
|
||||
deleteSelectedItems() {
|
||||
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: () => {
|
||||
|
||||
for (let i = 0; i < this.selectedItems.length; i++) {
|
||||
if (this.selectedItems[i]) {
|
||||
this.deleteItem(this.items[i].id)
|
||||
this.deleteItem({ itemId: this.items[i].id, isPermanently: this.isOnTrash })
|
||||
.then(() => {
|
||||
// this.$toast.open({
|
||||
// duration: 3000,
|
||||
|
@ -282,19 +280,21 @@ export default {
|
|||
}
|
||||
}
|
||||
this.allItemsOnPageSelected = false;
|
||||
}
|
||||
},
|
||||
icon: 'alert-circle',
|
||||
hasIcon: true,
|
||||
type: 'is-success'
|
||||
});
|
||||
},
|
||||
goToItemPage(item) {
|
||||
if (this.isOnTheme)
|
||||
window.location.href = item.url;
|
||||
else
|
||||
this.$router.push(this.$routerHelper.getItemPath(this.collectionId, item.id));
|
||||
this.$router.push(this.$routerHelper.getItemPath(this.collectionId, item.id));
|
||||
},
|
||||
goToItemEditPage(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) {
|
||||
return '';
|
||||
|
|
|
@ -213,13 +213,16 @@ export default {
|
|||
// Checks if user is deleting a term with unsaved info.
|
||||
if (term.id == 'new' || !term.saved || term.opened) {
|
||||
this.$dialog.confirm({
|
||||
title: this.$i18n.get('label_warning'),
|
||||
message: this.$i18n.get('info_warning_terms_not_saved'),
|
||||
onCancel: () => { return },
|
||||
onConfirm: () => { this.removeTerm(term);},
|
||||
cancelText: this.$i18n.get('cancel'),
|
||||
confirmText: this.$i18n.get('continue'),
|
||||
type: 'is-secondary'
|
||||
});
|
||||
onCancel: () => { return },
|
||||
onConfirm: () => { this.removeTerm(term); },
|
||||
icon: 'alert-circle',
|
||||
hasIcon: true,
|
||||
cancelText: this.$i18n.get('cancel'),
|
||||
confirmText: this.$i18n.get('continue'),
|
||||
type: 'is-success'
|
||||
});
|
||||
} else{
|
||||
this.removeTerm(term);
|
||||
}
|
||||
|
|
|
@ -1,74 +1,94 @@
|
|||
<template>
|
||||
<nav
|
||||
id="primary-menu"
|
||||
:class="isMenuCompressed ? 'is-compressed' : ''"
|
||||
role="navigation"
|
||||
:aria-label="$i18n.get('label_main_menu')"
|
||||
<nav
|
||||
id="primary-menu"
|
||||
:class="isMenuCompressed ? 'is-compressed' : ''"
|
||||
role="navigation"
|
||||
:aria-label="$i18n.get('label_main_menu')"
|
||||
class="column is-sidebar-menu">
|
||||
<aside class="menu">
|
||||
|
||||
|
||||
<ul class="menu-list">
|
||||
<li><router-link
|
||||
tag="a"
|
||||
to="/collections"
|
||||
:class="activeRoute == 'CollectionsPage' || $route.params.collectionId != undefined ? 'is-active':''">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="folder-multiple"/> <span class="menu-text">{{ $i18n.getFrom('collections', 'name') }}</span>
|
||||
</router-link></li>
|
||||
<!-- <li><router-link
|
||||
tag="a"
|
||||
to="/items"
|
||||
: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>
|
||||
<router-link
|
||||
tag="a"
|
||||
to="/collections"
|
||||
:class="activeRoute == 'CollectionsPage' || $route.params.collectionId != undefined ? 'is-active':''">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="folder-multiple"/>
|
||||
<span class="menu-text">{{ $i18n.getFrom('collections', 'name') }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<li>
|
||||
<router-link
|
||||
tag="a"
|
||||
to="/items"
|
||||
: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><router-link
|
||||
tag="a"
|
||||
to="/fields"
|
||||
:class="activeRoute == 'FieldsPage' ? 'is-active':''">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="format-list-bulleted-type"/> <span class="menu-text">{{ $i18n.getFrom('fields', 'name') }}</span>
|
||||
</router-link></li>
|
||||
<li><router-link
|
||||
tag="a"
|
||||
to="/filters"
|
||||
:class="activeRoute == 'FiltersPage' ? 'is-active':''">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="filter"/> <span class="menu-text">{{ $i18n.getFrom('filters', 'name') }}</span>
|
||||
</router-link></li>
|
||||
<li><router-link
|
||||
tag="a"
|
||||
to="/taxonomies"
|
||||
:class="activeRoute == 'CategoriesPage' ? 'is-active':''">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="shape"/> <span class="menu-text">{{ $i18n.getFrom('categories', 'name') }}</span>
|
||||
</router-link></li>
|
||||
<li><router-link
|
||||
tag="a"
|
||||
to="/events"
|
||||
:class="activeRoute == 'EventsPage' ? 'is-active':''">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="flash"/> <span class="menu-text">{{ $i18n.get('events') }}</span>
|
||||
</router-link></li>
|
||||
<li>
|
||||
<router-link
|
||||
tag="a"
|
||||
to="/fields"
|
||||
:class="activeRoute == 'FieldsPage' ? 'is-active':''">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="format-list-bulleted-type"/>
|
||||
<span class="menu-text">{{ $i18n.getFrom('fields', 'name') }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<li>
|
||||
<router-link
|
||||
tag="a"
|
||||
to="/filters"
|
||||
:class="activeRoute == 'FiltersPage' ? 'is-active':''">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="filter"/>
|
||||
<span class="menu-text">{{ $i18n.getFrom('filters', 'name') }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<li>
|
||||
<router-link
|
||||
tag="a"
|
||||
to="/taxonomies"
|
||||
:class="activeRoute == 'CategoriesPage' ? 'is-active':''">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="shape"/>
|
||||
<span class="menu-text">{{ $i18n.getFrom('categories', 'name') }}</span>
|
||||
</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>
|
||||
</aside>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ActivitiesIcon from '../other/activities-icon.vue';
|
||||
export default {
|
||||
name: 'PrimaryMenu',
|
||||
props: {
|
||||
isMenuCompressed: false,
|
||||
activeRoute: '/collections'
|
||||
}
|
||||
},
|
||||
components: {
|
||||
ActivitiesIcon
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -78,19 +98,22 @@ export default {
|
|||
|
||||
#primary-menu {
|
||||
background-color: $primary;
|
||||
padding: 100px 0px 0px 0px;
|
||||
padding: 100px 0px 0px 0px;
|
||||
-webkit-transition: max-width 0.2s linear; /* Safari */
|
||||
transition: max-width 0.2s linear;
|
||||
transition: max-width 0.2s linear;
|
||||
max-width: $side-menu-width;
|
||||
z-index: 99;
|
||||
|
||||
|
||||
.menu {
|
||||
padding-top: 10px;
|
||||
}
|
||||
.separator {
|
||||
height: 2px;
|
||||
background-color: $separator-color;
|
||||
width: 100%;
|
||||
margin: 24px 0;
|
||||
}
|
||||
li{
|
||||
li {
|
||||
a {
|
||||
color: white;
|
||||
white-space: nowrap;
|
||||
|
@ -99,13 +122,22 @@ export default {
|
|||
line-height: 1.5em;
|
||||
border-radius: 0px;
|
||||
-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 {
|
||||
background-color: $primary;
|
||||
color: $tertiary;
|
||||
|
||||
.activities-icon {
|
||||
fill: $tertiary;
|
||||
}
|
||||
}
|
||||
a:focus{
|
||||
a:focus {
|
||||
box-shadow: none;
|
||||
}
|
||||
.menu-text {
|
||||
|
@ -119,30 +151,32 @@ export default {
|
|||
|
||||
&.is-compressed {
|
||||
max-width: 45px;
|
||||
a {
|
||||
a {
|
||||
padding-left: 0.8em;
|
||||
padding-right: 0.8em;
|
||||
}
|
||||
.menu-text {
|
||||
visibility: hidden;
|
||||
.menu-text {
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 769px) {
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
padding-top: $header-height;
|
||||
.menu{
|
||||
.menu {
|
||||
padding-top: 0px;
|
||||
}
|
||||
ul {
|
||||
ul {
|
||||
flex-flow: wrap;
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
justify-content: space-evenly;
|
||||
.separator { display: none; }
|
||||
a{
|
||||
justify-content: space-evenly;
|
||||
.separator {
|
||||
display: none;
|
||||
}
|
||||
a {
|
||||
padding: 0.8em !important;
|
||||
text-align: center;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
{{ arrayViewPath[index] }}
|
||||
</router-link>
|
||||
<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>
|
||||
</nav>
|
||||
</div>
|
||||
|
@ -83,9 +83,7 @@
|
|||
:to="{ path: $routerHelper.getCollectionEventsPath(id) }"
|
||||
:class="activeRoute == 'CollectionEventsPage' ? 'is-active':''"
|
||||
:aria-label="$i18n.get('label_collection_events')">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="flash"/>
|
||||
<activities-icon />
|
||||
<br>
|
||||
<span class="menu-text">{{ $i18n.get('events') }}</span>
|
||||
</router-link>
|
||||
|
@ -97,6 +95,7 @@
|
|||
|
||||
<script>
|
||||
import { mapActions, mapGetters } from 'vuex';
|
||||
import ActivitiesIcon from '../other/activities-icon.vue';
|
||||
|
||||
export default {
|
||||
name: 'TainacanSubheader',
|
||||
|
@ -109,6 +108,9 @@ export default {
|
|||
activeRouteName: '',
|
||||
}
|
||||
},
|
||||
components: {
|
||||
ActivitiesIcon
|
||||
},
|
||||
props: {
|
||||
id: Number,
|
||||
},
|
||||
|
@ -130,7 +132,8 @@ export default {
|
|||
'fetchCollectionName'
|
||||
]),
|
||||
...mapGetters('collection', [
|
||||
'getCollectionName'
|
||||
'getCollectionName',
|
||||
'getCollection'
|
||||
]),
|
||||
...mapActions('item', [
|
||||
'fetchItemTitle'
|
||||
|
@ -160,6 +163,7 @@ export default {
|
|||
this.fetchCollectionName(this.arrayRealPath[i])
|
||||
.then(collectionName => this.arrayViewPath.splice(i, 1, collectionName))
|
||||
.catch((error) => this.$console.error(error));
|
||||
|
||||
break;
|
||||
case 'items':
|
||||
this.fetchItemTitle(this.arrayRealPath[i])
|
||||
|
@ -179,7 +183,11 @@ export default {
|
|||
}
|
||||
|
||||
} 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]));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -192,7 +200,7 @@ export default {
|
|||
|
||||
this.arrayRealPath = this.$route.path.split("/");
|
||||
this.arrayRealPath = this.arrayRealPath.filter((item) => item.length != 0);
|
||||
|
||||
|
||||
this.generateViewPath();
|
||||
}
|
||||
}
|
||||
|
@ -262,7 +270,6 @@ export default {
|
|||
}
|
||||
|
||||
.level-left {
|
||||
margin-left: 5px;
|
||||
.level-item {
|
||||
display: inline-block;
|
||||
}
|
||||
|
@ -342,9 +349,6 @@ export default {
|
|||
|
||||
.level-left {
|
||||
margin-left: 0px !important;
|
||||
.level-item {
|
||||
margin-left: 30px;
|
||||
}
|
||||
}
|
||||
top: 206px;
|
||||
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 {
|
||||
position: absolute;
|
||||
margin-top: -2px;
|
||||
}
|
||||
|
||||
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>
|
||||
<div>
|
||||
<collections-filter
|
||||
:open="collapsed"
|
||||
:query="getQuery"
|
||||
v-if="isRepositoryLevel"/>
|
||||
<tainacan-filter-item
|
||||
v-show="!isMenuCompressed"
|
||||
:query="getQuery"
|
||||
v-for="(filter, index) in filters"
|
||||
:key="index"
|
||||
:filter="filter"
|
||||
:open="collapsed"/>
|
||||
:open="collapsed"
|
||||
:is-repository-level="isRepositoryLevel"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import CollectionsFilter from '../repository/collection-filter/collection-filter.vue';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
filters: Array,
|
||||
collapsed: Boolean,
|
||||
isRepositoryLevel: Boolean,
|
||||
},
|
||||
methods: {
|
||||
...mapGetters('search',[
|
||||
|
@ -27,6 +34,9 @@
|
|||
getQuery() {
|
||||
return this.getPostQuery();
|
||||
}
|
||||
},
|
||||
components: {
|
||||
CollectionsFilter
|
||||
}
|
||||
}
|
||||
</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 router from './router'
|
||||
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';
|
||||
|
||||
// Configure and Register Plugins
|
||||
|
@ -50,6 +50,7 @@ Vue.use(VTooltip)
|
|||
Vue.use(I18NPlugin);
|
||||
Vue.use(UserPrefsPlugin);
|
||||
Vue.use(RouterHelperPlugin);
|
||||
Vue.use(UserCapabilitiesPlugin);
|
||||
Vue.use(ConsolePlugin, {visual: false});
|
||||
Vue.use(VueMask);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ Vue.use(VueRouter);
|
|||
|
||||
const i18nGet = function (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 = [
|
||||
|
@ -50,8 +50,8 @@ const routes = [
|
|||
]
|
||||
},
|
||||
|
||||
// { 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', 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: '/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 TaincanFiltersList from '../../classes/filter-types/tainacan-filter-item.vue';
|
||||
import ItemsPage from '../pages/lists/items-page.vue';
|
||||
import TableViewMode from '../../theme-helper/table-view-mode.vue';
|
||||
|
||||
// Remaining imports
|
||||
import HelpButton from '../components/other/help-button.vue';
|
||||
|
@ -76,6 +77,8 @@ Vue.component('help-button', HelpButton);
|
|||
Vue.component('draggable', draggable);
|
||||
Vue.component('items-page', ItemsPage);
|
||||
|
||||
Vue.component('table-view-mode', TableViewMode);
|
||||
|
||||
Vue.use(eventBusSearch, { store: store, router: routerTheme});
|
||||
|
||||
import ThemeItemsList from '../theme-items-list.vue';
|
||||
|
@ -85,12 +88,20 @@ new Vue({
|
|||
store,
|
||||
router: routerTheme,
|
||||
data: {
|
||||
collectionId: ''
|
||||
collectionId: '',
|
||||
defaultViewMode: '',
|
||||
enabledViewModes: {}
|
||||
},
|
||||
render: h => h(ThemeItemsList),
|
||||
beforeMount () {
|
||||
|
||||
if (this.$el.attributes['collection-id'] != undefined)
|
||||
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(',');
|
||||
|
||||
}
|
||||
|
||||
});
|
|
@ -254,8 +254,20 @@ RouterHelperPlugin.install = function (Vue, options = {}) {
|
|||
},
|
||||
getEventEditPath(id) {
|
||||
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 />
|
||||
<div
|
||||
class="sub-header"
|
||||
v-if="checkIfUserCanEdit()">
|
||||
v-if="$userCaps.hasCapability('edit_tainacan-taxonomies')">
|
||||
<div class="header-item">
|
||||
<router-link
|
||||
id="button-create-category"
|
||||
|
@ -135,13 +135,6 @@
|
|||
this.status = status;
|
||||
this.loadCategories();
|
||||
},
|
||||
checkIfUserCanEdit() {
|
||||
for (let capability of tainacan_plugin.user_caps) {
|
||||
if (capability == 'edit_tainacan-taxonomies')
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
onChangeCategoriesPerPage(value) {
|
||||
let prevValue = this.categoriesPerPage;
|
||||
this.categoriesPerPage = value;
|
||||
|
@ -205,7 +198,7 @@
|
|||
padding-top: $page-small-top-padding;
|
||||
padding-left: $page-side-padding;
|
||||
padding-right: $page-side-padding;
|
||||
border-bottom: 0.5px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
|
||||
.header-item {
|
||||
display: inline-block;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<tainacan-title />
|
||||
<div
|
||||
class="sub-header"
|
||||
v-if="checkIfUserCanEdit()">
|
||||
v-if="$userCaps.hasCapability('edit_tainacan-collections')">
|
||||
<div class="header-item">
|
||||
<b-dropdown id="collection-creation-options-dropdown">
|
||||
<button
|
||||
|
@ -50,7 +50,8 @@
|
|||
:total-collections="totalCollections"
|
||||
:page="page"
|
||||
:collections-per-page="collectionsPerPage"
|
||||
:collections="collections"/>
|
||||
:collections="collections"
|
||||
:is-on-trash="status == 'trash'"/>
|
||||
|
||||
<!-- Empty state image -->
|
||||
<div v-if="totalCollections <= 0 && !isLoading">
|
||||
|
@ -148,13 +149,6 @@ export default {
|
|||
this.status = status;
|
||||
this.loadCollections();
|
||||
},
|
||||
checkIfUserCanEdit() {
|
||||
for (let capability of tainacan_plugin.user_caps) {
|
||||
if (capability == 'edit_tainacan-collections')
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
onChangeCollectionsPerPage(value) {
|
||||
let prevValue = this.collectionsPerPage;
|
||||
this.collectionsPerPage = value;
|
||||
|
@ -215,7 +209,7 @@ export default {
|
|||
padding-top: $page-small-top-padding;
|
||||
padding-left: $page-side-padding;
|
||||
padding-right: $page-side-padding;
|
||||
border-bottom: 0.5px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
|
||||
.header-item {
|
||||
display: inline-block;
|
||||
|
|
|
@ -167,7 +167,7 @@
|
|||
padding-top: $page-small-top-padding;
|
||||
padding-left: $page-small-side-padding;
|
||||
padding-right: $page-small-side-padding;
|
||||
border-bottom: 0.5px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
|
||||
.header-item {
|
||||
display: inline-block;
|
||||
|
|
|
@ -3,24 +3,28 @@
|
|||
:class="{'primary-page': isRepositoryLevel}">
|
||||
|
||||
<!-- SEARCH AND FILTERS --------------------- -->
|
||||
<!-- Filter menu compress button -->
|
||||
<button
|
||||
id="filter-menu-compress-button"
|
||||
:class="{'filter-menu-compress-button-top-repo': isRepositoryLevel}"
|
||||
:style="{ top: isHeaderShrinked ? '125px' : '152px'}"
|
||||
@click="isFiltersMenuCompressed = !isFiltersMenuCompressed">
|
||||
<b-icon :icon="isFiltersMenuCompressed ? 'menu-right' : 'menu-left'" />
|
||||
</button>
|
||||
<!-- Side bar with search and filters -->
|
||||
<aside
|
||||
v-show="!isFiltersMenuCompressed"
|
||||
class="filters-menu">
|
||||
class="filters-menu"
|
||||
:class="{ 'tainacan-form': isOnTheme }">
|
||||
<b-loading
|
||||
:is-full-page="false"
|
||||
:active.sync="isLoadingFilters"/>
|
||||
|
||||
<b-field class="margin-1">
|
||||
<b-field>
|
||||
<div class="control is-small is-clearfix">
|
||||
<input
|
||||
class="input is-small"
|
||||
:placeholder=" $i18n.get('instruction_search_collection') "
|
||||
:placeholder="$i18n.get('instruction_search')"
|
||||
type="search"
|
||||
autocomplete="on"
|
||||
:value="searchQuery"
|
||||
|
@ -42,12 +46,11 @@
|
|||
</b-field>
|
||||
<!-- <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>
|
||||
<a
|
||||
v-if="!isLoadingFilters && filters.length > 0"
|
||||
v-if="!isLoadingFilters &&
|
||||
((filters.length >= 0 &&
|
||||
isRepositoryLevel) || filters.length > 0)"
|
||||
class="collapse-all is-size-7"
|
||||
@click="collapseAll = !collapseAll">
|
||||
{{ collapseAll ? $i18n.get('label_collapse_all') : $i18n.get('label_expand_all') }}
|
||||
|
@ -61,9 +64,12 @@
|
|||
<br>
|
||||
|
||||
<filters-items-list
|
||||
v-if="!isLoadingFilters && filters.length > 0"
|
||||
v-if="!isLoadingFilters &&
|
||||
((filters.length >= 0 &&
|
||||
isRepositoryLevel) || filters.length > 0)"
|
||||
:filters="filters"
|
||||
:collapsed="collapseAll"/>
|
||||
:collapsed="collapseAll"
|
||||
:is-repository-level="isRepositoryLevel"/>
|
||||
|
||||
<section
|
||||
v-else
|
||||
|
@ -71,11 +77,12 @@
|
|||
<div class="content has-text-gray has-text-centered">
|
||||
<p>
|
||||
<b-icon
|
||||
icon="filter-outline"
|
||||
icon="filter"
|
||||
size="is-large"/>
|
||||
</p>
|
||||
<p>{{ $i18n.get('info_there_is_no_filter' ) }}</p>
|
||||
<router-link
|
||||
v-if="!isOnTheme"
|
||||
id="button-create-filter"
|
||||
:to="isRepositoryLevel ? $routerHelper.getNewFilterPath() : $routerHelper.getNewCollectionFilterPath(collectionId)"
|
||||
tag="button"
|
||||
|
@ -86,54 +93,211 @@
|
|||
</section>
|
||||
</aside>
|
||||
|
||||
<!-- ITEMS LIST AREA (ASIDE THE ASIDE) ------------------------- -->
|
||||
<div
|
||||
id="items-list-area"
|
||||
class="items-list-area"
|
||||
:class="{ 'spaced-to-right': !isFiltersMenuCompressed }">
|
||||
<!-- SEARCH CONTROL ------------------------- -->
|
||||
<b-loading
|
||||
:is-full-page="false"
|
||||
:active.sync="isLoadingFields"/>
|
||||
<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
|
||||
:items="items"
|
||||
id="theme-items-list" /> -->
|
||||
<!-- LISTING RESULTS ------------------------- -->
|
||||
<div class="above-subheader">
|
||||
:active.sync="isLoadingItems"/>
|
||||
|
||||
<!-- SEARCH CONTROL ------------------------- -->
|
||||
<div class="search-control">
|
||||
<b-loading
|
||||
: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
|
||||
v-if="viewMode == 'table' && !isLoadingItems && items.length > 0"
|
||||
v-if="!isOnTheme &&
|
||||
!isLoadingItems &&
|
||||
totalItems > 0"
|
||||
:collection-id="collectionId"
|
||||
:table-fields="tableFields"
|
||||
:items="items"
|
||||
:is-loading="isLoading"
|
||||
:is-on-theme="isOnTheme"/>
|
||||
|
||||
<tainacan-cards-list
|
||||
v-if="viewMode == 'cards' && !isLoadingItems && items.length > 0"
|
||||
:is-loading="isLoadingItems"
|
||||
:is-on-trash="status == 'trash'"/>
|
||||
|
||||
<!-- Theme View Modes -->
|
||||
<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"
|
||||
:items="items"
|
||||
:is-loading="isLoading"/>
|
||||
|
||||
<tainacan-list-list
|
||||
v-if="viewMode == 'list' && !isLoadingItems && items.length > 0"
|
||||
:table-fields="tableFields"
|
||||
:items="items"
|
||||
:is-loading="isLoading"/>
|
||||
:is-loading="isLoadingItems"
|
||||
:is="'table-view-mode'"/>
|
||||
|
||||
<!-- Empty Placeholder (only used in Admin) -->
|
||||
<section
|
||||
v-if="!isLoadingItems && items.length <= 0"
|
||||
v-if="!isOnTheme && !isLoadingItems && totalItems <= 0"
|
||||
class="section">
|
||||
<div class="content has-text-grey has-text-centered">
|
||||
<p>
|
||||
|
@ -155,8 +319,9 @@
|
|||
</router-link>
|
||||
</div>
|
||||
</section>
|
||||
<!-- Pagination Footer -->
|
||||
<pagination v-if="items.length > 0"/>
|
||||
|
||||
<!-- Pagination -->
|
||||
<pagination v-if="totalItems > 0 && (!isOnTheme || registeredViewModes[viewMode].show_pagination)"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -164,14 +329,11 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import SearchControl from '../../components/search/search-control.vue'
|
||||
import ItemsList from '../../components/lists/items-list.vue';
|
||||
import FiltersItemsList from '../../components/search/filters-items-list.vue';
|
||||
import Pagination from '../../components/search/pagination.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';
|
||||
// import AdvancedSearch from '../../components/advanced-search/advanced-search.vue';
|
||||
import { mapActions, mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'ItemsPage',
|
||||
|
@ -189,23 +351,62 @@
|
|||
isOnTheme: false,
|
||||
futureSearchQuery: '',
|
||||
isHeaderShrinked: false,
|
||||
viewMode: 'table'
|
||||
localTableFields: [],
|
||||
registeredViewModes: tainacan_plugin.registered_view_modes
|
||||
}
|
||||
},
|
||||
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: {
|
||||
SearchControl,
|
||||
ItemsList,
|
||||
FiltersItemsList,
|
||||
Pagination,
|
||||
TainacanCardsList,
|
||||
TainacanListList
|
||||
// AdvancedSearch,
|
||||
},
|
||||
watch: {
|
||||
tableFields() {
|
||||
this.localTableFields = JSON.parse(JSON.stringify(this.tableFields));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapGetters('collection', [
|
||||
'getItems'
|
||||
'getItems',
|
||||
'getItemsListTemplate'
|
||||
]),
|
||||
...mapActions('fields', [
|
||||
'fetchFields'
|
||||
|
@ -221,11 +422,47 @@
|
|||
]),
|
||||
...mapGetters('search', [
|
||||
'getSearchQuery',
|
||||
'getStatus'
|
||||
'getStatus',
|
||||
'getOrderBy',
|
||||
'getOrder',
|
||||
'getViewMode',
|
||||
'getTotalItems'
|
||||
]),
|
||||
updateSearch() {
|
||||
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() {
|
||||
|
||||
this.isLoadingFilters = true;
|
||||
|
@ -233,7 +470,7 @@
|
|||
this.fetchFilters({
|
||||
collectionId: this.collectionId,
|
||||
isRepositoryLevel: this.isRepositoryLevel,
|
||||
isContextEdit: true,
|
||||
isContextEdit: !this.isOnTheme,
|
||||
includeDisabled: 'no',
|
||||
})
|
||||
.then(() => this.isLoadingFilters = false)
|
||||
|
@ -245,7 +482,7 @@
|
|||
this.fetchFields({
|
||||
collectionId: this.collectionId,
|
||||
isRepositoryLevel: this.isRepositoryLevel,
|
||||
isContextEdit: false
|
||||
isContextEdit: !this.isOnTheme
|
||||
})
|
||||
.then(() => {
|
||||
|
||||
|
@ -256,19 +493,19 @@
|
|||
slug: 'thumbnail',
|
||||
id: undefined,
|
||||
display: true
|
||||
})
|
||||
;
|
||||
});
|
||||
|
||||
let fetchOnlyFieldIds = [];
|
||||
|
||||
for (let field of this.fields) {
|
||||
if (field.display !== 'never') {
|
||||
// Will be pushed on array
|
||||
|
||||
let display = true;
|
||||
let display;
|
||||
|
||||
if (field.display === 'no') {
|
||||
if (field.display == 'no')
|
||||
display = false;
|
||||
}
|
||||
else if (field.display == 'yes')
|
||||
display = true;
|
||||
|
||||
this.tableFields.push(
|
||||
{
|
||||
|
@ -281,7 +518,8 @@
|
|||
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() {
|
||||
/*
|
||||
document.addEventListener('tainacan-items-change', () => {
|
||||
var themeList = document.getElementById('theme-items-list');
|
||||
var items = themeList.attributes.items.value;
|
||||
|
||||
var e = document.createElement('p');
|
||||
e.innerHTML = items;
|
||||
this.isOnTheme = (this.$route.name === null);
|
||||
|
||||
themeList.appendChild(e);
|
||||
}); */
|
||||
|
||||
this.isOnTheme = (this.$route.name == null);
|
||||
this.isRepositoryLevel = (this.collectionId == undefined);
|
||||
this.isRepositoryLevel = (this.collectionId === undefined);
|
||||
|
||||
this.$eventBusSearch.setCollectionId(this.collectionId);
|
||||
|
||||
|
@ -366,17 +578,24 @@
|
|||
this.hasFiltered = hasFiltered;
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$on('hasToPrepareFieldsAndFilters', () => {
|
||||
this.prepareFieldsAndFilters();
|
||||
this.$eventBusSearch.$on('hasToPrepareFieldsAndFilters', (to) => {
|
||||
/* 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() {
|
||||
//this.$eventBusSearch.updateStoreFromURL();
|
||||
//this.$eventBusSearch.loadItems();
|
||||
|
||||
|
||||
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) {
|
||||
document.getElementById('items-list-area').addEventListener('scroll', ($event) => {
|
||||
this.isHeaderShrinked = ($event.originalTarget.scrollTop > 53);
|
||||
|
@ -391,39 +610,10 @@
|
|||
|
||||
@import '../../scss/_variables.scss';
|
||||
|
||||
.margin-1 {
|
||||
margin-bottom: 0.1rem;
|
||||
}
|
||||
|
||||
.page-container {
|
||||
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 {
|
||||
position: relative;
|
||||
width: $filter-menu-width;
|
||||
|
@ -434,12 +624,24 @@
|
|||
padding: $page-small-side-padding;
|
||||
float: left;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
visibility: visible;
|
||||
display: block;
|
||||
transition: visibility ease 0.5s, display ease 0.5s;
|
||||
margin-bottom: -0.1rem;
|
||||
|
||||
h3 {
|
||||
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 {
|
||||
|
@ -448,29 +650,21 @@
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
.items-list-area {
|
||||
margin-left: 0;
|
||||
transition: margin-left ease 0.5s;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
.filter-menu-compress-button-top-repo {
|
||||
top: 123px !important;
|
||||
}
|
||||
.spaced-to-right {
|
||||
margin-left: $filter-menu-width;
|
||||
}
|
||||
|
||||
#filter-menu-compress-button {
|
||||
position: absolute;
|
||||
z-index: 9;
|
||||
top: 152px;
|
||||
left: 0px;
|
||||
left: 0;
|
||||
max-width: 23px;
|
||||
height: 21px;
|
||||
width: 23px;
|
||||
border: none;
|
||||
background-color: $primary-lighter;
|
||||
color: $tertiary;
|
||||
padding: 0px;
|
||||
padding: 0;
|
||||
border-top-right-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
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>
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
height: inherit !important;
|
||||
box-shadow: none !important;
|
||||
display: inline-flex !important;
|
||||
cursor: pointer;
|
||||
background-color: white;
|
||||
|
||||
&.is-secondary:hover, &.is-secondary:focus {
|
||||
background: $secondary !important;
|
||||
|
|
|
@ -14,16 +14,18 @@
|
|||
}
|
||||
}
|
||||
.dropdown-menu {
|
||||
padding: 0;
|
||||
border-radius: 0px;
|
||||
.dropdown-content {
|
||||
padding: 0;
|
||||
border-radius: 0px !important;
|
||||
.dropdown-item {
|
||||
padding: 0.375rem 1rem;
|
||||
label { margin-bottom: 0; }
|
||||
&.control { font-size: 13px !important; }
|
||||
.b-checkbox { width: 100% };
|
||||
&:hover {
|
||||
background-color: $primary-lighter;
|
||||
}
|
||||
.is-small {
|
||||
color: gray;
|
||||
}
|
||||
&:hover { background-color: $primary-lighter; }
|
||||
.is-small { color: gray; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// Tainacan modals
|
||||
.tainacan-modal-title {
|
||||
h1, h2 {
|
||||
|
@ -35,9 +34,64 @@
|
|||
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 {
|
||||
background-color: rgba(0, 0, 0, 0.70);
|
||||
.modal-card-head, .modal-card-body, .modal-card-foot {
|
||||
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
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
border: none !important;
|
||||
transform: none !important;
|
||||
margin-top: -15px !important;
|
||||
right: 10px !important;
|
||||
color: $primary;
|
||||
right: 15px !important;
|
||||
color: $secondary;
|
||||
display: flex !important;
|
||||
align-items: initial;
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
color: $tainacan-input-color;
|
||||
|
||||
.form-submit {
|
||||
justify-content: start !important;
|
||||
padding: 1em 1.2em 0.4em 1.2em;
|
||||
justify-content: space-between !important;
|
||||
padding: 12px 30px;
|
||||
margin-bottom: 0px;
|
||||
.button {
|
||||
border-width: 1px;
|
||||
|
@ -67,7 +67,6 @@
|
|||
.select {
|
||||
|
||||
select {
|
||||
font-size: 14px;
|
||||
color: $tainacan-input-color;
|
||||
background-color: white !important;
|
||||
border: 1px solid $tainacan-input-background;
|
||||
|
@ -77,11 +76,13 @@
|
|||
}
|
||||
&.is-empty select{
|
||||
background-color: $tainacan-input-background !important;
|
||||
}
|
||||
}
|
||||
.dropdown {
|
||||
.button {
|
||||
border: 1px solid $tainacan-input-background !important;
|
||||
border-radius: 0 !important;
|
||||
padding: 2px 20px !important;
|
||||
}
|
||||
&:not(.is-multiple)::after {
|
||||
margin-top: -0.6em;
|
||||
right: 0.95em;
|
||||
color: $primary;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@ $primary-darker: darken($primary-dark, 5%);
|
|||
$success: #25a189;
|
||||
$success-invert: findColorInvert($success);
|
||||
|
||||
$modal-backgound-color: #bfd8dd;
|
||||
$separator-color: #2b98a4;
|
||||
$tainacan-input-color: #1d1d1d;
|
||||
$tainacan-input-background: #e5e5e5;
|
||||
|
|
|
@ -5,3 +5,4 @@
|
|||
@import "../../../node_modules/bulma/sass/elements/icon.sass"
|
||||
@import "../../../node_modules/bulma/sass/elements/tag.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_created_by' => __( 'Created by', '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
|
||||
'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_insert_url' => __( 'Insert URL', 'tainacan' ),
|
||||
'instruction_write_text' => __( 'Write Text', 'tainacan' ),
|
||||
'instruction_search_repository' => __( 'Search on repository', 'tainacan' ),
|
||||
'instruction_search_collection' => __( 'Search on collection', 'tainacan' ),
|
||||
'instruction_search' => __( 'Search', 'tainacan' ),
|
||||
|
||||
// Info. Other feedback to user.
|
||||
'info_name_is_required' => __( 'Name is required.', 'tainacan' ),
|
||||
|
@ -237,11 +242,15 @@ return [
|
|||
'info_collection_deleted' => __( 'Collection deleted.', 'tainacan' ),
|
||||
'info_item_deleted' => __( 'Item deleted.', 'tainacan' ),
|
||||
'info_category_deleted' => __( 'Taxonomy deleted', 'tainacan' ),
|
||||
'info_warning_collection_delete' => __( 'Do you really want to delete this collection?', 'tainacan' ),
|
||||
'info_warning_item_delete' => __( 'Do you really want to delete this item?', 'tainacan' ),
|
||||
'info_warning_collection_delete' => __( 'Do you really want to permanently delete this collection?', '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_selected_collections_delete' => __( 'Do you really want to delete the selected collections?', 'tainacan' ),
|
||||
'info_warning_selected_items_delete' => __( 'Do you really want to delete the selected items?', 'tainacan' ),
|
||||
'info_warning_selected_collections_delete' => __( 'Do you really want to permanently delete the selected collections?', '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_collection_related' => __( 'The metadata Collection related is required', 'tainacan' ),
|
||||
'info_warning_no_fields_found' => __( 'No metadata found in this collection', 'tainacan' ),
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<template>
|
||||
<items-page
|
||||
class="theme-items-list"
|
||||
class="theme-items-list"
|
||||
:enabled-view-modes="$root.enabledViewModes"
|
||||
:default-view-mode="$root.defaultViewMode"
|
||||
:collection-id="$root.collectionId" />
|
||||
</template>
|
||||
|
||||
|
@ -12,50 +14,31 @@ export default {
|
|||
|
||||
|
||||
<style lang="scss">
|
||||
@import "../admin/scss/_variables.scss";
|
||||
|
||||
// Bulma imports
|
||||
@import "./scss/theme-basics.sass";
|
||||
|
||||
// Buefy imports
|
||||
@import "../../node_modules/buefy/src/scss/components/_datepicker.scss";
|
||||
$speed-slow: 0.5s;
|
||||
@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/_radio.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
|
||||
$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%;
|
||||
|
||||
// Tainacan imports
|
||||
@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/_tainacan-form.scss";
|
||||
|
||||
.theme-items-list {
|
||||
position: relative;
|
||||
display: flex;
|
||||
|
||||
a{ color: $secondary !important }
|
||||
a:hover {
|
||||
|
@ -76,11 +59,8 @@ export default {
|
|||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
display: inline-flex;
|
||||
color: #1d1d1d;
|
||||
font-size: 1.0em;
|
||||
font-weight: normal;
|
||||
cursor: pointer;
|
||||
background-color: white;
|
||||
|
||||
&.is-secondary:hover, &.is-secondary:focus {
|
||||
background: $secondary !important;
|
||||
|
@ -117,198 +97,30 @@ export default {
|
|||
font-size: 14px !important;
|
||||
}
|
||||
#collection-search-button {
|
||||
height: 25px !important;
|
||||
border: 1px solid $secondary !important;
|
||||
height: 32px !important;
|
||||
background-color: $secondary;
|
||||
color: white;
|
||||
}
|
||||
.select {
|
||||
padding-top: 0px !important;
|
||||
select {
|
||||
border: none;
|
||||
border-radius: 1px !important;
|
||||
font-weight: normal;
|
||||
font-size: 14px !important;
|
||||
height: 30px !important;
|
||||
padding: 2px 25px 2px 15px!important;
|
||||
margin-top: 0px !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;
|
||||
}
|
||||
.input, .textarea {
|
||||
font-size: 14px;
|
||||
border: none;
|
||||
border-radius: 1px !important;
|
||||
box-shadow: none !important;
|
||||
|
||||
&:focus, &:active {
|
||||
box-shadow: none !important;
|
||||
background-color: white;
|
||||
border: 1px solid $tainacan-input-background !important;
|
||||
}
|
||||
}
|
||||
.dropdown {
|
||||
display: inline-flex;
|
||||
position: relative;
|
||||
vertical-align: top;
|
||||
}
|
||||
.dropdown, .autocomplete {
|
||||
.dropdown-trigger{
|
||||
.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
display: block;
|
||||
}
|
||||
.b-checkbox.checkbox {
|
||||
|
||||
|
@ -470,5 +282,21 @@ export default {
|
|||
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>
|
||||
|
|
|
@ -375,12 +375,8 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
|
||||
$query_params['perpage'] = array(
|
||||
'description' => __( "Maximum number of $object_name to be returned in result set." ),
|
||||
'type' => 'integer',
|
||||
'type' => 'numeric',
|
||||
'default' => 10,
|
||||
'minimum' => 1,
|
||||
'maximum' => 100,
|
||||
'sanitize_callback' => 'absint',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
$query_params['paged'] = array(
|
||||
|
|
|
@ -110,6 +110,12 @@ class REST_Fields_Controller extends REST_Controller {
|
|||
'permission_callback' => array($this, 'update_item_permissions_check'),
|
||||
'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
|
||||
*/
|
||||
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'];
|
||||
|
||||
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);
|
||||
|
||||
} 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);
|
||||
}
|
||||
|
@ -145,14 +160,28 @@ class REST_Fields_Controller extends REST_Controller {
|
|||
* @throws \Exception
|
||||
*/
|
||||
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 ($request['context'] === 'edit' && ! $collection->can_read()) {
|
||||
return false;
|
||||
if($collection_id) {
|
||||
$collection = $this->collection_repository->fetch( $collection_id );
|
||||
|
||||
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;
|
||||
|
|
|
@ -116,7 +116,7 @@ class REST_Filters_Controller extends REST_Controller {
|
|||
$received_type = $body['filter_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, '_')){
|
||||
$received_type = ucfirst(strtolower($received_type));
|
||||
} else {
|
||||
|
@ -141,10 +141,20 @@ class REST_Filters_Controller extends REST_Controller {
|
|||
$collection_id = $request['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 {
|
||||
$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);
|
||||
|
@ -314,10 +324,11 @@ class REST_Filters_Controller extends REST_Controller {
|
|||
|
||||
if($request['context'] === '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['filter_type_object'] = $item->get_filter_type_object()->_toArray();
|
||||
|
||||
return $item_arr;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Tainacan\API\EndPoints;
|
|||
use \Tainacan\API\REST_Controller;
|
||||
use Tainacan\Repositories;
|
||||
use Tainacan\Entities;
|
||||
use Tainacan\Tests\Collections;
|
||||
|
||||
/**
|
||||
* 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,24 +211,60 @@ class REST_Items_Controller extends REST_Controller {
|
|||
public function get_items( $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');
|
||||
|
||||
$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);
|
||||
|
||||
array_push($response, $prepared_item);
|
||||
if ( isset($request['view_mode']) ) {
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
wp_reset_postdata();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$total_items = $items->found_posts;
|
||||
$max_pages = ceil($total_items / (int) $items->query_vars['posts_per_page']);
|
||||
|
||||
|
@ -261,9 +309,13 @@ class REST_Items_Controller extends REST_Controller {
|
|||
}
|
||||
|
||||
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_orderby,
|
||||
$columns,
|
||||
$default_view_mode,
|
||||
$default_view_mode,
|
||||
$enabled_view_modes,
|
||||
$fields_order,
|
||||
$filters_order,
|
||||
$enable_cover_page,
|
||||
|
@ -354,6 +355,15 @@ class Collection extends Entity {
|
|||
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
|
||||
*
|
||||
|
@ -444,6 +454,73 @@ class Collection extends Entity {
|
|||
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
|
||||
*
|
||||
|
@ -549,6 +626,17 @@ class Collection extends Entity {
|
|||
$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
|
||||
*
|
||||
|
|
|
@ -451,29 +451,40 @@ class Item extends Entity {
|
|||
*
|
||||
* 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
|
||||
*
|
||||
* @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 {
|
||||
* Optional. Array or string of arguments.
|
||||
*
|
||||
* @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>'
|
||||
* }
|
||||
* @param array|string $args {
|
||||
* Optional. Array or string of arguments.
|
||||
*
|
||||
* @type mixed $metadata Field object, ID or slug to retrieve only one field. empty returns all metadata
|
||||
*
|
||||
* @type array $metadata__in Array of metadata IDs or Slugs to be retrieved. Default none
|
||||
*
|
||||
* @type array $metadata__not_in Array of metadata IDs (slugs not accepted) to excluded. Default none
|
||||
*
|
||||
* @type bool $exclude_title Exclude the Core Title Metadata from result. Default false
|
||||
*
|
||||
* @type bool $exclude_description Exclude the Core Description Metadata from result. Default false
|
||||
*
|
||||
* @type bool $exclude_core Exclude Core Metadata (title and description) from result. Default false
|
||||
*
|
||||
* @type bool $hide_empty Wether to hide or not 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
|
||||
* @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_Fields = \Tainacan\Repositories\Fields::get_instance();
|
||||
|
@ -481,6 +492,12 @@ class Item extends Entity {
|
|||
$return = '';
|
||||
|
||||
$defaults = array(
|
||||
'metadata' => null,
|
||||
'metadata__in' => null,
|
||||
'metadata__not_in' => null,
|
||||
'exclude_title' => false,
|
||||
'exclude_description' => false,
|
||||
'exclude_core' => false,
|
||||
'hide_empty' => true,
|
||||
'before_title' => '<h3>',
|
||||
'after_title' => '</h3>',
|
||||
|
@ -489,7 +506,7 @@ class Item extends Entity {
|
|||
);
|
||||
$args = wp_parse_args($args, $defaults);
|
||||
|
||||
if (!is_null($field)) {
|
||||
if (!is_null($args['metadata'])) {
|
||||
|
||||
$field_object = null;
|
||||
|
||||
|
@ -505,6 +522,16 @@ class Item extends Entity {
|
|||
}
|
||||
|
||||
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);
|
||||
if ($item_meta->has_value() || !$args['hide_empty']) {
|
||||
$return .= $args['before_title'] . $field_object->get_name() . $args['after_title'];
|
||||
|
@ -516,10 +543,57 @@ class Item extends Entity {
|
|||
return $return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$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();
|
||||
$fields = $this->get_fields($query_args);
|
||||
|
||||
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']) {
|
||||
$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'];
|
||||
|
|
|
@ -48,7 +48,10 @@ class Core_Description extends Field_Type {
|
|||
*
|
||||
* @param TainacanEntitiesItem_Metadata_Entity $item_metadata
|
||||
* @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) {
|
||||
|
||||
$item = $item_metadata->get_item();
|
||||
|
@ -61,6 +64,8 @@ class Core_Description extends Field_Type {
|
|||
return $item->validate_prop('description');
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
public function validate_options( Field $field ) {
|
||||
|
||||
|
|
|
@ -49,7 +49,10 @@ class Core_Title extends Field_Type {
|
|||
*
|
||||
* @param TainacanEntitiesItem_Metadata_Entity $item_metadata
|
||||
* @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) {
|
||||
|
||||
$item = $item_metadata->get_item();
|
||||
|
@ -62,6 +65,7 @@ class Core_Title extends Field_Type {
|
|||
return $item->validate_prop('title');
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
public function validate_options( Field $field ) {
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
:type="fieldTypeMessage">
|
||||
<span
|
||||
class="collapse-handle"
|
||||
@click="$emit('changeCollapse', !isCollapsed)">
|
||||
@click="$emit('changeCollapse', fieldTypeMessage != 'is-danger' ? !isCollapsed : true)">
|
||||
<b-icon
|
||||
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>
|
||||
<span
|
||||
v-if="field.field.required == 'yes'"
|
||||
|
@ -20,7 +20,7 @@
|
|||
:message="field.field.description"/>
|
||||
</span>
|
||||
<div
|
||||
v-show="isCollapsed"
|
||||
v-show="isCollapsed || fieldTypeMessage == 'is-danger'"
|
||||
v-if="isTextInputComponent( field.field.field_type_object.component )">
|
||||
<component
|
||||
:id="field.field.field_type_object.component + '-' + field.field.slug"
|
||||
|
@ -87,19 +87,19 @@
|
|||
|
||||
let msg = '';
|
||||
let errors = eventBus.getErrors(this.field.field.id);
|
||||
|
||||
|
||||
if ( errors) {
|
||||
this.setFieldTypeMessage('is-danger');
|
||||
for (let error of errors) {
|
||||
for (let index of Object.keys(error)) {
|
||||
//this.$console.log(index);
|
||||
// this.$console.log(index);
|
||||
msg += error[index] + '\n';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setFieldTypeMessage('');
|
||||
}
|
||||
|
||||
|
||||
return msg;
|
||||
}
|
||||
},
|
||||
|
@ -133,8 +133,6 @@
|
|||
},
|
||||
setFieldTypeMessage( 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.field = ( this.field_id ) ? this.field_id : this.filter.field.field_id;
|
||||
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 => {
|
||||
let result = res.data;
|
||||
if( result && result.field_type ){
|
||||
|
@ -75,6 +82,9 @@
|
|||
label: ''
|
||||
}
|
||||
},
|
||||
props: {
|
||||
isRepositoryLevel: Boolean,
|
||||
},
|
||||
mixins: [filter_type_mixin],
|
||||
methods: {
|
||||
setResults(option){
|
||||
|
@ -101,7 +111,7 @@
|
|||
promise = this.getValuesRelationship( collectionTarget );
|
||||
|
||||
} else {
|
||||
promise = this.getValuesPlainText( this.field, query );
|
||||
promise = this.getValuesPlainText( this.field, query, this.isRepositoryLevel );
|
||||
}
|
||||
|
||||
promise.then( () => {
|
||||
|
|
|
@ -22,7 +22,13 @@
|
|||
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;
|
||||
|
||||
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 => {
|
||||
let field = res.data;
|
||||
this.selectedValues( field.field_type_options.taxonomy_id );
|
||||
|
@ -50,7 +56,8 @@
|
|||
id: '',
|
||||
query: {
|
||||
type: Object // concentrate all attributes field id and type
|
||||
}
|
||||
},
|
||||
isRepositoryLevel: Boolean,
|
||||
},
|
||||
watch: {
|
||||
selected( value ){
|
||||
|
|
|
@ -21,7 +21,14 @@
|
|||
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;
|
||||
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 => {
|
||||
let result = res.data;
|
||||
if( result && result.field_type ){
|
||||
|
@ -34,6 +41,9 @@
|
|||
this.$console.log(error);
|
||||
});
|
||||
},
|
||||
props: {
|
||||
isRepositoryLevel: Boolean,
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
isLoading: false,
|
||||
|
@ -63,7 +73,7 @@
|
|||
promise = this.getValuesRelationship( collectionTarget );
|
||||
|
||||
} else {
|
||||
promise = this.getValuesPlainText( this.field );
|
||||
promise = this.getValuesPlainText( this.field, null, this.isRepositoryLevel );
|
||||
}
|
||||
|
||||
promise.then(() => {
|
||||
|
|
|
@ -66,7 +66,13 @@
|
|||
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;
|
||||
|
||||
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 => {
|
||||
let result = res.data;
|
||||
if( result && result.field_type ){
|
||||
|
@ -101,7 +107,8 @@
|
|||
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
|
||||
id: '',
|
||||
query: Object
|
||||
query: Object,
|
||||
isRepositoryLevel: Boolean,
|
||||
},
|
||||
watch: {
|
||||
isTouched( val ){
|
||||
|
|
|
@ -12,9 +12,14 @@ export const filter_type_mixin = {
|
|||
query: {}
|
||||
},
|
||||
methods: {
|
||||
getValuesPlainText(fieldId, search) {
|
||||
getValuesPlainText(fieldId, search, isRepositoryLevel) {
|
||||
|
||||
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 ){
|
||||
url += "&search=" + search;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,14 @@
|
|||
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;
|
||||
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 => {
|
||||
let result = res.data;
|
||||
if( result && result.field_type ){
|
||||
|
@ -40,6 +47,9 @@
|
|||
this.$console.error(error);
|
||||
});
|
||||
},
|
||||
props: {
|
||||
isRepositoryLevel: Boolean,
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
isLoading: false,
|
||||
|
@ -68,7 +78,7 @@
|
|||
this.isLoading = true;
|
||||
|
||||
let promise = null;
|
||||
promise = this.getValuesPlainText( this.field );
|
||||
promise = this.getValuesPlainText( this.field, null, this.isRepositoryLevel );
|
||||
|
||||
promise.then(() => {
|
||||
this.isLoading = false;
|
||||
|
|
|
@ -23,7 +23,14 @@
|
|||
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;
|
||||
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 => {
|
||||
let result = res.data;
|
||||
if( result && result.field_type ){
|
||||
|
@ -48,6 +55,9 @@
|
|||
field_object: {}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
isRepositoryLevel: Boolean
|
||||
},
|
||||
mixins: [filter_type_mixin],
|
||||
watch: {
|
||||
selected( value ){
|
||||
|
@ -77,7 +87,7 @@
|
|||
promise = this.getValuesRelationship( collectionTarget, query );
|
||||
|
||||
} else {
|
||||
promise = this.getValuesPlainText( this.field, query );
|
||||
promise = this.getValuesPlainText( this.field, query, this.isRepositoryLevel );
|
||||
}
|
||||
this.isLoading = true;
|
||||
promise.then(() => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<b-field
|
||||
id="filter-item-forms"
|
||||
class="filter-item-forms"
|
||||
:message="getErrorMessage"
|
||||
:type="filterTypeMessage">
|
||||
<b-collapse
|
||||
|
@ -22,6 +22,7 @@
|
|||
:is="filter.filter_type_object.component"
|
||||
:filter="filter"
|
||||
:query="query"
|
||||
:is-repository-level="isRepositoryLevel"
|
||||
@input="listen( $event )"/>
|
||||
</div>
|
||||
</b-collapse>
|
||||
|
@ -36,6 +37,7 @@
|
|||
props: {
|
||||
filter: Object,
|
||||
query: Object,
|
||||
isRepositoryLevel: Boolean,
|
||||
open: true,
|
||||
},
|
||||
data(){
|
||||
|
@ -76,7 +78,7 @@
|
|||
<style lang="scss">
|
||||
@import "../../../src/admin/scss/_variables.scss";
|
||||
|
||||
#filter-item-forms {
|
||||
.filter-item-forms {
|
||||
|
||||
.datepicker {
|
||||
|
||||
|
@ -250,13 +252,7 @@
|
|||
.tag {
|
||||
height: 2em !important;
|
||||
}
|
||||
|
||||
.autocomplete {
|
||||
.dropdown-content {
|
||||
position: fixed !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.b-checkbox.checkbox {
|
||||
font-weight: normal;
|
||||
font-size: 12px;
|
||||
|
|
|
@ -127,6 +127,15 @@ class Collections extends Repository {
|
|||
'title' => __( 'Default view mode', 'tainacan' ),
|
||||
'type' => 'string',
|
||||
'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(),
|
||||
],
|
||||
'fields_order' => [
|
||||
|
@ -257,6 +266,7 @@ class Collections extends Repository {
|
|||
|
||||
$Tainacan_Fields->register_core_fields( $new_collection );
|
||||
$collection->register_collection_item_post_type();
|
||||
flush_rewrite_rules(false); // needed to activate items post type archive url
|
||||
$this->update_moderators( $new_collection );
|
||||
|
||||
return $new_collection;
|
||||
|
@ -272,7 +282,7 @@ class Collections extends Repository {
|
|||
* @return mixed|Collection
|
||||
*/
|
||||
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] ) );
|
||||
|
||||
if($deleted) {
|
||||
|
|
|
@ -318,8 +318,8 @@ class Fields extends Repository {
|
|||
}
|
||||
|
||||
/**
|
||||
* fetch field by collection, searches all field available
|
||||
*
|
||||
* fetch field by collection, considering inheritance
|
||||
*
|
||||
* @param Entities\Collection $collection
|
||||
* @param array $args WP_Query args plus disabled_fields
|
||||
* @param string $output The desired output format (@see \Tainacan\Repositories\Repository::fetch_output() for possible values)
|
||||
|
@ -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 $field_id
|
||||
|
@ -722,8 +725,9 @@ class Fields extends Repository {
|
|||
|
||||
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 (
|
||||
SELECT ID as item_id
|
||||
FROM $wpdb->posts
|
||||
|
@ -734,8 +738,24 @@ class Fields extends Repository {
|
|||
FROM $wpdb->postmeta $search_query
|
||||
) metas
|
||||
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 );
|
||||
if (!empty($pre_result)) {
|
||||
|
@ -750,8 +770,10 @@ class Fields extends Repository {
|
|||
$post_statuses = get_post_stati( $args, 'names', 'and' );
|
||||
|
||||
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 (
|
||||
SELECT ID as item_id
|
||||
FROM $wpdb->posts
|
||||
|
@ -762,8 +784,24 @@ class Fields extends Repository {
|
|||
FROM $wpdb->postmeta $search_query
|
||||
) metas
|
||||
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 );
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ class Filters extends Repository {
|
|||
*
|
||||
*/
|
||||
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]));
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class Items extends Repository {
|
|||
'type' => 'string',
|
||||
'description' => __( 'Title of the item', 'tainacan' ),
|
||||
'on_error' => __( 'The title should be a text value and not empty', 'tainacan' ),
|
||||
'validation' => v::stringType()->notEmpty(),
|
||||
//'validation' => v::stringType()->notEmpty(),
|
||||
],
|
||||
'status' => [
|
||||
'map' => 'post_status',
|
||||
|
@ -289,7 +289,7 @@ class Items extends Repository {
|
|||
* @return mixed|Entities\Item
|
||||
*/
|
||||
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] ) );
|
||||
|
||||
|
|
|
@ -510,6 +510,31 @@ abstract class Repository {
|
|||
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
|
||||
*
|
||||
|
|
|
@ -186,7 +186,7 @@ class Taxonomies extends Repository {
|
|||
$taxonomy_name = $args[1];
|
||||
$permanently = $args[2];
|
||||
|
||||
if($permanently === true){
|
||||
if($permanently == true){
|
||||
$unregistered = unregister_taxonomy($taxonomy_name);
|
||||
|
||||
if($unregistered instanceof \WP_Error){
|
||||
|
|
|
@ -765,9 +765,13 @@ class Old_Tainacan extends Importer
|
|||
*/
|
||||
public function get_total_items_from_source()
|
||||
{
|
||||
if(!isset($this->tmp_file)){
|
||||
return 0;
|
||||
}
|
||||
|
||||
$file = new \SplFileObject( $this->tmp_file, 'r' );
|
||||
$file_content = unserialize($file->fread($file->getSize()));
|
||||
|
||||
return $this->total_items = $file_content->found_items;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ export default {
|
|||
});
|
||||
},
|
||||
watch: {
|
||||
'$route' () {
|
||||
if (this.$route.params.collectionId)
|
||||
'$route' (to, from) {
|
||||
if (this.$route.params.collectionId)
|
||||
this.collectionId = parseInt(this.$route.params.collectionId);
|
||||
|
||||
if (this.$route.name == null || this.$route.name == undefined || this.$route.name == 'CollectionItemsPage' || this.$route.name == 'ItemsPage') {
|
||||
|
@ -40,9 +40,9 @@ export default {
|
|||
if (this.$route.query.orderby == undefined)
|
||||
this.$route.query.orderby = 'date';
|
||||
|
||||
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.updateURLQueries();
|
||||
},
|
||||
setViewMode(viewMode) {
|
||||
this.$store.dispatch('search/setViewMode', viewMode);
|
||||
this.updateURLQueries();
|
||||
},
|
||||
updateURLQueries() {
|
||||
this.$router.push({ query: {}});
|
||||
this.$router.push({ query: this.$store.getters['search/getPostQuery'] });
|
||||
|
@ -115,18 +119,20 @@ export default {
|
|||
updateStoreFromURL() {
|
||||
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)
|
||||
this.$emit( 'hasToPrepareFieldsAndFilters');
|
||||
this.$emit( 'hasToPrepareFieldsAndFilters', to);
|
||||
else {
|
||||
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( 'hasFiltered', res.hasFiltered);
|
||||
//var event = new Event('tainacan-items-change')
|
||||
//document.dispatchEvent(event);
|
||||
})
|
||||
.catch(() => {
|
||||
this.$emit( 'isLoadingItems', false);
|
||||
|
|
|
@ -36,6 +36,7 @@ export const eventBus = new Vue({
|
|||
},
|
||||
updateValue(data){
|
||||
if ( data.item_id ){
|
||||
|
||||
let values = ( Array.isArray( data.values[0] ) ) ? data.values[0] : data.values ;
|
||||
const promisse = this.$store.dispatch('item/updateMetadata',
|
||||
{ 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 );
|
||||
return ( error ) ? error.errors : false
|
||||
},
|
||||
|
|
|
@ -21,23 +21,40 @@ export const fetchItems = ({ rootGetters, dispatch, commit }, { collectionId, is
|
|||
|
||||
if (!isOnTheme)
|
||||
endpoint = endpoint + 'context=edit&'
|
||||
|
||||
axios.tainacan.get(endpoint + qs.stringify(postQueries) )
|
||||
.then(res => {
|
||||
let items = res.data;
|
||||
commit('setItems', items );
|
||||
dispatch('search/setTotalItems', res.headers['x-wp-total'], { root: true } );
|
||||
resolve({'items': items, 'total': res.headers['x-wp-total'], hasFiltered: hasFiltered});
|
||||
})
|
||||
.catch(error => reject(error));
|
||||
|
||||
if (qs.stringify(postQueries.fetch_only['meta']) != '') {
|
||||
axios.tainacan.get(endpoint + qs.stringify(postQueries))
|
||||
.then(res => {
|
||||
|
||||
let items = res.data;
|
||||
let viewModeObject = tainacan_plugin.registered_view_modes[postQueries.view_mode];
|
||||
|
||||
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) => {
|
||||
axios.tainacan.delete('/items/' + item_id)
|
||||
let endpoint = '/items/' + itemId;
|
||||
if (isPermanently)
|
||||
endpoint = endpoint + '?permanently=1'
|
||||
|
||||
axios.tainacan.delete(endpoint)
|
||||
.then( res => {
|
||||
commit('deleteItem', { id: item_id });
|
||||
commit('deleteItem', { id: itemId });
|
||||
resolve( res );
|
||||
}).catch((error) => {
|
||||
reject( error );
|
||||
|
@ -97,9 +114,13 @@ export const fetchCollectionName = ({ commit }, id) => {
|
|||
});
|
||||
}
|
||||
|
||||
export const deleteCollection = ({ commit }, id) => {
|
||||
return new Promise((resolve, reject) =>{
|
||||
axios.tainacan.delete('/collections/' + id)
|
||||
export const deleteCollection = ({ commit }, { collectionId, isPermanently }) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let endpoint = '/collections/' + collectionId;
|
||||
if (isPermanently)
|
||||
endpoint = endpoint + '?permanently=true'
|
||||
|
||||
axios.tainacan.delete(endpoint)
|
||||
.then(res => {
|
||||
let collection = res.data;
|
||||
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) => {
|
||||
axios.tainacan.patch('/collections/' + collection_id, {
|
||||
name: name,
|
||||
|
@ -121,7 +154,9 @@ export const updateCollection = ({ commit }, { collection_id, name, description,
|
|||
cover_page_id: "" + cover_page_id,
|
||||
enable_cover_page: enable_cover_page,
|
||||
moderators_ids: moderators_ids,
|
||||
parent: parent
|
||||
parent: parent,
|
||||
enabled_view_modes: enabled_view_modes,
|
||||
default_view_mode: default_view_mode
|
||||
}).then( res => {
|
||||
commit('setCollection', {
|
||||
id: collection_id,
|
||||
|
@ -132,7 +167,9 @@ export const updateCollection = ({ commit }, { collection_id, name, description,
|
|||
enable_cover_page: enable_cover_page,
|
||||
cover_page_id: cover_page_id,
|
||||
moderators_ids: moderators_ids,
|
||||
parent: parent
|
||||
parent: parent,
|
||||
enabled_view_modes: enabled_view_modes,
|
||||
default_view_mode: default_view_mode
|
||||
});
|
||||
resolve( res.data );
|
||||
}).catch( error => {
|
||||
|
|
|
@ -2,6 +2,10 @@ export const getItems = state => {
|
|||
return state.items;
|
||||
}
|
||||
|
||||
export const getItemsListTemplate = state => {
|
||||
return state.itemsListTemplate;
|
||||
}
|
||||
|
||||
export const getCollections = state => {
|
||||
return state.collections;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import * as mutations from './mutations';
|
|||
|
||||
const state = {
|
||||
items: [],
|
||||
itemsListTemplate: '',
|
||||
collections: [],
|
||||
collection: null,
|
||||
collectionName: '',
|
||||
|
|
|
@ -3,6 +3,9 @@ import Vue from 'vue';
|
|||
export const setItems = ( state, items ) => {
|
||||
state.items = items;
|
||||
}
|
||||
export const setItemsListTemplate = ( state, items ) => {
|
||||
state.itemsListTemplate = items;
|
||||
}
|
||||
|
||||
export const cleanItems = (state) => {
|
||||
state.items = [];
|
||||
|
|
|
@ -9,7 +9,7 @@ export const fetchFilters = ({ commit }, {collectionId, isRepositoryLevel, isCon
|
|||
else
|
||||
endpoint = '/filters/';
|
||||
|
||||
endpoint += '?nopaging=1'
|
||||
endpoint += '?nopaging=1';
|
||||
|
||||
if (isContextEdit) {
|
||||
endpoint += '&context=edit';
|
||||
|
@ -39,12 +39,14 @@ export const sendFilter = ( { commit }, { collectionId, fieldId, name, filterTyp
|
|||
endpoint = '/collection/' + collectionId + '/field/' + fieldId +'/filters/';
|
||||
else
|
||||
endpoint = '/filters/';
|
||||
|
||||
axios.tainacan.post(endpoint + '?context=edit', {
|
||||
filter_type: filterType,
|
||||
filter: {
|
||||
name: name,
|
||||
status: status
|
||||
}
|
||||
},
|
||||
field: fieldId,
|
||||
})
|
||||
.then( res => {
|
||||
let filter = res.data;
|
||||
|
|
|
@ -95,4 +95,9 @@ export const setOrder = ({ commit }, order ) => {
|
|||
// Set search query
|
||||
export const setSearchQuery = ({ commit }, 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;
|
||||
}
|
||||
|
||||
export const getViewMode = state => {
|
||||
return state.postquery.view_mode;
|
||||
}
|
||||
|
||||
export const getFetchOnly = state => {
|
||||
return state.postquery.fetch_only;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ const state = {
|
|||
'1': 'creation_date',
|
||||
'2': 'author_name'
|
||||
},
|
||||
view_mode: 'table'
|
||||
},
|
||||
totalItems: 0
|
||||
};
|
||||
|
|
|
@ -111,5 +111,9 @@ export const setSearchQuery = ( state, searchQuery ) => {
|
|||
};
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Stores view modes available to be used by the theme
|
||||
*/
|
||||
private $registered_view_modes = [];
|
||||
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
|
@ -43,6 +48,13 @@ class Theme_Helper {
|
|||
add_filter('get_the_archive_title', array($this, 'filter_archive_title'));
|
||||
|
||||
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',
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
@ -265,6 +277,78 @@ 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.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @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>'
|
||||
* }
|
||||
* Optional. Array or string of arguments.
|
||||
*
|
||||
* @type mixed $metadata Field object, ID or slug to retrieve only one field. empty returns all metadata
|
||||
*
|
||||
* @type array $metadata__in Array of metadata IDs or Slugs to be retrieved. Default none
|
||||
*
|
||||
* @type array $metadata__not_in Array of metadata IDs (slugs not accepted) to excluded. Default none
|
||||
*
|
||||
* @type bool $exclude_title Exclude the Core Title Metadata from result. Default false
|
||||
*
|
||||
* @type bool $exclude_description Exclude the Core Description Metadata from result. Default false
|
||||
*
|
||||
* @type bool $exclude_core Exclude Core Metadata (title and description) from result. Default false
|
||||
*
|
||||
* @type bool $hide_empty Wether to hide or not 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
|
||||
*/
|
||||
function tainacan_get_the_metadata($field = null, $args = array()) {
|
||||
$post = get_post();
|
||||
$theme_helper = \Tainacan\Theme_Helper::get_instance();
|
||||
function tainacan_get_the_metadata($args = array()) {
|
||||
|
||||
if (!$theme_helper->is_post_an_item($post))
|
||||
return;
|
||||
|
||||
$item = new Entities\Item($post);
|
||||
|
||||
return $item->get_metadata_as_html($field, $args);
|
||||
$item = tainacan_get_item();
|
||||
|
||||
if ($item instanceof \Tainacan\Entities\Item) {
|
||||
return $item->get_metadata_as_html($args);
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
|
@ -152,6 +161,26 @@ function tainacan_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
|
||||
*
|
||||
|
@ -162,4 +191,60 @@ function tainacan_get_term() {
|
|||
return get_queried_object();
|
||||
}
|
||||
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(){
|
||||
|
||||
$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_type' => 'autocomplete',
|
||||
'filter' => [
|
||||
'name' => '2x Filter',
|
||||
'description' => 'Description of 2x Filter',
|
||||
'status' => 'publish'
|
||||
]
|
||||
],
|
||||
'field' => $field2->get_id()
|
||||
]);
|
||||
|
||||
$filter_attr2 = json_encode([
|
||||
|
@ -272,7 +305,8 @@ class TAINACAN_REST_Terms_Controller extends TAINACAN_UnitApiTestCase {
|
|||
'name' => '4x Filter',
|
||||
'description' => 'Description of 4x Filter',
|
||||
'status' => 'publish'
|
||||
]
|
||||
],
|
||||
'field' => $field->get_id()
|
||||
]);
|
||||
|
||||
#### CREATE A FILTER IN REPOSITORY ####
|
||||
|
|
|
@ -170,5 +170,46 @@ class CoreFieldTypes extends TAINACAN_UnitTestCase {
|
|||
$this->assertFalse($core_description->validate(), 'Core metadata should not validate because it can not allow it to have multiple');
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
*
|
||||
* @group importer
|
||||
* @package Test_Tainacan
|
||||
*/
|
||||
|
||||
|
@ -45,8 +46,9 @@ class ImporterTests extends TAINACAN_UnitTestCase {
|
|||
//}
|
||||
|
||||
//$_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_repository();
|
||||
|
||||
while (!$_SESSION['tainacan_importer'][$id]->is_finished())
|
||||
{
|
||||
|
@ -161,9 +163,9 @@ class ImporterTests extends TAINACAN_UnitTestCase {
|
|||
$file_name = 'demosaved.csv';
|
||||
$csv_importer = new Importer\CSV();
|
||||
$id = $csv_importer->get_id();
|
||||
|
||||
|
||||
$_SESSION['tainacan_importer'][$id]->set_items_per_step(2);
|
||||
|
||||
|
||||
// open the file "demosaved.csv" for writing
|
||||
$file = fopen($file_name, 'w');
|
||||
|
||||
|
@ -230,7 +232,7 @@ class ImporterTests extends TAINACAN_UnitTestCase {
|
|||
$this->assertEquals( $_SESSION['tainacan_importer'][$id]->get_mapping(), $map );
|
||||
|
||||
//execute the process
|
||||
|
||||
|
||||
$this->assertEquals(2, $_SESSION['tainacan_importer'][$id]->run(), 'first step should import 2 items');
|
||||
$this->assertEquals(4, $_SESSION['tainacan_importer'][$id]->run(), 'second step should import 2 items');
|
||||
$this->assertEquals(5, $_SESSION['tainacan_importer'][$id]->run(), 'third step should import 3 items');
|
||||
|
@ -250,4 +252,4 @@ class ImporterTests extends TAINACAN_UnitTestCase {
|
|||
$_SESSION['tainacan_importer'][$id]->fetch_from_remote( 'http://localhost/wordpress-test/wp-json' );
|
||||
$this->assertTrue( isset( $_SESSION['tainacan_importer'][$id]->tmp_file ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,5 +131,46 @@ class Objects extends TAINACAN_UnitTestCase {
|
|||
$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