Add search UI for yield_albums.

This commit is contained in:
voussoir 2020-09-24 14:26:51 -07:00
parent 9a85714df7
commit 343ce508bf
4 changed files with 17 additions and 1 deletions

View file

@ -675,6 +675,7 @@ class PDBPhotoMixin:
has_thumbnail = searchhelpers.normalize_has_thumbnail(has_thumbnail)
is_searchhidden = searchhelpers.normalize_is_searchhidden(is_searchhidden)
mimetype = searchhelpers.normalize_extension(mimetype)
yield_albums = searchhelpers.normalize_yield_albums(yield_albums)
if has_tags is False:
tag_musts = None
@ -763,6 +764,7 @@ class PDBPhotoMixin:
'limit': limit,
'offset': offset or None,
'orderby': giveback_orderby or None,
'yield_albums': yield_albums,
}
yield parameters

View file

@ -385,6 +385,12 @@ def normalize_tag_expression(expression):
return expression
def normalize_yield_albums(yield_albums):
'''
See etiquette.helpers.truthystring.
'''
return helpers.truthystring(yield_albums)
EXIST_FORMAT = '''
{operator} (
SELECT 1 FROM photo_tag_rel WHERE photos.id == photo_tag_rel.photoid

View file

@ -325,6 +325,7 @@ def get_search_core():
extension_not = request.args.get('extension_not')
mimetype = request.args.get('mimetype')
is_searchhidden = request.args.get('is_searchhidden', False)
yield_albums = request.args.get('yield_albums', True)
limit = request.args.get('limit')
# This is being pre-processed because the site enforces a maximum value
@ -378,7 +379,9 @@ def get_search_core():
'orderby': orderby,
'warning_bag': warning_bag,
'give_back_parameters': True
'give_back_parameters': True,
'yield_albums': yield_albums,
}
# print(search_kwargs)
search_generator = common.P.search(**search_kwargs)

View file

@ -294,6 +294,10 @@
<option value="yes" {{"selected" if search_kwargs['has_thumbnail']==True else ""}}>Has thumbnail</option>
<option value="no" {{"selected" if search_kwargs['has_thumbnail']==False else ""}}>No thumbnail</option>
</select>
<select name="yield_albums" class="basic_param">
<option value="yes" {{"selected" if search_kwargs['yield_albums']==True else ""}}>Include albums</option>
<option value="no" {{"selected" if search_kwargs['yield_albums']==False else ""}}>Don't include albums</option>
</select>
<select name="view" class="basic_param">
<option value="grid" {{"selected" if search_kwargs['view']=="grid" else ""}}>Grid</option>
<option value="list" {{"selected" if search_kwargs['view']=="list" else ""}}>List</option>
@ -371,6 +375,7 @@ selected form values are these.
const PARAM_DEFAULTS = {
'limit': 50,
'view': 'grid',
'yield_albums': 'yes'
}
function add_searchtag(ul, value, inputted_list, li_class)
{