diff --git a/etiquette/etiquette.py b/etiquette/etiquette.py index 450cf4a..191431b 100644 --- a/etiquette/etiquette.py +++ b/etiquette/etiquette.py @@ -301,6 +301,7 @@ def get_search_core(): limit = int(limit) limit = min(100, limit) else: + # Note to self: also apply to search.html template url builder. limit = 50 # OFFSET @@ -400,9 +401,8 @@ def get_search_core(): else: prev_page_url = None - search_kwargs['extension'] = extension_string - search_kwargs['extension_not'] = extension_not_string - search_kwargs['mimetype'] = mimetype_string + view = request.args.get('view', 'grid') + search_kwargs['view'] = view final_results = { 'next_page_url': next_page_url, diff --git a/etiquette/helpers.py b/etiquette/helpers.py index 0ee42e4..bfc77dc 100644 --- a/etiquette/helpers.py +++ b/etiquette/helpers.py @@ -50,7 +50,8 @@ def edit_params(original, modifications): return '' new_params = ['%s=%s' % (k, v) for (k, v) in new_params.items() if v] new_params = '&'.join(new_params) - new_params = '?' + new_params + if new_params: + new_params = '?' + new_params return new_params def fit_into_bounds(image_width, image_height, frame_width, frame_height): diff --git a/etiquette/jsonify.py b/etiquette/jsonify.py index 17aac96..45614e8 100644 --- a/etiquette/jsonify.py +++ b/etiquette/jsonify.py @@ -26,7 +26,7 @@ def photo(p, include_albums=True, include_tags=True): 'bytes': p.bytes, 'duration_str': helpers.seconds_to_hms(p.duration) if p.duration is not None else None, 'duration': p.duration, - 'bytestring': p.bytestring(), + 'bytes_str': p.bytestring(), 'has_thumbnail': bool(p.thumbnail), 'created': p.created, 'filename': p.basename, diff --git a/etiquette/phototagger.py b/etiquette/phototagger.py index cf19f50..3a75a02 100644 --- a/etiquette/phototagger.py +++ b/etiquette/phototagger.py @@ -746,6 +746,7 @@ class PDBPhotoMixin: Returns the Photo object. ''' filename = os.path.abspath(filename) + assert os.path.isfile(filename) if not allow_duplicates: try: existing = self.get_photo_by_path(filename) diff --git a/etiquette/static/Highlander_Normal.ttf b/etiquette/static/Highlander_Normal.ttf new file mode 100644 index 0000000..00bf36c Binary files /dev/null and b/etiquette/static/Highlander_Normal.ttf differ diff --git a/etiquette/static/basic_thumbnails/archive.png b/etiquette/static/basic_thumbnails/archive.png new file mode 100644 index 0000000..8a6aa3f Binary files /dev/null and b/etiquette/static/basic_thumbnails/archive.png differ diff --git a/etiquette/static/basic_thumbnails/archive.svg b/etiquette/static/basic_thumbnails/archive.svg new file mode 100644 index 0000000..2e0a656 --- /dev/null +++ b/etiquette/static/basic_thumbnails/archive.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/etiquette/static/common.css b/etiquette/static/common.css index 13ffc6e..3a909ff 100644 --- a/etiquette/static/common.css +++ b/etiquette/static/common.css @@ -82,7 +82,14 @@ li border-right: 2px solid #ffacac; border-bottom: 2px solid #ffacac; } -.photo_galleryview +.photo_card_list +{ + background-color: #ffffd4; + display: block; + padding: 4px; + margin: 8px; +} +.photo_card_grid { vertical-align: middle; position: relative; @@ -96,7 +103,7 @@ li margin: 8px; border-radius: 8px; } -.photo_galleryview_thumb +.photo_card_grid_thumb { display:flex; flex-direction: column; @@ -106,7 +113,7 @@ li width: 100%; height: 150px; } -.photo_galleryview_thumb a +.photo_card_grid_thumb a { display:flex; flex-direction: column; @@ -116,13 +123,13 @@ li width: 100%; height: 150px; } -.photo_galleryview_thumb img +.photo_card_grid_thumb img { max-width: 100%; max-height: 100%; height: auto; } -.photo_galleryview_info +.photo_card_grid_info { position: absolute; top: 160px; @@ -131,23 +138,23 @@ li right: 8px; font-size: 0.8em; } -.photo_galleryview_info a +.photo_card_grid_info a { position: absolute; max-height: 30px; overflow: hidden; } -.photo_galleryview_info a:hover +.photo_card_grid_info a:hover { max-height: 100%; } -.photo_galleryview_file_metadata +.photo_card_grid_file_metadata { position: absolute; bottom: 0; right: 0; } -.photo_galleryview_tags +.photo_card_grid_tags { position: absolute; bottom: 0; @@ -174,4 +181,9 @@ li .callback_message_negative { background-color: #faa; +} + +@font-face { + font-family: 'Highlander'; + src: url('/static/Highlander_Normal.ttf'); } \ No newline at end of file diff --git a/etiquette/templates/album.html b/etiquette/templates/album.html index 9c5d366..7cfc47a 100644 --- a/etiquette/templates/album.html +++ b/etiquette/templates/album.html @@ -1,7 +1,7 @@ - {% import "photo_object.html" as photo_object %} + {% import "photo_card.html" as photo_card %} {% import "header.html" as header %} Album {{album["title"]}} @@ -44,7 +44,7 @@

Photos

{% endif %} diff --git a/etiquette/templates/photo.html b/etiquette/templates/photo.html index 16cfb9c..541d09f 100644 --- a/etiquette/templates/photo.html +++ b/etiquette/templates/photo.html @@ -42,7 +42,7 @@ flex: 1; background-color: rgba(0, 0, 0, 0.1); } -.photo_object +.photo_viewer { display: flex; flex: 1; @@ -52,10 +52,8 @@ height: 100%; width: 100%; } -.photo_object a +.photo_viewer a { - height: 100%; - width: 100%; display: flex; justify-content: center; align-items: center; @@ -69,16 +67,16 @@ align-items: center; background-repeat: no-repeat; } -.photo_object img +.photo_viewer img { max-height: 100%; max-width: 100%; } -.photo_object audio +.photo_viewer audio { width: 100%; } -.photo_object video +.photo_viewer video { max-width: 100%; max-height: 100%; @@ -112,7 +110,7 @@ {% if photo["width"] %}
  • Dimensions: {{photo["width"]}}x{{photo["height"]}} px
  • Aspect ratio: {{photo["ratio"]}}
  • -
  • Size: {{photo["bytestring"]}}
  • +
  • Size: {{photo["bytes_str"]}}
  • {% endif %} {% if photo["duration"] %}
  • Duration: {{photo["duration_str"]}}
  • @@ -137,7 +135,7 @@