mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge branch 'master' into breakdowns
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
Darkswarm.directive 'mapSearch', ($timeout)->
|
||||
# Install a basic search field in a map
|
||||
restrict: 'E'
|
||||
require: '^googleMap'
|
||||
replace: true
|
||||
template: '<input id="pac-input"></input>'
|
||||
link: (scope, elem, attrs, ctrl)->
|
||||
$timeout =>
|
||||
map = ctrl.getMap()
|
||||
input = (document.getElementById("pac-input"))
|
||||
map.controls[google.maps.ControlPosition.TOP_LEFT].push input
|
||||
searchBox = new google.maps.places.SearchBox((input))
|
||||
|
||||
google.maps.event.addListener searchBox, "places_changed", ->
|
||||
places = searchBox.getPlaces()
|
||||
return if places.length is 0
|
||||
# For each place, get the icon, place name, and location.
|
||||
markers = []
|
||||
bounds = new google.maps.LatLngBounds()
|
||||
for place in places
|
||||
#map.setCenter place.geometry.location
|
||||
map.fitBounds place.geometry.viewport
|
||||
#map.fitBounds bounds
|
||||
|
||||
# Bias the SearchBox results towards places that are within the bounds of the
|
||||
# current map's viewport.
|
||||
google.maps.event.addListener map, "bounds_changed", ->
|
||||
bounds = map.getBounds()
|
||||
searchBox.setBounds bounds
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
Darkswarm.factory 'Order', (order)->
|
||||
new class Order
|
||||
order: order
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,3 +10,7 @@
|
||||
img // https://github.com/zurb/foundation/issues/112
|
||||
max-width: none
|
||||
height: auto
|
||||
|
||||
#pac-input
|
||||
padding: 4px
|
||||
font-size: 2em
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
%link{href: "https://fonts.googleapis.com/css?family=Open+Sans:400,700", rel: "stylesheet", type: "text/css"}/
|
||||
|
||||
= yield :scripts
|
||||
%script{src: "//maps.googleapis.com/maps/api/js?sensor=false"}
|
||||
%script{src: "//maps.googleapis.com/maps/api/js?libraries=places&sensor=false"}
|
||||
= stylesheet_link_tag "darkswarm/all"
|
||||
= javascript_include_tag "darkswarm/all"
|
||||
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
.map-container{"fill-vertical" => true}
|
||||
%map{"ng-controller" => "MapCtrl"}
|
||||
%google-map{options: "map.additional_options", center: "map.center", zoom: "map.zoom", styles: "map.styles", draggable: "true"}
|
||||
%map-search
|
||||
%markers{models: "OfnMap.enterprises", fit: "true",
|
||||
coords: "'self'", icon: "'icon'", click: "'reveal'"}
|
||||
|
||||
@@ -56,6 +56,7 @@ describe ProductDistribution do
|
||||
adjustment.label.should == "Product distribution by #{distributor.name} for Pear"
|
||||
adjustment.amount.should == 1.23
|
||||
|
||||
# TODO ROB this has an intermittent failure
|
||||
# And it should have some associated metadata
|
||||
md = adjustment.metadata
|
||||
md.enterprise.should == distributor
|
||||
|
||||
Reference in New Issue
Block a user