From 6dcf47cab749cdc032290895960ad23947a8d83e Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 27 Dec 2018 15:30:30 -0800 Subject: [PATCH] Remove duplicated markup between list/grid photo cards. --- .../etiquette_flask/static/css/photo_card.css | 2 +- .../etiquette_flask/templates/photo_card.html | 81 ++++++++----------- 2 files changed, 35 insertions(+), 48 deletions(-) diff --git a/frontends/etiquette_flask/static/css/photo_card.css b/frontends/etiquette_flask/static/css/photo_card.css index 17134c5..02342c5 100644 --- a/frontends/etiquette_flask/static/css/photo_card.css +++ b/frontends/etiquette_flask/static/css/photo_card.css @@ -137,13 +137,13 @@ min-width: 100%; width: 0; - max-height: 30px; background-color: inherit; word-break: break-word; } .photo_card_grid .photo_card_filename { align-self: start; + max-height: 30px; font-size: 12.8px; } .photo_card_list .photo_card_filename diff --git a/frontends/etiquette_flask/templates/photo_card.html b/frontends/etiquette_flask/templates/photo_card.html index c643be6..12efe9b 100644 --- a/frontends/etiquette_flask/templates/photo_card.html +++ b/frontends/etiquette_flask/templates/photo_card.html @@ -15,38 +15,7 @@ } %} {% macro create_photo_card(photo, view="grid") %} - -{% if view == "list" %} -
- - {{photo.basename}} - -
-{% else -%} - -{% if photo.thumbnail %} - {% set thumbnail_src = "/thumbnail/" + photo.id + ".jpg" %} -{% else %} - {% set thumbnail_src = - thumbnails.get(photo.extension, "") or - thumbnails.get(photo.mimetype, "") or - thumbnails.get(photo.simple_mimetype, "") or - "other" - %} - {% set thumbnail_src = "/static/basic_thumbnails/" + thumbnail_src + ".png" %} -{% endif -%} - -{% set tag_names_title = [] %} -{% for tag in photo.get_tags() %} - {% do tag_names_title.append(tag.name) %} -{% endfor -%} - -{% set tag_names_title = ", ".join(tag_names_title) %} -{% if tag_names_title %} - {% set tag_names_inner = "T" %} -{% else %} - {% set tag_names_inner = "" %} -{% endif -%} +{% set view = (view if view in ("list", "grid") else "grid") %} {% set metadata_inner = "" %} {% if photo.width %} @@ -56,23 +25,41 @@ {% set metadata_inner = "{m}{d}, ".format(m=metadata_inner, d=photo.duration_string) %} {% endif -%} -
- - - - - - - {{tag_names_inner}} - +
+ + - + {% if view == "grid" %} + {% if photo.thumbnail %} + {% set thumbnail_src = "/thumbnail/" + photo.id + ".jpg" %} + {% else %} + {% set thumbnail_src = + thumbnails.get(photo.extension, "") or + thumbnails.get(photo.mimetype, "") or + thumbnails.get(photo.simple_mimetype, "") or + "other" + %} + {% set thumbnail_src = "/static/basic_thumbnails/" + thumbnail_src + ".png" %} + {% endif -%} + + {% set tag_names_title = [] %} + {% for tag in photo.get_tags() %} + {% do tag_names_title.append(tag.name) %} + {% endfor -%} + + {% set tag_names_title = ", ".join(tag_names_title) %} + {% if tag_names_title %} + {% set tag_names_inner = "T" %} + {% else %} + {% set tag_names_inner = "" %} + {% endif -%} + + {{tag_names_inner}} + {% endif %}
-{% endif %} + {% endmacro %}