mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-17 00:07:24 +00:00
Merge remote-tracking branch 'origin/master' into new-product-form
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
Darkswarm.controller "CartCtrl", ($scope, CurrentOrder) ->
|
||||
$scope.CurrentOrder = CurrentOrder
|
||||
@@ -1,10 +1,11 @@
|
||||
Darkswarm.directive "ofnEmptiesCart", (CurrentHub, Navigation) ->
|
||||
Darkswarm.directive "ofnEmptiesCart", (CurrentHub, CurrentOrder, Navigation) ->
|
||||
restrict: "A"
|
||||
scope:
|
||||
hub: '=ofnEmptiesCart'
|
||||
template: "{{action}} <strong>{{hub.name}}</strong>"
|
||||
link: (scope, elm, attr)->
|
||||
if CurrentHub.id and CurrentHub.id isnt scope.hub.id
|
||||
# A hub is selected, we're changing to a different hub, and the cart isn't empty
|
||||
if CurrentHub.id and CurrentHub.id isnt scope.hub.id and not CurrentOrder.empty()
|
||||
scope.action = attr.change
|
||||
elm.bind 'click', (ev)->
|
||||
ev.preventDefault()
|
||||
@@ -12,5 +13,3 @@ Darkswarm.directive "ofnEmptiesCart", (CurrentHub, Navigation) ->
|
||||
Navigation.go scope.hub.path
|
||||
else
|
||||
scope.action = attr.shop
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
Darkswarm.factory 'CurrentOrder', (currentOrder) ->
|
||||
new class CurrentOrder
|
||||
constructor: ->
|
||||
@[k] = v for k, v of currentOrder
|
||||
|
||||
empty: =>
|
||||
@line_items.length == 0
|
||||
@@ -15,6 +15,3 @@ footer
|
||||
&:hover, &:active, &:focus
|
||||
color: $clr-brick-bright
|
||||
@include textsoftpress
|
||||
span.email
|
||||
direction: rtl
|
||||
unicode-bidi: bidi-override
|
||||
|
||||
46
app/assets/stylesheets/darkswarm/images.css.sass
Normal file
46
app/assets/stylesheets/darkswarm/images.css.sass
Normal file
@@ -0,0 +1,46 @@
|
||||
@import mixins
|
||||
@import variables
|
||||
@import branding
|
||||
|
||||
.product-img
|
||||
border-bottom: 40px white solid
|
||||
border-top: 20px white solid
|
||||
border-left: 20px white solid
|
||||
border-right: 20px white solid
|
||||
outline: 1px solid #ccc
|
||||
@include box-shadow(0 1px 2px 1px rgba(0,0,0,0.25))
|
||||
|
||||
.producer-hero
|
||||
position: relative
|
||||
padding: 0
|
||||
|
||||
.producer-hero-img
|
||||
background-color: #999
|
||||
width: 100%
|
||||
height: inherit
|
||||
max-height: 260px
|
||||
overflow: hidden
|
||||
margin-top: 2em
|
||||
margin-bottom: 1em
|
||||
|
||||
|
||||
h3.producer-name
|
||||
background-color: rgba(255,255,255,0.65)
|
||||
height: 2.5em
|
||||
width: 100%
|
||||
position: absolute
|
||||
bottom: 0
|
||||
padding: 0.5em
|
||||
|
||||
.producer-logo
|
||||
max-width: 220px
|
||||
|
||||
@media only screen and (max-width: 1024px)
|
||||
.product-img
|
||||
margin-top: 2em
|
||||
margin-bottom: 1em
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,2 @@
|
||||
.row
|
||||
max-width: 74em
|
||||
|
||||
.reveal-modal
|
||||
position: fixed
|
||||
|
||||
@@ -69,3 +69,8 @@ table tr th, table tr td
|
||||
color: #333333
|
||||
table thead tr th, table thead tr td, table tfoot tr th, table tfoot tr td
|
||||
color: #333333
|
||||
|
||||
|
||||
span.email
|
||||
direction: rtl
|
||||
unicode-bidi: bidi-override
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
%br
|
||||
100 x 100 pixels
|
||||
.omega.eight.columns
|
||||
= image_tag @object.logo.url if @object.logo.present?
|
||||
= image_tag @object.logo(:medium) if @object.logo.present?
|
||||
= f.file_field :logo
|
||||
.row
|
||||
.alpha.three.columns
|
||||
|
||||
13
app/views/json/_current_order.rabl
Normal file
13
app/views/json/_current_order.rabl
Normal file
@@ -0,0 +1,13 @@
|
||||
object current_order
|
||||
attributes :id, :item_total
|
||||
|
||||
if current_order
|
||||
child line_items: :line_items do
|
||||
attributes :id, :variant_id, :quantity, :price
|
||||
end
|
||||
|
||||
node :cart_count do
|
||||
cart_count
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
%body.off-canvas{"ng-app" => "Darkswarm"}
|
||||
= inject_json "currentHub", "current_hub"
|
||||
= inject_json "currentOrder", "current_order"
|
||||
= inject_json "user", "current_user"
|
||||
|
||||
.off-canvas-wrap{offcanvas: true}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%h2 Food Hubs
|
||||
%h5 Our food hubs are the point of contact between you and the people who make your food!
|
||||
%p You can search for a convenient hub by location or name. Some hubs have multiple points where you can pick-up your purchases, and some will also provide delivery options. Each food hub is a sales point with independent business operations and logisitics - so variations between hubs are to be expected.
|
||||
%p You can only shop one food hub at a time.
|
||||
%p You can search for a convenient hub by location or name. Some hubs have multiple points where you can pick-up your purchases, and some will also provide delivery options. Each food hub is a sales point with independent business operations and logistics - so variations between hubs are to be expected.
|
||||
%p You can only shop at one food hub at a time.
|
||||
%a.close-reveal-modal{"ng-click" => "$close()"} ×
|
||||
|
||||
5
app/views/shared/menu/_cart.html.haml
Normal file
5
app/views/shared/menu/_cart.html.haml
Normal file
@@ -0,0 +1,5 @@
|
||||
%a.icon{href: cart_url, "ng-controller" => "CartCtrl"}
|
||||
%i.fi-shopping-cart.nav-branded
|
||||
%span
|
||||
{{ CurrentOrder.cart_count }}
|
||||
items
|
||||
@@ -43,8 +43,4 @@
|
||||
%span.nav-primary.nav-branded {{ CurrentHub.name }}
|
||||
%li.divider
|
||||
%li.cart
|
||||
%a.icon{href: cart_url}
|
||||
%i.fi-shopping-cart.nav-branded
|
||||
%span
|
||||
= cart_count
|
||||
items
|
||||
= render partial: "shared/menu/cart"
|
||||
|
||||
@@ -3,11 +3,7 @@
|
||||
%a.left-off-canvas-toggle.menu-icon
|
||||
%span
|
||||
%section.right
|
||||
%a.nav-branded.icon{href: cart_url}
|
||||
%i.fi-shopping-cart
|
||||
%span
|
||||
= cart_count
|
||||
items
|
||||
= render partial: "shared/menu/cart"
|
||||
%a{href: main_app.shop_path}
|
||||
{{ CurrentHub.name }}
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
.content#about
|
||||
%img.about.right{src: current_distributor.promo_image.url(:large)}
|
||||
%p= current_distributor.long_description.andand.html_safe
|
||||
.row
|
||||
.small-12.large-9.columns
|
||||
%p= current_distributor.long_description.andand.html_safe
|
||||
.small-12.large-3.columns
|
||||
%img.about.right{src: current_distributor.promo_image.url(:large)}
|
||||
|
||||
|
||||
@@ -1,15 +1,55 @@
|
||||
/ Will for all the things: please add logic to include this /only/ if data is available
|
||||
|
||||
.content#contact
|
||||
.panel
|
||||
%p
|
||||
%strong E
|
||||
%a{href: "mailto:#{current_distributor.email}"}= current_distributor.email
|
||||
- unless current_distributor.website.blank?
|
||||
%br
|
||||
%strong W
|
||||
%a{href: current_distributor.website}= current_distributor.website
|
||||
%br
|
||||
= [current_distributor.address.address1, current_distributor.address.address2].join ", "
|
||||
%br
|
||||
= current_distributor.address.city
|
||||
= current_distributor.address.state
|
||||
= current_distributor.address.zipcode
|
||||
.row
|
||||
.small-12.large-4.columns
|
||||
%h4=current_distributor.name
|
||||
%p
|
||||
= current_distributor.address.address1
|
||||
- if current_distributor.address.address2
|
||||
%br
|
||||
= current_distributor.address.address2
|
||||
%br
|
||||
= current_distributor.address.city
|
||||
= current_distributor.address.state
|
||||
= current_distributor.address.zipcode
|
||||
|
||||
.small-12.large-8.columns
|
||||
%ul.small-block-grid-1.large-block-grid-2{bindonce: true}
|
||||
- unless current_distributor.website.blank?
|
||||
%li
|
||||
%a{href: current_distributor.website, target: "_blank" }
|
||||
%i.fi-web
|
||||
= current_distributor.website
|
||||
|
||||
- unless current_distributor.email.blank?
|
||||
%li
|
||||
%a{href: current_distributor.email.reverse, mailto: true }
|
||||
%i.fi-mail
|
||||
%span.email
|
||||
= current_distributor.email.reverse
|
||||
|
||||
- unless current_distributor.twitter.blank?
|
||||
%li
|
||||
%a{href: current_distributor.twitter, target: "_blank" }
|
||||
%i.fi-social-twitter
|
||||
= current_distributor.twitter
|
||||
|
||||
- unless current_distributor.facebook.blank?
|
||||
%li
|
||||
%a{href: current_distributor.facebook, target: "_blank" }
|
||||
%i.fi-social-facebook
|
||||
= current_distributor.facebook
|
||||
|
||||
- unless current_distributor.linkedin.blank?
|
||||
%li
|
||||
%a{href: current_distributor.linkedin, target: "_blank" }
|
||||
%i.fi-social-linkedin
|
||||
= current_distributor.linkedin
|
||||
|
||||
- unless current_distributor.instagram.blank?
|
||||
%li
|
||||
%a{href: current_distributor.instagram, target: "_blank" }
|
||||
%i.fi-social-instagram
|
||||
= current_distributor.instagram
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
.content
|
||||
%ul
|
||||
- for group in current_distributor.groups
|
||||
%li
|
||||
%a{href: main_app.groups_path(anchor: "#/#group#{group.id}")}= group.name
|
||||
.row
|
||||
.small-12.columns
|
||||
%h5
|
||||
=current_distributor.name
|
||||
belongs to:
|
||||
%ul.ofn-list
|
||||
- for group in current_distributor.groups
|
||||
%li
|
||||
%a{href: main_app.groups_path(anchor: "#/#group#{group.id}")}= group.name
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
.content#producers{"ng-controller" => "ProducersTabCtrl"}
|
||||
%ul
|
||||
%li{"ng-repeat" => "producer in CurrentHub.producers"}
|
||||
= render partial: "modals/producer"
|
||||
.row
|
||||
.small-12.columns
|
||||
%h5
|
||||
= "#{current_distributor.name}'s producers:"
|
||||
%ul.ofn-list
|
||||
%li{"ng-repeat" => "producer in CurrentHub.producers"}
|
||||
= render partial: "modals/producer"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#tabs{"ng-controller" => "TabsCtrl"}
|
||||
.row
|
||||
%tabset
|
||||
%tabset.small-12.columns
|
||||
- for name, heading in { about: "About #{current_distributor.name}",
|
||||
producers: "Producers",
|
||||
groups: "Groups",
|
||||
|
||||
@@ -432,8 +432,8 @@ describe Enterprise do
|
||||
let(:supplier) { create(:supplier_enterprise) }
|
||||
let(:taxon1) { create(:taxon) }
|
||||
let(:taxon2) { create(:taxon) }
|
||||
let(:product1) { create(:simple_product, taxons: [taxon1]) }
|
||||
let(:product2) { create(:simple_product, taxons: [taxon1, taxon2]) }
|
||||
let(:product1) { create(:simple_product, primary_taxon: taxon1, taxons: [taxon1]) }
|
||||
let(:product2) { create(:simple_product, primary_taxon: taxon1, taxons: [taxon1, taxon2]) }
|
||||
|
||||
it "gets all taxons of all distributed products" do
|
||||
Spree::Product.stub(:in_distributor).and_return [product1, product2]
|
||||
|
||||
Reference in New Issue
Block a user