(js) Minor JavaScript improvements

pull/91/head
Francis Lachapelle 2015-07-01 15:21:22 -04:00
parent cc7eeca2c4
commit a408fdff52
4 changed files with 5 additions and 7 deletions

View File

@ -67,7 +67,7 @@
function sgSearchController($scope, $element) {
// Controller variables
this.previous = { searchText: '', searchField: '' };
this.searchText = '';
this.searchText = null;
this.searchField = $element.find('md-option').attr('value'); // defaults to first option
// Model options
@ -81,7 +81,7 @@
// Method to call on data changes
this.onChange = function(value) {
if (typeof this.searchText != 'undefined') {
if (this.searchText != null) {
if (this.searchText != this.previous.searchText || this.searchField != this.previous.searchField) {
if (this.searchText.length > 2 || this.searchText.length == 0) {
// See https://github.com/angular/angular.js/issues/7635

View File

@ -118,7 +118,7 @@
if (!this.$$fullname)
this.$$fullname = this.$fullname();
if (!this.$$email)
this.$$email = this.$preferredEmail();
this.$$email = this.$preferredEmail(partial);
if (!this.$$image)
this.$$image = this.image || Card.$gravatar(this.$preferredEmail(partial), 32);
this.selected = false;

View File

@ -178,7 +178,7 @@
Mailbox.prototype.$filter = function(sort, filters) {
var futureMailboxData, options;
if (!angular.isDefined(sort)) {
if (angular.isUndefined(sort)) {
sort = { sortingAttributes: { match: 'OR', sort: 'date', asc: false } };
}
options = { sortingAttributes: sort };
@ -366,7 +366,6 @@
* @return a promise of the HTTP operation
*/
Mailbox.prototype.$deleteMessages = function(uids) {
var _this = this;
return Mailbox.$$resource.post(this.id, 'batchDelete', {uids: uids});
};
@ -377,7 +376,6 @@
* @return a promise of the HTTP operation
*/
Mailbox.prototype.$copyMessages = function(uids, folder) {
var _this = this;
return Mailbox.$$resource.post(this.id, 'copyMessages', {uids: uids, folder: folder});
};
@ -388,7 +386,6 @@
* @return a promise of the HTTP operation
*/
Mailbox.prototype.$moveMessages = function(uids, folder) {
var _this = this;
return Mailbox.$$resource.post(this.id, 'moveMessages', {uids: uids, folder: folder});
};

View File

@ -159,6 +159,7 @@
folder: calendar
}
});
/**
* @ngInject
*/