fixes #1601 custom placeholder on album search

This commit is contained in:
plegall
2022-01-24 16:17:40 +01:00
parent beb8873b01
commit 0c3ef1d521
2 changed files with 38 additions and 3 deletions
+37 -2
View File
@@ -53,9 +53,44 @@ foreach ($result as $cat)
// +-----------------------------------------------------------------------+
// | template initialization |
// +-----------------------------------------------------------------------+
// let's find a custom placeholder
$query = '
SELECT
name
FROM '.CATEGORIES_TABLE.'
ORDER BY RAND()
LIMIT 1
;';
$lines = query2array($query);
$placeholder = null;
foreach ($lines as $line)
{
$name = trigger_change('render_category_name', $line['name']);
if (mb_strlen($name) > 25)
{
$name = mb_substr($name, 0, 25).'...';
}
$placeholder = $name;
break;
}
if (empty($placeholder))
{
$placeholder = l10n('Portraits');
}
$template->set_filename('cat_search', 'cat_search.tpl');
$template->assign('data_cat', $categories);
$template->assign('ADMIN_PAGE_TITLE', l10n('Album search tool'));
$template->assign(
array(
'data_cat' => $categories,
'ADMIN_PAGE_TITLE' => l10n('Album search tool'),
'placeholder' => $placeholder,
)
);
// +-----------------------------------------------------------------------+
// | sending html code |
+1 -1
View File
@@ -148,7 +148,7 @@ $('.search-input').focus();
<div class="search-album-input-container" style="position:relative">
<span class="icon-search search-icon"></span>
<span class="icon-cancel search-cancel"></span>
<input class='search-input' type="text" placeholder="{'Portraits'|@translate}">
<input class='search-input' type="text" placeholder="{$placeholder|escape:html}">
</div>
<span class="search-album-help icon-help-circled" title="{'Enter a term to search for album'|@translate}"></span>
<span class="search-album-num-result"></span>