Fixing up hubs page

This commit is contained in:
Will Marshall
2014-07-10 11:37:27 +10:00
parent 0b3b8883cd
commit 409d647f62
8 changed files with 16 additions and 12 deletions

View File

@@ -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"

View File

@@ -9,6 +9,3 @@ Darkswarm.controller "ProducersCtrl", ($scope, Producers, $filter, FilterSelecto
$scope.$watch "query", (query)->
Search.search query

View File

@@ -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()

View File

@@ -25,3 +25,4 @@ Darkswarm.factory "FilterSelectorsService", ->
clearAll: =>
for selector in @selectors
selector.active = false
selector.emit()

View File

@@ -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
Clear all filters

View File

@@ -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",

View File

@@ -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
Clear all filters

View File

@@ -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}}"}