From 1fff71ee0e4017d614a64fd48ca3cfdac1e3e4f1 Mon Sep 17 00:00:00 2001 From: Thomas Citharel <tcit@tcit.fr> Date: Fri, 16 Apr 2021 17:18:41 +0200 Subject: [PATCH 1/4] Allow to remove user location setting Closes #671 Signed-off-by: Thomas Citharel <tcit@tcit.fr> --- .../components/Event/AddressAutoComplete.vue | 2 +- .../Event/FullAddressAutoComplete.vue | 12 +++++++++ js/src/types/current-user.model.ts | 6 ++--- js/src/views/Settings/Preferences.vue | 27 +++++++++++++++++-- 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/js/src/components/Event/AddressAutoComplete.vue b/js/src/components/Event/AddressAutoComplete.vue index 9be4b29aa..a3b39c96c 100644 --- a/js/src/components/Event/AddressAutoComplete.vue +++ b/js/src/components/Event/AddressAutoComplete.vue @@ -150,7 +150,7 @@ export default class AddressAutoComplete extends Vue { } get queryText(): string { - if (this.value) { + if (this.value !== undefined) { return new Address(this.value).fullName; } return this.initialQueryText; diff --git a/js/src/components/Event/FullAddressAutoComplete.vue b/js/src/components/Event/FullAddressAutoComplete.vue index 35581015f..4c73150e0 100644 --- a/js/src/components/Event/FullAddressAutoComplete.vue +++ b/js/src/components/Event/FullAddressAutoComplete.vue @@ -46,6 +46,12 @@ </div> </template> </b-autocomplete> + <b-button + :disabled="!queryText" + @click="resetAddress" + class="reset-area" + icon-left="close" + /> </b-field> <div class="map" v-if="selected && selected.geom && selected.poiInfos"> <map-leaflet @@ -295,6 +301,12 @@ export default class FullAddressAutoComplete extends Vue { ); }); } + + resetAddress(): void { + this.$emit("input", null); + this.queryText = ""; + this.selected = new Address(); + } } </script> <style lang="scss"> diff --git a/js/src/types/current-user.model.ts b/js/src/types/current-user.model.ts index 051b31f7f..352b2f2ae 100644 --- a/js/src/types/current-user.model.ts +++ b/js/src/types/current-user.model.ts @@ -13,9 +13,9 @@ export interface ICurrentUser { } export interface IUserPreferredLocation { - range?: number; - name?: string; - geohash?: string; + range?: number | null; + name?: string | null; + geohash?: string | null; } export interface IUserSettings { diff --git a/js/src/views/Settings/Preferences.vue b/js/src/views/Settings/Preferences.vue index 29ae92299..b779aec08 100644 --- a/js/src/views/Settings/Preferences.vue +++ b/js/src/views/Settings/Preferences.vue @@ -80,6 +80,12 @@ </option> </b-select> </b-field> + <b-button + :disabled="address == undefined" + @click="resetArea" + class="reset-area" + icon-left="close" + /> </b-field> <p> {{ @@ -239,11 +245,11 @@ export default class Preferences extends Vue { } } - get locationRange(): number | undefined { + get locationRange(): number | undefined | null { return this.loggedUser?.settings?.location?.range; } - set locationRange(locationRange: number | undefined) { + set locationRange(locationRange: number | undefined | null) { if (locationRange) { this.updateUserSettings({ location: { @@ -253,6 +259,16 @@ export default class Preferences extends Vue { } } + resetArea(): void { + this.updateUserSettings({ + location: { + geohash: null, + name: null, + range: null, + }, + }); + } + private async updateUserSettings(userSettings: IUserSettings) { await this.$apollo.mutate<{ setUserSetting: string }>({ mutation: SET_USER_SETTINGS, @@ -262,3 +278,10 @@ export default class Preferences extends Vue { } } </script> +<style lang="scss" scoped> +.reset-area { + align-self: center; + position: relative; + top: 10px; +} +</style> From 57b1e534203bc6da77cadbdc5e3549eb97326525 Mon Sep 17 00:00:00 2001 From: Thomas Citharel <tcit@tcit.fr> Date: Fri, 16 Apr 2021 17:19:21 +0200 Subject: [PATCH 2/4] Fix some dependencies issue Signed-off-by: Thomas Citharel <tcit@tcit.fr> --- js/.prettierrc.json | 1 + js/package.json | 13 ++++--- js/yarn.lock | 86 +++++++++++++++++++++------------------------ 3 files changed, 47 insertions(+), 53 deletions(-) create mode 100644 js/.prettierrc.json diff --git a/js/.prettierrc.json b/js/.prettierrc.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/js/.prettierrc.json @@ -0,0 +1 @@ +{} diff --git a/js/package.json b/js/package.json index 00dbee656..d32e57a18 100644 --- a/js/package.json +++ b/js/package.json @@ -64,11 +64,11 @@ "@types/prosemirror-state": "^1.2.4", "@types/prosemirror-view": "^1.11.4", "@types/vuedraggable": "^2.23.0", - "@typescript-eslint/eslint-plugin": "^4.14.1", - "@typescript-eslint/parser": "^4.14.1", + "@typescript-eslint/eslint-plugin": "^4.18.0", + "@typescript-eslint/parser": "^4.18.0", "@vue/cli-plugin-babel": "~4.5.12", "@vue/cli-plugin-e2e-cypress": "~4.5.12", - "@vue/cli-plugin-eslint": "~4.5.12", + "@vue/cli-plugin-eslint": "~4.5.0", "@vue/cli-plugin-pwa": "~4.5.12", "@vue/cli-plugin-router": "~4.5.12", "@vue/cli-plugin-typescript": "~4.5.12", @@ -78,15 +78,14 @@ "@vue/eslint-config-typescript": "^7.0.0", "@vue/test-utils": "^1.1.0", "eslint": "^6.7.2", - "eslint-config-prettier": "^7.0.0", "eslint-plugin-cypress": "^2.10.3", "eslint-plugin-import": "^2.20.2", - "eslint-plugin-prettier": "^3.1.3", - "eslint-plugin-vue": "^7.9.0", + "eslint-plugin-prettier": "^3.3.1", + "eslint-plugin-vue": "^6.2.2", "flush-promises": "^1.0.2", "jest-junit": "^12.0.0", "mock-apollo-client": "^0.6", - "prettier": "2.2.1", + "prettier": "^2.2.1", "prettier-eslint": "^12.0.0", "sass": "^1.29.0", "sass-loader": "^8.0.2", diff --git a/js/yarn.lock b/js/yarn.lock index cb0594e42..ad0c26db6 100644 --- a/js/yarn.lock +++ b/js/yarn.lock @@ -28,9 +28,9 @@ zen-observable "0.8.11" "@apollo/client@^3.0.0": - version "3.3.14" - resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.3.14.tgz#b077f42e17941dbf4c62c4f41bf83c0828872d09" - integrity sha512-z7YwMvF9grmpWUG+26e3gPcBAOA/r/Ci5gwK7JVm3bGYG9kKqG8MF6sMXEbuwTsFseE4duSp0icJ6tdzxJhhlA== + version "3.3.15" + resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.3.15.tgz#bdd230894aac4beb8ade2b472a1d3c9ea6152812" + integrity sha512-/WQmNvLEZMA0mA3u+FkEPTXKzxZD/KhyO7WlbKcy3zKGrXKza83tAbNMzsitQE7DTcSc3DLEcIu1Z5Rc7PFq0Q== dependencies: "@graphql-typed-document-node/core" "^3.0.0" "@types/zen-observable" "^0.8.0" @@ -1501,9 +1501,9 @@ integrity sha512-6nlq2eEh75JegDGUXis9wGTYIJpUvbori4qx++PRKQsV3YRkaqUNPNykzphniqPSZADXCouBuAnyptjUkMkhvw== "@types/node@*", "@types/node@>=6": - version "14.14.37" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.37.tgz#a3dd8da4eb84a996c36e331df98d82abd76b516e" - integrity sha512-XYmBiy+ohOR4Lh5jE379fV2IU+6Jn4g5qASinhitfyO71b/sCo6MKsMLF5tc7Zf2CE8hViVQyYSobJNke8OvUw== + version "14.14.41" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.41.tgz#d0b939d94c1d7bd53d04824af45f1139b8c45615" + integrity sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g== "@types/normalize-package-data@^2.4.0": version "2.4.0" @@ -1695,7 +1695,7 @@ resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.2.tgz#808c9fa7e4517274ed555fa158f2de4b4f468e71" integrity sha512-HrCIVMLjE1MOozVoD86622S7aunluLb2PJdPfb3nYiEtohm8mIB/vyv0Fd37AdeMFrTUQXEunw78YloMA3Qilg== -"@typescript-eslint/eslint-plugin@^4.14.1": +"@typescript-eslint/eslint-plugin@^4.18.0": version "4.22.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.22.0.tgz#3d5f29bb59e61a9dba1513d491b059e536e16dbc" integrity sha512-U8SP9VOs275iDXaL08Ln1Fa/wLXfj5aTr/1c0t0j6CdbOnxh+TruXu1p4I0NAvdPBQgoPjHsgKn28mOi0FzfoA== @@ -1743,7 +1743,7 @@ "@typescript-eslint/typescript-estree" "3.10.1" eslint-visitor-keys "^1.1.0" -"@typescript-eslint/parser@^4.14.1": +"@typescript-eslint/parser@^4.18.0": version "4.22.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.22.0.tgz#e1637327fcf796c641fe55f73530e90b16ac8fe8" integrity sha512-z/bGdBJJZJN76nvAY9DkJANYgK3nlRstRRi74WHm3jjgf2I8AglrSY+6l7ogxOmn55YJ6oKZCLLy+6PW70z15Q== @@ -1962,7 +1962,7 @@ cypress "^3.8.3" eslint-plugin-cypress "^2.10.3" -"@vue/cli-plugin-eslint@~4.5.12": +"@vue/cli-plugin-eslint@~4.5.0": version "4.5.12" resolved "https://registry.yarnpkg.com/@vue/cli-plugin-eslint/-/cli-plugin-eslint-4.5.12.tgz#7fc2a1d0a490fa300ef4e94518c2cc49ba7a292f" integrity sha512-nbjGJkWxo/xdD32DwvnEAUwkWYsObpqNk9NuU7T62ehdzHPzz58o3j03YZ7a7T7Le8bYyOWMYsdNfz63F+XiZQ== @@ -3543,9 +3543,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001208: - version "1.0.30001208" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001208.tgz#a999014a35cebd4f98c405930a057a0d75352eb9" - integrity sha512-OE5UE4+nBOro8Dyvv0lfx+SRtfVIOM9uhKqFmJeUbGriqhhStgp1A0OyBpgy3OUF8AhYCT+PVwPC1gMl2ZcQMA== + version "1.0.30001209" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001209.tgz#1bb4be0bd118e98e21cfb7ef617b1ef2164622f4" + integrity sha512-2Ktt4OeRM7EM/JaOZjuLzPYAIqmbwQMNnYbgooT+icoRGrKOyAxA1xhlnotBD1KArRSPsuJp3TdYcZYrL7qNxA== capture-exit@^2.0.0: version "2.0.0" @@ -4851,9 +4851,9 @@ ejs@^2.6.1: integrity sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA== electron-to-chromium@^1.3.712: - version "1.3.713" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.713.tgz#4583efb17f2d1e9ec07a44c8004ea73c013ad146" - integrity sha512-HWgkyX4xTHmxcWWlvv7a87RHSINEcpKYZmDMxkUlHcY+CJcfx7xEfBHuXVsO1rzyYs1WQJ7EgDp2CoErakBIow== + version "1.3.717" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.717.tgz#78d4c857070755fb58ab64bcc173db1d51cbc25f" + integrity sha512-OfzVPIqD1MkJ7fX+yTl2nKyOE4FReeVfMCzzxQS+Kp43hZYwHwThlGP+EGIZRXJsxCM7dqo8Y65NOX/HP12iXQ== elegant-spinner@^1.0.1: version "1.0.1" @@ -5022,11 +5022,6 @@ eslint-config-prettier@^6.0.0: dependencies: get-stdin "^6.0.0" -eslint-config-prettier@^7.0.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-7.2.0.tgz#f4a4bd2832e810e8cc7c1411ec85b3e85c0c53f9" - integrity sha512-rV4Qu0C3nfJKPOAhFujFxB7RMP+URFyQqqOZW9DMRD7ZDTFyjaIlETU3xzHELt++4ugC0+Jm084HQYkkJe+Ivg== - eslint-import-resolver-node@^0.3.4: version "0.3.4" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz#85ffa81942c25012d8231096ddf679c03042c717" @@ -5080,22 +5075,21 @@ eslint-plugin-import@^2.20.2: resolve "^1.17.0" tsconfig-paths "^3.9.0" -eslint-plugin-prettier@^3.1.3: +eslint-plugin-prettier@^3.3.1: version "3.4.0" resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.0.tgz#cdbad3bf1dbd2b177e9825737fe63b476a08f0c7" integrity sha512-UDK6rJT6INSfcOo545jiaOwB701uAIt2/dR7WnFQoGCVl1/EMqdANBmwUaqqQ45aXprsTGzSa39LI1PyuRBxxw== dependencies: prettier-linter-helpers "^1.0.0" -eslint-plugin-vue@^7.9.0: - version "7.9.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-7.9.0.tgz#f8e83a2a908f4c43fc8304f5401d4ff671f3d560" - integrity sha512-2Q0qQp5+5h+pZvJKCbG1/jCRUYrdgAz5BYKGyTlp2NU8mx09u3Hp7PsH6d5qef6ojuPoCXMnrbbDxeoplihrSw== +eslint-plugin-vue@^6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-6.2.2.tgz#27fecd9a3a24789b0f111ecdd540a9e56198e0fe" + integrity sha512-Nhc+oVAHm0uz/PkJAWscwIT4ijTrK5fqNqz9QB1D35SbbuMG1uB6Yr5AJpvPSWg+WOw7nYNswerYh0kOk64gqQ== dependencies: - eslint-utils "^2.1.0" natural-compare "^1.4.0" - semver "^7.3.2" - vue-eslint-parser "^7.6.0" + semver "^5.6.0" + vue-eslint-parser "^7.0.0" eslint-scope@^4.0.3: version "4.0.3" @@ -6575,9 +6569,9 @@ http-proxy-middleware@0.19.1: micromatch "^3.1.10" http-proxy-middleware@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-1.1.1.tgz#48900a68cd9d388c735d1dd97302c919b7e94a13" - integrity sha512-FIDg9zPvOwMhQ3XKB2+vdxK6WWbVAH7s5QpqQCif7a1TNL76GNAATWA1sy6q2gSfss8UJ/Nwza3N6QnFkKclpA== + version "1.1.2" + resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-1.1.2.tgz#38d062ce4182b2931442efc2d9a0c429cab634f8" + integrity sha512-YRFUeOG3q85FJjAaYVJUoNRW9a73SDlOtAyQOS5PHLr18QeZ/vEhxywNoOPiEO8BxCegz4RXzTHcvyLEGB78UA== dependencies: "@types/http-proxy" "^1.17.5" http-proxy "^1.18.1" @@ -7272,9 +7266,9 @@ iterall@^1.2.2: integrity sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg== javascript-stringify@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/javascript-stringify/-/javascript-stringify-2.0.1.tgz#6ef358035310e35d667c675ed63d3eb7c1aa19e5" - integrity sha512-yV+gqbd5vaOYjqlbk16EG89xB5udgjqQF3C5FAORDg4f/IS1Yc5ERCv5e/57yBcfJYw05V5JyIXabhwb75Xxow== + version "2.1.0" + resolved "https://registry.yarnpkg.com/javascript-stringify/-/javascript-stringify-2.1.0.tgz#27c76539be14d8bd128219a2d731b09337904e79" + integrity sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg== jest-changed-files@^24.9.0: version "24.9.0" @@ -7706,9 +7700,9 @@ js-base64@^2.1.9: integrity sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ== js-beautify@^1.6.12, js-beautify@^1.6.14: - version "1.13.5" - resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.13.5.tgz#a08a97890cae55daf1d758d3f6577bd4a64d7014" - integrity sha512-MsXlH6Z/BiRYSkSRW3clNDqDjSpiSNOiG8xYVUBXt4k0LnGvDhlTGOlHX1VFtAdoLmtwjxMG5qiWKy/g+Ipv5w== + version "1.13.11" + resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.13.11.tgz#3fc59d74d4fcb03268a559220da26f5d8a2d5246" + integrity sha512-+3CW1fQqkV7aXIvprevNYfSrKrASQf02IstAZCVSNh+/IS5ciaOtE7erfjyowdMYZZmP2A7SMFkcJ28qCl84+A== dependencies: config-chain "^1.1.12" editorconfig "^0.15.3" @@ -10005,16 +9999,16 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@2.2.1, prettier@^2.0.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" - integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== - prettier@^1.18.2: version "1.19.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== +prettier@^2.0.0, prettier@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" + integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== + pretty-bytes@^5.3.0: version "5.6.0" resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb" @@ -11806,9 +11800,9 @@ table@^5.2.3: string-width "^3.0.0" table@^6.0.4: - version "6.0.9" - resolved "https://registry.yarnpkg.com/table/-/table-6.0.9.tgz#790a12bf1e09b87b30e60419bafd6a1fd85536fb" - integrity sha512-F3cLs9a3hL1Z7N4+EkSscsel3z55XT950AvB05bwayrNg5T1/gykXtigioTAjbltvbMSJvvhFCbnf6mX+ntnJQ== + version "6.1.0" + resolved "https://registry.yarnpkg.com/table/-/table-6.1.0.tgz#676a0cfb206008b59e783fcd94ef8ba7d67d966c" + integrity sha512-T4G5KMmqIk6X87gLKWyU5exPpTjLjY5KyrFWaIjv3SvgaIUGXV7UEzGEnZJdTA38/yUS6f9PlKezQ0bYXG3iIQ== dependencies: ajv "^8.0.1" is-boolean-object "^1.1.0" @@ -12648,7 +12642,7 @@ vue-cli-plugin-svg@~0.1.3: url-loader "^2.0.0" vue-svg-loader "^0.12.0" -vue-eslint-parser@^7.0.0, vue-eslint-parser@^7.6.0: +vue-eslint-parser@^7.0.0: version "7.6.0" resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-7.6.0.tgz#01ea1a2932f581ff244336565d712801f8f72561" integrity sha512-QXxqH8ZevBrtiZMZK0LpwaMfevQi9UL7lY6Kcp+ogWHC88AuwUPwwCIzkOUc1LR4XsYAt/F9yHXAB/QoD17QXA== From 6eb42660d51795f48ac9d9a1a929dc0876d88688 Mon Sep 17 00:00:00 2001 From: Thomas Citharel <tcit@tcit.fr> Date: Fri, 16 Apr 2021 18:12:57 +0200 Subject: [PATCH 3/4] Reset address when field is empty Signed-off-by: Thomas Citharel <tcit@tcit.fr> --- js/src/components/Event/FullAddressAutoComplete.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/src/components/Event/FullAddressAutoComplete.vue b/js/src/components/Event/FullAddressAutoComplete.vue index 4c73150e0..537996c8d 100644 --- a/js/src/components/Event/FullAddressAutoComplete.vue +++ b/js/src/components/Event/FullAddressAutoComplete.vue @@ -22,7 +22,7 @@ expanded @select="updateSelected" > - <template slot-scope="{ option }"> + <template #default="{ option }"> <b-icon :icon="option.poiInfos.poiIcon.icon" /> <b>{{ option.poiInfos.name }}</b ><br /> @@ -31,7 +31,7 @@ <template slot="empty"> <span v-if="isFetching">{{ $t("Searching…") }}</span> <div v-else-if="queryText.length >= 3" class="is-enabled"> - <span>{{ $t('No results for "{queryText}"') }}</span> + <span>{{ $t('No results for "{queryText}"', { queryText }) }}</span> <span>{{ $t( "You can try another search term or drag and drop the marker on the map", @@ -302,6 +302,14 @@ export default class FullAddressAutoComplete extends Vue { }); } + @Watch("queryText") + resetAddressOnEmptyField(queryText: string): void { + if (queryText === "" && this.selected?.id) { + console.log("doing reset"); + this.resetAddress(); + } + } + resetAddress(): void { this.$emit("input", null); this.queryText = ""; From fb821ac45580e0bdc461c19c6a9b1f6df4bcf681 Mon Sep 17 00:00:00 2001 From: Thomas Citharel <tcit@tcit.fr> Date: Fri, 16 Apr 2021 18:13:17 +0200 Subject: [PATCH 4/4] Update to modern slot syntax Signed-off-by: Thomas Citharel <tcit@tcit.fr> --- js/src/components/Account/ActorAutoComplete.vue | 2 +- js/src/components/Admin/Followers.vue | 2 +- js/src/components/Admin/Followings.vue | 2 +- js/src/components/Event/AddressAutoComplete.vue | 2 +- js/src/views/Admin/GroupProfiles.vue | 4 ++-- js/src/views/Admin/Profiles.vue | 4 ++-- js/src/views/Admin/Users.vue | 4 ++-- js/src/views/Event/Participants.vue | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/js/src/components/Account/ActorAutoComplete.vue b/js/src/components/Account/ActorAutoComplete.vue index 879935102..a7f14334e 100644 --- a/js/src/components/Account/ActorAutoComplete.vue +++ b/js/src/components/Account/ActorAutoComplete.vue @@ -10,7 +10,7 @@ @select="handleSelect" @infinite-scroll="getAsyncData" > - <template slot-scope="props"> + <template #default="props"> <div class="media"> <div class="media-left"> <img diff --git a/js/src/components/Admin/Followers.vue b/js/src/components/Admin/Followers.vue index cae94c52a..f8472c042 100644 --- a/js/src/components/Admin/Followers.vue +++ b/js/src/components/Admin/Followers.vue @@ -78,7 +78,7 @@ ></b-table-column > - <template slot="detail" slot-scope="props"> + <template #detail="props"> <article> <div class="content"> <strong>{{ props.row.actor.name }}</strong> diff --git a/js/src/components/Admin/Followings.vue b/js/src/components/Admin/Followings.vue index f21825ab0..18a9fbb9f 100644 --- a/js/src/components/Admin/Followings.vue +++ b/js/src/components/Admin/Followings.vue @@ -103,7 +103,7 @@ ></b-table-column > - <template slot="detail" slot-scope="props"> + <template #detail="props"> <article> <div class="content"> <strong>{{ props.row.targetActor.name }}</strong> diff --git a/js/src/components/Event/AddressAutoComplete.vue b/js/src/components/Event/AddressAutoComplete.vue index a3b39c96c..8b403591d 100644 --- a/js/src/components/Event/AddressAutoComplete.vue +++ b/js/src/components/Event/AddressAutoComplete.vue @@ -12,7 +12,7 @@ expanded @select="updateSelected" > - <template slot-scope="{ option }"> + <template #default="{ option }"> <b-icon :icon="option.poiInfos.poiIcon.icon" /> <b>{{ option.poiInfos.name }}</b ><br /> diff --git a/js/src/views/Admin/GroupProfiles.vue b/js/src/views/Admin/GroupProfiles.vue index 5ee1c757f..9d2553317 100644 --- a/js/src/views/Admin/GroupProfiles.vue +++ b/js/src/views/Admin/GroupProfiles.vue @@ -33,7 +33,7 @@ :label="$t('Username')" searchable > - <template slot="searchable" slot-scope="props"> + <template #searchable="props"> <b-input v-model="props.filters.preferredUsername" placeholder="Search..." @@ -68,7 +68,7 @@ </b-table-column> <b-table-column field="domain" :label="$t('Domain')" searchable> - <template slot="searchable" slot-scope="props"> + <template #searchable="props"> <b-input v-model="props.filters.domain" placeholder="Search..." diff --git a/js/src/views/Admin/Profiles.vue b/js/src/views/Admin/Profiles.vue index fa8ba120c..71384cf5a 100644 --- a/js/src/views/Admin/Profiles.vue +++ b/js/src/views/Admin/Profiles.vue @@ -33,7 +33,7 @@ :label="$t('Username')" searchable > - <template slot="searchable" slot-scope="props"> + <template #searchable="props"> <b-input v-model="props.filters.preferredUsername" placeholder="Search..." @@ -68,7 +68,7 @@ </b-table-column> <b-table-column field="domain" :label="$t('Domain')" searchable> - <template slot="searchable" slot-scope="props"> + <template #searchable="props"> <b-input v-model="props.filters.domain" placeholder="Search..." diff --git a/js/src/views/Admin/Users.vue b/js/src/views/Admin/Users.vue index ff647f011..60ffb817b 100644 --- a/js/src/views/Admin/Users.vue +++ b/js/src/views/Admin/Users.vue @@ -33,7 +33,7 @@ {{ props.row.id }} </b-table-column> <b-table-column field="email" :label="$t('Email')" searchable> - <template slot="searchable" slot-scope="props"> + <template #searchable="props"> <b-input v-model="props.filters.email" :placeholder="$t('Search…')" @@ -76,7 +76,7 @@ {{ props.row.locale }} </b-table-column> - <template slot="detail" slot-scope="props"> + <template #detail="props"> <router-link class="profile" v-for="actor in props.row.actors" diff --git a/js/src/views/Event/Participants.vue b/js/src/views/Event/Participants.vue index c530dad33..93886e2b8 100644 --- a/js/src/views/Event/Participants.vue +++ b/js/src/views/Event/Participants.vue @@ -172,7 +172,7 @@ }} </span> </b-table-column> - <template slot="detail" slot-scope="props"> + <template #detail="props"> <article v-html="nl2br(props.row.metadata.message)" /> </template> <template slot="empty">