From 9f86429a1252b45c95b7c62fbaa1b82de3723997 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Mon, 05 Jan 2026 18:16:07 +0000
Subject: [PATCH] =Complete TaxonomySelector.js and TaxonomyCreator.js refactor
---
inc/helpers/ui.php | 71 ++++++++++++++++++-----------------
1 files changed, 37 insertions(+), 34 deletions(-)
diff --git a/inc/helpers/ui.php b/inc/helpers/ui.php
index a9e310d..bbd289a 100644
--- a/inc/helpers/ui.php
+++ b/inc/helpers/ui.php
@@ -1,6 +1,7 @@
<?php
use JVBase\utility\Features;
+use JVBase\utility\Image;
if (!defined('ABSPATH')) {
exit;
@@ -16,12 +17,12 @@
}
?>
- <aside id="queue" class="left col start btw" aria-expanded="false" hidden>
+ <aside id="queue" class="left col start btw main" aria-expanded="false" hidden>
<div class="status-actions row start nowrap">
<div class="refresh row btw">
<span class="countdown row" title="Will refresh again...">5</span>
<button class="refreshNow row" title="Check now">
- <?= jvbIcon('refresh', ['title'=> 'Check now']) ?>
+ <?= jvbIcon('arrows-clockwise', ['title'=> 'Check now']) ?>
</button>
</div>
<div class="popup row"><span></span></div>
@@ -53,16 +54,15 @@
?>
</nav>
</div>
- <div class="qitems col">
- <!-- Operations will be listed here -->
+ <div class="qitems col a-start nowrap">
</div>
- <div class="queue-actions row btw">
+ <div class="queue-actions row btw nowrap">
<button class="dismiss-all">Clear Completed</button>
<button class="retry-all">Retry Failed</button>
</div>
</aside>
<button class="qtoggle row" title="Show Queue" aria-controls="queue" hidden>
- <?= jvbIcon('save') ?>
+ <?= jvbIcon('floppy-disk') ?>
<span class="screen-reader-text"></span>
<span class="indicator"></span>
<span class="count row"></span>
@@ -111,7 +111,7 @@
?>
<li>
<a href="<?=get_home_url(null, '/dash/')?>" title="Behind the Scenes">
- <?= jvbIcon('dashboard', ['title' => 'Behind the Scenes'])?>
+ <?= jvbIcon('door', ['title' => 'Behind the Scenes'])?>
<span class="screen-reader-text">Go Behind the Scenes</span>
</a>
</li>
@@ -152,6 +152,9 @@
*/
function jvbHelpMenu():string
{
+ if (!Features::forSite()->has('helpMenu')) {
+ return '';
+ }
$out = get_option(BASE.'help_menu');
if ($out === false) {
@@ -180,7 +183,7 @@
}
$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('help', ['title'=> 'Quick Help']).'</button>
+ <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">
'.$links.'
</ul>
@@ -190,9 +193,9 @@
}
if (is_user_logged_in()) {
- $out .= '<li><a href="'.wp_logout_url(get_home_url()).'" title="Logout">'.jvbIcon('logout').'<span class="screen-reader-text">Logout</span></a></li>';
+ $out .= '<li><a href="'.wp_logout_url(get_home_url()).'" title="Logout">'.jvbIcon('sign-out').'<span class="screen-reader-text">Logout</span></a></li>';
} else {
- $out .= '<li><a href="'.wp_login_url(null, true).'" title="Login">'.jvbIcon('login').'<span class="screen-reader-text">Login</span></a></li>';
+ $out .= '<li><a href="'.wp_login_url(null, true).'" title="Login">'.jvbIcon('sign-in').'<span class="screen-reader-text">Login</span></a></li>';
}
return $out;
}
@@ -213,7 +216,7 @@
aria-label="Clear search"
onclick="this.previousElementSibling.value = \'\'; this.previousElementSibling.focus();"
>'.jvbIcon('x', ['title'=> 'Clear Search']).'</button>
- <button type="button" title="Search" class="toggle search" aria-label="Toggles search input visually" onclick="this.parentNode.classList.toggle(\'open\');this.previousElementSibling.previousElementSibling.focus();">'.jvbIcon('search').'</button>
+ <button type="button" title="Search" class="toggle search" aria-label="Toggles search input visually" onclick="this.parentNode.classList.toggle(\'open\');this.previousElementSibling.previousElementSibling.focus();">'.jvbIcon('magnifying-glass').'</button>
</div>';
}
@@ -222,8 +225,8 @@
function jvbModalActions()
{
return '<div class="m-actions row">
- <button type="button" class="cancel">'.jvbIcon('close').'<span class="screen-reader-text">Cancel</span></button>
- <button type="submit" class="save">'.jvbIcon('save').'<span class="screen-reader-text">Save</span></button>
+ <button type="button" class="cancel">'.jvbIcon('x').'<span class="screen-reader-text">Cancel</span></button>
+ <button type="submit" class="save">'.jvbIcon('floppy-disk').'<span class="screen-reader-text">Save</span></button>
</div>';
}
@@ -245,19 +248,17 @@
*
* @return string
*/
-function jvbFormatImage(int|string $imgID, string $start = 'tiny', string $end = 'large'):string
+function jvbFormatImage(int $imgID, string $start = 'tiny', string $end = 'large', bool $addLink = true, ?string $postSlug = null):string
{
- $block = new \JVBase\blocks\CustomBlocks();
- if ($imgID === '' || $imgID === 0) {
- $imgID = $block->imageID($imgID);
- }
- if ($imgID === '' || $imgID === 0 || $imgID === false) {
- return '';
- }
+ $image = new Image();
+ return $image->formatImage($imgID, $start, $end, $addLink, $postSlug);
+}
- $imgID = (int)$imgID;
-
- return $block->formatImage($imgID, $start, $end);
+function jvbImageCaption(int $imgID, string $start = 'tiny', string $end = 'large', bool $addLink = true, ?string $postSlug = null):string
+{
+ $caption = wp_get_attachment_caption($imgID);
+ $caption = ($caption && $caption !== '') ? '<figcaption>'.apply_filters('the_content', $caption).'</figcaption>' : '';
+ return '<figure>'.jvbFormatImage($imgID, $start, $end, $addLink, $postSlug).$caption.'</figure>';
}
/**
@@ -265,8 +266,6 @@
* @return void
*/
add_action('wp_footer', 'jvbToastContainer');
-
-
function jvbToastContainer():void
{
?>
@@ -278,7 +277,7 @@
<div class="toast-content row btw">
<p></p>
<button type="button" class="close-toast" aria-label="Close">
- <?= jvbIcon('close') ?>
+ <?= jvbIcon('x') ?>
</button>
</div>
</div>
@@ -304,13 +303,13 @@
<nav id="<?=$id?>" class="on-this-page index">
<label>Jump to:
<button type="button" aria-label="Show Index" title="Show Index" class="toggle" aria-expanded="false">
- <?= jvbIcon('add') ?>
+ <?= jvbIcon('plus-square') ?>
</button>
</label>
<ul>
<li>
<a href="#top" title="Back to Top">
- <?= jvbIcon('up') ?>
+ <?= jvbIcon('caret-circle-up') ?>
</a>
</li>
<?php
@@ -332,11 +331,12 @@
add_action('wp_footer', 'jvbLoadingScreen');
function jvbLoadingScreen():string
{
+ $icon = apply_filters('jvbLoadingIcon', 'drop-simple');
return '<dialog class="loading">
<div class="col">
<div class="spinner"></div>
<div class="status col">
- <div class="icon">'.apply_filters('jvbLoadingIcon', jvbIcon('tattoo')).'</div>
+ <div class="icon">'.jvbIcon($icon).'</div>
<h3>Loading</h3>
<p class="typeText">Please wait...</p>
</div>
@@ -396,7 +396,7 @@
}
$content .= '>
<h2>'.$config['title'].'</h2>';
- if ( $config['description']) {
+ if ( array_key_exists('description', $config)) {
if (!is_array($config['description'])) {
$content .= apply_filters('the_content', $config['description']);
} else {
@@ -432,8 +432,11 @@
<div class="bar">
<div class="fill"></div>
</div>
- <div class="details row btw">
- <?=$inside?>
+ <div class="row btw">
+ <i class="icon"></i>
+ <div class="details">
+ <?=$inside?>
+ </div>
</div>
</div>
<?php
@@ -449,7 +452,7 @@
<span>Start Over</span>
</button>
<button type="button" data-action="dismiss-restore">
- '.jvbIcon('close').'
+ '.jvbIcon('x').'
<span>Dismiss</span>
</button>
</div>
--
Gitblit v1.10.0