Skip to content

Commit

Permalink
Import changes of pksec :
Browse files Browse the repository at this point in the history
- Added VUE_APP_PINCODE_LENGTH_VALIDATION=<int> e.g., 6 for India; 4 for Swiss.
- Improved Readme for ``VUE_APP_REPORT_LOCATION_SELECTOR=postal-code`
- Added MAP view button immediately after submission page
  • Loading branch information
mullerch committed Apr 5, 2020
1 parent 1d0d342 commit 979af81
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 14 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#### In .env ###


# Choose you location selector type (e.g., address based or postal-code based) (default: postal-code) (only postal code method is available for now)
VUE_APP_REPORT_LOCATION_SELECTOR=postal-code
# Set the PINCODE length of your country <int> 6 for India; 4 for Switzerland
VUE_APP_PINCODE_LENGTH_VALIDATION=6

# Data sources
VUE_APP_VISU_DATA_SOURCE_URL=<your data source CSV file: https://raw.githubusercontent.com/...>
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [1.4.1] 2020-04-04

Changes by @pksec

### Added

- Added VUE_APP_PINCODE_LENGTH_VALIDATION=<int> e.g., 6 for India; 4 for Swiss.
- Improved Readme for ``VUE_APP_REPORT_LOCATION_SELECTOR=postal-code`
- Added MAP view button immediately after submission page

## [1.4.0] 2020-04-04

### Added
Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,16 @@ Please be sure to use 'yarn' instead of 'npm' as package manager.

#### Configuration

1. Choose you location selector (default: postal-code) (only postal code available for now)
1. Setup the data source and geocoding data URLs
2. Set the map default position and zoom level
3. Set the recaptcha key (not the secret) with the value from the reCAPTCHA console.
4. List the languages you need
5. Set the github repository of your fork for the issues reporting
6. Set the social links for the desired platforms
7. Configure the URL for the backend endpoint to your backend instance.
1. Choose you location selector type (e.g., address or postal-code) (default: postal-code) (only postal code method is available for now)
- e.g., configuration ``VUE_APP_REPORT_LOCATION_SELECTOR=postal-code``
2. Set the PINCODE length of your country : ``VUE_APP_PINCODE_LENGTH_VALIDATION=6``
3. Setup the data source and geocoding data URLs
4. Set the map default position and zoom level
5. Set the recaptcha key (not the secret) with the value from the reCAPTCHA console.
6. List the languages you need
7. Set the github repository of your fork for the issues reporting
8. Set the social links for the desired platforms
9. Configure the URL for the backend endpoint to your backend instance.

## Develop

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "covid-self-report",
"version": "1.4.0",
"version": "1.4.1",
"author": {
"name": "Christian Müller",
"email": "muller.ch@gmail.com"
Expand Down
3 changes: 2 additions & 1 deletion src/assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
"sentComeBack": "Thank you for your contribution. Please come back if your health status changes.",
"sentSomeoneElse": "If you want to file a report for someone else, please use another phone, tablet or computer.",
"sentMistake": "You've made a mistake ? You can correct it : ",
"sentMistakeClickHere": "click here"
"sentMistakeClickHere": "click here",
"wantToSeePublicData": "Your contribution helps to build a public dataset. If you want to see the current data, click:"
},
"visualize": {
"title": "Visualize",
Expand Down
7 changes: 7 additions & 0 deletions src/pages/Report.vue
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,15 @@
</div>

<div v-else class="text-white">

<h3 class="text-white">{{ $t('report.sentThanks') }}</h3>
<p>{{ $t('report.sentComeBack') }}</p>
<p>
{{ $t('report.wantToSeePublicData') }}
<base-button size="sm" @click="$router.replace({ name: 'visualize' })" type="info">
{{ $t('visualize.title') }}
</base-button>
</p>
<p>{{ $t('report.sentSomeoneElse') }}</p>
<p>
{{ $t('report.sentMistake') }}
Expand Down
16 changes: 13 additions & 3 deletions src/views/LocationEditors/LocationFromPostalCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@input="locationChanged"
type="number"
:placeholder="$t('report.locationPlaceholder')"
:error="enableCheck && !valid ? $t('report.locationValidError') : ''"
:error="enableCheck && !valid ? $t('report.locationValidError', { length: process.env.VUE_APP_PINCODE_LENGTH_VALIDATION }) : ''"
@focusout="enableCheck = true"
:valid="!enableCheck ? null : valid"></base-input>
</div>
Expand Down Expand Up @@ -32,11 +32,21 @@
this.$emit('update:location', value);
},
isValid(value) {
if (this.location === null) {
if (value === null) {
return false;
}
return value.length === 4 && !isNaN(value);
if (isNaN(value)) {
return false;
}
if (process.env.VUE_APP_PINCODE_LENGTH_VALIDATION) {
if (value.length !== parseInt(process.env.VUE_APP_PINCODE_LENGTH_VALIDATION)) {
return false
}
}
return true;
},
},
watch: {
Expand Down

0 comments on commit 979af81

Please sign in to comment.