mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 07:55:36 +00:00
[dirent.js] fixed 'delete' bug
This commit is contained in:
@@ -179,20 +179,21 @@ define([
|
|||||||
|
|
||||||
delete: function() {
|
delete: function() {
|
||||||
var dirent_name = this.model.get('obj_name');
|
var dirent_name = this.model.get('obj_name');
|
||||||
|
var dir = this.dir;
|
||||||
var options = {
|
var options = {
|
||||||
repo_id: this.dirView.dir.repo_id,
|
repo_id: dir.repo_id,
|
||||||
name: this.model.get('is_dir') ? 'del_dir' : 'del_file'
|
name: this.model.get('is_dir') ? 'del_dir' : 'del_file'
|
||||||
};
|
};
|
||||||
var el = this.$el;
|
var model = this.model;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: Common.getUrl(options) + '?parent_dir=' + encodeURIComponent(this.dirView.dir.path)
|
url: Common.getUrl(options) + '?parent_dir=' + encodeURIComponent(dir.path)
|
||||||
+ '&name=' + encodeURIComponent(dirent_name),
|
+ '&name=' + encodeURIComponent(dirent_name),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
el.remove();
|
dir.remove(model);
|
||||||
app.globalState.noFileOpPopup = true; // make other items can work normally when hover
|
app.globalState.noFileOpPopup = true; // make other items can work normally when hover
|
||||||
var msg = gettext("Successfully deleted %(name)s");
|
var msg = gettext("Successfully deleted %(name)s")
|
||||||
msg = msg.replace('%(name)s', Common.HTMLescape(dirent_name));
|
.replace('%(name)s', Common.HTMLescape(dirent_name));
|
||||||
Common.feedback(msg, 'success');
|
Common.feedback(msg, 'success');
|
||||||
},
|
},
|
||||||
error: Common.ajaxErrorHandler
|
error: Common.ajaxErrorHandler
|
||||||
|
Reference in New Issue
Block a user