mirror of
https://github.com/haiwen/seahub.git
synced 2025-07-31 22:57:47 +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-ops {
|
||||
float:right;
|
||||
margin-right:10px;
|
||||
}
|
||||
.msg-op {
|
||||
cursor:pointer;
|
||||
}
|
||||
.msg-username {
|
||||
}
|
||||
.msg-content p:first-child {
|
||||
|
@ -65,8 +65,8 @@ class GroupDiscussions(APIView):
|
||||
info = get_user_common_info(msg.from_email, avatar_size)
|
||||
isoformat_timestr = datetime_to_isoformat_timestr(msg.timestamp)
|
||||
msgs.append({
|
||||
"id": msg.pk,
|
||||
"group_id": group_id,
|
||||
"discussion_id": msg.pk,
|
||||
"user_name": info["name"],
|
||||
"user_email": info["email"],
|
||||
"user_login_id": info["login_id"],
|
||||
@ -100,8 +100,8 @@ class GroupDiscussions(APIView):
|
||||
|
||||
isoformat_timestr = datetime_to_isoformat_timestr(discuss.timestamp)
|
||||
return Response({
|
||||
"id": discuss.pk,
|
||||
"group_id": group_id,
|
||||
"discussion_id": discuss.pk,
|
||||
"user_name": info["name"],
|
||||
"user_email": info["email"],
|
||||
"user_login_id": info["login_id"],
|
||||
|
@ -985,6 +985,10 @@
|
||||
<img src="<%= avatar_url %>" alt="" width="32" class="msg-avatar avatar-circle" />
|
||||
<div class="msg-body">
|
||||
<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>
|
||||
<span class="msg-time" title="<%- time %>"><%- time_from_now %></span>
|
||||
</div>
|
||||
|
@ -1,11 +1,14 @@
|
||||
define([
|
||||
'underscore',
|
||||
'backbone',
|
||||
'common'
|
||||
], function(_, Backbone, Common) {
|
||||
'common',
|
||||
'app/models/group-discussion'
|
||||
], function(_, Backbone, Common, GroupDiscussion) {
|
||||
'use strict';
|
||||
|
||||
var GroupDiscussions = Backbone.Collection.extend({
|
||||
model: GroupDiscussion,
|
||||
|
||||
setGroupId: function(group_id) {
|
||||
this.group_id = group_id;
|
||||
},
|
||||
@ -13,6 +16,7 @@ define([
|
||||
url: function() {
|
||||
return Common.getUrl({name: 'group_discussions', group_id: this.group_id});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return GroupDiscussions;
|
||||
|
@ -1,7 +1,8 @@
|
||||
define([
|
||||
'underscore',
|
||||
'backbone'
|
||||
], function(_, Backbone) {
|
||||
'backbone',
|
||||
'common'
|
||||
], function(_, Backbone, Common) {
|
||||
'use strict';
|
||||
|
||||
var GroupDiscussion = Backbone.Model.extend({});
|
||||
|
@ -10,16 +10,18 @@ define([
|
||||
|
||||
var View = Backbone.View.extend({
|
||||
tagName: 'li',
|
||||
className: 'msg cspt ovhd',
|
||||
className: 'msg ovhd',
|
||||
|
||||
template: _.template($('#group-discussion-tmpl').html()),
|
||||
|
||||
events: {
|
||||
'mouseenter': 'highlight',
|
||||
'mouseleave': 'rmHighlight'
|
||||
'mouseleave': 'rmHighlight',
|
||||
'click .js-del-msg': 'delMessage'
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
this.listenTo(this.model, 'destroy', this.remove);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
@ -46,6 +48,23 @@ define([
|
||||
|
||||
rmHighlight: function() {
|
||||
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