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/owners/OwnerController.js"></script>
<script src="components/visits/VisitController.js"></script>
<script src="components/dashboard/DashboardController.js"></script>
<script src="js/app.js"></script>
<!-- endbuild -->
</body>

View file

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

View file

@ -1,11 +1,11 @@
<!-- Welcome -->
<data-ng-include src="'components/landing/_welcome.html'"></data-ng-include>
<data-ng-include src="'components/dashboard/_welcome.html'"></data-ng-include>
<!-- Owners -->
<data-ng-include src="'components/landing/_owners.html'"></data-ng-include>
<data-ng-include src="'components/dashboard/_owners.html'"></data-ng-include>
<!-- Pets -->
<data-ng-include src="'components/landing/_pets.html'"></data-ng-include>
<data-ng-include src="'components/dashboard/_pets.html'"></data-ng-include>
<!-- 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.session = { 'username' : 'test' };
$state.go('dashboard');
};
$scope.logout = function() {
$scope.session = null;
$state.go('landing');
};
$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';
$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 data-ng-repeat="vet in vets | limitTo : 12" class="col-md-3">
<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">
<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>

View file

@ -11,27 +11,38 @@ app.config(['stateHelperProvider','$urlRouterProvider','$urlMatcherFactoryProvid
url: "/",
templateUrl: "components/landing/landing.html",
controller: "MainController",
data: { requireLogin : false }
}).state({
name: "dashboard",
url: "/dashboard",
templateUrl: "components/dashboard/dashboard.html",
controller: "DashboardController",
data: { requireLogin : true }
}).state({
name: "vets",
url: "/vets",
templateUrl: "components/veterinarians/veterinarians.html",
controller: "VeterinarianController",
data: { requireLogin : true }
}).state({
name: "pets",
url: "/pets",
templateUrl: "components/pets/pets.html",
controller: "PetController"
controller: "PetController",
data: { requireLogin : true }
}).state({
name: "owners",
url: "/owners",
templateUrl: "components/owners/owners.html",
controller: "OwnerController"
controller: "OwnerController",
data: { requireLogin : true }
});
} ]);
/** Controllers **/
app.controller('MainController', MainController);
app.controller('DashboardController', DashboardController);
app.controller('VeterinarianController', VeterinarianController);
app.controller('PetController', PetController);
app.controller('OwnerController', OwnerController);
@ -50,7 +61,7 @@ app.directive('scrollToTarget', function() {
element.bind('click', function() {
angular.element('html, body').stop().animate({
scrollTop: angular.element(angular.element(element).attr('href')).offset().top - 20
}, 1500);
}, 1500);
return false;
});
};