Merge branch 'master' into working

This commit is contained in:
Rob H
2014-07-03 10:15:45 +10:00
91 changed files with 671 additions and 254 deletions

View File

@@ -6,11 +6,13 @@
#= require angular
#= require angular-cookies
#= require angular-sanitize
#= require angular-animate
#= require angular-resource
#= require lodash.underscore.js
#= require angular-scroll.min.js
#= require angular-google-maps.min.js
#= require ../shared/mm-foundation-tpls-0.2.0-SNAPSHOT
#= require angular-timer.min.js
#= require ../shared/mm-foundation-tpls-0.2.2.min.js
#= require ../shared/bindonce.min.js
#= require ../shared/ng-infinite-scroll.min.js
#= require ../shared/angular-local-storage.js

View File

@@ -2,5 +2,7 @@ Darkswarm.controller "GroupsCtrl", ($scope, Groups, $anchorScroll, $rootScope) -
$scope.Groups = Groups
$scope.order = 'position'
$rootScope.$on "$locationChangeSuccess", (newRoute, oldRoute) ->
$anchorScroll()
#$rootScope.$on "$locationChangeSuccess", (newRoute, oldRoute) ->
#$anchorScroll()
#
#

View File

@@ -1,6 +1,6 @@
Darkswarm.controller "HubsCtrl", ($scope, Hubs, $document, $rootScope, HashNavigation) ->
$scope.Hubs = Hubs
$scope.hubs = Hubs.hubs
$scope.hubs = Hubs.visible
$rootScope.$on "$locationChangeSuccess", (newRoute, oldRoute) ->
if HashNavigation.active "hubs"

View File

@@ -1,2 +1,3 @@
Darkswarm.controller "ProducersTabCtrl", ($scope, CurrentHub) ->
Darkswarm.controller "ProducersTabCtrl", ($scope, CurrentHub, Enterprises) ->
# Injecting Enterprises so CurrentHub.producers is dereferenced
$scope.CurrentHub = CurrentHub

View File

@@ -5,10 +5,11 @@ window.Darkswarm = angular.module("Darkswarm", ["ngResource",
'infinite-scroll',
'angular-flash.service',
'templates',
'timer',
'ngSanitize',
'google-maps',
'duScroll',
'backstretch']).config ($httpProvider, $tooltipProvider, $locationProvider, $anchorScrollProvider) ->
]).config ($httpProvider, $tooltipProvider, $locationProvider, $anchorScrollProvider) ->
$httpProvider.defaults.headers.post['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')
$httpProvider.defaults.headers.put['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')
$httpProvider.defaults.headers['common']['X-Requested-With'] = 'XMLHttpRequest'

View File

@@ -6,7 +6,7 @@ Darkswarm.directive "activeTableHubLink", (CurrentHub, CurrentOrder) ->
link: (scope, elm, attr)->
# Swap out the text of the hub link depending on whether it'll change current hub
# To be used with ofnEmptiesCart
if CurrentHub.hub.id and CurrentHub.hub.id isnt scope.hub.id
if CurrentHub.hub?.id and CurrentHub.hub.id isnt scope.hub.id
scope.action = attr.change
else
scope.action = attr.shop

View File

