Improve folders rename
parent
7b580f8af6
commit
70bb512bb8
|
@ -47,7 +47,7 @@
|
||||||
ng-show="app.editMode!=folder.id">{{folder.name}}</p>
|
ng-show="app.editMode!=folder.id">{{folder.name}}</p>
|
||||||
<md-input-container class="md-flex md-tile-content"
|
<md-input-container class="md-flex md-tile-content"
|
||||||
ng-show="app.editMode == folder.id">
|
ng-show="app.editMode == folder.id">
|
||||||
<input class="folder-name" type="text"
|
<input class="sg-item-name" type="text"
|
||||||
label:aria-label="Name of the Address Book"
|
label:aria-label="Name of the Address Book"
|
||||||
ng-model="folder.name"
|
ng-model="folder.name"
|
||||||
ng-cloak="ng-cloak"
|
ng-cloak="ng-cloak"
|
||||||
|
@ -123,7 +123,7 @@
|
||||||
ng-show="editMode!=folder.id">{{folder.name}}</p>
|
ng-show="editMode!=folder.id">{{folder.name}}</p>
|
||||||
<md-input-container class="md-flex md-tile-content"
|
<md-input-container class="md-flex md-tile-content"
|
||||||
ng-show="app.editMode==folder.id">
|
ng-show="app.editMode==folder.id">
|
||||||
<input class="folder-name" type="text"
|
<input class="sg-item-name" type="text"
|
||||||
label:aria-label="Name of the Address Book"
|
label:aria-label="Name of the Address Book"
|
||||||
ng-model="folder.name"
|
ng-model="folder.name"
|
||||||
ng-cloak="ng-cloak"
|
ng-cloak="ng-cloak"
|
||||||
|
|
|
@ -260,9 +260,9 @@
|
||||||
{{app.metadataForFolder(folder).name}}
|
{{app.metadataForFolder(folder).name}}
|
||||||
<span ng-show="folder.unseenCount"> ({{folder.unseenCount}})</span>
|
<span ng-show="folder.unseenCount"> ({{folder.unseenCount}})</span>
|
||||||
</p>
|
</p>
|
||||||
<md-input-container class="md-flex md-tile-content"
|
<md-input-container class="md-flex"
|
||||||
ng-show="app.editMode == folder.path">
|
ng-show="app.editMode == folder.path">
|
||||||
<input class="folder-name" type="text"
|
<input class="sg-item-name" type="text"
|
||||||
label:aria-label="Enter the new name of your folder"
|
label:aria-label="Enter the new name of your folder"
|
||||||
ng-model="folder.name"
|
ng-model="folder.name"
|
||||||
ng-blur="app.saveFolder(folder)"
|
ng-blur="app.saveFolder(folder)"
|
||||||
|
|
|
@ -17,9 +17,7 @@
|
||||||
return function(scope, element, attrs) {
|
return function(scope, element, attrs) {
|
||||||
element.bind("keydown keypress", function(event) {
|
element.bind("keydown keypress", function(event) {
|
||||||
if (event.which === ENTER_KEY) {
|
if (event.which === ENTER_KEY) {
|
||||||
scope.$apply(function() {
|
scope.$apply(attrs.sgEnter);
|
||||||
scope.$eval(attrs.sgEnter);
|
|
||||||
});
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -351,15 +351,13 @@
|
||||||
Mailbox.prototype.$rename = function() {
|
Mailbox.prototype.$rename = function() {
|
||||||
var _this = this,
|
var _this = this,
|
||||||
findParent,
|
findParent,
|
||||||
deferred = Mailbox.$q.defer(),
|
|
||||||
parent,
|
parent,
|
||||||
children,
|
children,
|
||||||
i;
|
i;
|
||||||
|
|
||||||
if (this.name == this.$shadowData.name) {
|
if (this.name == this.$shadowData.name) {
|
||||||
// Name hasn't changed
|
// Name hasn't changed
|
||||||
deferred.resolve();
|
return Mailbox.$q.when();
|
||||||
return deferred.promise;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Local recursive function
|
// Local recursive function
|
||||||
|
@ -391,7 +389,7 @@
|
||||||
// Find index of mailbox among siblings
|
// Find index of mailbox among siblings
|
||||||
i = _.indexOf(_.pluck(children, 'id'), this.id);
|
i = _.indexOf(_.pluck(children, 'id'), this.id);
|
||||||
|
|
||||||
this.$save().then(function(data) {
|
return this.$save().then(function(data) {
|
||||||
var sibling;
|
var sibling;
|
||||||
angular.extend(_this, data); // update the path attribute
|
angular.extend(_this, data); // update the path attribute
|
||||||
_this.id = _this.$id();
|
_this.id = _this.$id();
|
||||||
|
@ -409,13 +407,7 @@
|
||||||
i = children.length;
|
i = children.length;
|
||||||
}
|
}
|
||||||
children.splice(i, 0, _this);
|
children.splice(i, 0, _this);
|
||||||
|
|
||||||
deferred.resolve();
|
|
||||||
}, function(data) {
|
|
||||||
deferred.reject(data);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -222,7 +222,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveFolder(folder) {
|
function saveFolder(folder) {
|
||||||
folder.$rename();
|
folder.$rename()
|
||||||
|
.then(function(data) {
|
||||||
|
vm.editMode = false;
|
||||||
|
}, function(data, status) {
|
||||||
|
Dialog.alert(l('Warning'), data);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function compactFolder(folder) {
|
function compactFolder(folder) {
|
||||||
|
|
|
@ -25,6 +25,16 @@ md-list-item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove padding of input fields in the sidenav for better transitions between read and edit mode of a folder
|
||||||
|
md-sidenav {
|
||||||
|
md-input-container {
|
||||||
|
padding: 0;
|
||||||
|
.md-input {
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add some padding to the first icon in a list item
|
// Add some padding to the first icon in a list item
|
||||||
//.md-list-item-inner {
|
//.md-list-item-inner {
|
||||||
// > i:first-child {
|
// > i:first-child {
|
||||||
|
|
Loading…
Reference in New Issue