Skip to content

Commit

Permalink
Add 'live' attribute to meeting_count, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
otrok7 committed Jan 8, 2024
1 parent d59373c commit 6008d07
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
18 changes: 15 additions & 3 deletions crouton.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,23 +392,35 @@ public function meetingCount($atts)
if (isset($_GET['meeting-id'])) {
return '1';
}
return "<span id='bmlt_tabs_meeting_count'>Fetching...</span>";
$live = '';
if (is_array($atts) && isset($atts['live']) && $atts['live']=='1') {
$live = "-live";
}
return "<span id='bmlt_tabs_meeting_count$live'>Fetching...</span>";
}

public function groupCount($atts)
{
if (isset($_GET['meeting-id'])) {
return '1';
}
return "<span id='bmlt_tabs_group_count'>Fetching...</span>";
$live = '';
if (is_array($atts) && isset($atts['live']) && $atts['live']=='1') {
$live = "-live";
}
return "<span id='bmlt_tabs_group_count$live'>Fetching...</span>";
}

public function serviceBodyNames($atts)
{
if (isset($_GET['meeting-id'])) {
return '';
}
return "<span id='bmlt_tabs_service_body_names'>Fetching...</span>";
$live = '';
if (is_array($atts) && isset($atts['live']) && $atts['live']=='1') {
$live = "-live";
}
return "<span id='bmlt_tabs_service_body_names$live'>Fetching...</span>";
}
public function handlebarFooter()
{
Expand Down
12 changes: 8 additions & 4 deletions croutonjs/src/js/crouton-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,19 @@ function Crouton(config) {
self.updateMeetingCount = function(showingNow=null) {
self = this;
let meetingCount = self.meetingData.length;
if (showingNow !== null) meetingCount = showingNow.length;
jQuery('#bmlt_tabs_meeting_count').text(meetingCount);
jQuery('#bmlt_tabs_group_count').each(function(){
addLive = function(id) {return id+", "+id+"-live"};
if (showingNow !== null) {
meetingCount = showingNow.length;
addLive = function(id) {return id+"-live"};
}
jQuery(addLive('#bmlt_tabs_meeting_count')).text(meetingCount);
jQuery(addLive('#bmlt_tabs_group_count')).each(function(){
var filteredMeetings = self.meetingData;
if (showingNow!==null) filteredMeetings = self.meetingData.filter((m) => showingNow.includes(m.id_bigint));
var groups = filteredMeetings.map((m)=>m['worldid_mixed'] !== "" ? m['worldid_mixed'] :m['meeting_name']);
jQuery(this).text(arrayUnique(groups).length);
});
jQuery('#bmlt_tabs_service_body_names').each(function() {
jQuery(addLive('#bmlt_tabs_service_body_names')).each(function() {
var filteredMeetings = self.meetingData;
if (showingNow!==null) filteredMeetings = self.meetingData.filter((m) => showingNow.includes(m.id_bigint));
var ids = getUniqueValuesOfKey(filteredMeetings, 'service_body_bigint');
Expand Down

0 comments on commit 6008d07

Please sign in to comment.