Show only featured apps first on appstore listing

This commit is contained in:
Johannes Zellner
2018-06-08 09:48:34 +02:00
parent 55fb3b3b55
commit ee0a25962b
2 changed files with 7 additions and 4 deletions
+1
View File
@@ -273,6 +273,7 @@
</form>
</div>
<br/>
<a href="" class="appstore-category-link" ng-click="showCategory($event);" ng-class="{'category-active': category === 'featured' }" category="featured">Popular</a>
<a href="" class="appstore-category-link" ng-click="showCategory($event);" ng-class="{'category-active': category === '' }" category="">All</a>
<br/>
<a href="" class="appstore-category-link" ng-click="showCategory($event);" ng-class="{'category-active': category === 'analytics' }" category="analytics"><i class="fa fa-bar-chart"></i> Analytics</a>
+6 -4
View File
@@ -363,21 +363,19 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$scope.cachedCategory = $scope.category;
$scope.ready = false;
AppStore.getAppsFast(function (error, apps) {
if (error) return $timeout($scope.showCategory.bind(null, event), 1000);
if (!$scope.category) {
$scope.apps = apps;
} else if ($scope.category === 'featured') {
$scope.apps = apps.filter(function (app) { return app.featured; });
} else {
$scope.apps = apps.filter(function (app) {
return app.manifest.tags.some(function (tag) { return $scope.category === tag; });
});
}
$scope.ready = true;
document.getElementById('appstoreGrid').scrollIntoView();
});
};
@@ -533,9 +531,13 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
fetchUsers();
fetchGroups();
// start with featured apps listing
$scope.showCategory(null, 'featured');
// domains is required since we populate the dropdown with domains[0]
Client.getDomains(function (error, result) {
if (error) console.error(error);
$scope.domains = result;
// show install app dialog immediately if an app id was passed in the query