Commit d72cc2a9 authored by SeeBenj's avatar SeeBenj

Merge branch 'feature/OSMopeningHoursParser' into 'develop'

Opening Hours URL

See merge request !146
parents c91c2f49 7ab8929d
Pipeline #75946901 passed with stages
in 9 minutes and 54 seconds
......@@ -7536,6 +7536,18 @@
"pumpify": "^1.3.3",
"stream-each": "^1.1.0",
"through2": "^2.0.0"
},
"dependencies": {
"pump": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz",
"integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==",
"dev": true,
"requires": {
"end-of-stream": "^1.1.0",
"once": "^1.3.1"
}
}
}
},
"mixin-deep": {
......
......@@ -50,11 +50,19 @@
src="../../assets/info_black.png">
</div>
<input type="text"
<input v-validate="'url'"
:class="{'is-error': errors.has('website_opening_hours')}"
type="text"
name="website_opening_hours"
v-on:blur="blurOpeningHours()"
id="openingHoursURL"
v-model="details.opening_hours_url"
v-model="details.opening_url"
:placeholder="$t('detail.placeholders.opening_hours_url')">
<span v-show="errors.has('website_opening_hours')"
class="help is-danger">
{{$t('detail.validate.website')}}
</span>
</div>
<div class="field">
......
......@@ -66,6 +66,7 @@
"country": "Country",
"name": "Name",
"opening_hours": "Opening hours",
"opening_hours_url": "Opening hours URL",
"phone": "Phone number",
"email": "E-Mail address",
"website": "Website",
......@@ -87,6 +88,7 @@
"city": "Winterthur",
"country": "Switzerland",
"opening_hours": "Tu-Su 08:00-17:00",
"opening_hours_url": "https://www.example.com/",
"phone": "+41 11 111 11 11",
"email": "example@example.com",
"website": "http://www.example.com",
......
......@@ -29,6 +29,7 @@ const initialState = {
},
name: '',
opening_hours: '',
opening_url: '',
phone: '',
email: '',
website: '',
......@@ -88,6 +89,9 @@ function constructSuccessMessage(response, isNote) {
}
function parseTagToString(tag, value, initialValue, additionalText) {
if (tag === 'opening_url') {
tag = 'opening_hours:url';
}
if (deepEqual(value, initialValue)) {
if (value) {
return `${additionalText}${tag} = ${value}\n`;
......@@ -193,6 +197,7 @@ export function clearDetails() {
},
name: '',
opening_hours: '',
opening_url: '',
phone: '',
email: '',
website: '',
......
......@@ -49,7 +49,6 @@ const actions = {
resolve(subscribedBusinessPOI);
}
});
promise.then(() => {
if (isNoteWithoutOsmElement(subscribedBusinessPOI.id)) {
subscribedBusinessPOI.tags = {};
......
......@@ -7,6 +7,7 @@ function parseDetails(businessPOITags) {
const tags = [
'name',
'opening_hours',
'opening_hours:url',
'phone',
'email',
'website',
......@@ -128,6 +129,9 @@ function createDetailTags(businessPOI) {
if (businessPOI.details.opening_hours.length !== 0) {
text += `<tag k="opening_hours" v="${businessPOI.details.opening_hours}"/>`;
}
if (businessPOI.opening_url.length !== 0) {
text += `<tag k="opening_hours:url" v="${businessPOI.details.opening_url}"/>`;
}
if (businessPOI.details.phone.length !== 0) {
text += `<tag k="phone" v="${businessPOI.details.phone}"/>`;
}
......@@ -235,7 +239,6 @@ function extractId(businessPOIDiff) {
return getAttributes(diffJson).new_id;
}
export default {
parseUser,
constructUpload,
......
......@@ -65,6 +65,7 @@ function createNoteFromBusinessPOI(businessPOI) {
category: getBizCategory(businessPOI),
name: extractTag(businessPOI, 'name'),
opening_hours: extractTag(businessPOI, 'opening_hours'),
opening_url: extractTag(businessPOI, 'opening_hours:url'),
phone: extractTag(businessPOI, 'phone'),
email: extractTag(businessPOI, 'email'),
website: extractTag(businessPOI, 'website'),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment