mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Changing our composition of producers and hubs
This commit is contained in:
@@ -2,8 +2,9 @@ Darkswarm.factory "MapModal", ($modal, $rootScope)->
|
||||
new class MapModal
|
||||
open: (enterprise)->
|
||||
scope = $rootScope.$new(true) # Spawn an isolate to contain the enterprise
|
||||
scope.enterprise = enterprise
|
||||
if enterprise['is_primary_producer?']
|
||||
scope.producer = enterprise
|
||||
$modal.open(templateUrl: "map_modal_producer.html", scope: scope)
|
||||
else
|
||||
scope.hub = enterprise
|
||||
$modal.open(templateUrl: "map_modal_hub.html", scope: scope)
|
||||
|
||||
@@ -2,3 +2,11 @@ Darkswarm.factory 'Producers', (producers) ->
|
||||
new class Producers
|
||||
constructor: ->
|
||||
@producers = producers
|
||||
|
||||
# TODO: start adding functionality to producers like so
|
||||
#@producers = (@extend(producer) for producer in producers)
|
||||
|
||||
#extend: (producer)->
|
||||
#new class Producer
|
||||
#constructor: ->
|
||||
#@[k] = v for k, v of Producer
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
%ng-include{src: "'signup.html'"}
|
||||
%ng-include{src: "'forgot.html'"}
|
||||
%a.close-reveal-modal{"ng-click" => "$close()"}
|
||||
%i.ofn-i_009-close
|
||||
%i.ofn-i_009-close
|
||||
|
||||
@@ -2,48 +2,30 @@
|
||||
.small-12.columns.producer-hero
|
||||
%h3.producer-name
|
||||
%i.ofn-i_036-producers
|
||||
{{ enterprise.name }}
|
||||
{{ enterprise.id }}
|
||||
%img.producer-hero-img{"ng-src" => "{{enterprise.promo_image}}"}
|
||||
{{ producer.name }}
|
||||
%img.producer-hero-img{"ng-src" => "{{producer.promo_image}}"}
|
||||
|
||||
.row
|
||||
.row{bindonce: true}
|
||||
.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 }}
|
||||
%img.producer-logo{"bo-src" => "producer.logo", "bo-if" => "producer.logo"}
|
||||
%p{"ng-bind-html" => "producer.long_description"}
|
||||
|
||||
%a.close-reveal-modal{"ng-click" => "$close()"}
|
||||
%i.ofn-i_009-close
|
||||
.small-12.large-6.columns
|
||||
|
||||
%ng-include{src: "'partials/contact.html'"}
|
||||
%ng-include{src: "'partials/follow.html'"}
|
||||
|
||||
.row{bindonce: true}
|
||||
.hubs
|
||||
%h4 Shop for {{producer.name}} products at:
|
||||
%a.hub{"ng-repeat" => "hub in producer.hubs",
|
||||
"bo-href" => "hub.path",
|
||||
"bo-class" => "{active: hub.active, inactive: !hub.active}",
|
||||
"ofn-empties-cart" => "hub"}
|
||||
%i.ofn-i_033-open-sign{"bo-if" => "hub.active"}
|
||||
%i.ofn-i_032-closed-sign{"bo-if" => "!hub.active"}
|
||||
{{hub.name}}
|
||||
( {{ hub.address.city }} , {{hub.address.state}} )
|
||||
|
||||
%a.close-reveal-modal{"ng-click" => "$close()"}
|
||||
%i.ofn-i_009-close
|
||||
|
||||
16
app/assets/javascripts/templates/partials/contact.html.haml
Normal file
16
app/assets/javascripts/templates/partials/contact.html.haml
Normal file
@@ -0,0 +1,16 @@
|
||||
%div{"bo-if" => "producer.email || producer.website || producer.address.phone"}
|
||||
%h3 Contact
|
||||
|
||||
%p{"bo-if" => "producer.email"}
|
||||
%a{"ng-href" => "mailto:{{producer.email | stripUrl}}", target: "_blank" }
|
||||
%i.ofn-i_050-mail-circle
|
||||
{{ producer.email | stripUrl }}
|
||||
|
||||
%p{"ng-if" => "producer.address.phone"}
|
||||
WE NEED A PHONE ICON
|
||||
{{ producer.address.phone }}
|
||||
|
||||
%p{"ng-if" => "producer.website"}
|
||||
%a{"ng-href" => "http://{{producer.website | stripUrl}}", target: "_blank" }
|
||||
%i.ofn-i_049-web
|
||||
{{ producer.website | stripUrl }}
|
||||
20
app/assets/javascripts/templates/partials/follow.html.haml
Normal file
20
app/assets/javascripts/templates/partials/follow.html.haml
Normal file
@@ -0,0 +1,20 @@
|
||||
%div{"bo-if" => "producer.twitter || producer.facebook || producer.linkedin || producer.instagram"}
|
||||
%h3 Follow
|
||||
|
||||
%ul.small-block-grid-1{bindonce: true}
|
||||
%li{"ng-if" => "producer.twitter"}
|
||||
%a{"ng-href" => "http://twitter.com/{{producer.twitter}}", target: "_blank"}
|
||||
%i.ofn-i_041-twitter
|
||||
|
||||
%li{"ng-if" => "producer.facebook"}
|
||||
%a{"ng-href" => "http://{{producer.facebook | stripUrl}}", target: "_blank"}
|
||||
%i.ofn-i_044-facebook
|
||||
|
||||
%li{"ng-if" => "producer.linkedin"}
|
||||
%a{"ng-href" => "http://{{producer.linkedin | stripUrl}}", target: "_blank"}
|
||||
%i.ofn-i_042-linkedin
|
||||
|
||||
%li{"ng-if" => "producer.instagram"}
|
||||
%a{"ng-href" => "http://instagram.com/{{producer.instagram}}", target: "_blank"}
|
||||
%i.ofn-i_043-instagram
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
# DON'T USE DIRECTLY - for inheritance
|
||||
attributes :name, :id, :description
|
||||
|
||||
node :email do |enterprise|
|
||||
enterprise.email.to_s.reverse
|
||||
end
|
||||
|
||||
child :address do
|
||||
extends "json/partials/address"
|
||||
end
|
||||
|
||||
@@ -14,6 +14,14 @@ node :active do |enterprise|
|
||||
@active_distributors.include?(enterprise)
|
||||
end
|
||||
|
||||
child distributors: :hubs do
|
||||
extends 'json/enterprises'
|
||||
node :active do |hub|
|
||||
@active_distributors.include?(hub)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
node :icon do |e|
|
||||
if e.is_primary_producer? and e.is_distributor?
|
||||
image_path "map-icon-both.svg"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
attributes :city, :zipcode
|
||||
attributes :city, :zipcode, :phone
|
||||
node :state do |address|
|
||||
address.state.abbr
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user