</select>\r
</div>\r
</div>\r
+\r
<accordion close-others="false">\r
<accordion-group class = "simfileListing"\r
is-open = "isOpen"\r
ng-class = "{active: isOpen}"\r
heading = "{{isOpen ? '- ' + pack.title : '+ ' + pack.title}}"\r
ng-init = "contributors=getContributors(pack.contributors); beast=false"\r
- ng-repeat = "pack in filteredPackList = (packList | filter: packTitleFilter\r
- | filter: simfileFilter)\r
- | startFrom: (currentPage-1)*pageSize\r
- | limitTo: pageSize"\r
+ ng-repeat = "pack in filteredPackList | startFrom: (currentPage-1)*pageSize | limitTo: pageSize"\r
>\r
<div ng-if="beast || isOpen">\r
<img ng-src="{{rockEndpoint}}{{pack.banner}}" alt="swage" />\r
angular.module("DivinElegy.pages.packs", ["DivinElegy.components.simfiles","DivinElegy.components.user","DivinElegy.components.config","DivinElegy.components.ui", "ui.bootstrap"])
-.controller("PackController", ['$scope', '$rootScope', 'rockEndpoint', 'SimfileService', 'UserService', 'UiSettingsService', 'HelloService', function($scope, $rootScope, rockEndpoint, SimfileService, UserService, UiSettingsService, HelloService)
+.controller("PackController", ['$scope', '$rootScope', 'rockEndpoint', 'SimfileService', 'UserService', 'UiSettingsService', 'HelloService', 'filterFilter', function($scope, $rootScope, rockEndpoint, SimfileService, UserService, UiSettingsService, HelloService, filterFilter)
{
$scope.rockEndpoint = rockEndpoint;
$scope.packTitleFilterKeyword = null;
$scope.bgChangesFilterKeyword = 'Any';
$scope.bpmChangesFilterKeyword = 'Any';
$scope.modeFilterKeyword = 'Any';
+ $scope.packList = [];
+ $scope.filteredPackList = [];
+
+ var watchMen = ['packTitleFilterKeyword', 'artistFilterKeyword', 'songTitleFilterKeyword', 'difficultyFilterKeyword', 'ratingFilterKeyword', 'stepArtistFilterKeyword', 'fgChangesFilterKeyword', 'bgChangesFilterKeyword', 'bpmChangesFilterKeyword', 'modeFilterKeyword'];
+ $scope.$watchGroup(watchMen, function(newValues, oldValues) {
+ $scope.applyFilters();
+ });
var filesizeBytes = function(size)
{
return match;
};
-
- $scope.packList = [];
-
+
+ $scope.applyFilters = function()
+ {
+ $scope.filteredPackList = filterFilter(filterFilter($scope.packList, $scope.packTitleFilter), $scope.simfileFilter);
+ };
+
SimfileService.getPacks().then(function(packs)
{
$scope.pageSize = UiSettingsService.getDirective('simfilesPerPage');
$scope.currentPage = 1;
$scope.packList = packs;
+ $scope.filteredPackList = packs;
});
}]);
\ No newline at end of file