@bmlt-enabled/croutonjs 3.18.0 → 3.18.2

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/crouton-core.js CHANGED
@@ -13311,7 +13311,7 @@ function CroutonLocalization(language) {
13311
13311
  "no_meetings_for_this_day": "Keine Meetings an diesem Tag.",
13312
13312
  'css-textalign': '',
13313
13313
  'css-floatdirection': '',
13314
- 'all': 'All',
13314
+ 'all': 'Alle',
13315
13315
  'menu': 'Menu',
13316
13316
  'search for meetings': 'Search for meetings',
13317
13317
  'show meetings near...': 'Meetings in andere Städten',
@@ -14496,7 +14496,7 @@ this["hbs_Crouton"]["templates"]["mapSearch"] = Handlebars.template({"compiler":
14496
14496
  return undefined
14497
14497
  };
14498
14498
 
14499
- return "<button id=\"map-search-button\" class=\"menu-button\" title=\"Erweiterte Suche\" style=\"width: 95px; height:55px;\">\n <span class=\"menu-button-label\" style=\"position:initial;\">"
14499
+ return "<button id=\"map-search-button\" class=\"menu-button\" title=\"Erweiterte Suche\">\n <span class=\"menu-button-label\" style=\"position:initial;\">"
14500
14500
  + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Search for meetings",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":2,"column":62},"end":{"line":2,"column":95}}}))
14501
14501
  + "</span>\n</button>\n<div id=\"bmltsearch_modal\" class=\"modal\" style=\"display: none;\">\n <div id=\"bmltsearch_content\" class=\"modal-content\">\n <span class=\"modal-title\">"
14502
14502
  + alias3((lookupProperty(helpers,"getWord")||(depth0 && lookupProperty(depth0,"getWord"))||alias2).call(alias1,"Search for meetings",{"name":"getWord","hash":{},"data":data,"loc":{"start":{"line":6,"column":28},"end":{"line":6,"column":61}}}))