@@ -3,7 +3,7 @@ Darkswarm.directive "ofnEmptiesCart", (CurrentHub, CurrentOrder, Navigation, sto
link: (scope, elm, attr)->
hub = scope.$eval(attr.ofnEmptiesCart)
# A hub is selected, we're changing to a different hub, and the cart isn't empty
if CurrentHub.hub.id and CurrentHub.hub.id isnt hub.id
if CurrentHub.hub?.id and CurrentHub.hub.id isnt hub.id
unless CurrentOrder.empty()
elm.bind 'click', (ev)->
ev.preventDefault()

View File

@@ -0,0 +1,7 @@
Darkswarm.directive "hubModal", ($modal)->
restrict: 'E'
replace: true
template: "<a>{{enterprise.name}}</a>"
link: (scope, elem, attrs, ctrl)->
elem.on "click", =>
scope.modalInstance = $modal.open(controller: ctrl, templateUrl: 'hub_modal.html', scope: scope)

View File

@@ -1,6 +0,0 @@
Darkswarm.directive "offcanvas", ->
restrict: "A"
link: (scope, el, attr) ->
el.find(".left-off-canvas-toggle").bind 'click', ->
el.toggleClass 'move-right'

View File

@@ -0,0 +1,9 @@
Darkswarm.directive "producerModal", ($modal)->
restrict: 'E'
replace: true
template: "<a ng-transclude></a>"
transclude: true
link: (scope, elem, attrs, ctrl)->
elem.on "click", =>
scope.modalInstance = $modal.open(controller: ctrl, templateUrl: 'producer_modal.html', scope: scope)

View File

@@ -0,0 +1,9 @@
Darkswarm.directive "productModal", ($modal)->
restrict: 'E'
replace: true
template: "<a ng-transclude></a>"
transclude: true
link: (scope, elem, attrs, ctrl)->
elem.on "click", =>
scope.modalInstance = $modal.open(controller: ctrl, templateUrl: 'product_modal.html', scope: scope)

View File

@@ -0,0 +1,10 @@
Darkswarm.filter "groups", (Matcher)->
(groups, text)->
groups ||= []
text ?= ""
groups.filter (group)=>
Matcher.match([
group.name, group.long_description
], text) || group.enterprises.some (e)->
Matcher.match [e.name], text

View File

@@ -0,0 +1,4 @@
Darkswarm.filter "visible", ->
(objects)->
objects.filter (obj)->
obj.visible

View File

@@ -0,0 +1,6 @@
Darkswarm.factory 'Dereferencer', ->
new class Dereferencer
dereference: (array, data)->
if array
for object, i in array
array[i] = data[object.id]

View File

@@ -1,4 +1,4 @@
Darkswarm.factory 'Enterprises', (enterprises, CurrentHub)->
Darkswarm.factory 'Enterprises', (enterprises, CurrentHub, Dereferencer)->
new class Enterprises
enterprises_by_id: {} # id/object pairs for lookup
constructor: ->
@@ -10,12 +10,6 @@ Darkswarm.factory 'Enterprises', (enterprises, CurrentHub)->
dereference: ->
if CurrentHub.hub?.id
CurrentHub.hub = @enterprises_by_id[CurrentHub.hub.id]
for enterprise in @enterprises
if enterprise.hubs
for hub, i in enterprise.hubs
enterprise.hubs[i] = @enterprises_by_id[hub.id]
if enterprise.producers
for producer, i in enterprise.producers
enterprise.producers[i] = @enterprises_by_id[producer.id]
Dereferencer.dereference enterprise.hubs, @enterprises_by_id
Dereferencer.dereference enterprise.producers, @enterprises_by_id

View File

@@ -1,4 +1,14 @@
Darkswarm.factory 'Groups', (groups) ->
Darkswarm.factory 'Groups', (groups, Enterprises, Dereferencer) ->
new class Groups
groups: groups
groups_by_id: {}
constructor: ->
@groups = groups
for group in @groups
@groups_by_id[group.id] = group
@dereference()
dereference: ->
for group in @groups
Dereferencer.dereference group.enterprises, Enterprises.enterprises_by_id
for enterprise in Enterprises.enterprises
Dereferencer.dereference enterprise.groups, @groups_by_id

View File

@@ -1,8 +1,9 @@
Darkswarm.factory 'Hubs', ($filter, Enterprises) ->
Darkswarm.factory 'Hubs', ($filter, Enterprises, visibleFilter) ->
new class Hubs
constructor: ->
@hubs = @order Enterprises.enterprises.filter (hub)->
hub.is_distributor
@visible = visibleFilter @hubs
order: (hubs)->
$filter('orderBy')(hubs, ['-active', '+orders_close_at'])

View File

@@ -1,7 +1,7 @@
Darkswarm.factory "OfnMap", (Enterprises, MapModal)->
Darkswarm.factory "OfnMap", (Enterprises, MapModal, visibleFilter)->
new class OfnMap
constructor: ->
@enterprises = (@extend(enterprise) for enterprise in Enterprises.enterprises)
@enterprises = (@extend(enterprise) for enterprise in visibleFilter(Enterprises.enterprises))
# Adding methods to each enterprise

View File

@@ -6,7 +6,7 @@ Darkswarm.factory "MapModal", ($modal, $rootScope)->
scope.enterprise = enterprise
if enterprise.is_distributor
scope.hub = enterprise
$modal.open(templateUrl: "map_modal_hub.html", scope: scope)
$modal.open(templateUrl: "hub_modal.html", scope: scope)
else
scope.producer = enterprise
$modal.open(templateUrl: "map_modal_producer.html", scope: scope)

View File

@@ -1,4 +1,4 @@
Darkswarm.factory 'Navigation', ($location) ->
Darkswarm.factory 'Navigation', ($location, $window) ->
new class Navigation
path: null
@@ -10,7 +10,6 @@ Darkswarm.factory 'Navigation', ($location) ->
$location.path(@path)
toggle: (path = false)=>
console.log "toggling"
@path = path || @path
if $location.path() == @path
$location.path("/")
@@ -18,4 +17,7 @@ Darkswarm.factory 'Navigation', ($location) ->
@navigate(path)
go: (path)->
window.location.pathname = path
if path.match /^http/
$window.location.href = path
else
$window.location.pathname = path

View File

@@ -1,6 +1,7 @@
Darkswarm.factory 'Producers', (Enterprises) ->
Darkswarm.factory 'Producers', (Enterprises, visibleFilter) ->
new class Producers
constructor: ->
@producers = Enterprises.enterprises.filter (enterprise)->
enterprise.is_primary_producer
@visible = visibleFilter @producers

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
%ng-include{src: "'partials/enterprise_header.html'"}
%ng-include{src: "'partials/enterprise_details.html'"}
%ng-include{src: "'partials/hub_details.html'"}
%ng-include{src: "'partials/close.html'"}

View File

@@ -1,37 +1,4 @@
.highlight
.highlight-top
%p.right
{{ [enterprise.address.city, enterprise.address.state] | printArray}}
%h3
%i.ofn-i_036-producers
{{ enterprise.name }}
%img.hero-img{"ng-src" => "{{enterprise.promo_image}}"}
.row{bindonce: true}
.small-12.large-8.columns
%div{"ng-if" => "enterprise.long_description.length > 0 || enterprise.logo"}
%h5.modal-header About
.about-container
%img.enterprise-logo{"bo-src" => "enterprise.logo", "bo-if" => "enterprise.logo"}
%p.text-small{"ng-bind-html" => "enterprise.long_description"}
.small-12.large-4.columns
%ng-include{src: "'partials/contact.html'"}
%ng-include{src: "'partials/follow.html'"}
.row.pad-top{bindonce: true, "ng-if" => "enterprise.hubs.length > 0"}
.cta-container.small-12.columns
%h5
%i.ofn-i_029-shopping-basket
Shop for {{enterprise.name}} products at:
%a.button.hub{"ng-repeat" => "hub in enterprise.hubs",
"bo-href" => "hub.path",
"bo-class" => "{primary: hub.active, secondary: !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}}
.button-address {{ hub.address.city }} , {{hub.address.state}}
%i.ofn-i_007-caret-right
%a.close-reveal-modal.outside{"ng-click" => "$close()"}
%i.ofn-i_009-close
%ng-include{src: "'partials/enterprise_header.html'"}
%ng-include{src: "'partials/enterprise_details.html'"}
%ng-include{src: "'partials/hub_actions.html'"}
%ng-include{src: "'partials/close.html'"}

View File

@@ -0,0 +1,2 @@
%a.close-reveal-modal.outside{"ng-click" => "$close()"}
%i.ofn-i_009-close

View File

@@ -5,8 +5,9 @@
{{ enterprise.phone }}
%p{"ng-if" => "enterprise.email"}
%a{"ng-href" => "mailto:{{enterprise.email | stripUrl}}", target: "_blank" }
{{ enterprise.email | stripUrl }}
%a{"ng-href" => "{{enterprise.email | stripUrl}}", target: "_blank", mailto: true}
%span.email
{{ enterprise.email | stripUrl }}
%p{"ng-if" => "enterprise.website"}
%a{"ng-href" => "http://{{enterprise.website | stripUrl}}", target: "_blank" }

View File

@@ -0,0 +1,10 @@
.row{bindonce: true}
.small-12.large-8.columns
%div{"ng-if" => "enterprise.long_description.length > 0 || enterprise.logo"}
%h5.modal-header About
.about-container
%img.enterprise-logo{"bo-src" => "enterprise.logo", "bo-if" => "enterprise.logo"}
%p.text-small{"ng-bind-html" => "enterprise.long_description"}
.small-12.large-4.columns
%ng-include{src: "'partials/contact.html'"}
%ng-include{src: "'partials/follow.html'"}

View File

@@ -0,0 +1,9 @@
.highlight
.highlight-top
%p.right
{{ [enterprise.address.city, enterprise.address.state] | printArray}}
%h3
%i.ofn-i_036-producers{"ng-show" => "!enterprise.is_distributor"}
%i.ofn-i_040-hub{"ng-show" => "enterprise.is_distributor"}
{{ enterprise.name }}
%img.hero-img{"ng-src" => "{{enterprise.promo_image}}"}

View File

@@ -0,0 +1,15 @@
.row.pad-top{bindonce: true, "ng-if" => "enterprise.hubs.length > 0"}
.cta-container.small-12.columns
%h5
%i.ofn-i_029-shopping-basket
Shop for {{enterprise.name}} products at:
%a.button.hub{"ng-repeat" => "hub in enterprise.hubs",
"bo-href" => "hub.path",
"bo-class" => "{primary: hub.active, secondary: !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}}
.button-address {{ hub.address.city }} , {{hub.address.state}}
%i.ofn-i_007-caret-right

View File

@@ -1,23 +1,3 @@
.highlight
.highlight-top
%p.right
{{ [enterprise.address.city, enterprise.address.state] | printArray}}
%h3
%i.ofn-i_040-hub
{{ enterprise.name }}
%img.hero-img{"ng-src" => "{{enterprise.promo_image}}"}
.row{bindonce: true}
.small-12.large-8.columns
%div{"ng-if" => "enterprise.long_description.length > 0 || enterprise.logo"}
%h5.modal-header About
.about-container
%img.enterprise-logo{"bo-src" => "enterprise.logo", "bo-if" => "enterprise.logo"}
%p.text-small{"ng-bind-html" => "enterprise.long_description"}
.small-12.large-4.columns
%ng-include{src: "'partials/contact.html'"}
%ng-include{src: "'partials/follow.html'"}
.row.pad-top{bindonce: true}
.cta-container.small-12.columns
.row
@@ -26,7 +6,6 @@
%i.ofn-i_029-shopping-basket
%span{"active-table-hub-link" => "enterprise", change: "Change hub to", shop: "Shop at"}
.small-12.large-6.columns.right
/ Needs logic to hide if nothing populated:
.right{"bo-if" => "enterprise.pickup || enterprise.delivery"}
Delivery options:
%span{"bo-if" => "enterprise.pickup"}
@@ -45,7 +24,3 @@
{{enterprise.name}}
.button-address {{ enterprise.address.city }} , {{enterprise.address.state}}
%i.ofn-i_007-caret-right
%a.close-reveal-modal.outside{"ng-click" => "$close()"}
%i.ofn-i_009-close

View File

@@ -0,0 +1,3 @@
%ng-include{src: "'partials/enterprise_header.html'"}
%ng-include{src: "'partials/enterprise_details.html'"}
%ng-include{src: "'partials/close.html'"}

View File

@@ -0,0 +1,9 @@
.row
.columns.small-12.large-6
%img.product-img{"ng-src" => "{{product.master.images[0].large_url}}", "ng-if" => "product.master.images[0]"}
.columns.small-12.large-6.product-header
%h2
%render-svg{path: "{{product.primary_taxon.icon}}"}
{{product.name}}
%p {{product.description}}
%ng-include{src: "'partials/close.html'"}

View File

@@ -0,0 +1,30 @@
.fade
opacity: 0
-webkit-transition: opacity .15s linear
transition: opacity .15s linear
.fade.in
opacity: 1
.reveal-modal.fade
-webkit-transition: -webkit-transform .3s ease-out
-moz-transition: -moz-transform .3s ease-out
-o-transition: -o-transform .3s ease-out
transition: transform .3s ease-out
-webkit-transform: translate(0, -25%)
-ms-transform: translate(0, -25%)
transform: translate(0, -25%)
.reveal-modal.in
-webkit-transform: translate(0, 0)
-ms-transform: translate(0, 0)
transform: translate(0, 0)
.reveal-modal-bg.fade
filter: alpha(opacity = 0)
opacity: 0
.reveal-modal-bg.in
filter: alpha(opacity = 50)
opacity: .5

View File

@@ -7,19 +7,24 @@
background-color: black
background-image: url("/assets/home/tagline-bg.jpg")
@include fullbg
height: 400px
height: 500px
padding: 40px 0px
h1, h2, p
h1, h2, span, small, timer
color: white
p
color: $clr-brick-light
h1
margin-bottom: 1em
margin-bottom: 3rem
h2
font-size: 1.6875rem
max-width: 610px
margin: 0 auto
padding-bottom: 0.5rem
a
color: $clr-brick-bright
&:hover, &:active, &:focus
color: $clr-brick-light-bright
@include textsoftpress
@include textsoftpress
a.button.primary
color: white

View File

@@ -21,7 +21,7 @@
.hero-img-small
background-color: #333
width: 100%
min-height: 60px
// min-height: 60px
height: inherit
overflow: hidden
margin: 0 0 1rem 0 !important

View File

@@ -29,7 +29,8 @@
max-height: 200px
min-height: 20px
margin-bottom: 0.5rem
overflow: scroll
overflow-y: scroll
overflow-x: hidden
border-bottom: 1px solid #999
@include box-shadow(0 2px 2px -2px #999)

View File

@@ -4,4 +4,11 @@
.producers
@include fullwidthbg
background-image: url("/assets/producers/producers-pg-bg.jpg")
background-repeat: no-repeat
background-repeat: no-repeat
a
color: $clr-turquoise
&:hover, &:active, &:focus
color: $clr-turquoise-bright
a.button.primary
&:hover, &:active, &:focus
color: white

View File

@@ -38,6 +38,8 @@
ordercycle
p.text-right
max-width: 400px
@media all and (max-width: 640px)
float: left
clear: left
@@ -45,6 +47,8 @@
width: 100%
margin-top: 10px
background: #e5e5e5
p.text-right
max-width: 100%
float: right
form.custom
text-align: right

View File

@@ -2,10 +2,27 @@
@import mixins
@import branding
// Foundation overrides
#tabs .tabs-content > .content p
max-width: 100% !important
.tabs-content > .content
padding-top: 0 !important
// Tabs styling
#tabs
background: url("/assets/gray_jean.png") top left repeat
@include box-shadow(inset 0 2px 3px 0 rgba(0,0,0,0.15))
display: block
color: $dark-grey
.panel
border-color: rgba(219, 88, 61, 0.5)
background-color: rgba(255, 255, 255, 0)
// @include box-shadow( 0 1px 1px 0 rgba(255,255,255,1))
dl dd a
@include avenir

View File

@@ -138,9 +138,8 @@ class CheckoutController < Spree::CheckoutController
render :edit and return
end
redirect_to(main_app.shop_paypal_payment_url(@order, :payment_method_id => payment_method.id))
render json: {path: main_app.paypal_payment_url(@order, :payment_method_id => payment_method.id)}, status: 200
true
end
# Overriding to customize the cancel url

View File

@@ -1,12 +1,17 @@
module SharedHelper
def inject_enterprises
inject_json "enterprises" , "enterprises"
inject_json_ams "enterprises", Enterprise.all, Api::EnterpriseSerializer, active_distributors: @active_distributors
end
def inject_json(name, partial, opts = {})
render partial: "json/injection", locals: {name: name, partial: partial}.merge(opts)
end
def inject_json_ams(name, data, serializer, opts = {})
json = ActiveModel::ArraySerializer.new(data, {each_serializer: serializer}.merge(opts)).to_json
render partial: "json/injection_ams", locals: {name: name, json: json}
end
def distributor_link_class(distributor)
cart = current_order(true)
@active_distributors ||= Enterprise.distributors_with_active_order_cycles

View File

@@ -156,7 +156,7 @@ class Enterprise < ActiveRecord::Base
end
def distributors
self.relatives.is_distributor.visible
self.relatives.is_distributor
end
def website
@@ -170,7 +170,7 @@ class Enterprise < ActiveRecord::Base
end
def suppliers
self.relatives.is_primary_producer.visible
self.relatives.is_primary_producer
end
def distributed_variants
@@ -187,15 +187,17 @@ class Enterprise < ActiveRecord::Base
# Return all taxons for all distributed products
def distributed_taxons
Spree::Product.in_distributor(self).map do |p|
p.taxons
end.flatten.uniq
Spree::Taxon.
joins(:products).
where('spree_products.id IN (?)', Spree::Product.in_distributor(self)).
select('DISTINCT spree_taxons.*')
end
# Return all taxons for all supplied products
def supplied_taxons
Spree::Product.in_supplier(self).map do |p|
p.taxons
end.flatten.uniq
Spree::Taxon.
joins(:products).
where('spree_products.id IN (?)', Spree::Product.in_supplier(self)).
select('DISTINCT spree_taxons.*')
end
private

View File

@@ -0,0 +1,7 @@
class Api::AddressSerializer < ActiveModel::Serializer
attributes :id, :zipcode, :city, :state
def state
object.state.abbr
end
end

View File

@@ -0,0 +1,62 @@
class Api::EnterpriseSerializer < ActiveModel::Serializer
attributes :name, :id, :description, :latitude, :longitude,
:long_description, :website, :instagram, :linkedin, :twitter,
:facebook, :is_primary_producer, :is_distributor, :phone, :visible,
:email, :hash, :logo, :promo_image, :icon, :path,
:pickup, :delivery, :active, :orders_close_at
has_many :distributed_taxons, key: :taxons, serializer: Api::TaxonSerializer
has_many :supplied_taxons, serializer: Api::TaxonSerializer
has_many :distributors, key: :hubs, serializer: Api::IdSerializer
has_many :suppliers, key: :producers, serializer: Api::IdSerializer
has_one :address, serializer: Api::AddressSerializer
def pickup
object.shipping_methods.where(:require_ship_address => false).present?
end
def delivery
object.shipping_methods.where(:require_ship_address => true).present?
end
def active
@options[:active_distributors].andand.include?(object)
end
def orders_close_at
OrderCycle.first_closing_for(object).andand.orders_close_at
end
def email
object.email.to_s.reverse
end
def hash
object.to_param
end
def logo
object.logo(:medium) if object.logo.exists?
end
def promo_image
object.promo_image(:large) if object.promo_image.exists?
end
def icon
if object.is_primary_producer? and object.is_distributor?
"/assets/map-icon-both.svg"
elsif object.is_primary_producer?
"/assets/map-icon-producer.svg"
else
"/assets/map-icon-hub.svg"
end
end
# TODO when ActiveSerializers supports URL helpers
# Then refactor. See readme https://github.com/rails-api/active_model_serializers
def path
"/enterprises/#{object.to_param}/shop"
end
end

View File

@@ -0,0 +1,3 @@
class Api::IdSerializer < ActiveModel::Serializer
attributes :id
end

View File

@@ -0,0 +1,7 @@
class Api::TaxonSerializer < ActiveModel::Serializer
attributes :id, :name, :permalink, :icon
def icon
object.icon(:original)
end
end

View File

@@ -1,4 +1,5 @@
= inject_enterprises
:javascript
angular.module('Darkswarm').value('groups', #{render partial: "json/groups", object: @groups})
@@ -19,7 +20,7 @@
"ng-debounce" => "150",
"ofn-disable-enter" => true}
.group{"ng-repeat" => "group in Groups.groups | filter:query | orderBy:order",
.group{"ng-repeat" => "group in Groups.groups | groups:query | orderBy:order",
name: "group{{group.id}}",
id: "group{{group.id}}"}
.row.pad-top{bindonce: true}
@@ -36,10 +37,12 @@
.small-6.columns
%p {{ group.long_description }}
.small-6.columns
%h5 Our hubs & producers
%h5 Our hubs &amp; producers
%ul.small-block-grid-2
%li{"ng-repeat" => "enterprise in group.enterprises"}
%a{"bo-href" => "enterprise.path"} {{ enterprise.name }}
%li{"ng-repeat" => "enterprise in group.enterprises", "scroll-after-load" => true}
%hub-modal{"ng-if" => "enterprise.is_distributor"}
%producer-modal{"ng-if" => "!enterprise.is_distributor", "show-hub-actions" => 'true'}
{{ enterprise.name }}
.row.group_footer
.small-12.columns

View File

@@ -28,9 +28,9 @@
Our producers
%ul.bullet-list
%li{"ng-repeat" => "enterprise in hub.producers"}
= render partial: "modals/producer"
%producer-modal {{ enterprise.name }}
.row.active_table_row.link{"ng-show" => "open()", "bo-if" => "hub.active"}
.row.active_table_row.link{"ng-show" => "open()"}
.cta-container.columns.small-12
.row
.columns.small-12

View File

@@ -2,10 +2,16 @@
.row
.small-12.text-center.columns
%h1= image_tag "ofn_logo_beta.png", title: "Open Food Network (beta)"
%h2 An open marketplace that makes it easy to find, buy, sell and move sustainable local food.
%ofn-modal{title: "Learn more"}
= render partial: "modals/learn_more"
%h2 We're crowdfunding right now!
%h5
%timer{"end-time" => '1407679200000'}
{{days}} days, {{hours}} hrs, {{minutes}} mins & {{seconds}} secs to go
%p Help us make Open Food Network the best it can be:
%a.button.primary{href: "http://startsomegood.com/openfoodnetwork", target:"_blank"} Support now
/ %h2 An open marketplace that makes it easy to find, buy, sell and move sustainable local food.
%br
%ofn-modal{title: "Learn more"}
= render partial: "modals/learn_more"
= render partial: "home/hubs"

View File

@@ -2,7 +2,7 @@ collection @groups
attributes :id, :name, :position, :description, :long_description
child enterprises: :enterprises do
extends 'json/enterprises'
attributes :id
end
node :logo do |group|

View File

@@ -0,0 +1,2 @@
:javascript
angular.module('Darkswarm').value("#{name.to_s}", #{json})

View File

@@ -13,8 +13,10 @@ end
node :delivery do |hub|
hub.shipping_methods.where(:require_ship_address => true).present?
end
node :active do |hub|
@active_distributors.include?(hub)
if @active_distributors
node :active do |hub|
@active_distributors.include?(hub)
end
end
node :orders_close_at do |hub|
OrderCycle.first_closing_for(hub).andand.orders_close_at

View File

@@ -4,8 +4,11 @@
%meta{name: 'viewport', content: "width=device-width,initial-scale=1.0"}/
%title= content_for?(:title) ? yield(:title) : 'Welcome to Open Food Network'
= favicon_link_tag "favicon.png"
%link{href: "http://fonts.googleapis.com/css?family=Open+Sans:400,700", rel: "stylesheet", type: "text/css"}/
- if Rails.env.production?
= favicon_link_tag
- else
= favicon_link_tag "/favicon-staging.ico"
%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"}

View File

@@ -23,8 +23,9 @@
{{ enterprise.phone }}
%p{"bo-if" => "enterprise.email"}
%a{"ng-href" => "mailto:{{enterprise.email | stripUrl}}", target: "_blank" }
{{ enterprise.email | stripUrl }}
%a{"ng-href" => "{{enterprise.email | stripUrl}}", target: "_blank", mailto: true }
%span.email
{{ enterprise.email | stripUrl }}
%p{"bo-show" => "enterprise.website"}
%a{"ng-href" => "http://{{enterprise.website}}", target: "_blank" }

View File

@@ -1,11 +0,0 @@
%ofn-modal{title: "{{product.name}}"}
.row
.columns.small-12.large-6
%img.product-img{"ng-src" => "{{product.master.images[0].large_url}}", "ng-if" => "product.master.images[0]"}
.columns.small-12.large-6.product-header
%h2
%render-svg{path: "{{product.primary_taxon.icon}}"}
{{product.name}}
%p {{product.description}}
%a.close-reveal-modal{"ng-click" => "$close()"}
%i.ofn-i_009-close

View File

@@ -14,16 +14,16 @@
%i.ofn-i_020-search
%input{type: :text,
"ng-model" => "query",
placeholder: "Search postcode, suburb or hub name...",
placeholder: "Search postcode, suburb or producer name...",
"ng-debounce" => "150",
"ofn-disable-enter" => true}
.row{bindonce: true}
.small-12.columns
.active_table
%producer.active_table_node.row{id: "{{producer.path}}",
%producer.active_table_node.row.animate-repeat{id: "{{producer.path}}",
"scroll-after-load" => true,
"ng-repeat" => "producer in filteredProducers = (Producers.producers | filterProducers:query)",
"ng-repeat" => "producer in filteredProducers = (Producers.visible | filterProducers:query)",
"ng-controller" => "ProducerNodeCtrl",
"ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !producer.active}",
id: "{{producer.hash}}"}

View File

@@ -12,7 +12,7 @@
%input.button.primary.right{type: :submit, value: "Add to Cart"}
%div{bindonce: true}
%product{"ng-controller" => "ProductNodeCtrl",
%product.animate-repeat{"ng-controller" => "ProductNodeCtrl",
"ng-repeat" => "product in Product.products | products:query | orderBy:ordering.order | limitTo: limit track by product.id"}
%div
= render partial: "shop/products/summary"

View File

@@ -1,5 +1,5 @@
.small-1.columns
%span.bulk{"bo-if" => "product.group_buy"} bulk
%i.ofn-i_056-bulk{"bo-if" => "product.group_buy"}
&nbsp;
.small-4.columns
@@ -15,7 +15,7 @@
name: "variants[{{product.master.id}}]",
id: "variants_{{product.master.id}}",
"ng-model" => "product.quantity"}
%small {{ product.master.unit_to_display }}
%small x {{ product.master.unit_to_display }}
-# WITH GROUP BUY
.small-2.columns{"bo-if" => "product.group_buy"}
@@ -36,7 +36,7 @@
max: "{{product.on_demand && 9999 || product.count_on_hand }}",
name: "variant_attributes[{{product.master.id}}][max_quantity]",
"ng-model" => "product.max_quantity"}
{{ product.master.unit_to_display }}
%small x {{ product.master.unit_to_display }}
.small-2.columns.text-right
{{ product.price | currency }}

View File

@@ -1,14 +1,15 @@
.row.summary
.small-1.columns
%img{"bo-src" => "product.master.images[0].small_url"}
%product-modal
%img{"bo-src" => "product.master.images[0].small_url"}
.small-4.columns.summary-header
%render-svg{path: "{{product.primary_taxon.icon}}"}
= render partial: "modals/product"
%product-modal {{ product.name }}
.small-5.columns
%i.ofn-i_036-producers
= render partial: "modals/producer"
%producer-modal {{ enterprise.name }}
.small-2.columns.summary-price.text-right.price
%span{"ng-if" => "hasVariants"}

View File

@@ -2,7 +2,7 @@
"ng-repeat" => "variant in product.variants"}
.small-1.columns
%span.bulk{"bo-if" => "product.group_buy"} bulk
%i.ofn-i_056-bulk{"bo-if" => "product.group_buy"}
&nbsp;
.small-4.columns
@@ -18,7 +18,7 @@
max: "{{variant.on_demand && 9999 || variant.count_on_hand }}",
name: "variants[{{variant.id}}]", id: "variants_{{variant.id}}",
"bo-model" => "variant.quantity"}
%small {{ variant.unit_to_display }}
%small x {{ variant.unit_to_display }}
-# WITH GROUP BUY
.small-2.columns{"bo-if" => "product.group_buy"}
@@ -39,7 +39,7 @@
max: "{{variant.on_demand && 9999 || variant.count_on_hand }}",
name: "variant_attributes[{{variant.id}}][max_quantity]",
"ng-model" => "variant.max_quantity"}
%small {{ variant.unit_to_display }}
%small x {{ variant.unit_to_display }}
.small-2.columns.text-right.price
{{ variant.price | currency }}

View File

@@ -1,9 +1,7 @@
.content#about{"ng-controller" => "AboutUsCtrl", bindonce: true}
.row
.small-12.large-6.columns
%img.hero-img-small{"bo-src" => "CurrentHub.hub.promo_image"}
%p.small-text{"bo-html" => "CurrentHub.hub.long_description"}
.small-12.large-3.columns
.small-12.large-8.columns.panel
%img.hero-img-small{"bo-src" => "CurrentHub.hub.promo_image", "bo-if" => "CurrentHub.hub.promo_image"}
%p{"bo-html" => "CurrentHub.hub.long_description"}
.small-12.large-4.columns
&nbsp;
.small-12.large-3.columns
%img{"bo-src" => "CurrentHub.hub.logo", "bo-if" => "CurrentHub.hub.logo"}

View File

@@ -4,52 +4,57 @@
.panel
.row
.small-12.large-4.columns
%h4=current_distributor.name
%p
= current_distributor.address.address1
- unless current_distributor.address.address2.blank?
%br
= current_distributor.address.address2
%br
= current_distributor.address.city
= current_distributor.address.state
= current_distributor.address.zipcode
- if current_distributor.address.address1 || current_distributor.address.address2 || current_distributor.address.city || current_distributor.address.state || current_distributor.address.zipcode
%div.modal-centered
%h5.modal-header=current_distributor.name
%p
= current_distributor.address.address1
- unless current_distributor.address.address2.blank?
%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: "http://#{current_distributor.website}", target: "_blank" }
%i.ofn-i_049-web
= current_distributor.website
.small-12.large-4.columns
- if current_distributor.website || current_distributor.email
%div.modal-centered
%h5.modal-header Contact
- unless current_distributor.website.blank?
%p
%a{href: "http://#{current_distributor.website}", target: "_blank" }
= current_distributor.website
- unless current_distributor.email.blank?
%p
%a{href: current_distributor.email.reverse, mailto: true}
%span.email
= current_distributor.email.reverse
- unless current_distributor.email.blank?
%li
%a{href: current_distributor.email.reverse, mailto: true }
%i.ofn-i_050-mail-circle
%span.email
= current_distributor.email.reverse
.small-12.large-4.columns
- if current_distributor.twitter.present? || current_distributor.facebook.present? || current_distributor.linkedin.present? || current_distributor.instagram.present?
%div.modal-centered
%h5.modal-header Follow
%div.follow-icons
- unless current_distributor.twitter.blank?
%span
%a{href: "http://twitter.com/#{current_distributor.twitter}", target: "_blank" }
%i.ofn-i_041-twitter
- unless current_distributor.twitter.blank?
%li
%a{href: "http://twitter.com/#{current_distributor.twitter}", target: "_blank" }
%i.ofn-i_041-twitter
= current_distributor.twitter
- unless current_distributor.facebook.blank?
%span
%a{href: "http://#{current_distributor.facebook}", target: "_blank" }
%i.ofn-i_044-facebook
= current_distributor.facebook
- unless current_distributor.facebook.blank?
%li
%a{href: "http://#{current_distributor.facebook}", target: "_blank" }
%i.ofn-i_044-facebook
= current_distributor.facebook
- unless current_distributor.linkedin.blank?
%span
%a{href: "http://#{current_distributor.linkedin}", target: "_blank" }
%i.ofn-i_042-linkedin
= current_distributor.linkedin
- unless current_distributor.linkedin.blank?
%li
%a{href: "http://#{current_distributor.linkedin}", target: "_blank" }
%i.ofn-i_042-linkedin
= current_distributor.linkedin
- unless current_distributor.instagram.blank?
%li
%a{href: "http://instagram.com.#{current_distributor.instagram}", target: "_blank" }
%i.ofn-i_043-instagram
= current_distributor.instagram
- unless current_distributor.instagram.blank?
%span
%a{href: "http://instagram.com.#{current_distributor.instagram}", target: "_blank" }
%i.ofn-i_043-instagram
= current_distributor.instagram

View File

@@ -1,10 +1,12 @@
.content
.row
.small-12.columns
%h5
=current_distributor.name
belongs to:
%ul.bullet-list
- for group in current_distributor.groups
%li
%a{href: main_app.groups_path(anchor: "#/#group#{group.id}")}= group.name
.small-12.columns.panel
- if current_distributor.groups.length > 0
%h5
=current_distributor.name
is part of:
%ul.bullet-list
- for group in current_distributor.groups
%li
%a{href: main_app.groups_path + "/#/#group#{group.id}"}
= group.name

View File

@@ -3,13 +3,15 @@
angular.module('Darkswarm').value('orderCycleData', #{render "json/order_cycle"})
- if @order_cycles and @order_cycles.empty?
Orders are currently closed for this hub
%p
Please contact your hub directly to see if they accept late orders,
or wait until the next cycle opens.
= render partial: "shopping_shared/next_order_cycle"
= render partial: "shopping_shared/last_order_cycle"
%h4.text-right
%i.ofn-i_032-closed-sign
Orders are closed
%p.text-right Please wait until the next cycle opens (or contact us directly to see if we can accept any late orders)
.text-right
%small
%em
= render partial: "shopping_shared/next_order_cycle"
= render partial: "shopping_shared/last_order_cycle"
- else
%form.custom

View File

@@ -1,8 +1,8 @@
.content#producers{"ng-controller" => "ProducersTabCtrl"}
.row
.small-12.columns
%h5
= "#{current_distributor.name}'s producers:"
.small-12.columns.panel
%h5
{{CurrentHub.hub.name}}'s producers:
%ul.bullet-list
%li{"ng-repeat" => "enterprise in CurrentHub.hub.producers"}
= render partial: "modals/producer"

View File

@@ -1,4 +1,5 @@
- @body_id = 'cart'
= inject_enterprises
.darkswarm
- content_for :order_cycle_form do
%strong.avenir

View File

@@ -1,3 +1,5 @@
= inject_enterprises
.darkswarm
- content_for :order_cycle_form do
%strong.avenir