39:28ad6d3e2618
Anton Shestakov <av6@dwimlabs.net>, Wed, 23 Mar 2016 16:55:52 +0800
index: maintain only one contact with type 'self' This isn't done in an event handler of contacts collection because doing it in 'add' handler would trigger 'sort' event after the model has been added, but before its 'add' event has propagated, and that's dumb.

previous change 15:52b632342209

js/validation.js

Permissions: -rw-r--r--

Other formats: Feeds:
// Generated by CoffeeScript 1.10.0
(function() {
Tram.validation = {
setError: function($field, message) {
var $el;
$el = $('<div class="uk-text-danger"></div>').text(message);
$field.addClass('uk-form-danger');
return $field.after($el);
},
unsetError: function($field) {
return $field.removeClass('uk-form-danger').siblings('.uk-text-danger').remove();
},
validateRequired: function(field, trim) {
var $field, val;
$field = $(field);
val = $field.val();
if (trim) {
val = val.trim();
}
if (val === '') {
this.setError($field, 'This field is required.');
return false;
} else {
return true;
}
},
validatePasswords: function(field1, field2) {
var $field1, $field2;
$field1 = $(field1);
$field2 = $(field2);
if ($field1.val() !== $field2.val()) {
this.setError($field2, 'Passwords must match.');
return false;
} else {
return true;
}
}
};
}).call(this);
//# sourceMappingURL=validation.js.map