fix: Resolve console errors on staging

1. Created zoho-admin.css (was missing, causing 404)
   - Added styles for Zoho admin page layout
   - Card styling, form tables, sync buttons, status messages

2. Fixed jQuery not defined on master-trainer pages
   - Changed inject_inline_content hook from wp_head to wp_footer
   - Ensures jQuery is loaded before inline script executes

Note: "message channel closed" error is a browser extension issue,
not a code problem (typically ad blockers intercepting message passing)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
ben 2025-12-16 15:16:42 -04:00
parent b19f1c8e79
commit 08944d48ee
2 changed files with 177 additions and 5 deletions

168
assets/css/zoho-admin.css Normal file
View file

@ -0,0 +1,168 @@
/**
* Zoho CRM Admin Styles
*
* @package HVACCommunityEvents
*/
/* Card Layout */
.hvac-zoho-wrap {
max-width: 1200px;
}
.hvac-zoho-wrap .card {
max-width: 100%;
padding: 20px;
margin-bottom: 20px;
}
.hvac-zoho-wrap h2 {
margin-top: 0;
padding-bottom: 10px;
border-bottom: 1px solid #ccd0d4;
}
/* Form Styles */
.hvac-zoho-wrap table.form-table th {
width: 200px;
}
.hvac-zoho-wrap .regular-text {
width: 400px;
}
.hvac-zoho-wrap code {
background: #f0f0f1;
padding: 4px 8px;
border-radius: 3px;
font-size: 13px;
}
/* Button Groups */
.hvac-zoho-wrap .button-group {
display: flex;
gap: 10px;
flex-wrap: wrap;
margin-top: 15px;
}
/* Sync Buttons */
.hvac-zoho-wrap .sync-button {
min-width: 150px;
}
/* Status Messages */
.hvac-zoho-wrap .sync-status {
margin-top: 15px;
padding: 10px;
background: #f8f9fa;
border-left: 4px solid #007cba;
}
.hvac-zoho-wrap .sync-status.success {
border-left-color: #00a32a;
}
.hvac-zoho-wrap .sync-status.error {
border-left-color: #d63638;
}
/* Connection Status */
#connection-status {
margin-top: 15px;
}
#connection-status .notice {
margin: 0;
}
/* Staging Mode Banner */
.hvac-zoho-wrap .staging-notice {
background: #fff3cd;
border: 1px solid #ffc107;
border-radius: 4px;
padding: 15px;
margin-bottom: 20px;
}
.hvac-zoho-wrap .staging-notice h3 {
margin: 0 0 10px 0;
color: #856404;
}
/* Debug Info */
.hvac-zoho-debug-info {
margin-top: 15px;
padding: 10px;
background: #f0f0f1;
border-radius: 4px;
font-size: 12px;
}
.hvac-zoho-debug-info details {
margin-top: 10px;
}
.hvac-zoho-debug-info summary {
cursor: pointer;
color: #007cba;
}
.hvac-zoho-debug-info pre {
margin: 10px 0 0 0;
white-space: pre-wrap;
word-wrap: break-word;
}
/* Credentials Form */
#zoho-credentials-form .description {
color: #646970;
font-style: italic;
margin-top: 5px;
}
/* Password Toggle */
#toggle-secret {
margin-left: 10px;
vertical-align: middle;
}
/* Sync Results */
.sync-results {
margin-top: 15px;
}
.sync-results ul {
margin: 10px 0;
padding-left: 20px;
}
.sync-results details {
margin-top: 10px;
}
.sync-results pre {
background: #f0f0f1;
padding: 10px;
overflow: auto;
max-height: 300px;
font-size: 12px;
}
/* Responsive */
@media screen and (max-width: 782px) {
.hvac-zoho-wrap table.form-table th {
width: auto;
}
.hvac-zoho-wrap .regular-text {
width: 100%;
}
.hvac-zoho-wrap .button-group {
flex-direction: column;
}
.hvac-zoho-wrap .sync-button {
width: 100%;
}
}

View file

@ -66,7 +66,8 @@ class HVAC_Master_Content_Injector {
*/ */
private function __construct() { private function __construct() {
add_filter('the_content', array($this, 'inject_master_content'), 10); add_filter('the_content', array($this, 'inject_master_content'), 10);
add_action('wp_head', array($this, 'inject_inline_content'), 1); // Use wp_footer instead of wp_head to ensure jQuery is loaded first
add_action('wp_footer', array($this, 'inject_inline_content'), 20);
} }
/** /**
@ -220,16 +221,19 @@ class HVAC_Master_Content_Injector {
return ''; return '';
} }
// Try direct method call first // Try direct method call first - check which method exists
if (class_exists($shortcode_data['class'])) { if (class_exists($shortcode_data['class'])) {
$instance = call_user_func(array($shortcode_data['class'], 'instance')); $instance = null;
if (!$instance && method_exists($shortcode_data['class'], 'get_instance')) { if (method_exists($shortcode_data['class'], 'get_instance')) {
$instance = call_user_func(array($shortcode_data['class'], 'get_instance')); $instance = call_user_func(array($shortcode_data['class'], 'get_instance'));
} elseif (method_exists($shortcode_data['class'], 'instance')) {
$instance = call_user_func(array($shortcode_data['class'], 'instance'));
} }
if ($instance && method_exists($instance, $shortcode_data['method'])) { if ($instance && method_exists($instance, $shortcode_data['method'])) {
ob_start(); ob_start();
echo $instance->{$shortcode_data['method']}(); // Pass empty array to satisfy shortcode callback signature
echo $instance->{$shortcode_data['method']}(array());
return ob_get_clean(); return ob_get_clean();
} }
} }