mirror of
https://github.com/haiwen/seahub.git
synced 2025-10-22 11:43:33 +00:00
Merge branch 'lj_reply'
This commit is contained in:
@@ -200,11 +200,10 @@ addConfirmTo($('#quit-group'), '确定要退出?');
|
|||||||
addConfirmTo($('.cancel-share'), '确定要取消共享该目录?');
|
addConfirmTo($('.cancel-share'), '确定要取消共享该目录?');
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
var member_list = [];
|
var member_list = [], nickname, pinyin;
|
||||||
{% for member in members %}
|
{% for member in members %}
|
||||||
var nickname = "{{ member.user_name|email2nickname }}";
|
nickname = '{{ member.user_name|email2nickname }}';
|
||||||
var pinyin = "{{ member.user_name|email2nickname|char2pinyin }}";
|
pinyin = '{{ member.user_name|email2nickname|char2pinyin }}';
|
||||||
|
|
||||||
member_list.push({value:nickname + pinyin, label:nickname});
|
member_list.push({value:nickname + pinyin, label:nickname});
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
addAtAutocomplete('#message', '#group-message-form', member_list, {'border':'1px solid #ddd', 'width':'600px', 'height': '80px', 'word-wrap':'break-word', 'overflow-y':'auto', '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
|
addAtAutocomplete('#message', '#group-message-form', member_list, {'border':'1px solid #ddd', 'width':'600px', 'height': '80px', 'word-wrap':'break-word', 'overflow-y':'auto', '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
|
||||||
|
@@ -7,51 +7,62 @@ $('.reply, .replyclose').hover(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
$('.reply').click(function() {
|
$('.reply').click(function() {
|
||||||
var msg_id = $(this).attr('data'),
|
var myself = $(this),
|
||||||
|
msg_id = $(this).attr('data'),
|
||||||
msg_bd = $(this).parent(),
|
msg_bd = $(this).parent(),
|
||||||
reply_cnt = msg_bd.find('.reply-cnt');
|
reply_cnt = msg_bd.find('.reply-cnt'),
|
||||||
$.ajax({
|
reply_bd = msg_bd.children('.reply-bd');
|
||||||
url: '{{ SITE_ROOT }}group/reply/' + msg_id + '/',
|
|
||||||
dataType: 'json',
|
function afterBdShow() {
|
||||||
cache: false,
|
myself.addClass('hide');
|
||||||
contentType: 'application/json; charset=utf-8',
|
myself.next().removeClass('hide'); // show 'replyclose'
|
||||||
success: function(data) {
|
var reply_input = msg_bd.find('.reply-input'),
|
||||||
msg_bd.children('.reply-bd').html(data['html']).attr('class', 'reply-bd');
|
error = msg_bd.find('.error');
|
||||||
var reply_input = msg_bd.find('.reply-input'),
|
function replyatHandler() {
|
||||||
error = msg_bd.find('.error');
|
reply_input.val('@' + $(this).attr('data') + ' ');
|
||||||
function handleReplyInput() {
|
var pos = reply_input.val().length;
|
||||||
reply_input.val('@' + $(this).attr('data') + ' ');
|
setSelectionRange(reply_input[0], pos, pos);
|
||||||
var pos = reply_input.val().length;
|
|
||||||
setSelectionRange(reply_input[0], pos, pos);
|
|
||||||
}
|
|
||||||
msg_bd.find('.reply-at').click(handleReplyInput);
|
|
||||||
msg_bd.find('.submit').click(function() {
|
|
||||||
var reply = $.trim(reply_input.val());
|
|
||||||
if (reply && reply.length <= 150) {
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: '{{ SITE_ROOT }}group/reply/' + msg_id + '/',
|
|
||||||
dataType: 'json',
|
|
||||||
cache: false,
|
|
||||||
contentType: 'application/json; charset=utf-8',
|
|
||||||
beforeSend: prepareCSRFToken,
|
|
||||||
data: "message=" + reply,
|
|
||||||
success: function(data) {
|
|
||||||
msg_bd.find('.reply-list').append(data['html']);
|
|
||||||
reply_input.val('');
|
|
||||||
error.attr('class', 'error hide');
|
|
||||||
reply_cnt.html((parseInt(reply_cnt.html()) + 1 || 1) + ' ');
|
|
||||||
msg_bd.find('.reply-at').click(handleReplyInput);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
error.removeClass('hide');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
msg_bd.find('.reply-at').click(replyatHandler);
|
||||||
$(this).addClass('hide');
|
msg_bd.find('.submit').click(function() {
|
||||||
$(this).next().removeClass('hide'); // show 'replyclose'
|
var reply = $.trim(reply_input.val());
|
||||||
|
if (reply && reply.length <= 150) {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: '{{ SITE_ROOT }}group/reply/' + msg_id + '/',
|
||||||
|
dataType: 'json',
|
||||||
|
cache: false,
|
||||||
|
contentType: 'application/json; charset=utf-8',
|
||||||
|
beforeSend: prepareCSRFToken,
|
||||||
|
data: "message=" + reply,
|
||||||
|
success: function(data) {
|
||||||
|
msg_bd.find('.reply-list').append(data['html']);
|
||||||
|
reply_input.val('');
|
||||||
|
error.attr('class', 'error hide');
|
||||||
|
reply_cnt.html((parseInt(reply_cnt.html()) + 1 || 1) + ' ');
|
||||||
|
msg_bd.find('.reply-at').click(replyatHandler);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
error.removeClass('hide');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.trim(reply_cnt.html()) == '') {
|
||||||
|
reply_bd.html('<ul class="reply-list"></ul><textarea name="message" class="reply-input"></textarea> <button class="submit">回复</button><p class="error hide">输入不能为空且应少于150个字符。</p>').attr('class', 'reply-bd');
|
||||||
|
afterBdShow();
|
||||||
|
} else {
|
||||||
|
reply_bd.html('<img src="{{MEDIA_URL}}img/loading-icon.gif" alt="加载中..." />');
|
||||||
|
$.ajax({
|
||||||
|
url: '{{ SITE_ROOT }}group/reply/' + msg_id + '/',
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(data) {
|
||||||
|
reply_bd.html(data['html']).attr('class', 'reply-bd');
|
||||||
|
afterBdShow();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.replyclose').click(function() {
|
$('.replyclose').click(function() {
|
||||||
|
BIN
media/img/loading-icon.gif
Normal file
BIN
media/img/loading-icon.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Reference in New Issue
Block a user