mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-02 06:51:40 +00:00
Adding modals for the map
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
Darkswarm.controller "MapCtrl", ($scope, MapConfiguration, OfnMap, Marker)->
|
||||
Darkswarm.controller "MapCtrl", ($scope, MapConfiguration, OfnMap)->
|
||||
$scope.OfnMap = OfnMap
|
||||
console.log Marker
|
||||
window.Marker = Marker
|
||||
$scope.map =
|
||||
center:
|
||||
latitude: -37.775757
|
||||
longitude: 144.743663
|
||||
zoom: 8
|
||||
styles: MapConfiguration.options
|
||||
|
||||
|
||||
14
app/assets/javascripts/darkswarm/services/map.js.coffee
Normal file
14
app/assets/javascripts/darkswarm/services/map.js.coffee
Normal file
@@ -0,0 +1,14 @@
|
||||
Darkswarm.factory "OfnMap", (enterprisesForMap, MapModal)->
|
||||
new class OfnMap
|
||||
constructor: ->
|
||||
@enterprises = (@extend(enterprise) for enterprise in enterprisesForMap)
|
||||
|
||||
# Adding methods to each enterprise
|
||||
extend: (enterprise)->
|
||||
new class MapMarker
|
||||
icon: "/test.opng"
|
||||
constructor: ->
|
||||
@[k] = v for k, v of enterprise
|
||||
|
||||
reveal: =>
|
||||
MapModal.open @
|
||||
@@ -0,0 +1,6 @@
|
||||
Darkswarm.factory "MapModal", ($modal, $rootScope)->
|
||||
new class MapModal
|
||||
open: (enterprise)->
|
||||
scope = $rootScope.$new(true) # Spawn an isolate to contain the enterprise
|
||||
scope.enterprise = enterprise
|
||||
$modal.open(templateUrl: "map_modal.html", scope: scope)
|
||||
48
app/assets/javascripts/templates/map_modal.html.haml
Normal file
48
app/assets/javascripts/templates/map_modal.html.haml
Normal file
@@ -0,0 +1,48 @@
|
||||
.row
|
||||
.small-12.columns.producer-hero
|
||||
%h3.producer-name
|
||||
%i.ofn-i_036-producers
|
||||
{{ producer.name }}
|
||||
%img.producer-hero-img{"ng-src" => "{{enterprise.promo_image}}"}
|
||||
|
||||
.row
|
||||
.small-12.large-6.columns
|
||||
%p{"ng-bind-html" => "enterprise.long_description"}
|
||||
.small-12.large-6.columns
|
||||
%img.producer-logo{"ng-src" => "{{enterprise.logo}}", "ng-if" => "enterprise.logo"}
|
||||
%h5 Stay in touch with {{ enterprise.name }}
|
||||
|
||||
%ul.small-block-grid-1{bindonce: true}
|
||||
|
||||
%li{"ng-if" => "enterprise.website"}
|
||||
%a{"ng-href" => "http://{{enterprise.website | stripUrl}}", target: "_blank" }
|
||||
%i.ofn-i_049-web
|
||||
{{ enterprise.website | stripUrl }}
|
||||
|
||||
%li{"ng-if" => "enterprise.email"}
|
||||
%a{"ng-href" => "mailto:{{enterprise.email | stripUrl}}", target: "_blank" }
|
||||
%i.ofn-i_050-mail-circle
|
||||
{{ enterprise.email | stripUrl }}
|
||||
|
||||
%li{"ng-if" => "enterprise.twitter"}
|
||||
%a{"ng-href" => "http://twitter.com/{{enterprise.twitter}}", target: "_blank"}
|
||||
%i.ofn-i_041-twitter
|
||||
{{ enterprise.twitter }}
|
||||
|
||||
%li{"ng-if" => "enterprise.facebook"}
|
||||
%a{"ng-href" => "http://{{enterprise.facebook | stripUrl}}", target: "_blank"}
|
||||
%i.ofn-i_044-facebook
|
||||
{{ enterprise.facebook | stripUrl }}
|
||||
|
||||
%li{"ng-if" => "enterprise.linkedin"}
|
||||
%a{"ng-href" => "http://{{enterprise.linkedin | stripUrl}}", target: "_blank"}
|
||||
%i.ofn-i_042-linkedin
|
||||
{{ enterprise.linkedin | stripUrl }}
|
||||
|
||||
%li{"ng-if" => "enterprise.instagram"}
|
||||
%a{"ng-href" => "http://instagram.com/{{enterprise.instagram}}", target: "_blank"}
|
||||
%i.ofn-i_043-instagram
|
||||
{{ enterprise.instagram }}
|
||||
|
||||
%a.close-reveal-modal{"ng-click" => "$close()"}
|
||||
%i.ofn-i_009-close
|
||||
Reference in New Issue
Block a user