mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-02 04:15:05 +02:00
fixes #1601 custom placeholder on album search
This commit is contained in:
+37
-2
@@ -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 |
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user