chore: alphabetize entries in resources page. Add margin under frontpage banner

This commit is contained in:
Eric Jimenez 2016-07-13 13:56:01 -04:00 committed by Naomi Black
parent f50dff818a
commit 8c1bbbf318
3 changed files with 18 additions and 3 deletions

View File

@ -1,6 +1,6 @@
.home-rows {
// NOTE (ericjim): if a banner is placed on the homescreen, add this margin.
//margin-top: 112px;
margin-top: 112px;
}
.home-row {

View File

@ -13,7 +13,7 @@
<h3 class="text-uppercase subcategory-title">{{subCategory}}</h3>
<div ng-repeat="(section, sectionObj) in subcategoryObj">
<div ng-repeat="resource in sectionObj">
<div ng-repeat="resource in sectionObj | orderObjectByOfTypeString:'title':false">
<div class="c-resource" ng-if="resource.rev">
<a class="l-flex--column resource-row-link" target="_blank" href="{{resource.url}}">
<div>

View File

@ -38,4 +38,19 @@ angularIO.controller('ResourcesCtrl', ['$scope', '$element', '$window', '$fireba
vm.selectedCategory = category;
};
}]);
}]);
angularIO.filter('orderObjectByOfTypeString', function() {
return function(items, field, reverse) {
var filtered = [];
angular.forEach(items, function(item) {
filtered.push(item);
});
filtered.sort(function (a, b) {
// normalize sort by uppercasing values.
return (a[field].toUpperCase() > b[field].toUpperCase() ? 1 : -1);
});
if(reverse) filtered.reverse();
return filtered;
};
});