diff --git a/www/js/diary/infinite_scroll_list.js b/www/js/diary/infinite_scroll_list.js index 8c61982ae..9245befa8 100644 --- a/www/js/diary/infinite_scroll_list.js +++ b/www/js/diary/infinite_scroll_list.js @@ -54,6 +54,7 @@ angular.module('emission.main.diary.infscrolllist',['ui-leaflet', f.state = false; }); $scope.filterInputs[0].state = true; + $scope.selFilter = $scope.filterInputs[0].key; ClientStats.addReading(ClientStats.getStatKeys().LABEL_TAB_SWITCH, {"source": null, "dest": $scope.getActiveFilters()}); $scope.allTrips = false; const ONE_WEEK = 7 * 24 * 60 * 60; // seconds @@ -192,15 +193,24 @@ angular.module('emission.main.diary.infscrolllist',['ui-leaflet', } }); - $scope.select = function(selF) { + $scope.updateFilterSel = function(selFilterKey) { const prev = $scope.getActiveFilters(); - selF.state = true; - $scope.filterInputs.forEach((f) => { - if (f !== selF) { + const selFilter = $scope.filterInputs.find(f => f.key == selFilterKey); + if (selFilter) { + selFilter.state = true; + $scope.filterInputs.forEach((f) => { + if (f !== selFilter) { + f.state = false; + } + }); + $scope.allTrips = false; + } else { + $scope.filterInputs.forEach((f) => { f.state = false; - } - }); - $scope.allTrips = false; + }); + $scope.allTrips = true; + } + $scope.recomputeDisplayTrips(); // scroll to the bottom while changing filters so users don't have to // fixes the first of the fit-and-finish issues from @@ -209,17 +219,6 @@ angular.module('emission.main.diary.infscrolllist',['ui-leaflet', ClientStats.addReading(ClientStats.getStatKeys().LABEL_TAB_SWITCH, {"source": prev, "dest": $scope.getActiveFilters()}); } - $scope.resetSelection = function() { - const prev = $scope.getActiveFilters(); - $scope.filterInputs.forEach((f) => { - f.state = false; - }); - $scope.allTrips = true; - $scope.recomputeDisplayTrips(); - $ionicScrollDelegate.scrollBottom(); - ClientStats.addReading(ClientStats.getStatKeys().LABEL_TAB_SWITCH, {"source": prev, "dest": $scope.getActiveFilters()}); - } - $scope.recomputeDisplayTrips = function() { let alreadyFiltered = false; $scope.filterInputs.forEach((f) => { diff --git a/www/js/survey/enketo/infinite_scroll_filters.js b/www/js/survey/enketo/infinite_scroll_filters.js index 65d6c9ddc..6af04c659 100644 --- a/www/js/survey/enketo/infinite_scroll_filters.js +++ b/www/js/survey/enketo/infinite_scroll_filters.js @@ -21,15 +21,13 @@ angular.module('emission.survey.enketo.trip.infscrollfilters',[ sf.UNLABELED = { key: "unlabeled", text: $translate.instant(".unlabeled"), - filter: unlabeledCheck, - width: "col-50" + filter: unlabeledCheck } sf.TO_LABEL = { key: "to_label", text: $translate.instant(".to-label"), - filter: unlabeledCheck, - width: "col-50" + filter: unlabeledCheck } sf.configuredFilters = [ diff --git a/www/templates/diary/infinite_scroll_list.html b/www/templates/diary/infinite_scroll_list.html index 6b3ebfb53..daba8ff49 100644 --- a/www/templates/diary/infinite_scroll_list.html +++ b/www/templates/diary/infinite_scroll_list.html @@ -5,14 +5,14 @@ -
- -