Merge pull request #261 from coreos-inc/decibel

Small improvements for the table view
This commit is contained in:
Jimmy Zelinskie 2015-07-22 14:35:16 -04:00
commit d19da364bd
3 changed files with 14 additions and 3 deletions

View file

@ -30,3 +30,7 @@
.repo-list-table .popularity { .repo-list-table .popularity {
line-height: 10px; line-height: 10px;
} }
.repo-list-table .repo-star i {
color: #ccc;
}

View file

@ -43,7 +43,8 @@
<span class="empty" ng-if="!repository.last_modified">(Empty Repository)</span> <span class="empty" ng-if="!repository.last_modified">(Empty Repository)</span>
</td> </td>
<td class="popularity hidden-xs"> <td class="popularity hidden-xs">
<span class="strength-indicator" value="repository.popularity" maximum="maxPopularity"></span> <span class="strength-indicator" value="repository.popularity" maximum="maxPopularity"
log-base="10"></span>
</td> </td>
<td> <td>
<span class="repo-star" repository="repository" <span class="repo-star" repository="repository"

View file

@ -10,7 +10,8 @@ angular.module('quay').directive('strengthIndicator', function () {
restrict: 'C', restrict: 'C',
scope: { scope: {
'value': '=value', 'value': '=value',
'maximum': '=maximum' 'maximum': '=maximum',
'logBase': '=logBase'
}, },
controller: function($scope, $element) { controller: function($scope, $element) {
$scope.strengthClass = ''; $scope.strengthClass = '';
@ -22,6 +23,11 @@ angular.module('quay').directive('strengthIndicator', function () {
} }
var value = Math.round(($scope.value / $scope.maximum) * 4); var value = Math.round(($scope.value / $scope.maximum) * 4);
if ($scope.logBase) {
var currentValue = Math.log($scope.value) / Math.log($scope.logBase * 1);
var maximum = Math.log($scope.maximum) / Math.log($scope.logBase * 1);
value = Math.round((currentValue / maximum) * 4);
}
if (value <= 0) { if (value <= 0) {
$scope.strengthClass = 'none'; $scope.strengthClass = 'none';