Improve Photo Card CSS: Filename hover and metadata font
This commit is contained in:
parent
fcc671a617
commit
c6615284e0
5 changed files with 48 additions and 19 deletions
|
@ -4,6 +4,7 @@ Etiquette
|
||||||
This is the readme file.
|
This is the readme file.
|
||||||
|
|
||||||
### To do list
|
### To do list
|
||||||
|
- Make the wording between "new", "create", "add" and "remove", "delete" more consistent.
|
||||||
- At the moment I don't like the way that warnings and exceptions are so far apart, and need to be updated individually. Consider moving the warning strings to be class properties of the matching exceptions.
|
- At the moment I don't like the way that warnings and exceptions are so far apart, and need to be updated individually. Consider moving the warning strings to be class properties of the matching exceptions.
|
||||||
- User account system, permission levels, private pages.
|
- User account system, permission levels, private pages.
|
||||||
- Generalize the filename expression filter so it can work with any strings.
|
- Generalize the filename expression filter so it can work with any strings.
|
||||||
|
|
|
@ -110,7 +110,16 @@ WARNING_ORDERBY_BADDIRECTION = 'You can\'t order "{column}" by "{direction}". De
|
||||||
EXPRESSION_OPERATORS = {'(', ')', 'OR', 'AND', 'NOT'}
|
EXPRESSION_OPERATORS = {'(', ')', 'OR', 'AND', 'NOT'}
|
||||||
ADDITIONAL_MIMETYPES = {
|
ADDITIONAL_MIMETYPES = {
|
||||||
'srt': 'text',
|
'srt': 'text',
|
||||||
|
|
||||||
'mkv': 'video',
|
'mkv': 'video',
|
||||||
|
|
||||||
|
'm4a': 'audio',
|
||||||
|
|
||||||
|
'7z': 'archive',
|
||||||
|
'gz': 'archive',
|
||||||
|
'rar': 'archive',
|
||||||
|
'tar': 'archive',
|
||||||
|
'zip': 'archive',
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFAULT_DATADIR = '.\\_etiquette'
|
DEFAULT_DATADIR = '.\\_etiquette'
|
||||||
|
|
|
@ -112,7 +112,7 @@ def P_user(username):
|
||||||
except exceptions.NoSuchUser as e:
|
except exceptions.NoSuchUser as e:
|
||||||
return 'That user doesnt exist: %s' % e
|
return 'That user doesnt exist: %s' % e
|
||||||
|
|
||||||
def send_file(filepath):
|
def send_file(filepath, override_mimetype=None):
|
||||||
'''
|
'''
|
||||||
Range-enabled file sending.
|
Range-enabled file sending.
|
||||||
'''
|
'''
|
||||||
|
@ -122,6 +122,9 @@ def send_file(filepath):
|
||||||
flask.abort(404)
|
flask.abort(404)
|
||||||
|
|
||||||
outgoing_headers = {}
|
outgoing_headers = {}
|
||||||
|
if override_mimetype is not None:
|
||||||
|
mimetype = override_mimetype
|
||||||
|
else:
|
||||||
mimetype = mimetypes.guess_type(filepath)[0]
|
mimetype = mimetypes.guess_type(filepath)[0]
|
||||||
if mimetype is not None:
|
if mimetype is not None:
|
||||||
if 'text/' in mimetype:
|
if 'text/' in mimetype:
|
||||||
|
@ -385,7 +388,7 @@ def get_file(photoid):
|
||||||
response.headers['Content-Disposition'] = 'attachment; filename*=UTF-8\'\'%s' % download_as
|
response.headers['Content-Disposition'] = 'attachment; filename*=UTF-8\'\'%s' % download_as
|
||||||
return response
|
return response
|
||||||
else:
|
else:
|
||||||
return send_file(photo.real_filepath)
|
return send_file(photo.real_filepath, override_mimetype=photo.mimetype)
|
||||||
|
|
||||||
|
|
||||||
def get_photo_core(photoid):
|
def get_photo_core(photoid):
|
||||||
|
|
|
@ -124,7 +124,7 @@ li
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 150px;
|
height: 100%;
|
||||||
}
|
}
|
||||||
.photo_card_grid_thumb img
|
.photo_card_grid_thumb img
|
||||||
{
|
{
|
||||||
|
@ -136,27 +136,46 @@ li
|
||||||
{
|
{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
justify-content: space-between;
|
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
font-size: 0.8em;
|
|
||||||
}
|
|
||||||
.photo_card_grid_file_metadata
|
|
||||||
{
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
font-size: 12.8px;
|
||||||
|
background-color: inherit;
|
||||||
|
|
||||||
|
/*
|
||||||
|
The width of photo cards should be based on the aspect ratio of the
|
||||||
|
thumbnail image. Previously, I had problems where the card would be wider
|
||||||
|
than necessary because the file had a long name.
|
||||||
|
These min-width:100% + width:0 prevent the info div from controlling
|
||||||
|
card size, prioritizing the thumbnail.
|
||||||
|
*/
|
||||||
|
min-width: 100%;
|
||||||
|
width: 0;
|
||||||
}
|
}
|
||||||
.photo_card_grid_filename
|
.photo_card_grid_filename
|
||||||
{
|
{
|
||||||
/*position: absolute;*/
|
background-color: inherit;
|
||||||
max-height: 30px;
|
max-height: 30px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
align-self: flex-start;
|
align-self: flex-start;
|
||||||
word-break:break-word;
|
word-break:break-word;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
.photo_card_grid_filename a
|
||||||
|
{
|
||||||
|
background-color: inherit;
|
||||||
}
|
}
|
||||||
.photo_card_grid_filename:hover
|
.photo_card_grid_filename:hover
|
||||||
{
|
{
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
|
.photo_card_grid_file_metadata
|
||||||
|
{
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: 12px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
.photo_card_grid_tags
|
.photo_card_grid_tags
|
||||||
{
|
{
|
||||||
align-self: flex-start;
|
align-self: flex-start;
|
||||||
|
|
|
@ -1,15 +1,10 @@
|
||||||
{% set thumbnails =
|
{% set thumbnails =
|
||||||
{
|
{
|
||||||
"audio": "audio",
|
"audio": "audio",
|
||||||
|
"archive": "archive",
|
||||||
"txt": "txt",
|
"txt": "txt",
|
||||||
"svg": "svg",
|
"svg": "svg",
|
||||||
"video": "video",
|
"video": "video",
|
||||||
|
|
||||||
"7z": "archive",
|
|
||||||
"gz": "archive",
|
|
||||||
"rar": "archive",
|
|
||||||
"tar": "archive",
|
|
||||||
"zip": "archive",
|
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
{% macro create_photo_card(photo, view="grid") %}
|
{% macro create_photo_card(photo, view="grid") %}
|
||||||
|
@ -39,7 +34,9 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="photo_card_grid_info">
|
<div class="photo_card_grid_info">
|
||||||
<a target="_blank" class="photo_card_grid_filename" href="/photo/{{photo.id}}">{{photo.basename}}</a>
|
<div class="photo_card_grid_filename">
|
||||||
|
<a target="_blank" href="/photo/{{photo.id}}">{{photo.basename}}</a>
|
||||||
|
</div>
|
||||||
<div class="photo_card_grid_file_metadata">
|
<div class="photo_card_grid_file_metadata">
|
||||||
<div class="photo_card_grid_tags">
|
<div class="photo_card_grid_tags">
|
||||||
{% set tags = photo.tags() %}
|
{% set tags = photo.tags() %}
|
||||||
|
@ -53,7 +50,7 @@
|
||||||
</div>
|
</div>
|
||||||
<span>
|
<span>
|
||||||
{% if photo.width %}
|
{% if photo.width %}
|
||||||
{{photo.width}}x{{photo.height}},
|
{{photo.width}}×{{photo.height}},
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if photo.duration %}
|
{% if photo.duration %}
|
||||||
{{photo.duration_string()}},
|
{{photo.duration_string()}},
|
||||||
|
|
Loading…
Reference in a new issue