sr-npm 1.7.323 → 1.7.324
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pages/careersPage.js +17 -17
package/package.json
CHANGED
package/pages/careersPage.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const { getAllPositions } = require('../backend/queries');
|
|
2
2
|
const {wixData} = require('wix-data');
|
|
3
3
|
const { window } = require('@wix/site-window');
|
|
4
|
-
|
|
5
|
-
const {wixLocationFrontend} = require("wix-location-frontend");
|
|
4
|
+
const { query,queryParams,onChange} = require("wix-location-frontend");
|
|
6
5
|
const {
|
|
7
6
|
debounce,
|
|
8
7
|
getFilter,
|
|
@@ -55,7 +54,7 @@ async function loadMoreJobs(_$w) {
|
|
|
55
54
|
let shouldLoad = false;
|
|
56
55
|
if (pageParamSet == 0) {
|
|
57
56
|
shouldLoad = true;
|
|
58
|
-
} else if (
|
|
57
|
+
} else if (query.page % 2 == pageParamSet % 2) {
|
|
59
58
|
shouldLoad = true;
|
|
60
59
|
} else {
|
|
61
60
|
pageParamSet = Number(pageParamSet) + 1;
|
|
@@ -108,12 +107,12 @@ async function handlePageParam(_$w) {
|
|
|
108
107
|
|
|
109
108
|
if(allJobs.length/itemsPerPage<queryPageVar){
|
|
110
109
|
console.log(`max page is: ${allJobs.length/itemsPerPage}`)
|
|
111
|
-
|
|
110
|
+
queryParams.add({ page: allJobs.length/itemsPerPage })
|
|
112
111
|
}
|
|
113
112
|
if(queryPageVar<=1){
|
|
114
113
|
console.log("min page is : 2")
|
|
115
114
|
pageParamSet=2;
|
|
116
|
-
|
|
115
|
+
queryParams.add({ page: 2 })
|
|
117
116
|
}
|
|
118
117
|
if (queryPageVar) {
|
|
119
118
|
pageParamSet=queryPageVar;
|
|
@@ -175,8 +174,9 @@ function init(_$w) {
|
|
|
175
174
|
_$w('#dropdownsContainer, #closeFiltersButton').collapse();
|
|
176
175
|
});
|
|
177
176
|
|
|
178
|
-
|
|
179
|
-
console.log("onChange
|
|
177
|
+
onChange(()=>{
|
|
178
|
+
console.log("URL changed onChange");
|
|
179
|
+
handleUrlParams(_$w);
|
|
180
180
|
});
|
|
181
181
|
|
|
182
182
|
|
|
@@ -206,7 +206,7 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
206
206
|
_$w(filter.elementId).value = '';
|
|
207
207
|
filter.value = '';
|
|
208
208
|
if (!skipUrlUpdate) {
|
|
209
|
-
|
|
209
|
+
queryParams.remove(["keyWord", "department","page","location"]);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
|
|
@@ -214,13 +214,13 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
214
214
|
if (filter.value && filter.value.trim() !== '') {
|
|
215
215
|
if (!skipUrlUpdate) {
|
|
216
216
|
if(filter.field === 'title'){
|
|
217
|
-
|
|
217
|
+
queryParams.add({ keyWord: filter.value });
|
|
218
218
|
}
|
|
219
219
|
if(filter.field === 'department'){
|
|
220
|
-
|
|
220
|
+
queryParams.add({ department: encodeURIComponent(filter.value) });
|
|
221
221
|
}
|
|
222
222
|
if(filter.field === 'cityText'){
|
|
223
|
-
|
|
223
|
+
queryParams.add({ location: encodeURIComponent(filter.value) });
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
if(filter.field === 'remote') {
|
|
@@ -233,13 +233,13 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
233
233
|
else{
|
|
234
234
|
if (!skipUrlUpdate) {
|
|
235
235
|
if(filter.field === 'title'){
|
|
236
|
-
|
|
236
|
+
queryParams.remove(["keyWord" ]);
|
|
237
237
|
}
|
|
238
238
|
if(filter.field === 'department'){
|
|
239
|
-
|
|
239
|
+
queryParams.remove(["department" ]);
|
|
240
240
|
}
|
|
241
241
|
if(filter.field === 'cityText'){
|
|
242
|
-
|
|
242
|
+
queryParams.remove(["location" ]);
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
}
|
|
@@ -273,7 +273,7 @@ async function resetFilters(_$w) {
|
|
|
273
273
|
|
|
274
274
|
_$w('#resetFiltersButton').disable();
|
|
275
275
|
|
|
276
|
-
|
|
276
|
+
queryParams.remove(["keyWord", "department","page","location"]);
|
|
277
277
|
|
|
278
278
|
|
|
279
279
|
await updateCount(_$w);
|
|
@@ -310,7 +310,7 @@ async function handleDepartmentParam(_$w,department) {
|
|
|
310
310
|
}
|
|
311
311
|
else{
|
|
312
312
|
console.warn("department value not found in dropdown options");
|
|
313
|
-
|
|
313
|
+
queryParams.remove(["department" ]);
|
|
314
314
|
|
|
315
315
|
}
|
|
316
316
|
|
|
@@ -351,7 +351,7 @@ async function handleLocationParam(_$w,location) {
|
|
|
351
351
|
}
|
|
352
352
|
else{
|
|
353
353
|
console.warn("location value not found in dropdown options");
|
|
354
|
-
|
|
354
|
+
queryParams.remove(["location"]);
|
|
355
355
|
}
|
|
356
356
|
|
|
357
357
|
}
|