Skip to content

Commit

Permalink
Merge pull request #589 from SEED-platform/553-fix-selected-buildings
Browse files Browse the repository at this point in the history
Fix 'unseen selected buildings' issue after filters are updated
  • Loading branch information
mmclark committed Dec 17, 2015
2 parents 0a15537 + 61eb3ca commit 477fb20
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
10 changes: 8 additions & 2 deletions seed/static/seed/js/controllers/building_list_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,20 @@ angular.module('BE.seed.controller.building_list', [])
* SEARCH CODE
*/

$scope.do_update_buildings_filters = function(){
/* Called by 'Update Filters' click in buildings list UI */
$scope.do_update_buildings_filters = function(){
$scope.search.deselect_all_buildings();
refresh_search();
};

$scope.do_update_projects_filters = function(){
/* Called by 'Update Filters' click in projects buildings list UI */
$scope.do_update_project_buildings_filters = function(){
$scope.search.deselect_all_buildings();
refresh_search();
};

/* private function to refresh search, called by UI event handlers
or internal methods */
var refresh_search = function() {
$scope.search.search_buildings();
};
Expand Down
13 changes: 13 additions & 0 deletions seed/static/seed/js/services/search_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,19 @@ angular.module('BE.seed.service.search', [])
* end checkbox logic
*/

/** deselect_all_buildings: Force a deselection of all buildings
*
*/
search_service.deselect_all_buildings = function() {
var len = this.buildings.length;
for (var bldg_index = 0; bldg_index < len; bldg_index++) {
this.buildings[bldg_index].checked = false;
}
this.selected_buildings = [];
this.select_all_checkbox = false;
};


/**
* table columns logic
*/
Expand Down
2 changes: 1 addition & 1 deletion seed/static/seed/partials/project_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ <h1><i class="fa fa-folder-o"></i> {$ project.name $} ({$ search.number_matchin
<div class="btn-group" style="margin-left:20px;">
<button type="button"
class="btn btn-primary btn-sm"
ng-click="do_update_projects_filters()" >
ng-click="do_update_project_buildings_filters()" >
Update Filters
</button>
</div>
Expand Down

0 comments on commit 477fb20

Please sign in to comment.