@@ -14796,7 +14796,7 @@ var croutonDefaultTemplates = {
14796
14796
 
14797
14797
  meeting_count_template: [
14798
14798
  "{{#if this.config.has_meeting_count}}",
14799
- "<span class='bmlt_tabs_meeting_count'>{{getWord 'meeting_count'}} <span id='bmlt_tabs_meeting_count'>{{this.meetings.meetingCount}}</span></span>",
14799
+ "<span class='bmlt_tabs_meeting_count'>{{getWord 'meeting_count'}} <span id='bmlt_tabs_meeting_count-live'>{{this.meetings.meetingCount}}</span></span>",
14800
14800
  "{{/if}}"
14801
14801
  ].join('\n'),
14802
14802
 
@@ -15985,7 +15985,6 @@ function Crouton(config) {
15985
15985
  theme: "jack", // Allows for setting pre-packaged themes. Choices are listed here: https://github.com/bmlt-enabled/crouton/blob/master/croutonjs/dist/templates/themes
15986
15986
  meeting_data_template: croutonDefaultTemplates.meeting_data_template,
15987
15987
  metadata_template: croutonDefaultTemplates.metadata_template,
15988
- marker_contents_template: croutonDefaultTemplates.marker_contents_template,
15989
15988
  observer_template: croutonDefaultTemplates.observer_template,
15990
15989
  meeting_count_template: croutonDefaultTemplates.meeting_count_template,
15991
15990
  meeting_link_template: croutonDefaultTemplates.meeting_link_template,
@@ -15993,7 +15992,6 @@ function Crouton(config) {
15993
15992
  meetingpage_title_template: croutonDefaultTemplates.meetingpage_title_template,
15994
15993
  meetingpage_contents_template: croutonDefaultTemplates.meetingpage_contents_template,
15995
15994
  meetingpage_frame_template: croutonDefaultTemplates.meetingpage_frame_template,
15996
- marker_contents_template: croutonDefaultTemplates.marker_contents_template,
15997
15995
  lat: 0,
15998
15996
  lng: 0,
15999
15997
  zoom: 10,
@@ -16317,7 +16315,7 @@ function Crouton(config) {
16317
16315
  showingNow.push(rowId[rowId.length-1]);
16318
16316
  });
16319
16317
  showingNow = [...new Set(showingNow)];
16320
- self.updateMeetingCount(showingNow.length);
16318
+ self.updateMeetingCount(showingNow);
16321
16319
  self.updateFilters();
16322
16320
  if (croutonMap) croutonMap.fillMap(showingNow);
16323
16321
  if (self.config.map_page) {
@@ -16356,7 +16354,7 @@ function Crouton(config) {
16356
16354
  } else if (self.config.show_map) croutonMap.fillMap();
16357
16355
  self.filtering = false;
16358
16356
  self.updateFilters();
16359
- self.updateMeetingCount(self.meetingData.length);
16357
+ self.updateMeetingCount();
16360
16358
  jQuery(".filter-dropdown").val(null).trigger("change");
16361
16359
  jQuery(".meeting-header").removeClass("hide");
16362
16360
  jQuery(".bmlt-data-row").removeClass("hide");
@@ -16386,13 +16384,14 @@ function Crouton(config) {
16386
16384
  dropdown.optionsShowing = dropdown.uniqueData(showing).map((o) => dropdown.optionName(o));
16387
16385
  });
16388
16386
  }
16389
- self.renderStandaloneMap = function (selector, context, callback) {
16387
+ self.renderStandaloneMap = function (selector, context, callback=null, fitBounds=true) {
16390
16388
  hbs_Crouton['localization'] = self.localization;
16391
16389
  self.config["hide_byday_headers"] = true;
16392
16390
  crouton_Handlebars.registerPartial('meetings', hbs_Crouton.templates['meetings']);
16393
16391
  crouton_Handlebars.registerPartial('bydays', hbs_Crouton.templates['byday']);
16394
16392
  crouton_Handlebars.registerPartial('formatPopup', hbs_Crouton.templates['formatPopup']);
16395
- croutonMap.initialize(self.createBmltMapElement(),self.meetingData,context,null,callback);
16393
+ window.crouton = self;
16394
+ croutonMap.initialize(self.createBmltMapElement(),self.meetingData,context,null,fitBounds,callback);
16396
16395
  }
16397
16396
  self.getCurrentLocation = function(callback) {
16398
16397
  if (navigator.geolocation) {
@@ -16401,7 +16400,7 @@ function Crouton(config) {
16401
16400
  $('.geo').removeClass("hide").addClass("show").html('<p>Geolocation is not supported by your browser</p>');
16402
16401
  }
16403
16402
  };
16404
- self.renderView = function (selector, context, callback) {
16403
+ self.renderView = function (selector, context, callback, fitBounds) {
16405
16404
  hbs_Crouton['localization'] = self.localization;
16406
16405
  crouton_Handlebars.registerPartial('meetings', hbs_Crouton.templates['meetings']);
16407
16406
  crouton_Handlebars.registerPartial('bydays', hbs_Crouton.templates['byday']);
@@ -16413,8 +16412,45 @@ function Crouton(config) {
16413
16412
  jQuery(selector).html(template(context));
16414
16413
  callback();
16415
16414
  };
16416
- self.updateMeetingCount = function(meetingCount) {
16417
- jQuery('#bmlt_tabs_meeting_count').html(meetingCount);
16415
+ self.updateMeetingCount = function(showingNow=null) {
16416
+ self = this;
16417
+ let meetingCount = self.meetingData.length;
16418
+ addLive = function(id) {return id+", "+id+"-live"};
16419
+ if (showingNow !== null) {
16420
+ meetingCount = showingNow.length;
16421
+ addLive = function(id) {return id+"-live"};
16422
+ }
16423
+ jQuery(addLive('#bmlt_tabs_meeting_count')).text(meetingCount);
16424
+ jQuery(addLive('#bmlt_tabs_group_count')).each(function(){
16425
+ var filteredMeetings = self.meetingData;
16426
+ if (showingNow!==null) filteredMeetings = self.meetingData.filter((m) => showingNow.includes(m.id_bigint));
16427
+ var groups = filteredMeetings.map((m)=>m['worldid_mixed'] !== "" ? m['worldid_mixed'] :m['meeting_name']);
16428
+ jQuery(this).text(arrayUnique(groups).length);
16429
+ });
16430
+ jQuery(addLive('#bmlt_tabs_service_body_names')).each(function() {
16431
+ var filteredMeetings = self.meetingData;
16432
+ if (showingNow!==null) filteredMeetings = self.meetingData.filter((m) => showingNow.includes(m.id_bigint));
16433
+ var ids = getUniqueValuesOfKey(filteredMeetings, 'service_body_bigint');
16434
+ var me = this;
16435
+ self.getServiceBodies(ids).then(function (service_bodies) {
16436
+ var n = service_bodies.length;
16437
+ var names = service_bodies.map((m)=>m['name']);
16438
+ names.sort();
16439
+ var ret = "";
16440
+ if (n===1) {
16441
+ ret = names[0];
16442
+ }
16443
+ else {
16444
+ ret = names[0];
16445
+ for (var j = 1; j < n-1; j++) {
16446
+ ret += ', ';
16447
+ ret += names[j];
16448
+ }
16449
+ ret += ' and ' + names[n-1];
16450
+ }
16451
+ jQuery(me).text(ret);
16452
+ });
16453
+ });
16418
16454
  }
16419
16455
  self.getServiceBodies = function(service_bodies_id) {
16420
16456
  var requires_parents = self.config.has_regions;
@@ -16559,9 +16595,6 @@ function Crouton(config) {
16559
16595
  self.filteredPage();
16560
16596
  }
16561
16597
 
16562
- self.isMeetingInTime = function(meeting, dayNow, hour, mins) {
16563
-
16564
- }
16565
16598
  self.distance = function(lat1, lon1, lat2, lon2, unit) {
16566
16599
  if ((lat1 === lat2) && (lon1 === lon2)) {
16567
16600
  return 0;
@@ -16596,14 +16629,12 @@ function Crouton(config) {
16596
16629
 
16597
16630
  crouton_Handlebars.registerPartial("meetingDataTemplate", self.config['meeting_data_template']);
16598
16631
  crouton_Handlebars.registerPartial("metaDataTemplate", self.config['metadata_template']);
16599
- crouton_Handlebars.registerPartial("popupTemplate", self.config['marker_contents_template']);
16600
16632
  crouton_Handlebars.registerPartial("observerTemplate", self.config['observer_template']);
16601
16633
  crouton_Handlebars.registerPartial("meetingpageTitleTemplate", self.config['meetingpage_title_template']);
16602
16634
  crouton_Handlebars.registerPartial("meetingpageContentsTemplate", self.config['meetingpage_contents_template']);
16603
16635
  crouton_Handlebars.registerPartial("meetingCountTemplate", self.config['meeting_count_template']);
16604
16636
  crouton_Handlebars.registerPartial("meetingLink", self.config['meeting_link_template']);
16605
16637
  crouton_Handlebars.registerPartial("meetingModal", self.config['meeting_modal_template']);
16606
- crouton_Handlebars.registerPartial("markerContentsTemplate", self.config['marker_contents_template']);
16607
16638
 
16608
16639
  for (var m = 0; m < meetingData.length; m++) {
16609
16640
  meetingData[m]['formatted_comments'] = meetingData[m]['comments'];
@@ -16810,52 +16841,6 @@ Crouton.prototype.reset = function() {
16810
16841
  jQuery("#" + self.config["placeholder_id"]).html("");
16811
16842
  };
16812
16843
 
16813
- Crouton.prototype.meetingCount = function(callback) {
16814
- var self = this;
16815
- self.lock(function() {
16816
- callback(self.meetingData.length);
16817
- });
16818
- };
16819
-
16820
- Crouton.prototype.groupCount = function(callback) {
16821
- var self = this;
16822
- self.lock(function() {
16823
- var groups = [];
16824
- for (var i = 0; i < self.meetingData.length; i++) {
16825
- groups.push(self.meetingData[i]['worldid_mixed'] !== "" ? self.meetingData[i]['worldid_mixed'] : self.meetingData[i]['meeting_name']);
16826
- }
16827
- callback(arrayUnique(groups).length);
16828
- });
16829
- };
16830
-
16831
- Crouton.prototype.serviceBodyNames = function(callback) {
16832
- var self = this;
16833
- self.lock(function() {
16834
- var ids = getUniqueValuesOfKey(self.meetingData, 'service_body_bigint');
16835
- self.getServiceBodies(ids).then(function (service_bodies) {
16836
- var n = service_bodies.length;
16837
- var names = [];
16838
- for (var i = 0; i < n; i++) {
16839
- names.push(service_bodies[i]['name']);
16840
- }
16841
- names.sort();
16842
- if (n===1) {
16843
- callback(names[0]);
16844
- }
16845
- else if (n===2) {
16846
- callback(names[0] + ' and ' + names[1]);
16847
- }
16848
- else {
16849
- var str = '';
16850
- for (var j = 0; j < n-1; j++) {
16851
- str += names[j];
16852
- str += ', ';
16853
- }
16854
- callback(str + ' and ' + names[n-1]);
16855
- }
16856
- });
16857
- });
16858
- };
16859
16844
  Crouton.prototype.doFilters = function() {
16860
16845
  return this.filteredPage();
16861
16846
  }
@@ -16955,7 +16940,7 @@ Crouton.prototype.searchMap = function() {
16955
16940
  "meetingData": []
16956
16941
  },
16957
16942
  "dropdownData": [],
16958
- "location": {'latitude':0,'longitude':0,'zoom':10}
16943
+ "location": {'latitude':0,'longitude':0,'zoom':10} // TODO: Where is this used?
16959
16944
  });
16960
16945
  }
16961
16946
  Crouton.prototype.render = function(doMeetingMap = false) {
@@ -17265,16 +17250,16 @@ Crouton.prototype.render = function(doMeetingMap = false) {
17265
17250
  croutonMap.initialize(self.createBmltMapElement(), self.meetingData);
17266
17251
  jQuery("#bmlt-map").removeClass("hide");
17267
17252
  }
17268
- if (self.config['map_page']) {
17253
+ if (self.config['map_page'] && !doMeetingMap) {
17269
17254
  croutonMap.initialize('byfield_embeddedMapPage', self.meetingData);
17270
17255
  }
17271
17256
  if (self.config['refresh_map']) {
17272
- croutonMap.refreshMeetings(self.meetingData, 0, '', true);
17257
+ croutonMap.refreshMeetings(self.meetingData, true, true);
17273
17258
  }
17274
17259
  if (self.config['on_complete'] != null && isFunction(self.config['on_complete'])) {
17275
17260
  self.config['on_complete']();
17276
17261
  }
17277
- });
17262
+ }, !doMeetingMap);
17278
17263
  });
17279
17264
  });
17280
17265
  };