maatma: display progress on home page

This commit is contained in:
nemunaire 2019-03-26 00:17:22 +01:00
parent 6dbd0107a0
commit 6000b5dd2e
2 changed files with 18 additions and 0 deletions

View File

@ -49,6 +49,7 @@ angular.module("AdLinApp")
}
}).then(function(response) {
$rootScope.isLogged = response.data;
$rootScope.student = response.data;
}, function(response) {
$rootScope.isLogged = false;
});
@ -63,6 +64,17 @@ angular.module("AdLinApp")
}
})
.controller("ProgressionController", function($scope, $interval, $http) {
$scope.mychallenges = {};
var refreshChal = function() {
$http.get("/api/students/" + $scope.student.id + "/progress").then(function(response) {
$scope.mychallenges = response.data
});
}
refreshChal();
$interval(refreshChal, 15750);
})
.controller("AuthController", function($scope, $rootScope, $http, $location) {
$scope.auth = {
"username": "",

View File

@ -13,6 +13,12 @@
<h2 ng-if="isLogged">
Qu'allons-nous faire aujourd'hui&nbsp;?
</h2>
<div ng-controller="ProgressionController" ng-if="isLogged">
<span class="badge" ng-class="{'badge-success': mychallenges[100], 'badge-danger': !mychallenges[100]}">HTTP</span>
<span class="badge" ng-class="{'badge-success': mychallenges[101], 'badge-danger': !mychallenges[101]}">HTTPS</span>
<span class="badge" ng-class="{'badge-success': mychallenges[102], 'badge-danger': !mychallenges[102]}">DNS</span>
</div>
</div>
<div class="card-deck">