@bmlt-enabled/croutonjs 3.18.0 → 3.18.1

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.css CHANGED
@@ -1780,6 +1780,13 @@ div.bmlt_map_container_div button {
1780
1780
  color: #2d5c88 !important;
1781
1781
 
1782
1782
  }
1783
+ #map-search-button {
1784
+ width: fit-content;
1785
+ height: fit-content;
1786
+ }
1787
+ #map-search-button .menu-button-label {
1788
+ margin: 10px;
1789
+ }
1783
1790
  .menu-button-child {
1784
1791
  width: 32px;
1785
1792
  height: 32px;
package/crouton.js CHANGED
@@ -13314,7 +13314,7 @@ function CroutonLocalization(language) {
13314
13314
  "no_meetings_for_this_day": "Keine Meetings an diesem Tag.",
13315
13315
  'css-textalign': '',
13316
13316
  'css-floatdirection': '',
13317
- 'all': 'All',
13317
+ 'all': 'Alle',
13318
13318
  'menu': 'Menu',
13319
13319
  'search for meetings': 'Search for meetings',
13320
13320
  'show meetings near...': 'Meetings in andere Städten',
@@ -14499,7 +14499,7 @@ this["hbs_Crouton"]["templates"]["mapSearch"] = Handlebars.template({"compiler":
14499
14499
  return undefined
14500
14500
  };
14501
14501
 
14502
- 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;\">"
14502
+ return "<button id=\"map-search-button\" class=\"menu-button\" title=\"Erweiterte Suche\">\n <span class=\"menu-button-label\" style=\"position:initial;\">"
14503
14503
  + 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}}}))
14504
14504
  + "</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\">"
14505
14505
  + 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}}}))
@@ -14799,7 +14799,7 @@ var croutonDefaultTemplates = {
14799
14799
 
14800
14800
  meeting_count_template: [
14801
14801
  "{{#if this.config.has_meeting_count}}",
14802
- "<span class='bmlt_tabs_meeting_count'>{{getWord 'meeting_count'}} <span id='bmlt_tabs_meeting_count'>{{this.meetings.meetingCount}}</span></span>",
14802
+ "<span class='bmlt_tabs_meeting_count'>{{getWord 'meeting_count'}} <span id='bmlt_tabs_meeting_count-live'>{{this.meetings.meetingCount}}</span></span>",
14803
14803
  "{{/if}}"
14804
14804
  ].join('\n'),
14805
14805
 
@@ -15988,7 +15988,6 @@ function Crouton(config) {
15988
15988
  theme: "jack", // Allows for setting pre-packaged themes. Choices are listed here: https://github.com/bmlt-enabled/crouton/blob/master/croutonjs/dist/templates/themes
15989
15989
  meeting_data_template: croutonDefaultTemplates.meeting_data_template,
15990
15990
  metadata_template: croutonDefaultTemplates.metadata_template,
15991
- marker_contents_template: croutonDefaultTemplates.marker_contents_template,
15992
15991
  observer_template: croutonDefaultTemplates.observer_template,
15993
15992
  meeting_count_template: croutonDefaultTemplates.meeting_count_template,
15994
15993
  meeting_link_template: croutonDefaultTemplates.meeting_link_template,
@@ -15996,7 +15995,6 @@ function Crouton(config) {
15996
15995
  meetingpage_title_template: croutonDefaultTemplates.meetingpage_title_template,
15997
15996
  meetingpage_contents_template: croutonDefaultTemplates.meetingpage_contents_template,
15998
15997
  meetingpage_frame_template: croutonDefaultTemplates.meetingpage_frame_template,
15999
- marker_contents_template: croutonDefaultTemplates.marker_contents_template,
16000
15998
  lat: 0,
16001
15999
  lng: 0,
16002
16000
  zoom: 10,
@@ -16320,7 +16318,7 @@ function Crouton(config) {
16320
16318
  showingNow.push(rowId[rowId.length-1]);
16321
16319
  });
16322
16320
  showingNow = [...new Set(showingNow)];
16323
- self.updateMeetingCount(showingNow.length);
16321
+ self.updateMeetingCount(showingNow);
16324
16322
  self.updateFilters();
16325
16323
  if (croutonMap) croutonMap.fillMap(showingNow);
16326
16324
  if (self.config.map_page) {
@@ -16359,7 +16357,7 @@ function Crouton(config) {
16359
16357
  } else if (self.config.show_map) croutonMap.fillMap();
16360
16358
  self.filtering = false;
16361
16359
  self.updateFilters();
16362
- self.updateMeetingCount(self.meetingData.length);
16360
+ self.updateMeetingCount();
16363
16361
  jQuery(".filter-dropdown").val(null).trigger("change");
16364
16362
  jQuery(".meeting-header").removeClass("hide");
16365
16363
  jQuery(".bmlt-data-row").removeClass("hide");
@@ -16389,13 +16387,13 @@ function Crouton(config) {
16389
16387
  dropdown.optionsShowing = dropdown.uniqueData(showing).map((o) => dropdown.optionName(o));
16390
16388
  });
16391
16389
  }
16392
- self.renderStandaloneMap = function (selector, context, callback) {
16390
+ self.renderStandaloneMap = function (selector, context, callback=null, fitBounds=true) {
16393
16391
  hbs_Crouton['localization'] = self.localization;
16394
16392
  self.config["hide_byday_headers"] = true;
16395
16393
  crouton_Handlebars.registerPartial('meetings', hbs_Crouton.templates['meetings']);
16396
16394
  crouton_Handlebars.registerPartial('bydays', hbs_Crouton.templates['byday']);
16397
16395
  crouton_Handlebars.registerPartial('formatPopup', hbs_Crouton.templates['formatPopup']);
16398
- croutonMap.initialize(self.createBmltMapElement(),self.meetingData,context,null,callback);
16396
+ croutonMap.initialize(self.createBmltMapElement(),self.meetingData,context,null,fitBounds,callback);
16399
16397
  }
16400
16398
  self.getCurrentLocation = function(callback) {
16401
16399
  if (navigator.geolocation) {
@@ -16404,7 +16402,7 @@ function Crouton(config) {
16404
16402
  $('.geo').removeClass("hide").addClass("show").html('<p>Geolocation is not supported by your browser</p>');
16405
16403
  }
16406
16404
  };
16407
- self.renderView = function (selector, context, callback) {
16405
+ self.renderView = function (selector, context, callback, fitBounds) {
16408
16406
  hbs_Crouton['localization'] = self.localization;
16409
16407
  crouton_Handlebars.registerPartial('meetings', hbs_Crouton.templates['meetings']);
16410
16408
  crouton_Handlebars.registerPartial('bydays', hbs_Crouton.templates['byday']);
@@ -16416,8 +16414,45 @@ function Crouton(config) {
16416
16414
  jQuery(selector).html(template(context));
16417
16415
  callback();
16418
16416
  };
16419
- self.updateMeetingCount = function(meetingCount) {
16420
- jQuery('#bmlt_tabs_meeting_count').html(meetingCount);
16417
+ self.updateMeetingCount = function(showingNow=null) {
16418
+ self = this;
16419
+ let meetingCount = self.meetingData.length;
16420
+ addLive = function(id) {return id+", "+id+"-live"};
16421
+ if (showingNow !== null) {
16422
+ meetingCount = showingNow.length;
16423
+ addLive = function(id) {return id+"-live"};
16424
+ }
16425
+ jQuery(addLive('#bmlt_tabs_meeting_count')).text(meetingCount);
16426
+ jQuery(addLive('#bmlt_tabs_group_count')).each(function(){
16427
+ var filteredMeetings = self.meetingData;
16428
+ if (showingNow!==null) filteredMeetings = self.meetingData.filter((m) => showingNow.includes(m.id_bigint));
16429
+ var groups = filteredMeetings.map((m)=>m['worldid_mixed'] !== "" ? m['worldid_mixed'] :m['meeting_name']);
16430
+ jQuery(this).text(arrayUnique(groups).length);
16431
+ });
16432
+ jQuery(addLive('#bmlt_tabs_service_body_names')).each(function() {
16433
+ var filteredMeetings = self.meetingData;
16434
+ if (showingNow!==null) filteredMeetings = self.meetingData.filter((m) => showingNow.includes(m.id_bigint));
16435
+ var ids = getUniqueValuesOfKey(filteredMeetings, 'service_body_bigint');
16436
+ var me = this;
16437
+ self.getServiceBodies(ids).then(function (service_bodies) {
16438
+ var n = service_bodies.length;
16439
+ var names = service_bodies.map((m)=>m['name']);
16440
+ names.sort();
16441
+ var ret = "";
16442
+ if (n===1) {
16443
+ ret = names[0];
16444
+ }
16445
+ else {
16446
+ ret = names[0];
16447
+ for (var j = 1; j < n-1; j++) {
16448
+ ret += ', ';
16449
+ ret += names[j];
16450
+ }
16451
+ ret += ' and ' + names[n-1];
16452
+ }
16453
+ jQuery(me).text(ret);
16454
+ });
16455
+ });
16421
16456
  }
16422
16457
  self.getServiceBodies = function(service_bodies_id) {
16423
16458
  var requires_parents = self.config.has_regions;
@@ -16562,9 +16597,6 @@ function Crouton(config) {
16562
16597
  self.filteredPage();
16563
16598
  }
16564
16599
 
16565
- self.isMeetingInTime = function(meeting, dayNow, hour, mins) {
16566
-
16567
- }
16568
16600
  self.distance = function(lat1, lon1, lat2, lon2, unit) {
16569
16601
  if ((lat1 === lat2) && (lon1 === lon2)) {
16570
16602
  return 0;
@@ -16599,14 +16631,12 @@ function Crouton(config) {
16599
16631
 
16600
16632
  crouton_Handlebars.registerPartial("meetingDataTemplate", self.config['meeting_data_template']);
16601
16633
  crouton_Handlebars.registerPartial("metaDataTemplate", self.config['metadata_template']);
16602
- crouton_Handlebars.registerPartial("popupTemplate", self.config['marker_contents_template']);
16603
16634
  crouton_Handlebars.registerPartial("observerTemplate", self.config['observer_template']);
16604
16635
  crouton_Handlebars.registerPartial("meetingpageTitleTemplate", self.config['meetingpage_title_template']);
16605
16636
  crouton_Handlebars.registerPartial("meetingpageContentsTemplate", self.config['meetingpage_contents_template']);
16606
16637
  crouton_Handlebars.registerPartial("meetingCountTemplate", self.config['meeting_count_template']);
16607
16638
  crouton_Handlebars.registerPartial("meetingLink", self.config['meeting_link_template']);
16608
16639
  crouton_Handlebars.registerPartial("meetingModal", self.config['meeting_modal_template']);
16609
- crouton_Handlebars.registerPartial("markerContentsTemplate", self.config['marker_contents_template']);
16610
16640
 
16611
16641
  for (var m = 0; m < meetingData.length; m++) {
16612
16642
  meetingData[m]['formatted_comments'] = meetingData[m]['comments'];
@@ -16813,52 +16843,6 @@ Crouton.prototype.reset = function() {
16813
16843
  jQuery("#" + self.config["placeholder_id"]).html("");
16814
16844
  };
16815
16845
 
16816
- Crouton.prototype.meetingCount = function(callback) {
16817
- var self = this;
16818
- self.lock(function() {
16819
- callback(self.meetingData.length);
16820
- });
16821
- };
16822
-
16823
- Crouton.prototype.groupCount = function(callback) {
16824
- var self = this;
16825
- self.lock(function() {
16826
- var groups = [];
16827
- for (var i = 0; i < self.meetingData.length; i++) {
16828
- groups.push(self.meetingData[i]['worldid_mixed'] !== "" ? self.meetingData[i]['worldid_mixed'] : self.meetingData[i]['meeting_name']);
16829
- }
16830
- callback(arrayUnique(groups).length);
16831
- });
16832
- };
16833
-
16834
- Crouton.prototype.serviceBodyNames = function(callback) {
16835
- var self = this;
16836
- self.lock(function() {
16837
- var ids = getUniqueValuesOfKey(self.meetingData, 'service_body_bigint');
16838
- self.getServiceBodies(ids).then(function (service_bodies) {
16839
- var n = service_bodies.length;
16840
- var names = [];
16841
- for (var i = 0; i < n; i++) {
16842
- names.push(service_bodies[i]['name']);
16843
- }
16844
- names.sort();
16845
- if (n===1) {
16846
- callback(names[0]);
16847
- }
16848
- else if (n===2) {
16849
- callback(names[0] + ' and ' + names[1]);
16850
- }
16851
- else {
16852
- var str = '';
16853
- for (var j = 0; j < n-1; j++) {
16854
- str += names[j];
16855
- str += ', ';
16856
- }
16857
- callback(str + ' and ' + names[n-1]);
16858
- }
16859
- });
16860
- });
16861
- };
16862
16846
  Crouton.prototype.doFilters = function() {
16863
16847
  return this.filteredPage();
16864
16848
  }
@@ -16958,7 +16942,7 @@ Crouton.prototype.searchMap = function() {
16958
16942
  "meetingData": []
16959
16943
  },
16960
16944
  "dropdownData": [],
16961
- "location": {'latitude':0,'longitude':0,'zoom':10}
16945
+ "location": {'latitude':0,'longitude':0,'zoom':10} // TODO: Where is this used?
16962
16946
  });
16963
16947
  }
16964
16948
  Crouton.prototype.render = function(doMeetingMap = false) {
@@ -17268,16 +17252,16 @@ Crouton.prototype.render = function(doMeetingMap = false) {
17268
17252
  croutonMap.initialize(self.createBmltMapElement(), self.meetingData);
17269
17253
  jQuery("#bmlt-map").removeClass("hide");
17270
17254
  }
17271
- if (self.config['map_page']) {
17255
+ if (self.config['map_page'] && !doMeetingMap) {
17272
17256
  croutonMap.initialize('byfield_embeddedMapPage', self.meetingData);
17273
17257
  }
17274
17258
  if (self.config['refresh_map']) {
17275
- croutonMap.refreshMeetings(self.meetingData, 0, '', true);
17259
+ croutonMap.refreshMeetings(self.meetingData, true, true);
17276
17260
  }
17277
17261
  if (self.config['on_complete'] != null && isFunction(self.config['on_complete'])) {
17278
17262
  self.config['on_complete']();
17279
17263
  }
17280
- });
17264
+ }, !doMeetingMap);
17281
17265
  });
17282
17266
  });
17283
17267
  };
@@ -17693,6 +17677,7 @@ function MeetingMap(inConfig) {
17693
17677
  const config = inConfig;
17694
17678
  if (!config.maxZoom) config.maxZoom = 17;
17695
17679
  if (!config.minZoom) config.minZoom = 6;
17680
+ if (!config.marker_contents_template) config.marker_contents_template = croutonDefaultTemplates.marker_contents_template;
17696
17681
  var gAllMeetings = null;
17697
17682
  var gMeetingIdsFromCrouton = null;
17698
17683
  var loadedCallbackFunction = null;
@@ -17710,6 +17695,7 @@ function MeetingMap(inConfig) {
17710
17695
 
17711
17696
  function loadMap(inDiv, menuContext, handlebarMapOptions=null,cb=null) {
17712
17697
  if (inDiv) {
17698
+ crouton_Handlebars.registerPartial("markerContentsTemplate", config['marker_contents_template']);
17713
17699
  gInDiv = inDiv;
17714
17700
  createThrobber(inDiv);
17715
17701
  if (!config.map_search) showThrobber();
@@ -17843,15 +17829,15 @@ function MeetingMap(inConfig) {
17843
17829
  return controlDiv;
17844
17830
  }
17845
17831
 
17846
- function loadFromCrouton(inDiv_id, meetings_responseObject, menuContext = null, handlebarMapOptions = null, callback) {
17832
+ function loadFromCrouton(inDiv_id, meetings_responseObject, menuContext = null, handlebarMapOptions = null, fitBounds = true, callback) {
17847
17833
  if (!gDelegate.isApiLoaded()) {
17848
- preloadApiLoadedCallback(loadFromCrouton, [inDiv_id, meetings_responseObject, menuContext, handlebarMapOptions, callback]);
17834
+ preloadApiLoadedCallback(loadFromCrouton, [inDiv_id, meetings_responseObject, menuContext, handlebarMapOptions, fitBounds, callback]);
17849
17835
  gDelegate.loadApi();
17850
17836
  return;
17851
17837
  }
17852
17838
  let inDiv = document.getElementById(inDiv_id);
17853
17839
  loadMap(inDiv, menuContext, handlebarMapOptions,callback);
17854
- loadAllMeetings(meetings_responseObject, true);
17840
+ loadAllMeetings(meetings_responseObject, fitBounds, true);
17855
17841
  };
17856
17842
  function loadPopupMap(inDiv_id, meeting, handlebarMapOptions = null) {
17857
17843
  if (!gDelegate.isApiLoaded()) {
@@ -17932,7 +17918,7 @@ function MeetingMap(inConfig) {
17932
17918
  showThrobber();
17933
17919
  crouton.searchByCoordinates(latlng.lat, latlng.lng, config.map_search.width);
17934
17920
  }
17935
- function loadAllMeetings(meetings_responseObject, fitAll=false) {
17921
+ function loadAllMeetings(meetings_responseObject, fitBounds=true, fitAll=false) {
17936
17922
  if (meetings_responseObject === null && config.map_search) {
17937
17923
  if (config.map_search.auto) nearMeSearch();
17938
17924
  else if (config.map_search.coordinates_search) {
@@ -17945,8 +17931,10 @@ function MeetingMap(inConfig) {
17945
17931
  return;
17946
17932
  }
17947
17933
  gAllMeetings = meetings_responseObject.filter(m => m.venue_type != 2);
17948
- const lat_lngs = gAllMeetings.reduce(function(a,m) {a.push([m.latitude, m.longitude]); return a;},[]);
17949
- gDelegate.fitBounds(lat_lngs);
17934
+ if (fitBounds) {
17935
+ const lat_lngs = gAllMeetings.reduce(function(a,m) {a.push([m.latitude, m.longitude]); return a;},[]);
17936
+ gDelegate.fitBounds(lat_lngs);
17937
+ }
17950
17938
  searchResponseCallback();
17951
17939
  hideThrobber();
17952
17940
  if (config.centerMe) {