sr-npm 1.7.192 → 1.7.194

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.192",
3
+ "version": "1.7.194",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -16,11 +16,12 @@ const {
16
16
  let queryPageVar;
17
17
  let queryKeyWordVar;
18
18
  let queryDepartmentVar;
19
-
20
- async function careersPageOnReady(_$w,thisObject,querypage,querykeyWord,querydepartment) {
19
+ let queryLocationVar;
20
+ async function careersPageOnReady(_$w,thisObject,querypage,querykeyWord,querydepartment,querylocation) {
21
21
  queryPageVar=querypage;
22
22
  queryKeyWordVar=querykeyWord;
23
23
  queryDepartmentVar=querydepartment;
24
+ queryLocationVar=querylocation;
24
25
  thisObjectVar=thisObject;
25
26
  allJobs=await getAllPositions();
26
27
  await handleUrlParams(_$w);
@@ -90,6 +91,10 @@ async function handleUrlParams(_$w) {
90
91
  if (queryDepartmentVar) {
91
92
  await handleDepartmentParam(_$w,queryDepartmentVar);
92
93
  }
94
+ if (queryLocationVar) {
95
+ console.log("queryLocationVar:@!#$#@%^%$&%&^%&^% ", queryLocationVar);
96
+ await handleLocationParam(_$w,queryLocationVar);
97
+ }
93
98
  }
94
99
 
95
100
  async function handleKeyWordParam(_$w,keyWord) {
@@ -200,6 +205,9 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
200
205
  if(filter.field === 'department'){
201
206
  queryParams.add({ department: encodeURIComponent(filter.value) });
202
207
  }
208
+ if(filter.field === 'cityText'){
209
+ queryParams.add({ location: encodeURIComponent(filter.value) });
210
+ }
203
211
  }
204
212
  if(filter.field === 'remote') {
205
213
  value = filter.value === 'true';
@@ -216,6 +224,9 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
216
224
  if(filter.field === 'department'){
217
225
  queryParams.remove(["department" ]);
218
226
  }
227
+ if(filter.field === 'cityText'){
228
+ queryParams.remove(["location" ]);
229
+ }
219
230
  }
220
231
  }
221
232
  });
@@ -266,7 +277,7 @@ async function handleDepartmentParam(_$w,department) {
266
277
  //+1 because of the "All" option
267
278
 
268
279
  if(dropdownOptions.length!==optionsFromCMS.items.length+1){
269
- fixDropdownOptions(optionsFromCMS, _$w);
280
+ fixDropdownOptions('#dropdownDepartment',optionsFromCMS, _$w);
270
281
  }
271
282
 
272
283
  if (_$w('#dropdownDepartment').options.find(option => option.value === departmentValue))
@@ -284,7 +295,7 @@ async function handleDepartmentParam(_$w,department) {
284
295
 
285
296
  }
286
297
 
287
- function fixDropdownOptions(optionsFromCMS, _$w){
298
+ function fixDropdownOptions(dropdown,optionsFromCMS, _$w){
288
299
  let dropdownOptions = [];
289
300
  dropdownOptions=[{
290
301
  label: "All",
@@ -294,11 +305,34 @@ function fixDropdownOptions(optionsFromCMS, _$w){
294
305
  label: item.title,
295
306
  value: item.title
296
307
  })));
297
- _$w('#dropdownDepartment').options=dropdownOptions;
308
+ _$w(dropdown).options=dropdownOptions;
298
309
  console.warn("something is wrong with the dropdown options, fixing it");
299
310
 
300
311
  }
301
312
 
313
+ async function handleLocationParam(_$w,location) {
314
+ let dropdownOptions = _$w('#dropdownLocation').options;
315
+ console.log("location dropdown options:", dropdownOptions);
316
+ const optionsFromCMS=await wixData.query("Cities").find();
317
+ //+1 because of the "All" option
318
+
319
+ if(dropdownOptions.length!==optionsFromCMS.items.length+1){
320
+ fixDropdownOptions('#dropdownLocation',optionsFromCMS, _$w);
321
+ }
322
+
323
+ if (_$w('#dropdownLocation').options.find(option => option.value === locationValue))
324
+ {
325
+ _$w('#dropdownLocation').value = locationValue;
326
+ await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
327
+ }
328
+ else{
329
+ console.warn("department value not found in dropdown options");
330
+ queryParams.remove(["department" ]);
331
+
332
+ }
333
+
334
+ }
335
+
302
336
 
303
337
 
304
338
  module.exports = {
package/pages/homePage.js CHANGED
@@ -35,6 +35,7 @@ async function homePageOnReady(_$w,thisObject) {
35
35
  longitude: location.longitude
36
36
  },
37
37
  address: item.locationAddress.formatted,
38
+ title: item.title,
38
39
  link: cityLinkUrl,
39
40
  linkTitle:`View ${item.count} Open Positions`
40
41
  };