mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-19 18:29:23 +00:00
[grp discuss] display image if the attachment is a image file
This commit is contained in:
@@ -83,8 +83,16 @@
|
|||||||
<div class="msg-attachment">
|
<div class="msg-attachment">
|
||||||
{% if ma.src == 'recommend' %}
|
{% if ma.src == 'recommend' %}
|
||||||
{% if ma.attach_type == 'file' %}
|
{% if ma.attach_type == 'file' %}
|
||||||
<img src="{{ MEDIA_URL }}img/file/{{ ma.name|file_icon_filter }}" alt="{% trans "File"%}" height="18" class="vam" />
|
{% if ma.filetype != 'Image'%}
|
||||||
<a href="{% url 'repo_view_file' ma.repo_id %}?p={{ ma.path|urlencode }}" target="_blank" class="vam">{{ ma.name }}</a>
|
<img src="{{ MEDIA_URL }}img/file/{{ ma.name|file_icon_filter }}" alt="{% trans "File"%}" height="18" class="vam" />
|
||||||
|
<a href="{% url 'repo_view_file' ma.repo_id %}?p={{ ma.path|urlencode }}" target="_blank" class="vam">{{ ma.name }}</a>
|
||||||
|
{% else %}
|
||||||
|
{% if ma.err %}
|
||||||
|
<p class="error">{{ma.err}}</p>
|
||||||
|
{% else %}
|
||||||
|
<a href="{% url 'repo_view_file' ma.repo_id %}?p={{ ma.path|urlencode }}" target="_blank" class="img-cont"><img src="{{ma.img_url}}" alt="{{ma.name}}" class="img" /></a>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory icon"%}" height="20" class="vam" />
|
<img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory icon"%}" height="20" class="vam" />
|
||||||
<a href="{% url 'repo' ma.repo_id %}?p={{ ma.path|urlencode }}" target="_blank" class="vam">{{ ma.name }}</a>
|
<a href="{% url 'repo' ma.repo_id %}?p={{ ma.path|urlencode }}" target="_blank" class="vam">{{ ma.name }}</a>
|
||||||
|
@@ -1051,6 +1051,16 @@ def group_discuss(request, group):
|
|||||||
if path[-1] == '/':
|
if path[-1] == '/':
|
||||||
path = path[:-1]
|
path = path[:-1]
|
||||||
att.name = os.path.basename(path)
|
att.name = os.path.basename(path)
|
||||||
|
if att.attach_type == 'file' and att.src == 'recommend':
|
||||||
|
att.filetype, att.fileext = get_file_type_and_ext(att.name)
|
||||||
|
if att.filetype == 'Image':
|
||||||
|
att.obj_id = get_file_id_by_path(att.repo_id, path)
|
||||||
|
if not att.obj_id:
|
||||||
|
att.err = _(u'File does not exist')
|
||||||
|
else:
|
||||||
|
att.token = web_get_access_token(att.repo_id, att.obj_id, 'view', request.user.username)
|
||||||
|
att.img_url = gen_file_get_url(att.token, att.name)
|
||||||
|
|
||||||
msg.attachment = att
|
msg.attachment = att
|
||||||
|
|
||||||
return render_to_response("group/group_discuss.html", {
|
return render_to_response("group/group_discuss.html", {
|
||||||
|
@@ -152,6 +152,7 @@ p {
|
|||||||
.vh { visibility:hidden; }
|
.vh { visibility:hidden; }
|
||||||
.vam { vertical-align:middle; }
|
.vam { vertical-align:middle; }
|
||||||
.italic { font-style:italic; }
|
.italic { font-style:italic; }
|
||||||
|
.al-rt { text-align:right; }
|
||||||
.notification {
|
.notification {
|
||||||
padding:5px;
|
padding:5px;
|
||||||
background:#FDF;
|
background:#FDF;
|
||||||
@@ -161,9 +162,6 @@ p {
|
|||||||
color:#808080;
|
color:#808080;
|
||||||
font-size:12px;
|
font-size:12px;
|
||||||
}
|
}
|
||||||
.al-rt {
|
|
||||||
text-align:right;
|
|
||||||
}
|
|
||||||
.op,
|
.op,
|
||||||
.more {
|
.more {
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
@@ -1520,6 +1518,18 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
border-top:1px solid #e9e9e9;
|
border-top:1px solid #e9e9e9;
|
||||||
margin-top:12px;
|
margin-top:12px;
|
||||||
}
|
}
|
||||||
|
.msg-attachment .img-cont {
|
||||||
|
display:block;
|
||||||
|
text-align:center;
|
||||||
|
line-height:0;
|
||||||
|
background:#fcfcfc;
|
||||||
|
}
|
||||||
|
.msg-attachment .img {
|
||||||
|
width:auto;
|
||||||
|
height:auto;
|
||||||
|
max-width:100%;
|
||||||
|
max-height:300px;
|
||||||
|
}
|
||||||
.msg-hd .author {
|
.msg-hd .author {
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user