mirror of
https://github.com/Alexander-D-Karpov/akarpov
synced 2024-11-29 10:53:44 +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 + f"images/files/{end}.png"
|
||||||
return settings.STATIC_URL + "images/files/_blank.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):
|
def get_absolute_url(self):
|
||||||
return reverse("files:view", kwargs={"slug": self.slug})
|
return reverse("files:view", kwargs={"slug": self.slug})
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
.fill-height { flex-grow: 1; width: 100%; }
|
||||||
|
.controlsdiv { display: table; width: 100%; }
|
||||||
</style>
|
</style>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -23,11 +25,14 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% for file in file_list %}
|
{% 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">
|
<div class="card-body d-flex flex-column">
|
||||||
<h5 class="card-title">{{ file.name }}</h5>
|
<h5 class="card-title">{{ file.name }}</h5>
|
||||||
<p class="card-text mb-4"><small class="text-muted">{{ file.edited | naturaltime }}</small></p>
|
<p class="card-text mb-4"><small class="text-muted">{{ file.file_size | filesizeformat }}</small></p>
|
||||||
<img src="{{ file.file_image_url }}" class="card-img-bottom" alt="">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user