LH :: Activated Dashboard screen

This commit is contained in:
Lim Han 2015-02-04 22:32:07 +08:00
parent d5081563cb
commit 8d30eb2d4f
6 changed files with 34 additions and 8 deletions

View file

@ -39,6 +39,7 @@
<script src="components/pets/PetController.js"></script> <script src="components/pets/PetController.js"></script>
<script src="components/owners/OwnerController.js"></script> <script src="components/owners/OwnerController.js"></script>
<script src="components/visits/VisitController.js"></script> <script src="components/visits/VisitController.js"></script>
<script src="components/dashboard/DashboardController.js"></script>
<script src="js/app.js"></script> <script src="js/app.js"></script>
<!-- endbuild --> <!-- endbuild -->
</body> </body>

View file

@ -0,0 +1,3 @@
var DashboardController = ['$scope',function($scope) {
}];

View file

@ -1,11 +1,11 @@
<!-- Welcome --> <!-- Welcome -->
<data-ng-include src="'components/landing/_welcome.html'"></data-ng-include> <data-ng-include src="'components/dashboard/_welcome.html'"></data-ng-include>
<!-- Owners --> <!-- Owners -->
<data-ng-include src="'components/landing/_owners.html'"></data-ng-include> <data-ng-include src="'components/dashboard/_owners.html'"></data-ng-include>
<!-- Pets --> <!-- Pets -->
<data-ng-include src="'components/landing/_pets.html'"></data-ng-include> <data-ng-include src="'components/dashboard/_pets.html'"></data-ng-include>
<!-- Vets --> <!-- Vets -->
<data-ng-include src="'components/landing/_vets.html'"></data-ng-include> <data-ng-include src="'components/dashboard/_vets.html'"></data-ng-include>

View file

@ -6,10 +6,12 @@ var MainController = ['$scope','$rootScope','$state',function($scope, $rootScop
$scope.login = function() { $scope.login = function() {
$scope.session = { 'username' : 'test' }; $scope.session = { 'username' : 'test' };
$state.go('dashboard');
}; };
$scope.logout = function() { $scope.logout = function() {
$scope.session = null; $scope.session = null;
$state.go('landing');
}; };
$scope.menuTabs = [ { $scope.menuTabs = [ {
@ -37,5 +39,14 @@ var MainController = ['$scope','$rootScope','$state',function($scope, $rootScop
$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;
$rootScope.$on('$stateChangeStart', function (event, toState, toParams) {
var requireLogin = toState.data.requireLogin;
if (requireLogin && $scope.session == null) {
event.preventDefault();
$state.go('landing');
}
});
}]; }];

View file

@ -12,7 +12,7 @@
<div class="row"> <div class="row">
<div data-ng-repeat="vet in vets | limitTo : 12" class="col-md-3"> <div data-ng-repeat="vet in vets | limitTo : 12" class="col-md-3">
<div class="thumbnail"> <div class="thumbnail">
<img src="http://placehold.it/600x600" alt="Generic placeholder image"> <img data-ng-src="images/avatars/vet{{vet.id%4 + 1}}.jpg" alt="Generic placeholder image">
<div class="caption"> <div class="caption">
<h3 data-ng-bind="'Dr. ' + vet.firstName + ' ' + vet.lastName">Veterinarian Name</h3> <h3 data-ng-bind="'Dr. ' + vet.firstName + ' ' + vet.lastName">Veterinarian Name</h3>
<p>Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum.</p> <p>Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum.</p>

View file

@ -11,27 +11,38 @@ app.config(['stateHelperProvider','$urlRouterProvider','$urlMatcherFactoryProvid
url: "/", url: "/",
templateUrl: "components/landing/landing.html", templateUrl: "components/landing/landing.html",
controller: "MainController", controller: "MainController",
data: { requireLogin : false }
}).state({
name: "dashboard",
url: "/dashboard",
templateUrl: "components/dashboard/dashboard.html",
controller: "DashboardController",
data: { requireLogin : true }
}).state({ }).state({
name: "vets", name: "vets",
url: "/vets", url: "/vets",
templateUrl: "components/veterinarians/veterinarians.html", templateUrl: "components/veterinarians/veterinarians.html",
controller: "VeterinarianController", controller: "VeterinarianController",
data: { requireLogin : true }
}).state({ }).state({
name: "pets", name: "pets",
url: "/pets", url: "/pets",
templateUrl: "components/pets/pets.html", templateUrl: "components/pets/pets.html",
controller: "PetController" controller: "PetController",
data: { requireLogin : true }
}).state({ }).state({
name: "owners", name: "owners",
url: "/owners", url: "/owners",
templateUrl: "components/owners/owners.html", templateUrl: "components/owners/owners.html",
controller: "OwnerController" controller: "OwnerController",
data: { requireLogin : true }
}); });
} ]); } ]);
/** Controllers **/ /** Controllers **/
app.controller('MainController', MainController); app.controller('MainController', MainController);
app.controller('DashboardController', DashboardController);
app.controller('VeterinarianController', VeterinarianController); app.controller('VeterinarianController', VeterinarianController);
app.controller('PetController', PetController); app.controller('PetController', PetController);
app.controller('OwnerController', OwnerController); app.controller('OwnerController', OwnerController);