diff --git a/.babelrc b/.babelrc index 3993cf614..835a1bdf2 100644 --- a/.babelrc +++ b/.babelrc @@ -1,6 +1,6 @@ { "presets": [ - ["es2015", { "modules": false }], - ["stage-2"] + ["env", { "modules": false }], + ["stage-3"] ] } \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js index b09c636ba..e2873fa26 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,16 +1,19 @@ module.exports = { - extends: [ - // add more generic rulesets here, such as: - 'eslint:recommended', - 'plugin:vue/strongly-recommended' - ], - rules: { - // override/add rules settings here, such as: - 'vue/no-unused-vars': 'error', - "no-console": "warn", - "no-unused-vars": "warn", - "no-undef": "warn", - "vue/html-indent": "off", - "vue/require-default-prop": "off", // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-default-prop.md - } + extends: [ + // add more generic rulesets here, such as: + 'eslint:recommended', + 'plugin:vue/strongly-recommended' + ], + parserOptions: { + "ecmaVersion": 2017 + }, + rules: { + // override/add rules settings here, such as: + 'vue/no-unused-vars': 'error', + "no-console": "warn", + "no-unused-vars": "warn", + "no-undef": "warn", + "vue/html-indent": "off", + "vue/require-default-prop": "off", // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-default-prop.md + } } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 81dbc01ee..67bb17ae9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,16 @@ "lodash.once": "^4.1.1" } }, + "@mrmlnc/readdir-enhanced": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", + "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==", + "dev": true, + "requires": { + "call-me-maybe": "^1.0.1", + "glob-to-regexp": "^0.3.0" + } + }, "@sindresorhus/is": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz", @@ -1099,10 +1109,29 @@ "babel-types": "^6.24.1" } }, + "babel-polyfill": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz", + "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "core-js": "^2.5.0", + "regenerator-runtime": "^0.10.5" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", + "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", + "dev": true + } + } + }, "babel-preset-env": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", - "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.7.0.tgz", + "integrity": "sha512-9OR2afuKDneX2/q2EurSftUYM0xGu4O2D9adAhVfADDhrYDaxXV0rBbevVYoY9n6nyX1PmQW/0jtpJvUNr9CHg==", "dev": true, "requires": { "babel-plugin-check-es2015-constants": "^6.22.0", @@ -1132,25 +1161,25 @@ "babel-plugin-transform-es2015-unicode-regex": "^6.22.0", "babel-plugin-transform-exponentiation-operator": "^6.22.0", "babel-plugin-transform-regenerator": "^6.22.0", - "browserslist": "^2.1.2", + "browserslist": "^3.2.6", "invariant": "^2.2.2", "semver": "^5.3.0" }, "dependencies": { "browserslist": { - "version": "2.11.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.11.3.tgz", - "integrity": "sha512-yWu5cXT7Av6mVwzWc8lMsJMHWn4xyjSuGYi4IozbVTLUOEYPSagUB8kiMDUHA1fS3zjr8nkxkn9jdvug4BBRmA==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-3.2.7.tgz", + "integrity": "sha512-oYVLxFVqpX9uMhOIQBLtZL+CX4uY8ZpWcjNTaxyWl5rO8yA9SSNikFnAfvk8J3P/7z3BZwNmEqFKaJoYltj3MQ==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30000792", - "electron-to-chromium": "^1.3.30" + "caniuse-lite": "^1.0.30000835", + "electron-to-chromium": "^1.3.45" } }, "electron-to-chromium": { - "version": "1.3.31", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.31.tgz", - "integrity": "sha512-XE4CLbswkZgZFn34cKFy1xaX+F5LHxeDLjY1+rsK9asDzknhbrd9g/n/01/acbU25KTsUSiLKwvlLyA+6XLUOA==", + "version": "1.3.47", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.47.tgz", + "integrity": "sha1-dk6IfKkQTQGgrI6r7n38DizhQQQ=", "dev": true } } @@ -1768,6 +1797,12 @@ } } }, + "call-me-maybe": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", + "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=", + "dev": true + }, "caller-path": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", @@ -1836,9 +1871,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30000792", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000792.tgz", - "integrity": "sha1-0M6pgfgRjzlhRxr7tDyaHlu/AzI=", + "version": "1.0.30000842", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000842.tgz", + "integrity": "sha512-juspQHLwQRgptEM03HN66SpM/ggZUB+m49NAgJIaIS11aXVNeRB57sEY1X6tEzeK2THGvYWKZZu1wIbh+W7YTA==", "dev": true }, "caseless": { @@ -2994,9 +3029,9 @@ "dev": true }, "deep-extend": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", - "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.1.tgz", + "integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==", "dev": true }, "deep-is": { @@ -3154,6 +3189,33 @@ "randombytes": "^2.0.0" } }, + "dir-glob": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.0.0.tgz", + "integrity": "sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "path-type": "^3.0.0" + }, + "dependencies": { + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, "dns-equal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", @@ -3271,9 +3333,9 @@ "dev": true }, "ejs": { - "version": "2.5.9", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.5.9.tgz", - "integrity": "sha512-GJCAeDBKfREgkBtgrYSf9hQy9kTb3helv0zGdzqhM7iAkW8FA/ZF97VQDbwFiwIT8MQLLOe5VlPZOEvZAqtUAQ==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.6.1.tgz", + "integrity": "sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ==", "dev": true }, "electron-to-chromium": { @@ -3757,14 +3819,14 @@ }, "dependencies": { "fill-range": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", - "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", + "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", "dev": true, "requires": { "is-number": "^2.1.0", "isobject": "^2.0.0", - "randomatic": "^1.1.3", + "randomatic": "^3.0.0", "repeat-element": "^1.1.2", "repeat-string": "^1.5.2" } @@ -4009,6 +4071,19 @@ "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=", "dev": true }, + "fast-glob": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.1.tgz", + "integrity": "sha512-wSyW1TBK3ia5V+te0rGPXudeMHoUQW6O5Y9oATiaGhpENmEifPDlOdhpsnlj5HoG6ttIvGiY1DdCmI9X2xGMhg==", + "dev": true, + "requires": { + "@mrmlnc/readdir-enhanced": "^2.2.1", + "glob-parent": "^3.1.0", + "is-glob": "^4.0.0", + "merge2": "^1.2.1", + "micromatch": "^3.1.10" + } + }, "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", @@ -4198,9 +4273,9 @@ "dev": true }, "flow-parser": { - "version": "0.70.0", - "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.70.0.tgz", - "integrity": "sha512-gGdyVUZWswG5jcINrVDHd3RY4nJptBTAx9mR9thGsrGGmAUR7omgJXQSpR+fXrLtxSTAea3HpAZNU/yzRJc2Cg==", + "version": "0.72.0", + "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.72.0.tgz", + "integrity": "sha512-kFaDtviKlD/rHi6NRp42KTbnPgz/nKcWUJQhqDnLDeKA8uGcRVSy0YlQjaf9M3pFo5PgC3SNFnCPpQGLtHjH2w==", "dev": true }, "flush-write-stream": { @@ -5134,6 +5209,12 @@ } } }, + "glob-to-regexp": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz", + "integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=", + "dev": true + }, "global-dirs": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", @@ -5197,9 +5278,9 @@ } }, "got": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/got/-/got-8.3.0.tgz", - "integrity": "sha512-kBNy/S2CGwrYgDSec5KTWGKUvupwkkTVAjIsVFF2shXO13xpZdFP4d4kxa//CLX2tN/rV0aYwK8vY6UKWGn2vQ==", + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/got/-/got-8.3.1.tgz", + "integrity": "sha512-tiLX+bnYm5A56T5N/n9Xo89vMaO1mrS9qoDqj3u/anVooqGozvY/HbXzEpDfbNeKsHCBpK40gSbz8wGYSp3i1w==", "dev": true, "requires": { "@sindresorhus/is": "^0.7.0", @@ -6270,6 +6351,12 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, + "isbinaryfile": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-3.0.2.tgz", + "integrity": "sha1-Sj6XTsDLqQBNP8bN5yCeppNopiE=", + "dev": true + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -6372,9 +6459,9 @@ "dev": true }, "babylon": { - "version": "7.0.0-beta.46", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.46.tgz", - "integrity": "sha512-WFJlg2WatdkXRFMpk7BN/Uzzkjkcjk+WaqnrSCpay+RYl4ypW9ZetZyT9kNt22IH/BQNst3M6PaaBn9IXsUNrg==", + "version": "7.0.0-beta.47", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.47.tgz", + "integrity": "sha512-+rq2cr4GDhtToEzKFD6KZZMDBXhjFAr9JjPw9pAppZACeEWqNM294j+NdBzkSHYXwzzBmVjZ3nEVJlOhbR2gOQ==", "dev": true }, "braces": { @@ -6902,6 +6989,12 @@ "integrity": "sha1-3oGf282E3M2PrlnGrreWFbnSZqw=", "dev": true }, + "math-random": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.1.tgz", + "integrity": "sha1-izqsWIuKZuSXXjzepn97sylgH6w=", + "dev": true + }, "md5.js": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", @@ -6944,16 +7037,17 @@ } }, "mem-fs-editor": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/mem-fs-editor/-/mem-fs-editor-3.0.2.tgz", - "integrity": "sha1-3Qpuryu4prN3QAZ6pUnrUwEFr58=", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/mem-fs-editor/-/mem-fs-editor-4.0.2.tgz", + "integrity": "sha512-QHvdXLLNmwJXxKdf7x27aNUren6IoPxwcM8Sfd+S6/ddQQMcYdEtVKsh6ilpqMrU18VQuKZEaH0aCGt3JDbA0g==", "dev": true, "requires": { "commondir": "^1.0.1", - "deep-extend": "^0.4.0", - "ejs": "^2.3.1", + "deep-extend": "^0.5.1", + "ejs": "^2.5.9", "glob": "^7.0.3", - "globby": "^6.1.0", + "globby": "^8.0.0", + "isbinaryfile": "^3.0.2", "mkdirp": "^0.5.0", "multimatch": "^2.0.0", "rimraf": "^2.2.8", @@ -6962,9 +7056,9 @@ }, "dependencies": { "clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.1.tgz", + "integrity": "sha1-0hfR6WERjjrJpLi7oyhVU79kfNs=", "dev": true }, "clone-stats": { @@ -6973,6 +7067,27 @@ "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", "dev": true }, + "globby": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-8.0.1.tgz", + "integrity": "sha512-oMrYrJERnKBLXNLVTqhm3vPEdJ/b2ZE28xN4YARiix1NOIOBPEpOUnm844K1iu/BkphCaf2WNFwMszv8Soi1pw==", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "dir-glob": "^2.0.0", + "fast-glob": "^2.0.2", + "glob": "^7.1.2", + "ignore": "^3.3.5", + "pify": "^3.0.0", + "slash": "^1.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, "replace-ext": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", @@ -7035,6 +7150,12 @@ "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", "dev": true }, + "merge2": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.2.2.tgz", + "integrity": "sha512-bgM8twH86rWni21thii6WCMQMRMmwqqdW3sGWi9IipnVAszdLXRjwDwAnyrVXo6DuP3AjRMMttZKUB48QWIFGg==", + "dev": true + }, "methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -9368,23 +9489,21 @@ "dev": true }, "randomatic": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", - "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.0.0.tgz", + "integrity": "sha512-VdxFOIEY3mNO5PtSRkkle/hPJDHvQhK21oa73K4yAc9qmp6N429gAyF1gZMOTMeS0/AYzaV/2Trcef+NaIonSA==", "dev": true, "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" + "is-number": "^4.0.0", + "kind-of": "^6.0.0", + "math-random": "^1.0.1" }, "dependencies": { - "kind-of": { + "is-number": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true } } }, @@ -10231,9 +10350,9 @@ "dev": true }, "shelljs": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.1.tgz", - "integrity": "sha512-YA/iYtZpzFe5HyWVGrb02FjPxc4EMCfpoU/Phg9fQoyMC72u9598OUBrsU8IrtwAKG0tO8IYaqbaLIw+k3IRGA==", + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.2.tgz", + "integrity": "sha512-pRXeNrCA2Wd9itwhvLp5LZQvPJ0wU6bcjaTMywHHGX5XWhVN2nzSu7WV0q+oUY7mGK3mgSkDDzP3MgjqdyIgbQ==", "dev": true, "requires": { "glob": "^7.0.0", @@ -10531,9 +10650,9 @@ "dev": true }, "sshpk": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", - "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz", + "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", "requires": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", @@ -11423,6 +11542,11 @@ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==" }, + "v-mask": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/v-mask/-/v-mask-1.3.2.tgz", + "integrity": "sha512-LuhSl4XMoC0yEpmkIdKatZ+bJiDg7ESGuc9NnZqPTF5Xv/TOt9Tb+ExqED1VKCEYeaav973HqkwNTGDPAF19xQ==" + }, "v8-compile-cache": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-1.1.2.tgz", @@ -11844,9 +11968,9 @@ } }, "webpack-cli": { - "version": "2.0.15", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-2.0.15.tgz", - "integrity": "sha512-bjNeIUO51D4OsmZ5ufzcpzVoacjxfWNfeBZKYL3jc+EMfCME3TyfdCPSUoKiOnebQChfupQuIRpAnx7L4l3Hew==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-2.1.3.tgz", + "integrity": "sha512-5AsKoL/Ccn8iTrwk3uErdyhetGH+c7VRQ7Itim2GL0IhBRq5rtojVDk00buMRmFmBpw1RvHXq97Gup965LbozA==", "dev": true, "requires": { "chalk": "^2.3.2", @@ -11874,7 +11998,7 @@ "webpack-addons": "^1.1.5", "yargs": "^11.1.0", "yeoman-environment": "^2.0.0", - "yeoman-generator": "^2.0.3" + "yeoman-generator": "^2.0.4" }, "dependencies": { "ansi-escapes": { @@ -11899,9 +12023,9 @@ } }, "chalk": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.0.tgz", - "integrity": "sha512-Wr/w0f4o9LuE7K53cD0qmbAMM+2XNLzR29vFn5hqko4sxGlUsyy363NvmyGIyk5tpe9cjTr9SJYbysEyPkRnFw==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "dev": true, "requires": { "ansi-styles": "^3.2.1", @@ -12670,26 +12794,40 @@ } }, "yeoman-environment": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/yeoman-environment/-/yeoman-environment-2.0.6.tgz", - "integrity": "sha512-jzHBTTy8EPI4ImV8dpUMt+Q5zELkSU5xvGpndHcHudQ4tqN6YgIWaCGmRFl+HDchwRUkcgyjQ+n6/w5zlJBCPg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/yeoman-environment/-/yeoman-environment-2.1.1.tgz", + "integrity": "sha512-IBLwCUrJrDxBYuwdYm1wuF3O/CR2LpXR0rFS684QOrU6x69DPPrsdd20dZOFaedZ/M9sON7po73WhO3I1CbgNQ==", "dev": true, "requires": { "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", "debug": "^3.1.0", "diff": "^3.3.1", "escape-string-regexp": "^1.0.2", - "globby": "^6.1.0", + "globby": "^8.0.1", "grouped-queue": "^0.3.3", - "inquirer": "^3.3.0", + "inquirer": "^5.2.0", "is-scoped": "^1.0.0", - "lodash": "^4.17.4", + "lodash": "^4.17.10", "log-symbols": "^2.1.0", "mem-fs": "^1.1.0", + "strip-ansi": "^4.0.0", "text-table": "^0.2.0", "untildify": "^3.0.2" }, "dependencies": { + "ansi-escapes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", + "dev": true + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -12700,9 +12838,9 @@ } }, "chalk": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.0.tgz", - "integrity": "sha512-Wr/w0f4o9LuE7K53cD0qmbAMM+2XNLzR29vFn5hqko4sxGlUsyy363NvmyGIyk5tpe9cjTr9SJYbysEyPkRnFw==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "dev": true, "requires": { "ansi-styles": "^3.2.1", @@ -12710,6 +12848,28 @@ "supports-color": "^5.3.0" } }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", @@ -12719,6 +12879,63 @@ "ms": "2.0.0" } }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "globby": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-8.0.1.tgz", + "integrity": "sha512-oMrYrJERnKBLXNLVTqhm3vPEdJ/b2ZE28xN4YARiix1NOIOBPEpOUnm844K1iu/BkphCaf2WNFwMszv8Soi1pw==", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "dir-glob": "^2.0.0", + "fast-glob": "^2.0.2", + "glob": "^7.1.2", + "ignore": "^3.3.5", + "pify": "^3.0.0", + "slash": "^1.0.0" + } + }, + "inquirer": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-5.2.0.tgz", + "integrity": "sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ==", + "dev": true, + "requires": { + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.0", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^2.1.0", + "figures": "^2.0.0", + "lodash": "^4.3.0", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^5.5.2", + "string-width": "^2.1.0", + "strip-ansi": "^4.0.0", + "through": "^2.3.6" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "lodash": { + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", + "dev": true + }, "log-symbols": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", @@ -12728,6 +12945,56 @@ "chalk": "^2.0.1" } }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, + "semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, "supports-color": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", @@ -12740,26 +13007,26 @@ } }, "yeoman-generator": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/yeoman-generator/-/yeoman-generator-2.0.4.tgz", - "integrity": "sha512-Sgvz3MAkOpEIobcpW3rjEl6bOTNnl8SkibP9z7hYKfIGIlw0QDC2k0MAeXvyE2pLqc2M0Duql+6R7/W9GrJojg==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/yeoman-generator/-/yeoman-generator-2.0.5.tgz", + "integrity": "sha512-rV6tJ8oYzm4mmdF2T3wjY+Q42jKF2YiiD0VKfJ8/0ZYwmhCKC9Xs2346HVLPj/xE13i68psnFJv7iS6gWRkeAg==", "dev": true, "requires": { "async": "^2.6.0", "chalk": "^2.3.0", "cli-table": "^0.3.1", - "cross-spawn": "^5.1.0", + "cross-spawn": "^6.0.5", "dargs": "^5.1.0", - "dateformat": "^3.0.2", + "dateformat": "^3.0.3", "debug": "^3.1.0", "detect-conflict": "^1.0.0", "error": "^7.0.2", "find-up": "^2.1.0", "github-username": "^4.0.0", - "istextorbinary": "^2.1.0", - "lodash": "^4.17.4", + "istextorbinary": "^2.2.1", + "lodash": "^4.17.10", "make-dir": "^1.1.0", - "mem-fs-editor": "^3.0.2", + "mem-fs-editor": "^4.0.0", "minimist": "^1.2.0", "pretty-bytes": "^4.0.2", "read-chunk": "^2.1.0", @@ -12782,9 +13049,9 @@ } }, "chalk": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.0.tgz", - "integrity": "sha512-Wr/w0f4o9LuE7K53cD0qmbAMM+2XNLzR29vFn5hqko4sxGlUsyy363NvmyGIyk5tpe9cjTr9SJYbysEyPkRnFw==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "dev": true, "requires": { "ansi-styles": "^3.2.1", @@ -12792,6 +13059,19 @@ "supports-color": "^5.3.0" } }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", @@ -12822,6 +13102,12 @@ "strip-bom": "^3.0.0" } }, + "lodash": { + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", + "dev": true + }, "minimist": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", @@ -12874,6 +13160,12 @@ "read-pkg": "^3.0.0" } }, + "semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", + "dev": true + }, "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", diff --git a/package.json b/package.json index 38d87f26e..edf51e0b8 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "node-sass": "^4.8.3", "qs": "^6.5.1", "sass-loader": "^7.0.1", + "v-mask": "^1.3.2", "vue": "^2.5.16", "vue-router": "^3.0.1", "vuedraggable": "^2.16.0", @@ -25,9 +26,9 @@ "autoprefixer": "^8.3.0", "babel-core": "^6.26.0", "babel-loader": "^7.1.4", - "babel-preset-env": "^1.6.1", - "babel-preset-es2015": "^6.24.1", - "babel-preset-stage-2": "^6.24.1", + "babel-polyfill": "^6.26.0", + "babel-preset-env": "^1.7.0", + "babel-preset-stage-3": "^6.24.1", "cross-env": "^5.1.4", "css-loader": "^0.28.11", "cypress": "^2.1.0", @@ -44,7 +45,7 @@ "vue-loader": "^14.2.2", "vue-template-compiler": "^2.5.16", "webpack": "^4.6.0", - "webpack-cli": "^2.0.15", + "webpack-cli": "^2.1.3", "webpack-dev-server": "^3.1.3" } } diff --git a/src/admin/class-tainacan-admin.php b/src/admin/class-tainacan-admin.php index 64bbfc8b7..910ef8314 100644 --- a/src/admin/class-tainacan-admin.php +++ b/src/admin/class-tainacan-admin.php @@ -18,6 +18,7 @@ class Admin { private function __construct() { + add_action( 'wp_ajax_tainacan_date_i18n', array( &$this, 'ajax_date_i18n') ); add_action( 'admin_menu', array( &$this, 'add_admin_menu' ) ); add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ) ); @@ -226,5 +227,14 @@ class Admin { register_meta( 'user', 'tainacan_prefs', $args ); } + function ajax_date_i18n(){ + + $unix_time_stamp = strtotime($_POST['date_string']); + + echo date_i18n(get_option('date_format'), $unix_time_stamp); + + wp_die(); + } + } diff --git a/src/admin/components/lists/items-list.vue b/src/admin/components/lists/items-list.vue index 4d06b6e72..98196a47f 100644 --- a/src/admin/components/lists/items-list.vue +++ b/src/admin/components/lists/items-list.vue @@ -88,15 +88,22 @@ v-for="(column, index) in tableFields" v-if="column.display" :label="column.name" - :aria-label="column.field != 'row_thumbnail' && column.field != 'row_actions' && column.field != 'row_creation' ? column.name + '' + item.metadata[column.slug].value_as_string : ''" + :aria-label="column.field != 'row_thumbnail' && + column.field != 'row_actions' && + column.field != 'row_creation' ? column.name + '' + item.metadata[column.slug].value_as_string : ''" class="column-default-width" :class="{ 'thumbnail-cell': column.field == 'row_thumbnail', 'table-creation': column.field == 'row_creation'}" @click="goToItemPage(item)"> -

+ +

+ import { mapActions } from 'vuex'; import moment from 'moment'; +import { wpAjax } from "../../js/mixins"; export default { name: 'ItemsList', + mixins: [ wpAjax ], data(){ return { allItemsOnPageSelected: false, isSelectingItems: false, - selectedItems: [] + selectedItems: [], } }, props: { @@ -342,15 +351,18 @@ export default { goToItemEditPage(itemId) { this.$router.push(this.$routerHelper.getItemEditPath(this.collectionId, itemId)); }, - renderMetadata( metadata ){ + renderMetadata(metadata) { - if( !metadata ) + if (!metadata) { return ''; - else + } else if (metadata.date_i18n) { + return metadata.date_i18n; + } else { return metadata.value_as_html; + } }, getCreationHtml(item) { - return this.$i18n.get('info_created_by') + item['author_name'] + '
' + this.$i18n.get('info_date') + moment( item['creation_date'], 'YYYY-MM-DD').format('DD/MM/YYYY'); + return this.$i18n.get('info_created_by') + item['author_name'] + '
' + this.$i18n.get('info_date') + item['creation_date']; }, getDecodedURI(url) { return decodeURIComponent(url); diff --git a/src/admin/js/main.js b/src/admin/js/main.js index e4c8262cc..cc8232a8a 100644 --- a/src/admin/js/main.js +++ b/src/admin/js/main.js @@ -41,6 +41,7 @@ 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 VueMask from 'v-mask'; // Configure and Register Plugins Vue.use(Buefy); @@ -48,6 +49,7 @@ Vue.use(I18NPlugin); Vue.use(UserPrefsPlugin); Vue.use(RouterHelperPlugin); Vue.use(ConsolePlugin, {visual: false}); +Vue.use(VueMask); /* Fields */ Vue.component('tainacan-text', Text); diff --git a/src/admin/js/mixins.js b/src/admin/js/mixins.js index 693ee42e8..3259e1c13 100644 --- a/src/admin/js/mixins.js +++ b/src/admin/js/mixins.js @@ -29,6 +29,26 @@ export const wpAjax = { reject(error) }) }); + }, + getDatei18n(dateString){ + this.axiosWPAjax.post('', qs.stringify({ + action: 'tainacan_date_i18n', + date_string: dateString, + nonce: tainacan_plugin.nonce, + })).then(res => { + return res.data + }); + }, + } +}; + +export const dateInter = { + methods: { + getDateLocaleFormat() { + + let now = new Date(); + + return now.toLocaleDateString().replace(/[\d]/g, '#'); } } }; \ No newline at end of file diff --git a/src/admin/pages/lists/collections-page.vue b/src/admin/pages/lists/collections-page.vue index 64e541e6d..43c034e10 100644 --- a/src/admin/pages/lists/collections-page.vue +++ b/src/admin/pages/lists/collections-page.vue @@ -122,7 +122,7 @@ export default { collections(){ let collectionsList = this.getCollections(); for (let collection of collectionsList) - collection['creation'] = this.$i18n.get('info_created_by') + collection['author_name'] + '
' + this.$i18n.get('info_date') + moment(collection['creation_date'], 'YYYY-MM-DD').format('DD/MM/YYYY'); + collection['creation'] = this.$i18n.get('info_created_by') + collection['author_name'] + '
' + this.$i18n.get('info_date') + collection['creation_date']; return collectionsList; } }, diff --git a/src/admin/pages/singles/item-page.vue b/src/admin/pages/singles/item-page.vue index 934ee9e50..c7ed3ad2e 100644 --- a/src/admin/pages/singles/item-page.vue +++ b/src/admin/pages/singles/item-page.vue @@ -3,7 +3,7 @@ - +

+ class="image" + v-html="item.document_as_html"/>

+ v-if="item.thumbnail" + class="media">
+ class="media-left">

- +

@@ -42,36 +42,40 @@
+ v-for="(metadata, index) in item.metadata" + :key="index" + class="box">

+ v-if="metadata.date_i18n" + class="is-size-3" + v-html="metadata.date_i18n"/>

--

+ v-else-if="metadata.value_as_html" + class="is-size-3" + v-html="metadata.value_as_html"/> +

--

- {{ metadata.name }} + {{ metadata.name }}

+ class="box">
+ v-if="attachments && attachments.length > 0"> + v-for="(attachment, index) in attachments" + :key="index" + > {{ attachment.guid.rendered }} + target="blank" + :href="attachment.guid.rendered">{{ attachment.guid.rendered }}
@@ -79,7 +83,7 @@

- {{ $i18n.get('label_attachments') }} + {{ $i18n.get('label_attachments') }}

@@ -89,52 +93,52 @@ diff --git a/src/api/endpoints/class-tainacan-rest-items-controller.php b/src/api/endpoints/class-tainacan-rest-items-controller.php index e1d889746..21575c637 100644 --- a/src/api/endpoints/class-tainacan-rest-items-controller.php +++ b/src/api/endpoints/class-tainacan-rest-items-controller.php @@ -106,6 +106,9 @@ class REST_Items_Controller extends REST_Controller { $item_array['metadata'][ $slug ]['value'] = $item_metadata_array['value']; $item_array['metadata'][ $slug ]['value_as_html'] = $item_metadata_array['value_as_html']; $item_array['metadata'][ $slug ]['value_as_string'] = $item_metadata_array['value_as_string']; + if($field->get_field_type_object()->get_primitive_type() === 'date') { + $item_array['metadata'][ $slug ]['date_i18n'] = $item_metadata_array['date_i18n']; + } $item_array['metadata'][ $slug ]['multiple'] = $field->get_multiple(); } diff --git a/src/classes/entities/class-tainacan-collection.php b/src/classes/entities/class-tainacan-collection.php index f197ffe4f..576408d62 100644 --- a/src/classes/entities/class-tainacan-collection.php +++ b/src/classes/entities/class-tainacan-collection.php @@ -68,10 +68,12 @@ class Collection extends Entity { public function __toArray() { $array_collection = parent::__toArray(); - $array_collection['thumbnail'] = $this->get_thumbnail(); - $array_collection['header_image'] = $this->get_header_image(); - $array_collection['author_name'] = $this->get_author_name(); - $array_collection['url'] = get_permalink( $this->get_id() ); + $array_collection['thumbnail'] = $this->get_thumbnail(); + $array_collection['header_image'] = $this->get_header_image(); + $array_collection['author_name'] = $this->get_author_name(); + $array_collection['url'] = get_permalink( $this->get_id() ); + $array_collection['creation_date'] = $this->get_date_i18n( explode( ' ', $array_collection['creation_date'] )[0] ); + $array_collection['modification_date'] = $this->get_date_i18n( explode( ' ', $array_collection['modification_date'] )[0] ); return $array_collection; } diff --git a/src/classes/entities/class-tainacan-entity.php b/src/classes/entities/class-tainacan-entity.php index 5ae28337e..86cbfdfad 100644 --- a/src/classes/entities/class-tainacan-entity.php +++ b/src/classes/entities/class-tainacan-entity.php @@ -132,6 +132,18 @@ class Entity { return $repository; } + /** + * @param $date + * + * @return string + */ + public function get_date_i18n($date){ + + $unix_time_stamp = strtotime($date); + + return date_i18n(get_option('date_format'), $unix_time_stamp); + } + /** * return the value for a mapped property * @param string $prop id of property diff --git a/src/classes/entities/class-tainacan-item-metadata-entity.php b/src/classes/entities/class-tainacan-item-metadata-entity.php index 5972fef06..092b25d90 100644 --- a/src/classes/entities/class-tainacan-item-metadata-entity.php +++ b/src/classes/entities/class-tainacan-item-metadata-entity.php @@ -89,7 +89,7 @@ class Item_Metadata_Entity extends Entity { } - + /** * Get the value as a plain text string * @return string @@ -142,6 +142,11 @@ class Item_Metadata_Entity extends Entity { $as_array['value'] = $this->get_value_as_array(); $as_array['value_as_html'] = $this->get_value_as_html(); $as_array['value_as_string'] = $this->get_value_as_string(); + + if($this->get_field()->get_field_type_object()->get_primitive_type() === 'date'){ + $as_array['date_i18n'] = $this->get_date_i18n($this->get_value_as_string()); + } + $as_array['item'] = $this->get_item()->__toArray(); $as_array['field'] = $this->get_field()->__toArray(); diff --git a/src/classes/entities/class-tainacan-item.php b/src/classes/entities/class-tainacan-item.php index bb5694feb..a7ca5c8e1 100644 --- a/src/classes/entities/class-tainacan-item.php +++ b/src/classes/entities/class-tainacan-item.php @@ -52,10 +52,12 @@ class Item extends Entity { public function __toArray() { $array_item = parent::__toArray(); - $array_item['thumbnail'] = $this->get_thumbnail(); - $array_item['_thumbnail_id'] = $this->get__thumbnail_id(); - $array_item['author_name'] = $this->get_author_name(); - $array_item['url'] = get_permalink( $this->get_id() ); + $array_item['thumbnail'] = $this->get_thumbnail(); + $array_item['_thumbnail_id'] = $this->get__thumbnail_id(); + $array_item['author_name'] = $this->get_author_name(); + $array_item['url'] = get_permalink( $this->get_id() ); + $array_item['creation_date'] = $this->get_date_i18n( explode( ' ', $array_item['creation_date'] )[0] ); + $array_item['modification_date'] = $this->get_date_i18n( explode( ' ', $array_item['modification_date'] )[0] ); return $array_item; } diff --git a/src/classes/field-types/date/Date.vue b/src/classes/field-types/date/Date.vue index 1f2c6e569..d68e13b5d 100644 --- a/src/classes/field-types/date/Date.vue +++ b/src/classes/field-types/date/Date.vue @@ -1,23 +1,57 @@