feat: update layout for download backups

This commit is contained in:
Shivam Mishra 2020-09-30 15:52:55 +05:30
parent 1992feb6b7
commit 2e1decd8b3
3 changed files with 29 additions and 32 deletions

View file

@ -0,0 +1,9 @@
.download-backup-card {
display: block;
text-decoration: none;
}
.download-backup-card:hover {
box-shadow: var(--shadow-md);
text-decoration: none;
}

View file

@ -1,32 +1,20 @@
<!-- jinja -->
<table class="table table-striped table-bordered" style="max-width: 600px;">
<thead>
<tr>
<th style="width: 30%;">
{{ _("Date") }}
</th>
<th style="width: 50%;">
{{ _("File") }}
</th>
<th>
{{ _("Size") }}
</th>
</tr>
</thead>
<tbody>
{% for f in files %}
<tr>
<td>
{{ f[1] }}
</td>
<td>
<a href="{{ f[0] }}" target="_blank" rel="noopener noreferrer">{{ f[0] }}</a>
</td>
<td>
{{ f[2] }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="row">
{% for f in files %}
<div class="col-lg-3 col-md-4 col-12">
<a href="{{ f[0] }}" target="_blank" rel="noopener noreferrer" class="frappe-card download-backup-card">
<div>
{{ f[1] }}
</div>
<div class="mt-2">
<svg class="icon-sm" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
stroke="var(--icon-stroke)">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" />
</svg>
{{ f[2] }}
</div>
</a>
</div>
{% endfor %}
</div>

View file

@ -9,7 +9,7 @@ import datetime
def get_context(context):
def get_time(path):
dt = os.path.getmtime(path)
return convert_utc_to_user_timezone(datetime.datetime.utcfromtimestamp(dt)).strftime('%Y-%m-%d %H:%M')
return convert_utc_to_user_timezone(datetime.datetime.utcfromtimestamp(dt)).strftime('%a %b %d %H:%M %Y')
def get_size(path):
size = os.path.getsize(path)