Fix search result ajax request being sent multiple times

This commit is contained in:
Björn Fromme
2019-07-05 12:18:30 +02:00
parent 4f9c3212e0
commit 383579d4b6
7 changed files with 32 additions and 29 deletions
@@ -2,7 +2,7 @@
<div class="boardtypeselect"> <div class="boardtypeselect">
<div class="checkbox" v-for="boardType of boardTypesOptions"> <div class="checkbox" v-for="boardType of boardTypesOptions">
<label> <label>
<input type="checkbox" v-model.number="boardTypesSelected" :value="boardType.uid"> <input type="checkbox" v-model.number="boardTypesSelected" :value="boardType.uid" @change="notifySelected">
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span> <span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
{{ boardType.label }} {{ boardType.label }}
</label> </label>
@@ -29,12 +29,14 @@
} }
} }
}, },
methods: {
notifySelected () {
this.$emit('selected', this.boardTypesSelected);
}
},
watch: { watch: {
boardTypes (value) { boardTypes (value) {
this.boardTypesSelected = value; this.boardTypesSelected = value;
},
boardTypesSelected (value) {
this.$emit('selected', value);
} }
} }
} }
@@ -3,7 +3,7 @@
<template v-if="busAvailable"> <template v-if="busAvailable">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" v-model="busSelected"> <input type="checkbox" v-model="busSelected" @change="notifySelected">
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span> <span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
Busanreise Busanreise
</label> </label>
@@ -32,12 +32,14 @@
default: false default: false
} }
}, },
methods: {
notifySelected () {
this.$emit('selected', this.busSelected);
}
},
watch: { watch: {
bus (value) { bus (value) {
this.busSelected = value; this.busSelected = value;
},
busSelected (value) {
this.$emit('selected', value);
} }
} }
} }
@@ -2,7 +2,7 @@
<div class="conceptselect"> <div class="conceptselect">
<div class="checkbox" v-for="concept of conceptOptions"> <div class="checkbox" v-for="concept of conceptOptions">
<label> <label>
<input type="checkbox" v-model="conceptsSelected" :value="concept.uid"> <input type="checkbox" v-model="conceptsSelected" :value="concept.uid" @change="notifySelected">
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span> <span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
nur {{ concept.name }} nur {{ concept.name }}
</label> </label>
@@ -29,12 +29,14 @@
} }
} }
}, },
methods: {
notifySelected () {
this.$emit('selected', this.conceptsSelected);
}
},
watch: { watch: {
concepts (value) { concepts (value) {
this.conceptsSelected = value; this.conceptsSelected = value;
},
conceptsSelected (value) {
this.$emit('selected', value);
} }
} }
} }
@@ -3,14 +3,14 @@
<div class="destinationselect__section" v-for="(destination, uid) of selectableDestinations"> <div class="destinationselect__section" v-for="(destination, uid) of selectableDestinations">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" v-model.number="countryUidsSelected" :value="uid"> <input type="checkbox" v-model.number="countryUidsSelected" :value="uid" @change="notifySelected">
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span> <span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
<strong>{{ destination.country.label }}</strong> <strong>{{ destination.country.label }}</strong>
</label> </label>
</div> </div>
<div class="checkbox" v-for="region of destination.regions"> <div class="checkbox" v-for="region of destination.regions">
<label> <label>
<input type="checkbox" v-model.number="regionUidsSelected" :value="region.uid"> <input type="checkbox" v-model.number="regionUidsSelected" :value="region.uid" @change="notifySelected">
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span> <span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
<span class="small">{{ region.label }}</span> <span class="small">{{ region.label }}</span>
</label> </label>
@@ -64,12 +64,6 @@
}, },
regionUids (value) { regionUids (value) {
this.regionUidsSelected = value; this.regionUidsSelected = value;
},
countryUidsSelected () {
this.notifySelected();
},
regionUidsSelected () {
this.notifySelected();
} }
} }
} }
@@ -2,7 +2,7 @@
<div class="hoteltypeselect"> <div class="hoteltypeselect">
<div class="checkbox" v-for="hotelTypesOption of hotelTypesOptions"> <div class="checkbox" v-for="hotelTypesOption of hotelTypesOptions">
<label> <label>
<input type="checkbox" v-model.number="hotelTypesSelected" :value="hotelTypesOption"> <input type="checkbox" v-model.number="hotelTypesSelected" :value="hotelTypesOption" @change="notifySelected">
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span> <span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
{{ hotelTypesLabels[hotelTypesOption] }} {{ hotelTypesLabels[hotelTypesOption] }}
</label> </label>
@@ -36,12 +36,14 @@
} }
} }
}, },
methods: {
notifySelected () {
this.$emit('selected', this.hotelTypesSelected);
}
},
watch: { watch: {
hotelTypes (value) { hotelTypes (value) {
this.hotelTypesSelected = value; this.hotelTypesSelected = value;
},
hotelTypesSelected (value) {
this.$emit('selected', value);
} }
} }
} }
@@ -2,7 +2,7 @@
<div class="roomtypeselect"> <div class="roomtypeselect">
<div class="checkbox" v-for="roomTypesOption of roomTypesOptions"> <div class="checkbox" v-for="roomTypesOption of roomTypesOptions">
<label> <label>
<input type="checkbox" v-model.number="roomTypesSelected" :value="roomTypesOption"> <input type="checkbox" v-model.number="roomTypesSelected" :value="roomTypesOption" @change="notifySelected">
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span> <span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
{{ roomTypesLabels[roomTypesOption] }} {{ roomTypesLabels[roomTypesOption] }}
</label> </label>
@@ -37,12 +37,14 @@
} }
} }
}, },
methods: {
notifySelected () {
this.$emit('selected', this.roomTypesSelected);
}
},
watch: { watch: {
roomTypes (value) { roomTypes (value) {
this.roomTypesSelected = value; this.roomTypesSelected = value;
},
roomTypesSelected (value) {
this.$emit('selected', value);
} }
} }
} }
@@ -140,7 +140,6 @@
resetFilterSettings () { resetFilterSettings () {
this.updateFilterSettings(defaultFilterSettings); this.updateFilterSettings(defaultFilterSettings);
EventBus.$emit('filterSettingsReset'); EventBus.$emit('filterSettingsReset');
this.loadResults();
}, },
updateDestination (destination) { updateDestination (destination) {
this.updateFilterSettings({ this.updateFilterSettings({