mirror of
https://github.com/processwire/processwire.git
synced 2025-08-16 19:54:24 +02:00
Update AdminThemeUikit search box to add a suggestion about typing "help" if you focus the input for a brief period without typing anything
This commit is contained in:
@@ -6,6 +6,8 @@ if(!defined("PROCESSWIRE")) die();
|
||||
/** @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 @@ if($adminTheme->isEditor): ?>
|
||||
<?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
|
||||
});
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user