Skip to content

Commit

Permalink
Improve folders rename
Browse files Browse the repository at this point in the history
  • Loading branch information
cgx committed Sep 16, 2015
1 parent 7b580f8 commit 70bb512
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 18 deletions.
4 changes: 2 additions & 2 deletions UI/Templates/ContactsUI/UIxContactFoldersView.wox
Expand Up @@ -47,7 +47,7 @@
ng-show="app.editMode!=folder.id">{{folder.name}}</p>
<md-input-container class="md-flex md-tile-content"
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"
ng-model="folder.name"
ng-cloak="ng-cloak"
Expand Down Expand Up @@ -123,7 +123,7 @@
ng-show="editMode!=folder.id">{{folder.name}}</p>
<md-input-container class="md-flex md-tile-content"
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"
ng-model="folder.name"
ng-cloak="ng-cloak"
Expand Down
4 changes: 2 additions & 2 deletions UI/Templates/MailerUI/UIxMailMainFrame.wox
Expand Up @@ -260,9 +260,9 @@
{{app.metadataForFolder(folder).name}}
<span ng-show="folder.unseenCount"> ({{folder.unseenCount}})</span>
</p>
<md-input-container class="md-flex md-tile-content"
<md-input-container class="md-flex"
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"
ng-model="folder.name"
ng-blur="app.saveFolder(folder)"
Expand Down
4 changes: 1 addition & 3 deletions UI/WebServerResources/js/Common/sgEnter.directive.js
Expand Up @@ -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();
}
});
Expand Down
12 changes: 2 additions & 10 deletions UI/WebServerResources/js/Mailer/Mailbox.service.js
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand All @@ -409,13 +407,7 @@
i = children.length;
}
children.splice(i, 0, _this);

deferred.resolve();
}, function(data) {
deferred.reject(data);
});

return deferred.promise;
};

/**
Expand Down
7 changes: 6 additions & 1 deletion UI/WebServerResources/js/Mailer/MailboxesController.js
Expand Up @@ -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) {
Expand Down
10 changes: 10 additions & 0 deletions UI/WebServerResources/scss/components/list/list.scss
Expand Up @@ -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
//.md-list-item-inner {
// > i:first-child {
Expand Down

0 comments on commit 70bb512

Please sign in to comment.