Commit 87d2c889 by Kálmán Viktor

dashboard: mark new files on store list

parent 77334780
......@@ -753,4 +753,20 @@ textarea[name="list-new-namelist"] {
display: none;
border-left: 1px solid #ddd;
border-right: 1px solid #ddd;
position: relative;
}
.store-list-item-new {
display: inline-block;
}
.store-list-item-new .badge {
margin-left: 5px;
background: #5bc0dc;
}
.store-download-button {
position: absolute;
right: 15px;
top: 32px;
}
......@@ -19,21 +19,28 @@
{% for f in root %}
<a class="list-group-item store-list-item" data-item-type="{{ f.TYPE }}"
href="{% if f.TYPE == "D" %}?directory={{ f.path }}{% else %}
{% url "dashboard.views.store-download" %}?path={{ f.path }}{% endif %}">
{% url "dashboard.views.store-download" %}?path={{ f.path }}{% endif %}"
>
<div class="store-list-item-icon">
<i class="
icon-{% if f.TYPE == "D" %}folder-open-alt{% else %}file-alt{% endif %}"
></i>
</div>
<i class="
icon-{% if f.TYPE == "D" %}folder-open-alt{% else %}file-alt{% endif %}"
></i>
</div>
{{ f.NAME }}
<div class="store-list-item-new">
{% if f.is_new %}
<span class="badge badge-pulse">{% trans "new" %}</span>
{% endif %}
</div>
<div class="store-list-item-size">
{{ f.human_readable_size }}
</div>
<div class="clearfix"></div>
</a>
<div class="store-list-file-infos" style="position: relative;">
<div class="store-list-file-infos">
<a href="{% url "dashboard.views.store-download" %}?path={{ f.path }}"
class="btn btn-primary" style="position: absolute; right: 15px; top: 32px;">
class="btn btn-primary btn-sm store-download-button">
<i class="icon-download"></i>
Download
</a>
......
......@@ -2962,8 +2962,11 @@ class StoreList(LoginRequiredMixin, TemplateView):
content = store_api.listfolder("test", directory)
for d in content:
d['human_readable_date'] = datetime.fromtimestamp(float(
d['human_readable_date'] = datetime.utcfromtimestamp(float(
d['MTIME']))
delta = (datetime.utcnow() - d['human_readable_date']
).total_seconds()
d['is_new'] = delta < 5 and delta > 0
d['human_readable_size'] = (
"directory" if d['TYPE'] == "D" else
filesizeformat(float(d['SIZE'])))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment