diff --git a/app/assets/javascripts/darkswarm/controllers/hubs_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/hubs_controller.js.coffee index acc71b1172..769b47cbe8 100644 --- a/app/assets/javascripts/darkswarm/controllers/hubs_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/hubs_controller.js.coffee @@ -1,6 +1,13 @@ -Darkswarm.controller "HubsCtrl", ($scope, Hubs, $document, $rootScope, HashNavigation) -> +Darkswarm.controller "HubsCtrl", ($scope, Hubs, Search, $document, $rootScope, HashNavigation, FilterSelectorsService) -> $scope.Hubs = Hubs $scope.hubs = Hubs.visible + $scope.totalActive = FilterSelectorsService.totalActive + $scope.clearAll = FilterSelectorsService.clearAll + $scope.filterText = FilterSelectorsService.filterText + $scope.query = Search.search() + + $scope.$watch "query", (query)-> + Search.search query $rootScope.$on "$locationChangeSuccess", (newRoute, oldRoute) -> if HashNavigation.active "hubs" diff --git a/app/assets/javascripts/darkswarm/controllers/producers_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/producers_controller.js.coffee index cb2c4c6dc3..6fdb589529 100644 --- a/app/assets/javascripts/darkswarm/controllers/producers_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/producers_controller.js.coffee @@ -9,6 +9,3 @@ Darkswarm.controller "ProducersCtrl", ($scope, Producers, $filter, FilterSelecto $scope.$watch "query", (query)-> Search.search query - - - diff --git a/app/assets/javascripts/darkswarm/directives/active_selector.js.coffee b/app/assets/javascripts/darkswarm/directives/active_selector.js.coffee index 803c83eee3..74523c2c3d 100644 --- a/app/assets/javascripts/darkswarm/directives/active_selector.js.coffee +++ b/app/assets/javascripts/darkswarm/directives/active_selector.js.coffee @@ -4,7 +4,9 @@ Darkswarm.directive "activeSelector", -> replace: true templateUrl: 'active_selector.html' link: (scope, elem, attr)-> + scope.selector.emit = scope.emit elem.bind "click", -> scope.$apply -> scope.selector.active = !scope.selector.active scope.emit() + diff --git a/app/assets/javascripts/darkswarm/services/filter_selectors.js.coffee b/app/assets/javascripts/darkswarm/services/filter_selectors.js.coffee index 370f98f88f..47ed12806d 100644 --- a/app/assets/javascripts/darkswarm/services/filter_selectors.js.coffee +++ b/app/assets/javascripts/darkswarm/services/filter_selectors.js.coffee @@ -25,3 +25,4 @@ Darkswarm.factory "FilterSelectorsService", -> clearAll: => for selector in @selectors selector.active = false + selector.emit() diff --git a/app/views/home/_filters.html.haml b/app/views/home/_filters.html.haml index 367025391d..eaebe08025 100644 --- a/app/views/home/_filters.html.haml +++ b/app/views/home/_filters.html.haml @@ -20,7 +20,7 @@ .row.filter-box .small-12.large-8.columns - %taxon-selector{objects: "Hubs.visible | filterHubs:query", + %taxon-selector{objects: "hubs | hubs:query", results: "activeTaxons"} .small-12.large-4.columns @@ -30,4 +30,4 @@ .small-12.columns %a.button.secondary.small.expand{"ng-click" => "clearAll()"} %i.ofn-i_009-close - Clear all filters \ No newline at end of file + Clear all filters diff --git a/app/views/home/_hubs.html.haml b/app/views/home/_hubs.html.haml index e92eb81147..5669014bcf 100644 --- a/app/views/home/_hubs.html.haml +++ b/app/views/home/_hubs.html.haml @@ -23,7 +23,7 @@ .row{bindonce: true} .small-12.columns .active_table - %hub.active_table_node.row.animate-repeat{"ng-repeat" => "hub in filteredHubs = (hubs | hubs:query)", + %hub.active_table_node.row.animate-repeat{"ng-repeat" => "hub in filteredHubs = (hubs | hubs:query | taxons:activeTaxons | shipping:shippingTypes)", "ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !hub.active, 'current' : current()}", "scroll-after-load" => true, "ng-controller" => "HubNodeCtrl", diff --git a/app/views/producers/_filters.html.haml b/app/views/producers/_filters.html.haml index 566ce460c3..5fd89d4323 100644 --- a/app/views/producers/_filters.html.haml +++ b/app/views/producers/_filters.html.haml @@ -19,11 +19,8 @@ %taxon-selector{objects: "Producers.visible | filterProducers:query", results: "activeTaxons"} - / .small-12.large-6.columns - / %shipping-type-selector{results: "shippingTypes"} - .row.filter-box.animate-show{"ng-show" => "filtersActive && totalActive() > 0"} .small-12.columns %a.button.secondary.small.expand{"ng-click" => "clearAll()"} %i.ofn-i_009-close - Clear all filters \ No newline at end of file + Clear all filters diff --git a/app/views/producers/index.html.haml b/app/views/producers/index.html.haml index 1f883645e4..1a2c827068 100644 --- a/app/views/producers/index.html.haml +++ b/app/views/producers/index.html.haml @@ -24,7 +24,7 @@ .active_table %producer.active_table_node.row.animate-repeat{id: "{{producer.path}}", "scroll-after-load" => true, - "ng-repeat" => "producer in producers = (Producers.visible | filterProducers:query | taxons:activeTaxons | shipping:shippingTypes)", + "ng-repeat" => "producer in producers = (Producers.visible | filterProducers:query | taxons:activeTaxons)", "ng-controller" => "ProducerNodeCtrl", "ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !producer.active}", id: "{{producer.hash}}"}