Complete translation of manual location picker + better guard for Map when user has not previously clicked on a button
This commit is contained in:
parent
edadbd6393
commit
b792f2ec44
@ -17,9 +17,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import fetch from 'isomorphic-fetch';
|
import { GEOCODING_API_ENDPOINT } from '@/constants';
|
||||||
|
|
||||||
const API_ENDPOINT = 'https://api-adresse.data.gouv.fr/search/';
|
require('es6-promise').polyfill();
|
||||||
|
require('isomorphic-fetch');
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@ -50,12 +51,12 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkValue() {
|
checkValue() {
|
||||||
return (this.selectedItem != null) || 'Invalid selection';
|
return (this.selectedItem != null) || this.$t('locationPicker.invalidSelection');
|
||||||
},
|
},
|
||||||
queryAPI(value) {
|
queryAPI(value) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
fetch(`${API_ENDPOINT}?q=${value}`)
|
fetch(`${GEOCODING_API_ENDPOINT}?q=${value}`)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => data.features)
|
.then(data => data.features)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
@ -135,3 +135,5 @@ export const TILE_SERVERS = {
|
|||||||
opencyclemap: opencyclemapURL,
|
opencyclemap: opencyclemapURL,
|
||||||
};
|
};
|
||||||
export const DEFAULT_TILE_SERVER = 'cartodb-voyager';
|
export const DEFAULT_TILE_SERVER = 'cartodb-voyager';
|
||||||
|
|
||||||
|
export const GEOCODING_API_ENDPOINT = 'https://api-adresse.data.gouv.fr/search/';
|
||||||
|
@ -29,6 +29,10 @@ export default {
|
|||||||
startReporting: 'Start reporting!',
|
startReporting: 'Start reporting!',
|
||||||
welcome: 'Welcome',
|
welcome: 'Welcome',
|
||||||
},
|
},
|
||||||
|
locationPicker: {
|
||||||
|
invalidSelection: 'Invalid selection',
|
||||||
|
pickALocationManually: 'pick a location manually',
|
||||||
|
},
|
||||||
menu: {
|
menu: {
|
||||||
About: 'Help',
|
About: 'Help',
|
||||||
Map: 'Map',
|
Map: 'Map',
|
||||||
@ -36,6 +40,7 @@ export default {
|
|||||||
},
|
},
|
||||||
misc: {
|
misc: {
|
||||||
discard: 'Discard',
|
discard: 'Discard',
|
||||||
|
or: 'or',
|
||||||
retry: 'Retry',
|
retry: 'Retry',
|
||||||
spaceBeforeDoublePunctuations: '',
|
spaceBeforeDoublePunctuations: '',
|
||||||
},
|
},
|
||||||
|
@ -29,6 +29,10 @@ export default {
|
|||||||
startReporting: 'Commencer à signaler !',
|
startReporting: 'Commencer à signaler !',
|
||||||
welcome: 'Bienvenue !',
|
welcome: 'Bienvenue !',
|
||||||
},
|
},
|
||||||
|
locationPicker: {
|
||||||
|
invalidSelection: 'Sélection invalide',
|
||||||
|
pickALocationManually: 'choisir une position manuellement',
|
||||||
|
},
|
||||||
menu: {
|
menu: {
|
||||||
About: 'Aide',
|
About: 'Aide',
|
||||||
Map: 'Carte',
|
Map: 'Carte',
|
||||||
@ -36,6 +40,7 @@ export default {
|
|||||||
},
|
},
|
||||||
misc: {
|
misc: {
|
||||||
discard: 'Annuler',
|
discard: 'Annuler',
|
||||||
|
or: 'ou',
|
||||||
retry: 'Réessayer',
|
retry: 'Réessayer',
|
||||||
spaceBeforeDoublePunctuations: ' ',
|
spaceBeforeDoublePunctuations: ' ',
|
||||||
},
|
},
|
||||||
|
@ -27,9 +27,9 @@
|
|||||||
<p class="text-xs-center">
|
<p class="text-xs-center">
|
||||||
<v-btn role="button" color="blue" dark @click="initializePositionWatching">Retry</v-btn>
|
<v-btn role="button" color="blue" dark @click="initializePositionWatching">Retry</v-btn>
|
||||||
</p>
|
</p>
|
||||||
<p>or</p>
|
<p>{{ $t('misc.or') }}</p>
|
||||||
<p>
|
<p>
|
||||||
<AddressInput label="pick a location manually" :onInput="onManualLocationPicker" v-model="manualLocation"></AddressInput>
|
<AddressInput :label="$t('locationPicker.pickALocationManually')" :onInput="onManualLocationPicker" v-model="manualLocation"></AddressInput>
|
||||||
</p>
|
</p>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
@ -47,8 +47,10 @@ import AddressInput from '@/components/AddressInput.vue';
|
|||||||
import Map from '@/components/Map.vue';
|
import Map from '@/components/Map.vue';
|
||||||
import ReportCard from '@/components/ReportCard.vue';
|
import ReportCard from '@/components/ReportCard.vue';
|
||||||
import ReportDialog from '@/components/ReportDialog/index.vue';
|
import ReportDialog from '@/components/ReportDialog/index.vue';
|
||||||
|
|
||||||
import * as constants from '@/constants';
|
import * as constants from '@/constants';
|
||||||
import { distance, mockLocation } from '@/tools';
|
import { distance, mockLocation } from '@/tools';
|
||||||
|
import store from '@/store';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -57,10 +59,11 @@ export default {
|
|||||||
ReportCard,
|
ReportCard,
|
||||||
ReportDialog,
|
ReportDialog,
|
||||||
},
|
},
|
||||||
created() {
|
beforeRouteEnter(to, from, next) {
|
||||||
if (!this.$store.state.hasGoneThroughIntro) {
|
if (!store.state.hasGoneThroughIntro) {
|
||||||
this.$router.replace({ name: 'Onboarding' });
|
return next({ name: 'Onboarding', replace: true });
|
||||||
}
|
}
|
||||||
|
return next();
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.disableNoSleep();
|
this.disableNoSleep();
|
||||||
|
Loading…
Reference in New Issue
Block a user