app/assets/javascripts/faalis_contacts/modules/contact.js in faalis_contacts-0.1.0 vs app/assets/javascripts/faalis_contacts/modules/contact.js in faalis_contacts-0.3.0

- old
+ new

@@ -286,11 +286,19 @@ $scope.details.push({}); }; $scope.remove_row = function(){ $scope.details_count.pop(); - $scope.details.pop(); + var lastobj = $scope.details.pop(); + if ("id" in lastobj) { + API.all("contact_details").customDELETE(lastobj.id) + .then(function(data) { + success_message(data.msg); + }, function(data){ + catch_error(data); + }); + } }; $scope.have = function(field, obj_id) { var tmp = _.where($scope[field], {id: obj_id}); if (tmp.length > 0) { @@ -305,9 +313,12 @@ $(".form input").val(""); $location.path("contacts"); }; $scope.save = function(save_another){ + $("small.error").html(""); + $("small.error").removeClass("error"); + var contact = {contact: { prefix: $scope.prefix, first_name: $scope.first_name, middle_name: $scope.middle_name, last_name: $scope.last_name,