Skip to content
Permalink
Browse files

Update AdminThemeUikit search box to add a suggestion about typing "h…

…elp" if you focus the input for a brief period without typing anything
  • Loading branch information
Ryan Cramer
Ryan Cramer committed Jan 17, 2020
1 parent f5f83e8 commit 6b04c4e15abd2c55da7de911d10b80765d3c00c3
@@ -6,6 +6,8 @@
/** @var AdminThemeUikit $adminTheme */

$searchURL = $urls->admin . 'page/search/live/';
$helpTerm = $this->_('help'); // Localized term to type for help (3+ chars)
$helpNote = $this->_('Try “help”'); // Short instruction (with your translated help term)

if($adminTheme->isEditor): ?>
<form class='pw-search-form' data-action='<?php echo $searchURL; ?>' action='<?php echo $searchURL; ?>' method='get'>
@@ -18,7 +20,7 @@
<?php echo $adminTheme->renderIcon('spinner fa-spin'); ?>
</span>
</span>
<input type='text' class='pw-search-input uk-input uk-form-width-medium' name='q'>
<input type='text' class='pw-search-input uk-input uk-form-width-medium' name='q' data-help-term='<?php echo $helpTerm;?>' data-help-note='<?php echo $helpNote;?>'>
</div>
<input class='uk-hidden' type='submit' name='search' value='Search' />
<input type='hidden' name='show_options' value='1' />
@@ -352,6 +352,7 @@ var ProcessWireAdminTheme = {
close: function(event, ui) {
},
source: function(request, response) {
if(request.term === $input.attr('data-help-term')) request.term = 'help';
var url = $input.parents('form').attr('data-action') + '?q=' + request.term;
$.getJSON(url, function(data) {
var len = data.matches.length;
@@ -394,7 +395,9 @@ var ProcessWireAdminTheme = {
}
}).focus(function() {
// $(this).siblings('label').find('i').hide(); // hide icon
setTimeout(function() { $input.attr('placeholder', $input.attr('data-help-note')); }, 1250);
}).blur(function() {
$input.attr('placeholder', '');
// $status.text('');
// $(this).siblings('label').find('i').show(); // show icon
});

0 comments on commit 6b04c4e

Please sign in to comment.
You can’t perform that action at this time.