Fix categories order on dashboard

This commit is contained in:
Gaël Métais
2014-12-23 17:33:13 +01:00
parent 2ddf2e8341
commit c0e02726be
2 changed files with 4 additions and 1 deletions
@@ -20,6 +20,9 @@ dashboardCtrl.controller('DashboardCtrl', ['$scope', '$rootScope', '$routeParams
}
function init() {
// By default, Angular sorts object's attributes alphabetically. Countering this problem by retrieving the keys order here.
$scope.categoriesOrder = Object.keys($scope.result.scoreProfiles.generic.categories);
$scope.globalScore = Math.max($scope.result.scoreProfiles.generic.globalScore, 0);
$scope.tweetText = 'My website\'s score is ' + $scope.globalScore + '/100 on #YellowLabTools!';
}
+1 -1
View File
@@ -11,7 +11,7 @@
<h2 ng-if="!fromSocialShare">Score details</h2>
<div ng-if="!fromSocialShare" class="notations">
<div ng-repeat="category in result.scoreProfiles.generic.categories">
<div ng-repeat="categoryKey in categoriesOrder" ng-init="category = result.scoreProfiles.generic.categories[categoryKey]">
<grade score="category.categoryScore" class="categoryScore"></grade>
<div class="category">{{category.label}}</div>
<div class="criteria">