mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-18 05:25:50 +00:00
LH :: Removing hardcoding of context from the rest of the application.
- The context constant is used to configure the whole app's context path
This commit is contained in:
parent
5b18fa6621
commit
16bbf17d98
3 changed files with 14 additions and 12 deletions
|
@ -2,7 +2,7 @@
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<!-- Brand and toggle get grouped for better mobile display -->
|
<!-- Brand and toggle get grouped for better mobile display -->
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
<a class="navbar-brand" href="/petclinic/" data-ng-click="goHome()">
|
<a class="navbar-brand" data-ng-href="{{context}}" data-ng-click="goHome()">
|
||||||
<img alt="Pet Clinic Brand" height="27" width="auto" src="images/logo.png">
|
<img alt="Pet Clinic Brand" height="27" width="auto" src="images/logo.png">
|
||||||
</a>
|
</a>
|
||||||
<button class="navbar-toggle navbar-toggle-left collapsed" type="button" data-toggle="collapse" data-target="#nav-menu">
|
<button class="navbar-toggle navbar-toggle-left collapsed" type="button" data-toggle="collapse" data-target="#nav-menu">
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var MainController = ['$scope','$rootScope','$state','$sessionStorage', function($scope, $rootScope, $state, $sessionStorage) {
|
var MainController = ['$scope','$rootScope','$state','$sessionStorage', 'context', function($scope, $rootScope, $state, $sessionStorage, context) {
|
||||||
|
|
||||||
$scope.$storage = $sessionStorage;
|
$scope.$storage = $sessionStorage;
|
||||||
|
|
||||||
|
@ -46,6 +46,8 @@ var MainController = ['$scope','$rootScope','$state','$sessionStorage', functio
|
||||||
'font' : 'fa fa-question'
|
'font' : 'fa fa-question'
|
||||||
} ];
|
} ];
|
||||||
|
|
||||||
|
$scope.context = context;
|
||||||
|
|
||||||
$scope.footerText = '© ' + new Date().getFullYear() + ' Pet Clinic, A Spring Framework Demonstration';
|
$scope.footerText = '© ' + new Date().getFullYear() + ' Pet Clinic, A Spring Framework Demonstration';
|
||||||
|
|
||||||
$rootScope.$state = $state;
|
$rootScope.$state = $state;
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
var Owner = ['$resource', function($resource) {
|
var Owner = ['$resource','context', function($resource, context) {
|
||||||
return $resource('/petclinic/api/owners/:id');
|
return $resource(context + '/api/owners/:id');
|
||||||
}];
|
}];
|
||||||
|
|
||||||
var OwnerPet = ['$resource', function($resource) {
|
var OwnerPet = ['$resource','context', function($resource, context) {
|
||||||
return $resource('/petclinic/api/owners/:ownerId/pets', {ownerId : '@ownerId'});
|
return $resource(context + '/api/owners/:ownerId/pets', {ownerId : '@ownerId'});
|
||||||
}];
|
}];
|
||||||
|
|
||||||
var Pet = ['$resource', function($resource) {
|
var Pet = ['$resource','context', function($resource, context) {
|
||||||
return $resource('/petclinic/api/pets/:id');
|
return $resource(context + '/api/pets/:id');
|
||||||
}];
|
}];
|
||||||
|
|
||||||
var Vet = ['$resource', function($resource) {
|
var Vet = ['$resource','context', function($resource, context) {
|
||||||
return $resource('/petclinic/api/vets/:vetId');
|
return $resource(context + '/api/vets/:vetId');
|
||||||
}];
|
}];
|
||||||
|
|
||||||
var Visit = ['$resource', function($resource) {
|
var Visit = ['$resource','context', function($resource, context) {
|
||||||
return $resource('/petclinic/api/pets/:petId/visits', {petId : '@id'});
|
return $resource(context + '/api/pets/:petId/visits', {petId : '@id'});
|
||||||
}];
|
}];
|
||||||
|
|
||||||
var MockService = ['$httpBackend', '$http', 'context', function($httpBackend, $http, context) {
|
var MockService = ['$httpBackend', '$http', 'context', function($httpBackend, $http, context) {
|
||||||
|
|
Loading…
Reference in a new issue