mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-15 18:28:51 +00:00
Improve folders rename
This commit is contained in:
@@ -17,9 +17,7 @@
|
||||
return function(scope, element, attrs) {
|
||||
element.bind("keydown keypress", function(event) {
|
||||
if (event.which === ENTER_KEY) {
|
||||
scope.$apply(function() {
|
||||
scope.$eval(attrs.sgEnter);
|
||||
});
|
||||
scope.$apply(attrs.sgEnter);
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -351,15 +351,13 @@
|
||||
Mailbox.prototype.$rename = function() {
|
||||
var _this = this,
|
||||
findParent,
|
||||
deferred = Mailbox.$q.defer(),
|
||||
parent,
|
||||
children,
|
||||
i;
|
||||
|
||||
if (this.name == this.$shadowData.name) {
|
||||
// Name hasn't changed
|
||||
deferred.resolve();
|
||||
return deferred.promise;
|
||||
return Mailbox.$q.when();
|
||||
}
|
||||
|
||||
// Local recursive function
|
||||
@@ -391,7 +389,7 @@
|
||||
// Find index of mailbox among siblings
|
||||
i = _.indexOf(_.pluck(children, 'id'), this.id);
|
||||
|
||||
this.$save().then(function(data) {
|
||||
return this.$save().then(function(data) {
|
||||
var sibling;
|
||||
angular.extend(_this, data); // update the path attribute
|
||||
_this.id = _this.$id();
|
||||
@@ -409,13 +407,7 @@
|
||||
i = children.length;
|
||||
}
|
||||
children.splice(i, 0, _this);
|
||||
|
||||
deferred.resolve();
|
||||
}, function(data) {
|
||||
deferred.reject(data);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -222,7 +222,12 @@
|
||||
}
|
||||
|
||||
function saveFolder(folder) {
|
||||
folder.$rename();
|
||||
folder.$rename()
|
||||
.then(function(data) {
|
||||
vm.editMode = false;
|
||||
}, function(data, status) {
|
||||
Dialog.alert(l('Warning'), data);
|
||||
});
|
||||
}
|
||||
|
||||
function compactFolder(folder) {
|
||||
|
||||
Reference in New Issue
Block a user