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

fix for jsInFooter #501

Merged
merged 6 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 7 additions & 5 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.4
Version: 3.20.5
*/
/* Disallow direct access to the plugin file */
if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
Expand Down Expand Up @@ -314,9 +314,11 @@ private function inlineScript($s)
}
private function outputScript($s)
{
if (isset($this->options['jsInFooter'])) {
if ($this->options['jsInFooter']) {
wp_add_inline_script('croutonjs', $s);
$s = "";
} else {
$s = "<script type='text/javascript'>$s</script>";
}
return $this->waitMsg.sprintf('%s<div id="bmlt-tabs" class="bmlt-tabs hide">%s</div>', $this->sharedRender(), $s);
}
Expand Down Expand Up @@ -381,9 +383,9 @@ private function getInitializeCroutonBlock($renderCmd, $config, $mapConfig)
if (!$this->croutonBlockInitialized) {
$this->croutonBlockInitialized = true;
$croutonMap = $this->getMapInitialization($mapConfig);
return "<script type='text/javascript'>var crouton;jQuery(document).ready(function() { $croutonMap crouton = new Crouton($config); $renderCmd });</script>";
return "var crouton;jQuery(document).ready(function() { $croutonMap crouton = new Crouton($config); $renderCmd });";
} else {
return isset($config) ? "<script type='text/javascript'>jQuery(document).ready(function() { crouton.setConfig($config); $renderCmd });</script>" : "";
return isset($config) ? "jQuery(document).ready(function() { crouton.setConfig($config); $renderCmd });" : "";
}
}

Expand Down Expand Up @@ -715,7 +717,7 @@ public function adminOptionsPage()
<h3><a id="config-advanced" class="anchor"></a>Advanced Options</h3>
<p>Should the generated Javascript be placed in the footer or in the body.</p>
<div>
<input type="checkbox" name="jsInFooter" value="1" <?php echo ($this->options['jsInFooter'] == 1 ? 'checked' : '') ?> />Place Javascript in Footer
<input type="checkbox" name="jsInFooter" value="1" <?php echo ($this->options['jsInFooter'] ? 'checked' : '') ?> />Place Javascript in Footer
</div>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions croutonjs/src/templates/header.hbs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{{startup this}}
{{#if this.config.header}}
{{#if this.config.include_weekday_button}}
<div class="bmlt-button-container"><a id="day" class="btn btn-primary btn-sm">{{getWord 'weekday'}}</a></div>
<div class="bmlt-button-container"><a id="day" tabindex=0 class="btn btn-primary btn-sm">{{getWord 'weekday'}}</a></div>
{{/if}}
{{#each this.config.button_filters}}
<div class="bmlt-button-container"><a id="filterButton_{{this.field}}" data-field="{{this.field}}" class="filterButton filterButtonLogic btn btn-primary btn-sm">{{getWord this.title}}</a></div>
<div class="bmlt-button-container"><a id="filterButton_{{this.field}}" tabindex=0 data-field="{{this.field}}" class="filterButton filterButtonLogic btn btn-primary btn-sm">{{getWord this.title}}</a></div>
{{/each}}
{{#each this.config.button_format_filters}}
<div class="bmlt-button-container"><a id="filterButton_{{this.field}}" data-field="{{this.field}}" class="filterButton filterButtonLogic btn btn-primary btn-sm">{{this.title}}</a></div>
<div class="bmlt-button-container"><a id="filterButton_{{this.field}}"tabindex=0 data-field="{{this.field}}" class="filterButton filterButtonLogic btn btn-primary btn-sm">{{this.title}}</a></div>
{{/each}}
{{#if this.config.map_page}}
<div class="bmlt-button-container"><a id="filterButton_embeddedMapPage" data-field="embeddedMapPage" class="filterButton displayTypeLogic btn btn-primary btn-sm">{{getWord 'map'}}</a></div>
<div class="bmlt-button-container"><a id="displayTypeButton_tablePages" data-field="tablePages" class="filterButton displayTypeLogic btn btn-primary btn-sm hide">{{getWord 'tabular'}}</a></div>
<div class="bmlt-button-container"><a id="filterButton_embeddedMapPage" tabindex=0 data-field="embeddedMapPage" class="filterButton displayTypeLogic btn btn-primary btn-sm">{{getWord 'map'}}</a></div>
<div class="bmlt-button-container"><a id="displayTypeButton_tablePages" tabindex=0 data-field="tablePages" class="filterButton displayTypeLogic btn btn-primary btn-sm hide">{{getWord 'tabular'}}</a></div>
{{/if}}

{{#each this.dropdownData}}
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.4
Stable tag: 3.20.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.20.4 =
* Bug fix for checkbox placing JS in footer
* Accessibility improvements

= 3.20.4 =
* Bug fix for fixing container height when using OSM

Expand Down
Loading