mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Hide closed shops by default, add "show" button
This commit is contained in:
@@ -8,6 +8,7 @@ Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, Enterpris
|
||||
$scope.show_profiles = false
|
||||
$scope.filtersActive = false
|
||||
$scope.distanceMatchesShown = false
|
||||
$scope.filterExpression = {active: true}
|
||||
|
||||
|
||||
$scope.$watch "query", (query)->
|
||||
@@ -65,3 +66,9 @@ Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, Enterpris
|
||||
$scope.nameMatchesFiltered[0]
|
||||
else
|
||||
undefined
|
||||
|
||||
$scope.showClosedShops = ->
|
||||
delete $scope.filterExpression['active']
|
||||
|
||||
$scope.hideClosedShops = ->
|
||||
$scope.filterExpression['active'] = true
|
||||
|
||||
@@ -28,4 +28,8 @@
|
||||
%a{href: "", "ng-click" => "showDistanceMatches()"}
|
||||
= t :hubs_distance_filter, location: "{{ nameMatchesFiltered[0].name }}"
|
||||
.more-controls
|
||||
%a.button{href: "", ng: {click: "showClosedShops()", show: "filterExpression.active"}}
|
||||
= t '.show_closed_shops'
|
||||
%a.button{href: "", ng: {click: "hideClosedShops()", show: "!filterExpression.active"}}
|
||||
= t '.hide_closed_shops'
|
||||
%a.button{href: main_app.map_path}= t '.show_on_map'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.active_table
|
||||
%hub.active_table_node.row{"ng-repeat" => "hub in #{enterprises}Filtered = (#{enterprises} | taxons:activeTaxons | shipping:shippingTypes | showHubProfiles:show_profiles | orderBy:['-active', '+distance', '+orders_close_at'])",
|
||||
%hub.active_table_node.row{"ng-repeat" => "hub in #{enterprises}Filtered = (#{enterprises} | filter:filterExpression | taxons:activeTaxons | shipping:shippingTypes | showHubProfiles:show_profiles | orderBy:['-active', '+distance', '+orders_close_at'])",
|
||||
"ng-class" => "{'is_profile' : hub.category == 'hub_profile', 'closed' : !open(), 'open' : open(), 'inactive' : !hub.active, 'current' : current()}",
|
||||
"ng-controller" => "HubNodeCtrl",
|
||||
id: "{{hub.hash}}"}
|
||||
|
||||
@@ -107,6 +107,8 @@ en:
|
||||
|
||||
home:
|
||||
hubs:
|
||||
show_closed_shops: "Show closed shops"
|
||||
hide_closed_shops: "Hide closed shops"
|
||||
show_on_map: "Show all on the map"
|
||||
|
||||
# Printable Invoice Columns
|
||||
|
||||
@@ -26,9 +26,17 @@ feature 'Shops', js: true do
|
||||
page.should_not have_content invisible_distributor.name
|
||||
end
|
||||
|
||||
it "should grey out hubs that are not in an order cycle" do
|
||||
it "should not show hubs that are not in an order cycle" do
|
||||
create(:simple_product, distributors: [d1, d2])
|
||||
visit shops_path
|
||||
page.should have_no_selector 'hub.inactive'
|
||||
page.should have_no_selector 'hub', text: d2.name
|
||||
end
|
||||
|
||||
it "should show closed shops after clicking the button" do
|
||||
create(:simple_product, distributors: [d1, d2])
|
||||
visit shops_path
|
||||
click_link "Show closed shops"
|
||||
page.should have_selector 'hub.inactive'
|
||||
page.should have_selector 'hub.inactive', text: d2.name
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user