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

View file

@ -385,6 +385,12 @@ def normalize_tag_expression(expression):
return expression return expression
def normalize_yield_albums(yield_albums):
'''
See etiquette.helpers.truthystring.
'''
return helpers.truthystring(yield_albums)
EXIST_FORMAT = ''' EXIST_FORMAT = '''
{operator} ( {operator} (
SELECT 1 FROM photo_tag_rel WHERE photos.id == photo_tag_rel.photoid 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') extension_not = request.args.get('extension_not')
mimetype = request.args.get('mimetype') mimetype = request.args.get('mimetype')
is_searchhidden = request.args.get('is_searchhidden', False) is_searchhidden = request.args.get('is_searchhidden', False)
yield_albums = request.args.get('yield_albums', True)
limit = request.args.get('limit') limit = request.args.get('limit')
# This is being pre-processed because the site enforces a maximum value # This is being pre-processed because the site enforces a maximum value
@ -378,7 +379,9 @@ def get_search_core():
'orderby': orderby, 'orderby': orderby,
'warning_bag': warning_bag, 'warning_bag': warning_bag,
'give_back_parameters': True 'give_back_parameters': True,
'yield_albums': yield_albums,
} }
# print(search_kwargs) # print(search_kwargs)
search_generator = common.P.search(**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="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> <option value="no" {{"selected" if search_kwargs['has_thumbnail']==False else ""}}>No thumbnail</option>
</select> </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"> <select name="view" class="basic_param">
<option value="grid" {{"selected" if search_kwargs['view']=="grid" else ""}}>Grid</option> <option value="grid" {{"selected" if search_kwargs['view']=="grid" else ""}}>Grid</option>
<option value="list" {{"selected" if search_kwargs['view']=="list" else ""}}>List</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 = { const PARAM_DEFAULTS = {
'limit': 50, 'limit': 50,
'view': 'grid', 'view': 'grid',
'yield_albums': 'yes'
} }
function add_searchtag(ul, value, inputted_list, li_class) function add_searchtag(ul, value, inputted_list, li_class)
{ {