1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-05-11 01:17:02 +00:00

['error' page] redesigned the 'error' page for 'Unable to view file' ()

This commit is contained in:
llj 2024-12-18 15:25:38 +08:00 committed by GitHub
parent a9753d876c
commit dd49dc1e41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 3 deletions
media/css
seahub
templates
utils
views

View File

@ -2969,3 +2969,8 @@ a.sf-popover-item {
margin-right: 2px;
background-color: #DBDBDB;
}
.unable-view-file-tip {
margin-top: 20px;
font-size: 1.125rem;
}

View File

@ -2,6 +2,11 @@
{% block main_content %}
<div class="text-panel">
<p class="error">{{ error_msg }}</p>
{% if unable_view_file %}
<img src="{{MEDIA_URL}}img/failed-to-view-file.png" alt="" width="100" />
<p class="unable-view-file-tip">{{ error_msg }}</p>
{% else %}
<p class="error">{{ error_msg }}</p>
{% endif %}
</div>
{% endblock %}

View File

@ -164,6 +164,7 @@ def render_permission_error(request, msg=None, extra_ctx=None):
"""
ctx = {}
ctx['unable_view_file'] = msg == _('Unable to view file')
ctx['error_msg'] = msg or _('permission error')
if extra_ctx:
@ -178,6 +179,7 @@ def render_error(request, msg=None, extra_ctx=None):
"""
ctx = {}
ctx['unable_view_file'] = msg == _('Unable to view file')
ctx['error_msg'] = msg or _('Internal Server Error')
if extra_ctx:
@ -554,7 +556,7 @@ def gen_file_get_url_new(repo_id, filepath, op='download'):
Generate fileserver file url.
Format: http://<domain:port>/repos/<repo_id>files/<filepath>/?op=download
"""
return '%s/repos/%s/files/%s/?op=%s' % (
get_fileserver_root(),
repo_id,

View File

@ -2064,7 +2064,7 @@ def get_file_content_from_cache(file_id, repo_id, file_name):
file_id, 'view', '', use_onetime=False)
if not access_token:
err_msg = 'Unable to view file'
err_msg = _('Unable to view file')
return err_msg, file_content
file_raw_path = gen_inner_file_get_url(access_token, file_name)