mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
View closed shops by URL
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, Enterprises, Search, $document, HashNavigation, FilterSelectorsService, EnterpriseModal, enterpriseMatchesNameQueryFilter, distanceWithinKmFilter) ->
|
||||
Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, $location, Enterprises, Search, $document, HashNavigation, FilterSelectorsService, EnterpriseModal, enterpriseMatchesNameQueryFilter, distanceWithinKmFilter) ->
|
||||
$scope.Enterprises = Enterprises
|
||||
$scope.producers_to_filter = Enterprises.producers
|
||||
$scope.filterSelectors = FilterSelectorsService.createSelectors()
|
||||
@@ -21,6 +21,10 @@ Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, Enterpris
|
||||
Enterprises.calculateDistance query, $scope.firstNameMatch()
|
||||
$rootScope.$broadcast 'enterprisesChanged'
|
||||
|
||||
$timeout ->
|
||||
if $location.search()['show_closed']?
|
||||
$scope.showClosedShops()
|
||||
|
||||
$scope.$watch "filtersActive", (value) ->
|
||||
$scope.$broadcast 'filtersToggled'
|
||||
|
||||
@@ -71,6 +75,8 @@ Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, Enterpris
|
||||
|
||||
$scope.showClosedShops = ->
|
||||
delete $scope.filterExpression['active']
|
||||
$location.search('show_closed', '1')
|
||||
|
||||
$scope.hideClosedShops = ->
|
||||
$scope.filterExpression['active'] = true
|
||||
$location.search('show_closed', null)
|
||||
|
||||
@@ -75,6 +75,19 @@ feature 'Shops', js: true do
|
||||
end
|
||||
end
|
||||
|
||||
describe "viewing closed shops by URL" do
|
||||
before do
|
||||
d1
|
||||
d2
|
||||
visit shops_path(anchor: "/?show_closed=1")
|
||||
end
|
||||
|
||||
it "shows closed shops" do
|
||||
#click_link_and_ensure("Show closed shops", -> { page.has_selector? 'hub.inactive' })
|
||||
page.should have_selector 'hub.inactive', text: d2.name
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
||||
Reference in New Issue
Block a user