Skip to content

Commit

Permalink
feature 2563: do not display all tags as checkboxes on search.php. Us…
Browse files Browse the repository at this point in the history
…e jQuery Selectize instead.

git-svn-id: http://piwigo.org/svn/trunk@28708 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
plegall committed Jun 16, 2014
1 parent 0511ed2 commit 583af81
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
9 changes: 1 addition & 8 deletions search.php
Expand Up @@ -204,14 +204,7 @@
{
usort( $available_tags, 'tag_alpha_compare');

$template->assign(
'TAG_SELECTION',
get_html_tag_selection(
$available_tags,
'tags',
isset($_POST['tags']) ? $_POST['tags'] : array()
)
);
$template->assign('TAGS', $available_tags);
}

// authors
Expand Down
14 changes: 10 additions & 4 deletions themes/default/template/search.tpl
Expand Up @@ -8,7 +8,7 @@

{footer_script}
jQuery(document).ready(function() {
jQuery("#authors").selectize({
jQuery("#authors, #tags").selectize({
plugins: ['remove_button']
});
});
Expand Down Expand Up @@ -46,16 +46,22 @@ jQuery(document).ready(function() {
<label>{'Search for Author'|@translate}
<select id="authors" placeholder="{'Type in a search term'|translate}" name="authors[]" multiple style="width:500px;">
{foreach from=$AUTHORS item=author}
<option value="{$author.author|strip_tags:false|escape:html}">{$author.author|strip_tags:false} ({'%d photos'|translate:$author.counter})</option>
<option value="{$author.author|strip_tags:false|escape:html}">{$author.author|strip_tags:false} ({$author.counter|translate_dec:'%d photo':'%d photos'})</option>
{/foreach}
</select>
</label>
</fieldset>

{if isset($TAG_SELECTION)}
{if isset($TAGS)}
<fieldset>
<legend>{'Search tags'|@translate}</legend>
{$TAG_SELECTION}

<select id="tags" placeholder="{'Type in a search term'|translate}" name="tags[]" multiple style="width:500px;">
{foreach from=$TAGS item=tag}
<option value="{$tag.id}">{$tag.name} ({$tag.counter|translate_dec:'%d photo':'%d photos'})</option>
{/foreach}
</select>

<label><span><input type="radio" name="tag_mode" value="AND" checked="checked"> {'All tags'|@translate}</span></label>
<label><span><input type="radio" name="tag_mode" value="OR"> {'Any tag'|@translate}</span></label>
</fieldset>
Expand Down

0 comments on commit 583af81

Please sign in to comment.