From b851bc66379b4ef45f1f7222e901041bd7b54a29 Mon Sep 17 00:00:00 2001 From: miferreiro Date: Thu, 21 Feb 2019 17:26:17 +0100 Subject: [PATCH] Improved control of adding a pet to a person's pet list - It has been added to restart the form after deleting a row. - Permits have been introduced to the rest resources --- src/main/webapp/WEB-INF/web.xml | 15 +++++++++++++++ src/main/webapp/js/view/people.js | 1 + src/main/webapp/js/view/pets.js | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index df238ce..efbb6ad 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -40,6 +40,21 @@ ADMIN + + + + Admin Area + /rest/pets/* + PUT + DELETE + GET + POST + OPTIONS + + + ADMIN + + diff --git a/src/main/webapp/js/view/people.js b/src/main/webapp/js/view/people.js index f577907..dd8f4cd 100644 --- a/src/main/webapp/js/view/people.js +++ b/src/main/webapp/js/view/people.js @@ -101,6 +101,7 @@ var PeopleView = (function() { dao.deletePerson(id, function() { $('tr#person-' + id).remove(); + self.resetForm(); }, showErrorMessage ); diff --git a/src/main/webapp/js/view/pets.js b/src/main/webapp/js/view/pets.js index 7579b05..9ed2b8a 100644 --- a/src/main/webapp/js/view/pets.js +++ b/src/main/webapp/js/view/pets.js @@ -92,6 +92,9 @@ var PetsView = (function() { function(pet) { appendToTable(pet); self.resetForm(); + if(pet.idOwner != id) { + $('tr#pet-' + pet.id).remove(); + } }, showErrorMessage, self.enableForm @@ -150,6 +153,7 @@ var PetsView = (function() { dao.deletePet(id, function() { $('tr#pet-' + id).remove(); + self.resetForm(); }, showErrorMessage ); -- 2.18.1