Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to some issues for non-wordpress scenarios #463

Merged
merged 4 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 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.18.4
Version: 3.18.5
*/
/* Disallow direct access to the plugin file */
if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
Expand Down
14 changes: 13 additions & 1 deletion croutonjs/src/js/crouton-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,10 @@ function Crouton(config) {
self.updateMeetingCount = function(showingNow=null) {
self = this;
let meetingCount = self.meetingData.length;
if (self.meetingCountCallback) self.meetingCountCallback(meetingCount);
if (self.groupCountCallback) self.groupCountCallback(
arrayUnique(self.meetingData.map((m)=>m['worldid_mixed'] !== "" ? m['worldid_mixed'] :m['meeting_name'])).length
);
addLive = function(id) {return id+", "+id+"-live"};
if (showingNow !== null) {
meetingCount = showingNow.length;
Expand Down Expand Up @@ -644,6 +648,14 @@ function Crouton(config) {
croutonMap.loadPopupMap("bmlt-handlebars-map", meetingDetailsData, self.handlebarMapOptions);
}
}
self.meetingCountCallback = null;
self.grouoCountCallback = null;
Crouton.prototype.meetingCount = function(f) {
self.meetingCountCallback = f;
}
Crouton.prototype.groupCount = function(f) {
self.groupCountCallback = f;
}
Crouton.prototype.filterNext24 = function(filterNow = true) {
if (!filterNow) {
jQuery("#filter-dropdown-next24").val('a-');
Expand Down Expand Up @@ -856,7 +868,7 @@ function Crouton(config) {
}
return 'bmlt-map';
}
if ((self.config['show_map'] || self.config['map_search']) && (typeof window.croutonMap === 'undefined')) {
if (typeof window.croutonMap === 'undefined') {
window.croutonMap = new MeetingMap(self.config);
if (self.config['map_search']) self.searchMap();
}
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.4.2
Stable tag: 3.18.4
Stable tag: 3.18.5
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.18.5 =
* Assure croutonMap object created.
* Add meetingCount and groupCount methods for backwards compatibility in non-wordpress cases.

= 3.18.4 =
* Do not embed map page when list contains only online meetings (fix for bug #460).

Expand Down