mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-08 10:27:33 +00:00
Add group discussion delete
This commit is contained in:
parent
077a2627f0
commit
26d25c6448
@ -1237,6 +1237,13 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
}
|
}
|
||||||
.msg-header {
|
.msg-header {
|
||||||
}
|
}
|
||||||
|
.msg-ops {
|
||||||
|
float:right;
|
||||||
|
margin-right:10px;
|
||||||
|
}
|
||||||
|
.msg-op {
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
.msg-username {
|
.msg-username {
|
||||||
}
|
}
|
||||||
.msg-content p:first-child {
|
.msg-content p:first-child {
|
||||||
|
@ -65,8 +65,8 @@ class GroupDiscussions(APIView):
|
|||||||
info = get_user_common_info(msg.from_email, avatar_size)
|
info = get_user_common_info(msg.from_email, avatar_size)
|
||||||
isoformat_timestr = datetime_to_isoformat_timestr(msg.timestamp)
|
isoformat_timestr = datetime_to_isoformat_timestr(msg.timestamp)
|
||||||
msgs.append({
|
msgs.append({
|
||||||
|
"id": msg.pk,
|
||||||
"group_id": group_id,
|
"group_id": group_id,
|
||||||
"discussion_id": msg.pk,
|
|
||||||
"user_name": info["name"],
|
"user_name": info["name"],
|
||||||
"user_email": info["email"],
|
"user_email": info["email"],
|
||||||
"user_login_id": info["login_id"],
|
"user_login_id": info["login_id"],
|
||||||
@ -100,8 +100,8 @@ class GroupDiscussions(APIView):
|
|||||||
|
|
||||||
isoformat_timestr = datetime_to_isoformat_timestr(discuss.timestamp)
|
isoformat_timestr = datetime_to_isoformat_timestr(discuss.timestamp)
|
||||||
return Response({
|
return Response({
|
||||||
|
"id": discuss.pk,
|
||||||
"group_id": group_id,
|
"group_id": group_id,
|
||||||
"discussion_id": discuss.pk,
|
|
||||||
"user_name": info["name"],
|
"user_name": info["name"],
|
||||||
"user_email": info["email"],
|
"user_email": info["email"],
|
||||||
"user_login_id": info["login_id"],
|
"user_login_id": info["login_id"],
|
||||||
|
@ -985,6 +985,10 @@
|
|||||||
<img src="<%= avatar_url %>" alt="" width="32" class="msg-avatar avatar-circle" />
|
<img src="<%= avatar_url %>" alt="" width="32" class="msg-avatar avatar-circle" />
|
||||||
<div class="msg-body">
|
<div class="msg-body">
|
||||||
<div class="msg-header">
|
<div class="msg-header">
|
||||||
|
<div class="msg-ops">
|
||||||
|
<span class="msg-op js-rep-msg">{% trans "Reply" %}</span>
|
||||||
|
<span class="msg-op js-del-msg">{% trans "Delete" %}</span>
|
||||||
|
</div>
|
||||||
<a class="msg-username ellipsis" href="<%= user_profile_url %>"><%- user_name %></a>
|
<a class="msg-username ellipsis" href="<%= user_profile_url %>"><%- user_name %></a>
|
||||||
<span class="msg-time" title="<%- time %>"><%- time_from_now %></span>
|
<span class="msg-time" title="<%- time %>"><%- time_from_now %></span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
define([
|
define([
|
||||||
'underscore',
|
'underscore',
|
||||||
'backbone',
|
'backbone',
|
||||||
'common'
|
'common',
|
||||||
], function(_, Backbone, Common) {
|
'app/models/group-discussion'
|
||||||
|
], function(_, Backbone, Common, GroupDiscussion) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var GroupDiscussions = Backbone.Collection.extend({
|
var GroupDiscussions = Backbone.Collection.extend({
|
||||||
|
model: GroupDiscussion,
|
||||||
|
|
||||||
setGroupId: function(group_id) {
|
setGroupId: function(group_id) {
|
||||||
this.group_id = group_id;
|
this.group_id = group_id;
|
||||||
},
|
},
|
||||||
@ -13,6 +16,7 @@ define([
|
|||||||
url: function() {
|
url: function() {
|
||||||
return Common.getUrl({name: 'group_discussions', group_id: this.group_id});
|
return Common.getUrl({name: 'group_discussions', group_id: this.group_id});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return GroupDiscussions;
|
return GroupDiscussions;
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
define([
|
define([
|
||||||
'underscore',
|
'underscore',
|
||||||
'backbone'
|
'backbone',
|
||||||
], function(_, Backbone) {
|
'common'
|
||||||
|
], function(_, Backbone, Common) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var GroupDiscussion = Backbone.Model.extend({});
|
var GroupDiscussion = Backbone.Model.extend({});
|
||||||
|
@ -10,16 +10,18 @@ define([
|
|||||||
|
|
||||||
var View = Backbone.View.extend({
|
var View = Backbone.View.extend({
|
||||||
tagName: 'li',
|
tagName: 'li',
|
||||||
className: 'msg cspt ovhd',
|
className: 'msg ovhd',
|
||||||
|
|
||||||
template: _.template($('#group-discussion-tmpl').html()),
|
template: _.template($('#group-discussion-tmpl').html()),
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'mouseenter': 'highlight',
|
'mouseenter': 'highlight',
|
||||||
'mouseleave': 'rmHighlight'
|
'mouseleave': 'rmHighlight',
|
||||||
|
'click .js-del-msg': 'delMessage'
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
this.listenTo(this.model, 'destroy', this.remove);
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
@ -46,6 +48,23 @@ define([
|
|||||||
|
|
||||||
rmHighlight: function() {
|
rmHighlight: function() {
|
||||||
this.$el.removeClass('hl');
|
this.$el.removeClass('hl');
|
||||||
|
},
|
||||||
|
|
||||||
|
delMessage: function() {
|
||||||
|
this.model.destroy({
|
||||||
|
wait: true,
|
||||||
|
success: function() {
|
||||||
|
},
|
||||||
|
error: function(model, response) {
|
||||||
|
var err;
|
||||||
|
if (response.responseText) {
|
||||||
|
err = $.parseJSON(response.responseText).error_msg;
|
||||||
|
} else {
|
||||||
|
err = gettext("Failed. Please check the network.");
|
||||||
|
}
|
||||||
|
Common.feedback(err, 'error');
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user