From 48721c85ebcfa973ee81719d2467ca80e4253dc9 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Fri, 01 May 2026 17:30:03 +0000
Subject: [PATCH] =Edmonton Ink hard test begins! Real testing of the managers and reset routes will commence. So far, just ensuring our classes are all loaded correctly: Site() and its sub-classes Membership, Login, etc. Care should be taken to load conditionally on 'init', as we finish defining most settings by 'plugins_loaded' at priority 5
---
inc/helpers/ui.php | 68 +++++++++++++++++----------------
1 files changed, 35 insertions(+), 33 deletions(-)
diff --git a/inc/helpers/ui.php b/inc/helpers/ui.php
index c9a5c1f..7b72fc1 100644
--- a/inc/helpers/ui.php
+++ b/inc/helpers/ui.php
@@ -1,5 +1,6 @@
<?php
+use JVBase\managers\Cache;
use JVBase\meta\Form;
use JVBase\base\Site;
use JVBase\utility\Image;
@@ -123,13 +124,13 @@
</a>
</li>
<li class="notifications has-submenu">
- <button class="toggle notifications" type="button" title="Toggle Notifications" aria-expanded="false" aria-controls="notifications-dropdown">
+ <button class="toggle notifications" type="button" data-action="toggle-submenu" title="Toggle Notifications" aria-expanded="false" aria-controls="notifications-dropdown">
<?= jvbIcon('bell', ['title'=> 'No Notifications'])?>
<?= jvbIcon('bell-ringing', ['title'=> 'New Notifications']) ?>
<span class="notification-badge" aria-label="Notifications">
</span>
</button>
- <ul class="notifications-preview submenu">
+ <ul class="notifications-preview submenu" id="notifications-dropdown">
<li id="view-all"><a href="<?=get_home_url(null, '/dash/notifications/')?>" class="view-all">View All Notifications</a></li>
</ul>
<template class="notificationItem">
@@ -159,45 +160,46 @@
*/
function jvbHelpMenu():string
{
- if (!Site::has('helpMenu')) {
+ if (!Site::has('help_menu')) {
return '';
}
- $out = get_option(BASE.'help_menu');
- if ($out === false) {
- $open = '<li><a href="';
- $mid = '">';
- $close = '</a></li>';
+ $cache = Cache::for('help_menu');
+ $out = $cache->remember(
+ 'help_menu',
+ function () {
+ $open = '<li><a href="';
+ $mid = '">';
+ $close = '</a></li>';
- $titles = array(
- 'About',
- 'Contact',
- 'Request a Feature',
- 'Technical Issue',
- );
- $links = '';
- foreach ($titles as $t) {
- $page = new WP_Query(array(
- 'post_type' => 'page',
- 'title' => $t,
- 'fields' => 'ids'
- ));
- if ($page->have_posts()) {
- $end = ($t == 'About') ? '<li><a href="'.get_home_url(null, '/directory/partners/').'" title="View our Partners">Partners</a></li>' : '';
- $links .= $open.get_the_permalink($page->posts[0]).'" title="'.$t.$mid.$t.$close.$end;
- }
- wp_reset_postdata();
- }
+ $titles = array(
+ 'About',
+ 'Contact',
+ 'Request a Feature',
+ 'Technical Issue',
+ );
+ $links = '';
+ foreach ($titles as $t) {
+ $page = new WP_Query(array(
+ 'post_type' => 'page',
+ 'title' => $t,
+ 'fields' => 'ids'
+ ));
+ if ($page->have_posts()) {
+ $end = ($t == 'About') ? '<li><a href="'.get_home_url(null, '/directory/partners/').'" title="View our Partners">Partners</a></li>' : '';
+ $links .= $open.get_the_permalink($page->posts[0]).'" title="'.$t.$mid.$t.$close.$end;
+ }
+ wp_reset_postdata();
+ }
- $out = '<li class="has-submenu">
- <button class="toggle quick-help" type="button" title="Toggle Quick Help Menu" aria-expanded="false" aria-controls="quick-help" aria-label="Toggle Quick Help Menu">'.jvbIcon('question', ['title'=> 'Quick Help']).'</button>
- <ul class="submenu">
+ return '<li class="has-submenu">
+ <button class="toggle quick-help" data-action="toggle-submenu" type="button" title="Toggle Quick Help Menu" aria-expanded="false" aria-controls="quick-help" aria-label="Toggle Quick Help Menu">'.jvbIcon('question', ['title'=> 'Quick Help']).'</button>
+ <ul class="submenu" id="quick-help">
'.$links.'
</ul>
</li>';
-
- update_option(BASE.'help_menu', $out);
- }
+ }
+ );
if (is_user_logged_in()) {
$out .= '<li><a href="'.wp_logout_url(get_home_url()).'" title="Logout">'.jvbIcon('sign-out').'<span class="screen-reader-text">Logout</span></a></li>';
--
Gitblit v1.10.0