mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-13 05:39:59 +00:00
Added at complete in file commet
This commit is contained in:
@@ -943,23 +943,35 @@ def attention(request):
|
|||||||
if not request.is_ajax():
|
if not request.is_ajax():
|
||||||
raise Http404
|
raise Http404
|
||||||
|
|
||||||
try:
|
|
||||||
gid = int(request.GET.get('gid', ''))
|
|
||||||
except ValueError:
|
|
||||||
raise Http404
|
|
||||||
|
|
||||||
name_str = request.GET.get('name_startsWith')
|
|
||||||
user = request.user.username
|
user = request.user.username
|
||||||
|
name_str = request.GET.get('name_startsWith')
|
||||||
if not is_group_user(gid, user):
|
gids = request.GET.get('gids', '')
|
||||||
raise Http404
|
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
# Get all group users
|
|
||||||
members = get_group_members(gid)
|
members = []
|
||||||
|
for gid in gids.split(','):
|
||||||
|
try:
|
||||||
|
gid = int(gid)
|
||||||
|
except ValueError:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if not is_group_user(gid, user):
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Get all group users
|
||||||
|
members += get_group_members(gid)
|
||||||
|
|
||||||
|
member_names = []
|
||||||
for m in members:
|
for m in members:
|
||||||
if m.user_name == user:
|
if m.user_name == user:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if m.user_name in member_names:
|
||||||
|
# Remove duplicated member names
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
member_names.append(m.user_name)
|
||||||
|
|
||||||
from base.templatetags.seahub_tags import email2nickname, char2pinyin
|
from base.templatetags.seahub_tags import email2nickname, char2pinyin
|
||||||
nickname = email2nickname(m.user_name)
|
nickname = email2nickname(m.user_name)
|
||||||
pinyin = char2pinyin(nickname)
|
pinyin = char2pinyin(nickname)
|
||||||
|
@@ -1160,7 +1160,8 @@ ul.with-bg li {
|
|||||||
border:none;
|
border:none;
|
||||||
}
|
}
|
||||||
.msg-bd .recommend,
|
.msg-bd .recommend,
|
||||||
.msg-bd .at {
|
.msg-bd .at,
|
||||||
|
.comment-bd .at {
|
||||||
color:#808;
|
color:#808;
|
||||||
}
|
}
|
||||||
.reply-list {
|
.reply-list {
|
||||||
|
@@ -81,7 +81,7 @@ function addAutocomplete(ele_id, container_id, data) {
|
|||||||
* @param ele_css: {'xx':'xxx'}, styles to be applied to ele_cp
|
* @param ele_css: {'xx':'xxx'}, styles to be applied to ele_cp
|
||||||
* @param container_id: id of autocomplete's container, often container of element above
|
* @param container_id: id of autocomplete's container, often container of element above
|
||||||
*/
|
*/
|
||||||
function addAtAutocomplete(ele_id, container_id, gid, aj_url, ele_css) {
|
function addAtAutocomplete(ele_id, container_id, gids, aj_url, ele_css) {
|
||||||
var pos = ''; // cursor position
|
var pos = ''; // cursor position
|
||||||
var cursor_at_end; // Boolean. if cursor at the end or in the middle.
|
var cursor_at_end; // Boolean. if cursor at the end or in the middle.
|
||||||
var end_str = ''; // str after '@' when '@' is inserted into the middle of the ele's value
|
var end_str = ''; // str after '@' when '@' is inserted into the middle of the ele's value
|
||||||
@@ -152,7 +152,7 @@ function addAtAutocomplete(ele_id, container_id, gid, aj_url, ele_css) {
|
|||||||
url: aj_url,
|
url: aj_url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: {
|
data: {
|
||||||
gid: gid,
|
gids: gids,
|
||||||
name_startsWith: request_term
|
name_startsWith: request_term
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
@@ -160,7 +160,7 @@
|
|||||||
<form id="file-comment-form" action="" method="post">
|
<form id="file-comment-form" action="" method="post">
|
||||||
<div class="w100 ovhd">
|
<div class="w100 ovhd">
|
||||||
<a class="pic fleft" href="{% url 'user_profile' request.user.username %}">{% avatar request.user.username 48 %}</a>
|
<a class="pic fleft" href="{% url 'user_profile' request.user.username %}">{% avatar request.user.username 48 %}</a>
|
||||||
<div class="txt fright">
|
<div id="comment-container" class="txt fright">
|
||||||
<textarea name="message" id="comment-input">评论一下~</textarea><br />
|
<textarea name="message" id="comment-input">评论一下~</textarea><br />
|
||||||
<p class="error hide"></p>
|
<p class="error hide"></p>
|
||||||
<input type="submit" value="提交" class="submit hide" />
|
<input type="submit" value="提交" class="submit hide" />
|
||||||
@@ -201,6 +201,15 @@ $('#view-original, #download').click(function() {
|
|||||||
window.open($(this).attr('data'));
|
window.open($(this).attr('data'));
|
||||||
});
|
});
|
||||||
{% if not view_history %}
|
{% if not view_history %}
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
var gids = '';
|
||||||
|
{% for g in groups %}
|
||||||
|
gids = gids + '{{ g.id }}' + ',';
|
||||||
|
{% endfor %}
|
||||||
|
addAtAutocomplete('#comment-input', '#comment-container', gids, "{% url 'group_attention' %}", {'width':'315px','max-width':'315px','padding-left':'1px','height':'36px','margin':'0','line-height': '1.5em'}); // remember to add unit (px or em) to line-height, as js in ie will take 1.5 as 1.5, not 1.5em
|
||||||
|
});
|
||||||
|
|
||||||
$('#edit, #update').click(function() {
|
$('#edit, #update').click(function() {
|
||||||
location.href = $(this).attr('data');
|
location.href = $(this).attr('data');
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user