diff --git a/src/main/webapp/components/landing/_banner.html b/src/main/webapp/components/landing/_banner.html index 32633bc15..354fa70a6 100644 --- a/src/main/webapp/components/landing/_banner.html +++ b/src/main/webapp/components/landing/_banner.html @@ -5,7 +5,7 @@

Pet care for the People who love them

PetClinic is here to enhance people's relationships with their pets

-

Learn more

+

Learn more

diff --git a/src/main/webapp/components/landing/_services.html b/src/main/webapp/components/landing/_services.html index 57028d787..1d3a58fbc 100644 --- a/src/main/webapp/components/landing/_services.html +++ b/src/main/webapp/components/landing/_services.html @@ -1,4 +1,4 @@ -
+
Generic placeholder image diff --git a/src/main/webapp/WEB-INF/jsp/index.jsp b/src/main/webapp/index.html similarity index 97% rename from src/main/webapp/WEB-INF/jsp/index.jsp rename to src/main/webapp/index.html index b47e43178..cdb404def 100644 --- a/src/main/webapp/WEB-INF/jsp/index.jsp +++ b/src/main/webapp/index.html @@ -33,6 +33,8 @@ + + diff --git a/src/main/webapp/js/app.js b/src/main/webapp/js/app.js index 3564b4a49..a2acfdf82 100644 --- a/src/main/webapp/js/app.js +++ b/src/main/webapp/js/app.js @@ -1,4 +1,10 @@ -var app = angular.module('spring-petclinic', ['ui.router','ui.router.stateHelper','ngAnimate','ngCookies','ngResource']); +var app = angular.module('spring-petclinic', ['ui.router','ui.router.stateHelper','ngAnimate','ngCookies','ngResource','ngMockE2E']); + + +/** Start of Configurable constants **/ +app.constant('useMockData', true); +app.constant('context', '/petclinic'); +/** End of Configurable constants **/ app.config(['stateHelperProvider','$urlRouterProvider','$urlMatcherFactoryProvider',function(stateHelperProvider,$urlRouterProvider,$urlMatcherFactoryProvider) { @@ -53,6 +59,7 @@ app.factory('Owner', Owner); app.factory('Pet', Pet); app.factory('Vet', Vet); app.factory('Visit', Visit); +app.factory('MockService', MockService); /** Directives **/ @@ -65,4 +72,8 @@ app.directive('scrollToTarget', function() { return false; }); }; +}); + +app.run(function(useMockData, MockService) { + MockService.mock(useMockData); }); \ No newline at end of file diff --git a/src/main/webapp/services/services.js b/src/main/webapp/services/services.js index d34ec4a27..290827e2a 100644 --- a/src/main/webapp/services/services.js +++ b/src/main/webapp/services/services.js @@ -18,3 +18,28 @@ var Visit = ['$resource', function($resource) { return $resource('/petclinic/api/pets/:petId/visits', {petId : '@id'}); }]; +var MockService = ['$httpBackend', '$http', 'context', function($httpBackend, $http, context) { + return { + mock : function(useMockData) { + + if(useMockData) { + $http.get(context + '/static/mock-data/pets.json').success(function(data) { + console.log("Mocking /api/pets"); + $httpBackend.whenGET(context + '/api/pets').respond(data); + }); + $http.get(context + '/static/mock-data/vets.json').success(function(data) { + console.log("Mocking /api/vets"); + $httpBackend.whenGET(context + '/api/vets').respond(data); + }); + $http.get(context + '/static/mock-data/owners.json').success(function(data) { + console.log("Mocking /api/owners"); + $httpBackend.whenGET(context + '/api/owners').respond(data); + }); + } + + console.log("Setting up passthrough for other urls"); + var passThroughRegex = new RegExp('/'); + $httpBackend.whenGET(passThroughRegex).passThrough(); + } + } +}]; \ No newline at end of file diff --git a/src/main/webapp/static/mock-data/owners.json b/src/main/webapp/static/mock-data/owners.json new file mode 100644 index 000000000..2aeac82e1 --- /dev/null +++ b/src/main/webapp/static/mock-data/owners.json @@ -0,0 +1,264 @@ +[ { + "id" : 1, + "firstName" : "George", + "lastName" : "Franklin", + "description" : null, + "address" : "110 W. Liberty St.", + "city" : "Madison", + "telephone" : "6085551023", + "pets" : [ { + "id" : 1, + "name" : "Leo", + "birthDate" : "2010-09-07T00:00:00.000Z", + "type" : { + "id" : 1, + "name" : "cat", + "new" : false + }, + "visits" : [ ], + "new" : false + } ], + "new" : false +}, { + "id" : 2, + "firstName" : "Betty", + "lastName" : "Davis", + "description" : null, + "address" : "638 Cardinal Ave.", + "city" : "Sun Prairie", + "telephone" : "6085551749", + "pets" : [ { + "id" : 2, + "name" : "Basil", + "birthDate" : "2012-08-06T00:00:00.000Z", + "type" : { + "id" : 6, + "name" : "hamster", + "new" : false + }, + "visits" : [ ], + "new" : false + } ], + "new" : false +}, { + "id" : 3, + "firstName" : "Eduardo", + "lastName" : "Rodriquez", + "description" : null, + "address" : "2693 Commerce St.", + "city" : "McFarland", + "telephone" : "6085558763", + "pets" : [ { + "id" : 4, + "name" : "Jewel", + "birthDate" : "2010-03-07T00:00:00.000Z", + "type" : { + "id" : 2, + "name" : "dog", + "new" : false + }, + "visits" : [ ], + "new" : false + }, { + "id" : 3, + "name" : "Rosy", + "birthDate" : "2011-04-17T00:00:00.000Z", + "type" : { + "id" : 2, + "name" : "dog", + "new" : false + }, + "visits" : [ ], + "new" : false + } ], + "new" : false +}, { + "id" : 4, + "firstName" : "Harold", + "lastName" : "Davis", + "description" : null, + "address" : "563 Friendly St.", + "city" : "Windsor", + "telephone" : "6085553198", + "pets" : [ { + "id" : 5, + "name" : "Iggy", + "birthDate" : "2010-11-30T00:00:00.000Z", + "type" : { + "id" : 3, + "name" : "lizard", + "new" : false + }, + "visits" : [ ], + "new" : false + } ], + "new" : false +}, { + "id" : 5, + "firstName" : "Peter", + "lastName" : "McTavish", + "description" : null, + "address" : "2387 S. Fair Way", + "city" : "Madison", + "telephone" : "6085552765", + "pets" : [ { + "id" : 6, + "name" : "George", + "birthDate" : "2010-01-20T00:00:00.000Z", + "type" : { + "id" : 4, + "name" : "snake", + "new" : false + }, + "visits" : [ ], + "new" : false + } ], + "new" : false +}, { + "id" : 6, + "firstName" : "Jean", + "lastName" : "Coleman", + "description" : null, + "address" : "105 N. Lake St.", + "city" : "Monona", + "telephone" : "6085552654", + "pets" : [ { + "id" : 8, + "name" : "Max", + "birthDate" : "2012-09-04T00:00:00.000Z", + "type" : { + "id" : 1, + "name" : "cat", + "new" : false + }, + "visits" : [ { + "id" : 3, + "date" : "2013-01-03T00:00:00.000Z", + "description" : "neutered", + "new" : false + }, { + "id" : 2, + "date" : "2013-01-02T00:00:00.000Z", + "description" : "rabies shot", + "new" : false + } ], + "new" : false + }, { + "id" : 7, + "name" : "Samantha", + "birthDate" : "2012-09-04T00:00:00.000Z", + "type" : { + "id" : 1, + "name" : "cat", + "new" : false + }, + "visits" : [ { + "id" : 4, + "date" : "2013-01-04T00:00:00.000Z", + "description" : "spayed", + "new" : false + }, { + "id" : 1, + "date" : "2013-01-01T00:00:00.000Z", + "description" : "rabies shot", + "new" : false + } ], + "new" : false + } ], + "new" : false +}, { + "id" : 7, + "firstName" : "Jeff", + "lastName" : "Black", + "description" : null, + "address" : "1450 Oak Blvd.", + "city" : "Monona", + "telephone" : "6085555387", + "pets" : [ { + "id" : 9, + "name" : "Lucky", + "birthDate" : "2011-08-06T00:00:00.000Z", + "type" : { + "id" : 5, + "name" : "bird", + "new" : false + }, + "visits" : [ ], + "new" : false + } ], + "new" : false +}, { + "id" : 8, + "firstName" : "Maria", + "lastName" : "Escobito", + "description" : null, + "address" : "345 Maple St.", + "city" : "Madison", + "telephone" : "6085557683", + "pets" : [ { + "id" : 10, + "name" : "Mulligan", + "birthDate" : "2007-02-24T00:00:00.000Z", + "type" : { + "id" : 2, + "name" : "dog", + "new" : false + }, + "visits" : [ ], + "new" : false + } ], + "new" : false +}, { + "id" : 9, + "firstName" : "David", + "lastName" : "Schroeder", + "description" : null, + "address" : "2749 Blackhawk Trail", + "city" : "Madison", + "telephone" : "6085559435", + "pets" : [ { + "id" : 11, + "name" : "Freddy", + "birthDate" : "2010-03-09T00:00:00.000Z", + "type" : { + "id" : 5, + "name" : "bird", + "new" : false + }, + "visits" : [ ], + "new" : false + } ], + "new" : false +}, { + "id" : 10, + "firstName" : "Carlos", + "lastName" : "Estaban", + "description" : null, + "address" : "2335 Independence La.", + "city" : "Waunakee", + "telephone" : "6085555487", + "pets" : [ { + "id" : 12, + "name" : "Lucky", + "birthDate" : "2010-06-24T00:00:00.000Z", + "type" : { + "id" : 2, + "name" : "dog", + "new" : false + }, + "visits" : [ ], + "new" : false + }, { + "id" : 13, + "name" : "Sly", + "birthDate" : "2012-06-08T00:00:00.000Z", + "type" : { + "id" : 1, + "name" : "cat", + "new" : false + }, + "visits" : [ ], + "new" : false + } ], + "new" : false +} ] \ No newline at end of file diff --git a/src/main/webapp/static/mock-data/pets.json b/src/main/webapp/static/mock-data/pets.json new file mode 100644 index 000000000..36ae3e0cc --- /dev/null +++ b/src/main/webapp/static/mock-data/pets.json @@ -0,0 +1,164 @@ +[ { + "id" : 1, + "name" : "Leo", + "birthDate" : "2010-09-07T00:00:00.000Z", + "type" : { + "id" : 1, + "name" : "cat", + "new" : false + }, + "visits" : [ ], + "new" : false +}, { + "id" : 2, + "name" : "Basil", + "birthDate" : "2012-08-06T00:00:00.000Z", + "type" : { + "id" : 6, + "name" : "hamster", + "new" : false + }, + "visits" : [ ], + "new" : false +}, { + "id" : 3, + "name" : "Rosy", + "birthDate" : "2011-04-17T00:00:00.000Z", + "type" : { + "id" : 2, + "name" : "dog", + "new" : false + }, + "visits" : [ ], + "new" : false +}, { + "id" : 4, + "name" : "Jewel", + "birthDate" : "2010-03-07T00:00:00.000Z", + "type" : { + "id" : 2, + "name" : "dog", + "new" : false + }, + "visits" : [ ], + "new" : false +}, { + "id" : 5, + "name" : "Iggy", + "birthDate" : "2010-11-30T00:00:00.000Z", + "type" : { + "id" : 3, + "name" : "lizard", + "new" : false + }, + "visits" : [ ], + "new" : false +}, { + "id" : 6, + "name" : "George", + "birthDate" : "2010-01-20T00:00:00.000Z", + "type" : { + "id" : 4, + "name" : "snake", + "new" : false + }, + "visits" : [ ], + "new" : false +}, { + "id" : 7, + "name" : "Samantha", + "birthDate" : "2012-09-04T00:00:00.000Z", + "type" : { + "id" : 1, + "name" : "cat", + "new" : false + }, + "visits" : [ { + "id" : 4, + "date" : "2013-01-04T00:00:00.000Z", + "description" : "spayed", + "new" : false + }, { + "id" : 1, + "date" : "2013-01-01T00:00:00.000Z", + "description" : "rabies shot", + "new" : false + } ], + "new" : false +}, { + "id" : 8, + "name" : "Max", + "birthDate" : "2012-09-04T00:00:00.000Z", + "type" : { + "id" : 1, + "name" : "cat", + "new" : false + }, + "visits" : [ { + "id" : 3, + "date" : "2013-01-03T00:00:00.000Z", + "description" : "neutered", + "new" : false + }, { + "id" : 2, + "date" : "2013-01-02T00:00:00.000Z", + "description" : "rabies shot", + "new" : false + } ], + "new" : false +}, { + "id" : 9, + "name" : "Lucky", + "birthDate" : "2011-08-06T00:00:00.000Z", + "type" : { + "id" : 5, + "name" : "bird", + "new" : false + }, + "visits" : [ ], + "new" : false +}, { + "id" : 10, + "name" : "Mulligan", + "birthDate" : "2007-02-24T00:00:00.000Z", + "type" : { + "id" : 2, + "name" : "dog", + "new" : false + }, + "visits" : [ ], + "new" : false +}, { + "id" : 11, + "name" : "Freddy", + "birthDate" : "2010-03-09T00:00:00.000Z", + "type" : { + "id" : 5, + "name" : "bird", + "new" : false + }, + "visits" : [ ], + "new" : false +}, { + "id" : 12, + "name" : "Lucky", + "birthDate" : "2010-06-24T00:00:00.000Z", + "type" : { + "id" : 2, + "name" : "dog", + "new" : false + }, + "visits" : [ ], + "new" : false +}, { + "id" : 13, + "name" : "Sly", + "birthDate" : "2012-06-08T00:00:00.000Z", + "type" : { + "id" : 1, + "name" : "cat", + "new" : false + }, + "visits" : [ ], + "new" : false +} ] \ No newline at end of file diff --git a/src/main/webapp/static/mock-data/vets.json b/src/main/webapp/static/mock-data/vets.json new file mode 100644 index 000000000..d976942e2 --- /dev/null +++ b/src/main/webapp/static/mock-data/vets.json @@ -0,0 +1,69 @@ +[ { + "id" : 1, + "firstName" : "James", + "lastName" : "Carter", + "description" : "Graduated from Oxford University in 2000 having \"gone the long way around\" picking up degrees in Agriculture & Applied Zoology and also in Animal Production along the way. He came down to work in Winchester in 2004 and set up PetClinic in 2005.", + "specialties" : [ ], + "nrOfSpecialties" : 0, + "new" : false +}, { + "id" : 3, + "firstName" : "Linda", + "lastName" : "Douglas", + "description" : "MA VetMB MRCVS Another Cambridge graduate, Linda joined our team in 2004. Linda has a hamster called Ash and a dog called Spotty.", + "specialties" : [ { + "id" : 3, + "name" : "dentistry", + "new" : false + }, { + "id" : 2, + "name" : "surgery", + "new" : false + } ], + "nrOfSpecialties" : 2, + "new" : false +}, { + "id" : 6, + "firstName" : "Sharon", + "lastName" : "Jenkins", + "description" : "MA VetMB MRCVS Sharon graduated from Oxford in 2006 and joined us in 2007. She joins international salsa competitions and consider herself an accomplished dancer.", + "specialties" : [ ], + "nrOfSpecialties" : 0, + "new" : false +}, { + "id" : 2, + "firstName" : "Helen", + "lastName" : "Leary", + "description" : "MA VetMB MRCVS A Cambridge graduate, Helen joined our expanding team of vets at the end of 2005. Helen has a cat called Checkers and a dog called Scoot.", + "specialties" : [ { + "id" : 1, + "name" : "radiology", + "new" : false + } ], + "nrOfSpecialties" : 1, + "new" : false +}, { + "id" : 4, + "firstName" : "Rafael", + "lastName" : "Ortega", + "description" : "MA VetMB MRCVS Rafael graduated from Cambridge in 2003 and joined PetClinit in October 2004. He has a particular interest in horseback archery and has competed in many international competitions.", + "specialties" : [ { + "id" : 2, + "name" : "surgery", + "new" : false + } ], + "nrOfSpecialties" : 1, + "new" : false +}, { + "id" : 5, + "firstName" : "Henry", + "lastName" : "Stevens", + "description" : "MA VetMB MRCVS Henry graduated from Oxford in 2008 and joined us in 2010. He is also a competitive chess player and has participated in many international competitions.", + "specialties" : [ { + "id" : 1, + "name" : "radiology", + "new" : false + } ], + "nrOfSpecialties" : 1, + "new" : false +} ] \ No newline at end of file