diff --git a/circle/dashboard/static/dashboard/dashboard.css b/circle/dashboard/static/dashboard/dashboard.css index 6d4a916..3881e6c 100644 --- a/circle/dashboard/static/dashboard/dashboard.css +++ b/circle/dashboard/static/dashboard/dashboard.css @@ -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; } diff --git a/circle/dashboard/templates/dashboard/store/list.html b/circle/dashboard/templates/dashboard/store/list.html index 8e31e6e..5b08276 100644 --- a/circle/dashboard/templates/dashboard/store/list.html +++ b/circle/dashboard/templates/dashboard/store/list.html @@ -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> diff --git a/circle/dashboard/views.py b/circle/dashboard/views.py index 5d9db80..2a5e971 100644 --- a/circle/dashboard/views.py +++ b/circle/dashboard/views.py @@ -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'])))