Skip to content

Commit

Permalink
Merge pull request #506 from bmlt-enabled/Fix-for-#497
Browse files Browse the repository at this point in the history
Fix-for-#497
  • Loading branch information
otrok7 authored Nov 11, 2024
2 parents c694f72 + 12f016e commit ffe618e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
9 changes: 5 additions & 4 deletions crouton.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Description: A tabbed based display for showing meeting information.
Author: bmlt-enabled
Author URI: https://bmlt.app
Version: 3.20.6
Version: 3.20.7
*/
/* Disallow direct access to the plugin file */
if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
Expand Down Expand Up @@ -48,6 +48,7 @@ class Crouton
),
'timeout' => 60
);
const END_WAIT_MESSAGE = "document.getElementById('please-wait').style.display='none';";
// crouton includes a map, we need to include the JS files and create the croutonMap object.
public $shortCodeOptions = array(
"root_server" => '',
Expand Down Expand Up @@ -372,17 +373,17 @@ private function getInitializeCroutonBlock($renderCmd, $config, $mapConfig)

private function renderTable($atts)
{
return $this->getInitializeCroutonBlock("crouton.render();document.getElementById('please-wait').style.display='none';", ...$this->getCroutonJsConfig($atts));
return $this->getInitializeCroutonBlock("crouton.render();".Crouton::END_WAIT_MESSAGE, ...$this->getCroutonJsConfig($atts));
}

private function renderMap($atts, $croutonMap = true)
{
if ($croutonMap) {
// This loads a map in which BMLT queries can be initiated
return $this->getInitializeCroutonBlock("crouton.searchMap();", ...$this->getCroutonJsConfig($atts, true));
return $this->getInitializeCroutonBlock("crouton.searchMap();".Crouton::END_WAIT_MESSAGE, ...$this->getCroutonJsConfig($atts, true));
}
// This is the map UI, but loading meetings like in the table form, only at startu
return $this->getInitializeCroutonBlock("crouton.render(true);", ...$this->getCroutonJsConfig($atts));
return $this->getInitializeCroutonBlock("crouton.render(true);".Crouton::END_WAIT_MESSAGE, ...$this->getCroutonJsConfig($atts));
}

public function initCrouton($atts)
Expand Down
6 changes: 5 additions & 1 deletion croutonjs/meetingMap/js/meeting_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ function MeetingMap(inConfig) {

return controlDiv;
}

function hasMapSearch() {
return 'map_search' in config;
}
function loadFromCrouton(inDiv_id, meetings_responseObject, menuContext = null, handlebarMapOptions = null, fitBounds = true, callback) {
if (!gDelegate.isApiLoaded()) {
preloadApiLoadedCallback(loadFromCrouton, [inDiv_id, meetings_responseObject, menuContext, handlebarMapOptions, fitBounds, callback]);
Expand Down Expand Up @@ -724,6 +726,7 @@ function MeetingMap(inConfig) {
this.closeModalWindow = closeModalWindow;
this.loadPopupMap = loadPopupMap;
this.filterVisible = filterVisible;
this.hasMapSearch = hasMapSearch;
};
MeetingMap.prototype.initialize = null;
MeetingMap.prototype.showMap = null;
Expand All @@ -736,3 +739,4 @@ MeetingMap.prototype.openModalWindow = null;
MeetingMap.prototype.closeModalWindow = null;
MeetingMap.prototype.loadPopupMap = null;
MeetingMap.prototype.filterVisible = null;
MeetingMap.prototype.hasMapSearch = null;
2 changes: 1 addition & 1 deletion croutonjs/src/js/crouton-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ function Crouton(config) {
if (self.config['map_search']) self.searchMap();
else self.meetingSearch();
}
else if (!self.config['map_search']) self.meetingSearch();
else if (!window.croutonMap.hasMapSearch()) self.meetingSearch();
}

Crouton.prototype.setConfig = function(config) {
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: na, meeting list, meeting finder, maps, recovery, addiction, webservant, b
Requires at least: 4.0
Required PHP: 8.0
Tested up to: 6.6.2
Stable tag: 3.20.6
Stable tag: 3.20.7
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
crouton implements a Tabbed UI for BMLT.
Expand Down Expand Up @@ -36,6 +36,10 @@ https://demo.bmlt.app/crouton

== Changelog ==

= 3.20.7 =
* Assure "Fetching" message is deleted.
* Remove unnecessary call to root server.

= 3.20.6 =
* Fix for 3.20.5

Expand Down

0 comments on commit ffe618e

Please sign in to comment.