mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-17 00:07:24 +00:00
add map modals, profile filters and bugfixes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
Darkswarm.controller "HubsCtrl", ($scope, Hubs, Search, $document, $rootScope, HashNavigation, FilterSelectorsService) ->
|
||||
Darkswarm.controller "HubsCtrl", ($scope, Hubs, Search, $document, $rootScope, HashNavigation, FilterSelectorsService, MapModal) ->
|
||||
$scope.Hubs = Hubs
|
||||
$scope.hubs = Hubs.visible
|
||||
$scope.totalActive = FilterSelectorsService.totalActive
|
||||
@@ -6,6 +6,8 @@ Darkswarm.controller "HubsCtrl", ($scope, Hubs, Search, $document, $rootScope, H
|
||||
$scope.filterText = FilterSelectorsService.filterText
|
||||
$scope.FilterSelectorsService = FilterSelectorsService
|
||||
$scope.query = Search.search()
|
||||
$scope.show_profiles = false
|
||||
$scope.openModal = MapModal.open
|
||||
|
||||
$scope.$watch "query", (query)->
|
||||
Search.search query
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Darkswarm.controller "ProducersCtrl", ($scope, Producers, $filter, FilterSelectorsService, Search) ->
|
||||
Darkswarm.controller "ProducersCtrl", ($scope, Producers, $filter, FilterSelectorsService, Search, MapModal) ->
|
||||
$scope.Producers = Producers
|
||||
$scope.totalActive = FilterSelectorsService.totalActive
|
||||
$scope.clearAll = FilterSelectorsService.clearAll
|
||||
@@ -7,6 +7,8 @@ Darkswarm.controller "ProducersCtrl", ($scope, Producers, $filter, FilterSelecto
|
||||
$scope.filtersActive = false
|
||||
$scope.activeTaxons = []
|
||||
$scope.query = Search.search()
|
||||
$scope.show_profiles = false
|
||||
$scope.openModal = MapModal.open
|
||||
|
||||
$scope.$watch "query", (query)->
|
||||
Search.search query
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
Darkswarm.filter 'showProfiles', ()->
|
||||
(enterprises, show_profiles) ->
|
||||
enterprises ||= []
|
||||
show_profiles ?= true
|
||||
|
||||
enterprises.filter (enterprise)=>
|
||||
show_profiles or not enterprise.is_profile
|
||||
@@ -2,7 +2,7 @@ Darkswarm.factory 'Hubs', ($filter, Enterprises, visibleFilter) ->
|
||||
new class Hubs
|
||||
constructor: ->
|
||||
@hubs = @order Enterprises.enterprises.filter (hub)->
|
||||
hub.is_distributor && hub.has_shopfront
|
||||
hub.is_distributor
|
||||
@visible = visibleFilter @hubs
|
||||
|
||||
order: (hubs)->
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
.highlight{"ng-class" => "{'has_shopfront' : enterprise.has_shopfront}"}
|
||||
.highlight
|
||||
.highlight-top
|
||||
%p.right
|
||||
{{ [enterprise.address.city, enterprise.address.state_name] | printArray}}
|
||||
%h3
|
||||
%h3{"ng-if" => "enterprise.has_shopfront"}
|
||||
%a{"bo-href" => "enterprise.path", "ofn-empties-cart" => "enterprise", bindonce: true}
|
||||
%i{"ng-class" => "enterprise.icon_font"}
|
||||
%span {{ enterprise.name }}
|
||||
%span {{ enterprise.name }}
|
||||
%h3{"ng-if" => "!enterprise.has_shopfront"}
|
||||
%i{"ng-class" => "enterprise.icon_font"}
|
||||
%span {{ enterprise.name }}
|
||||
%img.hero-img{"ng-src" => "{{enterprise.promo_image}}"}
|
||||
|
||||
@@ -16,8 +16,5 @@
|
||||
Delivery
|
||||
%ul.small-block-grid-2.medium-block-grid-4.large-block-grid-2
|
||||
%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
|
||||
|
||||
= render partial: 'shared/components/filter_box'
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
.small-12.columns
|
||||
/ %i.ofn-i_020-search
|
||||
%input{type: :text,
|
||||
"ng-model" => "query",
|
||||
"ng-model" => "query",
|
||||
placeholder: "Search by name or suburb...",
|
||||
"ng-debounce" => "150",
|
||||
"ofn-disable-enter" => true}
|
||||
@@ -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 | taxons:activeTaxons | shipping:shippingTypes)",
|
||||
%hub.active_table_node.row.animate-repeat{"ng-repeat" => "hub in filteredHubs = (hubs | hubs:query | taxons:activeTaxons | shipping:shippingTypes | showProfiles:show_profiles )",
|
||||
"ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !hub.active, 'current' : current()}",
|
||||
"scroll-after-load" => true,
|
||||
"ng-controller" => "HubNodeCtrl",
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
.row.active_table_row{"ng-click" => "toggle()", "ng-class" => "{'closed' : !open(), 'has_shopfront' : producer.has_shopfront}", bindonce: true}
|
||||
.row.active_table_row{"ng-if" => "!hub.is_profile", "ng-click" => "toggle()", "ng-class" => "{'closed' : !open(), 'has_shopfront' : producer.has_shopfront}", bindonce: true}
|
||||
|
||||
.columns.small-12.medium-6.large-5.skinny-head
|
||||
%a.hub{"bo-href" => "hub.path", "ng-class" => "{primary: hub.active, secondary: !hub.active}", "ofn-empties-cart" => "hub"}
|
||||
%a.hub{"ng-class" => "{primary: hub.active, secondary: !hub.active}", "ofn-empties-cart" => "hub"}
|
||||
%i{ng: {class: "hub.icon_font"}}
|
||||
%span.margin-top.hub-name-listing {{ hub.name | truncate:40}}
|
||||
|
||||
.columns.small-4.medium-2.large-2
|
||||
%span.margin-top {{ hub.address.city }}
|
||||
.columns.small-2.medium-1.large-1
|
||||
@@ -22,5 +24,16 @@
|
||||
%em Shopping here
|
||||
%span.margin-top{ bo: { if: "!current()" } } Orders closed
|
||||
|
||||
.row.active_table_row{"ng-if" => "hub.is_profile", "ng-class" => "closed"}
|
||||
.columns.small-12.medium-6.large-5.skinny-head
|
||||
%a.hub{"ng-click" => "openModal(hub)", "ng-class" => "{primary: hub.active, secondary: !hub.active}", "ofn-empties-cart" => "hub"}
|
||||
%i{ng: {class: "hub.icon_font"}}
|
||||
%span.margin-top.hub-name-listing {{ hub.name | truncate:40}}
|
||||
|
||||
.columns.small-4.medium-2.large-2
|
||||
%span.margin-top {{ hub.address.city }}
|
||||
.columns.small-2.medium-1.large-1
|
||||
%span.margin-top {{ hub.address.state_name | uppercase }}
|
||||
|
||||
.columns.small-6.medium-3.large-4.text-right
|
||||
%span.margin-top{ bo: { if: "!current()" } } Profile only
|
||||
|
||||
@@ -8,11 +8,6 @@
|
||||
.light Filter by
|
||||
Type
|
||||
%ul.small-block-grid-2.medium-block-grid-4.large-block-grid-6
|
||||
%taxon-selector{objects: "Producers.visible | filterProducers:query",
|
||||
%taxon-selector{objects: "Producers.visible | filterProducers:query ",
|
||||
results: "activeTaxons"}
|
||||
|
||||
.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
|
||||
|
||||
@@ -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)",
|
||||
"ng-repeat" => "producer in producers = (Producers.visible | showProfiles:show_profiles | filterProducers:query | taxons:activeTaxons)",
|
||||
"ng-controller" => "ProducerNodeCtrl",
|
||||
"ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !producer.active}",
|
||||
id: "{{producer.hash}}"}
|
||||
|
||||
5
app/views/shared/components/_filter_box.html.haml
Normal file
5
app/views/shared/components/_filter_box.html.haml
Normal file
@@ -0,0 +1,5 @@
|
||||
.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
|
||||
@@ -10,7 +10,7 @@
|
||||
No filters
|
||||
.small-12.medium-6.columns.text-right
|
||||
.profile-checkbox
|
||||
%input{type: "checkbox", name: "profile"}><
|
||||
%input{"ng-model" => "show_profiles", type: "checkbox", name: "profile"}><
|
||||
%label Show profiles
|
||||
%button.button.secondary.tiny.help-btn.ng-scope{:popover => "Profiles do not have a shopfront on the Open Food Network, but do have their own physical or online shop elsewhere", "popover-placement" => "left"}><
|
||||
%i.ofn-i_013-help
|
||||
|
||||
@@ -8,11 +8,7 @@
|
||||
.light Filter by
|
||||
Type
|
||||
%ul.small-block-grid-2.medium-block-grid-3.large-block-grid-4
|
||||
%taxon-selector{objects: "Products.products | products:query",
|
||||
%taxon-selector{objects: "Products.products | products:query | products:showProfiles",
|
||||
results: "activeTaxons"}
|
||||
|
||||
.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
|
||||
= render partial: 'shared/components/filter_box'
|
||||
|
||||
Reference in New Issue
Block a user