diff --git a/app/assets/javascripts/darkswarm/controllers/group_page_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/group_page_controller.js.coffee index 0d2f244b32..7b44cb749b 100644 --- a/app/assets/javascripts/darkswarm/controllers/group_page_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/group_page_controller.js.coffee @@ -1,18 +1,6 @@ -Darkswarm.controller "GroupPageCtrl", ($scope, enterprises, Enterprises, MapConfiguration, OfnMap, Navigation) -> +Darkswarm.controller "GroupPageCtrl", ($scope, enterprises, Enterprises, MapConfiguration, OfnMap) -> $scope.Enterprises = Enterprises - enterprises_by_id = enterprises.map (enterprise) => - Enterprises.enterprises_by_id[enterprise.id] - - # TODO: this is duplicate code with app/assets/javascripts/darkswarm/services/enterprises.js.coffee - # It would be better to load only the needed enterprises (group + related shops). - $scope.group_producers = enterprises_by_id.filter (enterprise) -> - enterprise.category in ["producer_hub", "producer_shop", "producer"] - $scope.group_hubs = enterprises_by_id.filter (enterprise) -> - enterprise.category in ["hub", "hub_profile", "producer_hub", "producer_shop"] - - $scope.producers_to_filter = $scope.group_producers - $scope.map = angular.copy MapConfiguration.options - $scope.mapMarkers = OfnMap.enterprise_markers enterprises_by_id - $scope.embedded_layout = window.location.search.indexOf("embedded_shopfront=true") != -1 \ No newline at end of file + $scope.mapMarkers = OfnMap.enterprise_markers enterprises + $scope.embedded_layout = window.location.search.indexOf("embedded_shopfront=true") != -1 diff --git a/app/assets/javascripts/darkswarm/controllers/hub_node_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/hub_node_controller.js.coffee index 9b08a09139..8b0a1159e6 100644 --- a/app/assets/javascripts/darkswarm/controllers/hub_node_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/hub_node_controller.js.coffee @@ -1,4 +1,4 @@ -Darkswarm.controller "HubNodeCtrl", ($scope, HashNavigation, Navigation, $location, CurrentHub, $http, $timeout) -> +Darkswarm.controller "HubNodeCtrl", ($scope, HashNavigation, CurrentHub, $http, $timeout) -> $scope.shopfront_loading = false $scope.enterprise_details = [] diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index 726aaff811..48ba7df8b2 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -62,7 +62,7 @@ .small-12.columns .active_table %producer.active_table_node.row.animate-repeat{id: "{{producer.path}}", - "ng-repeat" => "producer in filteredEnterprises = (group_producers | searchEnterprises:query | taxons:activeTaxons | properties:activeProperties:'supplied_properties')", + "ng-repeat" => "producer in filteredEnterprises = (Enterprises.producers | searchEnterprises:query | taxons:activeTaxons | properties:activeProperties:'supplied_properties')", "ng-controller" => "ProducerNodeCtrl", "ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !producer.active}", id: "{{producer.hash}}"} @@ -83,13 +83,13 @@ = t :groups_hubs = render "shared/components/enterprise_search" - = render "shops/filters", resource: "group_hubs", property_filters: "| searchEnterprises:query | taxons:activeTaxons | shipping:shippingTypes" + = render "shops/filters", resource: "Enterprises.hubs", property_filters: "| searchEnterprises:query | taxons:activeTaxons | shipping:shippingTypes" .row .small-12.columns .active_table %hub.active_table_node.row.animate-repeat{id: "{{hub.hash}}", - "ng-repeat" => "hub in filteredEnterprises = (group_hubs | searchEnterprises:query | taxons:activeTaxons | shipping:shippingTypes | properties:activeProperties:'distributed_properties' | orderBy:['-active', '+orders_close_at'])", + "ng-repeat" => "hub in filteredEnterprises = (Enterprises.hubs | searchEnterprises:query | taxons:activeTaxons | shipping:shippingTypes | properties:activeProperties:'distributed_properties' | orderBy:['-active', '+orders_close_at'])", "ng-class" => "{'is_profile' : hub.category == 'hub_profile', 'closed' : !open(), 'open' : open(), 'inactive' : !hub.active, 'current' : current()}", "ng-controller" => "HubNodeCtrl"} .small-12.columns diff --git a/app/views/producers/_filters.html.haml b/app/views/producers/_filters.html.haml index 17f260196a..283777cf09 100644 --- a/app/views/producers/_filters.html.haml +++ b/app/views/producers/_filters.html.haml @@ -11,13 +11,13 @@ .light = t :producers_filter = t :producers_filter_type - %filter-selector.small-block-grid-2.medium-block-grid-4.large-block-grid-6{"selector-set" => "filterSelectors", objects: "producers_to_filter | searchEnterprises:query | taxonsOf", "active-selectors" => "activeTaxons"} + %filter-selector.small-block-grid-2.medium-block-grid-4.large-block-grid-6{"selector-set" => "filterSelectors", objects: "Enterprises.producers | searchEnterprises:query | taxonsOf", "active-selectors" => "activeTaxons"} %h5.tdhead .light = t :producers_filter = t :producers_filter_property .filter-shopfront.property-selectors - %filter-selector{ "selector-set" => "filterSelectors", objects: "producers_to_filter | searchEnterprises:query | taxons:activeTaxons | propertiesOf:'supplied_properties'", "active-selectors" => "activeProperties"} + %filter-selector{ "selector-set" => "filterSelectors", objects: "Enterprises.producers | searchEnterprises:query | taxons:activeTaxons | propertiesOf:'supplied_properties'", "active-selectors" => "activeProperties"} = render partial: 'shared/components/filter_box'