From 4137331397d35ddeb771cc59af7d10781bd57ff5 Mon Sep 17 00:00:00 2001 From: lian Date: Wed, 10 May 2017 17:58:32 +0800 Subject: [PATCH] update view shared dir page 1. always return is_img and is_video info of a file 1. move magnific popup css file to base.html --- seahub/templates/base.html | 1 + seahub/templates/view_shared_dir.html | 4 ---- seahub/views/repo.py | 24 ++++++++++++------------ 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/seahub/templates/base.html b/seahub/templates/base.html index 8ba801f1dd..0b3ea11302 100644 --- a/seahub/templates/base.html +++ b/seahub/templates/base.html @@ -13,6 +13,7 @@ + {% block extra_style %}{% endblock %} {% if branding_css != '' %}{% endif %} diff --git a/seahub/templates/view_shared_dir.html b/seahub/templates/view_shared_dir.html index 91e4ef942d..d5ea7fb1cf 100644 --- a/seahub/templates/view_shared_dir.html +++ b/seahub/templates/view_shared_dir.html @@ -3,10 +3,6 @@ {% load seahub_tags i18n staticfiles %} {% load url from future %} -{% block extra_style %} - -{% endblock %} - {% block wide_page_content %} {% if traffic_over_limit %}

{% trans "File download is disabled: the share link traffic of owner is used up." %}

diff --git a/seahub/views/repo.py b/seahub/views/repo.py index 94fdd8822d..8723668c36 100644 --- a/seahub/views/repo.py +++ b/seahub/views/repo.py @@ -225,18 +225,18 @@ def view_shared_dir(request, fileshare): mode = 'grid' thumbnail_size = THUMBNAIL_DEFAULT_SIZE if mode == 'list' else THUMBNAIL_SIZE_FOR_GRID - if not repo.encrypted and ENABLE_THUMBNAIL: - for f in file_list: - file_type, file_ext = get_file_type_and_ext(f.obj_name) - if file_type == IMAGE: - f.is_img = True - if file_type == VIDEO: - f.is_video = True - if file_type == IMAGE or file_type == VIDEO: - if os.path.exists(os.path.join(THUMBNAIL_ROOT, str(thumbnail_size), f.obj_id)): - req_image_path = posixpath.join(req_path, f.obj_name) - src = get_share_link_thumbnail_src(token, thumbnail_size, req_image_path) - f.encoded_thumbnail_src = urlquote(src) + for f in file_list: + file_type, file_ext = get_file_type_and_ext(f.obj_name) + if file_type == IMAGE: + f.is_img = True + if file_type == VIDEO: + f.is_video = True + + if (file_type == IMAGE or file_type == VIDEO) and ENABLE_THUMBNAIL: + if os.path.exists(os.path.join(THUMBNAIL_ROOT, str(thumbnail_size), f.obj_id)): + req_image_path = posixpath.join(req_path, f.obj_name) + src = get_share_link_thumbnail_src(token, thumbnail_size, req_image_path) + f.encoded_thumbnail_src = urlquote(src) return render_to_response('view_shared_dir.html', { 'repo': repo,