mirror of
https://github.com/Alexander-D-Karpov/akarpov
synced 2024-11-11 07:06:34 +03:00
improved preview on file list, fixed update time
This commit is contained in:
parent
88c3c2d41a
commit
e072f71d9b
|
@ -45,6 +45,12 @@ def file_image_url(self):
|
|||
return settings.STATIC_URL + f"images/files/{end}.png"
|
||||
return settings.STATIC_URL + "images/files/_blank.png"
|
||||
|
||||
@property
|
||||
def file_size(self):
|
||||
if self.file:
|
||||
return self.file.size
|
||||
return 0
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse("files:view", kwargs={"slug": self.slug})
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.fill-height { flex-grow: 1; width: 100%; }
|
||||
.controlsdiv { display: table; width: 100%; }
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
|
@ -23,11 +25,14 @@
|
|||
{% endfor %}
|
||||
<div class="row">
|
||||
{% for file in file_list %}
|
||||
<div class="col-lg-2 col-md-4 col-sm-6 col-xs-12 mb-3 m-3 d-flex align-items-stretch card">
|
||||
<div class="col-lg-2 col-xxl-2 col-md-4 col-sm-6 col-xs-12 mb-3 m-3 d-flex align-items-stretch card">
|
||||
<div class="card-body d-flex flex-column">
|
||||
<h5 class="card-title">{{ file.name }}</h5>
|
||||
<p class="card-text mb-4"><small class="text-muted">{{ file.edited | naturaltime }}</small></p>
|
||||
<img src="{{ file.file_image_url }}" class="card-img-bottom" alt="">
|
||||
<p class="card-text mb-4"><small class="text-muted">{{ file.file_size | filesizeformat }}</small></p>
|
||||
<div class="align-self-stretch align-items-center justify-content-center d-flex flex-column fill-height controlsdiv">
|
||||
<img src="{{ file.file_image_url }}" class="img-fluid" alt="">
|
||||
</div>
|
||||
<p class="card-text mb-4 mt-2 ms-3"><small class="text-muted">{{ file.modified | naturaltime }}</small></p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in New Issue
Block a user