diff --git a/app/assets/javascripts/darkswarm/controllers/tabs/about_us_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/tabs/about_us_controller.js.coffee new file mode 100644 index 0000000000..c86cf12286 --- /dev/null +++ b/app/assets/javascripts/darkswarm/controllers/tabs/about_us_controller.js.coffee @@ -0,0 +1,2 @@ +Darkswarm.controller "AboutUsCtrl", ($scope, CurrentHub) -> + $scope.CurrentHub = CurrentHub diff --git a/app/assets/javascripts/darkswarm/services/current_hub.js.coffee b/app/assets/javascripts/darkswarm/services/current_hub.js.coffee index 68fcd6e3f6..dc281b0da5 100644 --- a/app/assets/javascripts/darkswarm/services/current_hub.js.coffee +++ b/app/assets/javascripts/darkswarm/services/current_hub.js.coffee @@ -1,5 +1,2 @@ -Darkswarm.factory 'CurrentHub', ($location, $filter, currentHub) -> - new class CurrentHub - constructor: -> - @[k] = v for k, v of currentHub - +Darkswarm.factory 'CurrentHub', ($location, $filter, currentHub, Enterprises) -> + Enterprises.enterprises_by_id[currentHub.id] || {} diff --git a/app/assets/javascripts/templates/map_modal_hub.html.haml b/app/assets/javascripts/templates/map_modal_hub.html.haml index 6e390155c9..79301798c4 100644 --- a/app/assets/javascripts/templates/map_modal_hub.html.haml +++ b/app/assets/javascripts/templates/map_modal_hub.html.haml @@ -13,7 +13,7 @@ %h5.modal-header About .about-container %img.enterprise-logo{"bo-src" => "enterprise.logo", "bo-if" => "enterprise.logo"} - %p.modal-small{"ng-bind-html" => "enterprise.long_description"} + %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'"} @@ -43,7 +43,7 @@ %i.ofn-i_033-open-sign{"bo-if" => "enterprise.active"} %i.ofn-i_032-closed-sign{"bo-if" => "!enterprise.active"} {{enterprise.name}} - .button-address ( {{ enterprise.address.city }} , {{enterprise.address.state}} ) + .button-address {{ enterprise.address.city }} , {{enterprise.address.state}} %i.ofn-i_007-caret-right %a.close-reveal-modal.outside{"ng-click" => "$close()"} diff --git a/app/assets/javascripts/templates/map_modal_producer.html.haml b/app/assets/javascripts/templates/map_modal_producer.html.haml index 804a81111e..23ae109b3e 100644 --- a/app/assets/javascripts/templates/map_modal_producer.html.haml +++ b/app/assets/javascripts/templates/map_modal_producer.html.haml @@ -13,7 +13,7 @@ %h5.modal-header About .about-container %img.enterprise-logo{"bo-src" => "enterprise.logo", "bo-if" => "enterprise.logo"} - %p.modal-small{"ng-bind-html" => "enterprise.long_description"} + %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'"} diff --git a/app/assets/stylesheets/darkswarm/active_table.css.sass b/app/assets/stylesheets/darkswarm/active_table.css.sass index 57c28f3d3e..33067b022a 100644 --- a/app/assets/stylesheets/darkswarm/active_table.css.sass +++ b/app/assets/stylesheets/darkswarm/active_table.css.sass @@ -52,14 +52,6 @@ border-left: 1px solid $dark-grey border-right: 1px solid $dark-grey border-bottom: 1px solid $dark-grey - // &:hover - // background-color: $disabled-dark - // a - // display: block - // padding: 0.8em 0.5em - // margin: 0 -0.9375rem - // &, & * - // color: white p padding-top: 1em diff --git a/app/assets/stylesheets/darkswarm/images.css.sass b/app/assets/stylesheets/darkswarm/images.css.sass index 61eab80ca4..5c4d4ff8e5 100644 --- a/app/assets/stylesheets/darkswarm/images.css.sass +++ b/app/assets/stylesheets/darkswarm/images.css.sass @@ -18,6 +18,14 @@ max-height: 260px overflow: hidden +.hero-img-small + background-color: #333 + width: 100% + min-height: 60px + height: inherit + overflow: hidden + margin: 0 0 1rem 0 !important + .producer-logo max-width: 220px diff --git a/app/assets/stylesheets/darkswarm/menu.css.sass b/app/assets/stylesheets/darkswarm/menu.css.sass index 54807e3977..0460367e87 100644 --- a/app/assets/stylesheets/darkswarm/menu.css.sass +++ b/app/assets/stylesheets/darkswarm/menu.css.sass @@ -9,6 +9,10 @@ nav @include textpress // Default overrides - big menu + + .top-bar-section ul li.ofn-logo > a + display: table-cell + vertical-align: middle .top-bar-section .has-dropdown > a padding-right: 15px !important diff --git a/app/assets/stylesheets/darkswarm/modal-enterprises.css.sass b/app/assets/stylesheets/darkswarm/modal-enterprises.css.sass index a9b5cae2a1..d3e9d1af22 100644 --- a/app/assets/stylesheets/darkswarm/modal-enterprises.css.sass +++ b/app/assets/stylesheets/darkswarm/modal-enterprises.css.sass @@ -91,17 +91,9 @@ .cta-container padding-bottom: 0.75rem padding-top: 0.5rem - .button.hub - margin-bottom: 0.25rem // Generic styles for use -.modal-small - font-size: 0.875rem - margin-bottom: 0.5rem - &, & * - font-size: 0.875rem - .modal-centered text-align: center p diff --git a/app/assets/stylesheets/darkswarm/modals.css.sass b/app/assets/stylesheets/darkswarm/modals.css.sass index 0ae6e31d93..7121e7ea69 100644 --- a/app/assets/stylesheets/darkswarm/modals.css.sass +++ b/app/assets/stylesheets/darkswarm/modals.css.sass @@ -22,3 +22,18 @@ dialog .close-reveal-modal.outside, .reveal-modal .close-reveal-modal.outside &:hover, &:active, &:focus text-shadow: 0 1px 3px #333 border: 1px solid white + + @media all and (max-width: 640px) + top: 0.5rem + right: 0.5rem + font-size: 2rem + color: white + text-shadow: none + padding: 0.25rem + background-color: rgba(150,150,150,0.85) + @include border-radius(999999) + border: 1px solid transparent + &:hover, &:active, &:focus + text-shadow: 0 1px 3px #333 + border: 1px solid white + diff --git a/app/assets/stylesheets/darkswarm/producer_node.css.sass b/app/assets/stylesheets/darkswarm/producer_node.css.sass index 55a0ec0f77..0a91c109ff 100644 --- a/app/assets/stylesheets/darkswarm/producer_node.css.sass +++ b/app/assets/stylesheets/darkswarm/producer_node.css.sass @@ -16,6 +16,7 @@ .active_table_row:nth-child(2) border-left: 1px solid $clr-turquoise border-right: 1px solid $clr-turquoise + border-bottom: 1px solid $clr-turquoise .active_table_row.link border-left: 1px solid $clr-turquoise border-right: 1px solid $clr-turquoise diff --git a/app/assets/stylesheets/darkswarm/taxons.css.sass b/app/assets/stylesheets/darkswarm/taxons.css.sass index 57ae6e6b70..d7d60fa31c 100644 --- a/app/assets/stylesheets/darkswarm/taxons.css.sass +++ b/app/assets/stylesheets/darkswarm/taxons.css.sass @@ -6,22 +6,38 @@ display: inline-block line-height: 1 margin-right: 0.5rem - margin-bottom: 0.2rem + margin-bottom: 0.35rem text-transform: uppercase - font-size: 1rem - // border: 1px solid $disabled-bright - padding: 0.25rem 0.5rem 0.25rem 0.35rem + font-weight: 300 + font-size: 0.875rem + background: rgba(235,235,235,0.5) + color: #555 + @include border-radius(3px) + padding: 0.25rem 0.5rem 0.35rem 0.35rem render-svg svg width: 16px height: 16px path - fill: $dark-grey + fill: #555 &, &* display: inline-block - color: $dark-grey + color: #555 // &:hover, &.hover, &:active // background: rgba(255,255,255,0.5) + +.product-header + render-svg + svg + width: 32px + height: 32px + path + fill: black + @media all and (max-width: 640px) + render-svg + svg + width: 24px + height: 24px .summary-header @include csstrans diff --git a/app/assets/stylesheets/darkswarm/typography.css.sass b/app/assets/stylesheets/darkswarm/typography.css.sass index fac62dfcb6..8dfe9eb9d9 100644 --- a/app/assets/stylesheets/darkswarm/typography.css.sass +++ b/app/assets/stylesheets/darkswarm/typography.css.sass @@ -29,6 +29,12 @@ a small, .small font-size: 0.75rem +.text-small + font-size: 0.875rem + margin-bottom: 0.5rem + &, & * + font-size: 0.875rem + @mixin avenir font-family: "AvenirBla_IE", "AvenirBla" diff --git a/app/views/checkout/edit.html.haml b/app/views/checkout/edit.html.haml index 0e8b80255c..156f435970 100644 --- a/app/views/checkout/edit.html.haml +++ b/app/views/checkout/edit.html.haml @@ -1,3 +1,5 @@ += inject_enterprises + .darkswarm - content_for :order_cycle_form do %strong.avenir diff --git a/app/views/home/_fat.html.haml b/app/views/home/_fat.html.haml index b70e195fa1..f9c0db6810 100644 --- a/app/views/home/_fat.html.haml +++ b/app/views/home/_fat.html.haml @@ -1,28 +1,34 @@ .row.active_table_row{"ng-show" => "open()"} - .columns.small-4 - %h5 - %i.ofn-i_029-shopping-basket - Shop for - %p.trans-sentence - %span.fat-taxons{"ng-repeat" => "taxon in hub.taxons"} - %render-svg{path: "{{taxon.icon}}"} - {{taxon.name}} - .columns.small-4 - %h5 Delivery options - %ol - %li.pickup{"bo-if" => "hub.pickup"} - %i.ofn-i_038-takeaway - Pickup - %li.delivery{"bo-if" => "hub.delivery"} - %i.ofn-i_039-delivery - Delivery - .columns.small-4 - %h5 - %i.ofn-i_036-producers - Our producers - %ul.bullet-list - %li{"ng-repeat" => "producer in hub.producers"} - = render partial: "modals/producer" + .columns.small-12.large-4 +   + %div{"bo-if" => "hub.taxons"} + %h5 + %i.ofn-i_029-shopping-basket + Shop for + %p.trans-sentence + %span.fat-taxons{"ng-repeat" => "taxon in hub.taxons"} + %render-svg{path: "{{taxon.icon}}"} + {{taxon.name}} + .columns.small-12.large-4 +   + %div{"bo-if" => "hub.pickup || hub.delivery"} + %h5 Delivery options + %ol + %li.pickup{"bo-if" => "hub.pickup"} + %i.ofn-i_038-takeaway + Pickup + %li.delivery{"bo-if" => "hub.delivery"} + %i.ofn-i_039-delivery + Delivery + .columns.small-12.large-4 +   + %div{"bo-if" => "hub.producers"} + %h5 + %i.ofn-i_036-producers + Our producers + %ul.bullet-list + %li{"ng-repeat" => "enterprise in hub.producers"} + = render partial: "modals/producer" .row.active_table_row.link{"ng-show" => "open()", "bo-if" => "hub.active"} .cta-container.columns.small-12 @@ -38,5 +44,5 @@ %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] | printArray }}) + .button-address {{ [hub.address.city, hub.address.state] | printArray }} %i.ofn-i_007-caret-right diff --git a/app/views/home/_hubs.html.haml b/app/views/home/_hubs.html.haml index 55b8cc29ca..a7c61f92c4 100644 --- a/app/views/home/_hubs.html.haml +++ b/app/views/home/_hubs.html.haml @@ -1,6 +1,5 @@ += inject_enterprises #hubs.hubs{"ng-controller" => "HubsCtrl"} - = inject_enterprises - .row .small-12.columns.text-center %h1 Ready to shop? diff --git a/app/views/json/_current_hub.rabl b/app/views/json/_current_hub.rabl index 7f615bb07a..33bacd38b1 100644 --- a/app/views/json/_current_hub.rabl +++ b/app/views/json/_current_hub.rabl @@ -1,8 +1,2 @@ object current_distributor -attributes :name, :id - -if current_distributor - child suppliers: :producers do - extends "json/producer" - end -end +attributes :id diff --git a/app/views/map/index.html.haml b/app/views/map/index.html.haml index e7f6006ae4..3c9e9b64ec 100644 --- a/app/views/map/index.html.haml +++ b/app/views/map/index.html.haml @@ -1,5 +1,3 @@ -= inject_enterprises - .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"} diff --git a/app/views/modals/_product.html.haml b/app/views/modals/_product.html.haml index 7c45a6ccab..6d50f9c09d 100644 --- a/app/views/modals/_product.html.haml +++ b/app/views/modals/_product.html.haml @@ -2,7 +2,7 @@ .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 + .columns.small-12.large-6.product-header %h2 %render-svg{path: "{{product.primary_taxon.icon}}"} {{product.name}} diff --git a/app/views/producers/_fat.html.haml b/app/views/producers/_fat.html.haml index 8290e8195e..46c313aa88 100644 --- a/app/views/producers/_fat.html.haml +++ b/app/views/producers/_fat.html.haml @@ -1,25 +1,36 @@ .row.active_table_row{"ng-show" => "open()"} - .columns.small-4 - %strong Shop for - %p.trans-sentence - {{ producer.taxons | printArrayOfObjects }} - .columns.small-8 - %strong About us - %p - {{ producer.description }} + .columns.small-12.large-4 +   + %div{"bo-if" => "producer.taxons"} + %h5 + %i.ofn-i_029-shopping-basket + Shop for + %p.trans-sentence + %span.fat-taxons{"ng-repeat" => "taxon in producer.taxons"} + %render-svg{path: "{{taxon.icon}}"} + {{taxon.name}} + .columns.small-12.large-3 +   + %img{src: "{{ producer.logo }}" } + .columns.small-12.large-5 +   + %div{"bo-if" => "producer.description"} + %h5 About us + %p.text-small + {{ producer.description }} -.row.active_table_row.link{"ng-show" => "open()"} - .columns.small-11 - Shop for {{ producer.name }} products at: - - %a{"ng-repeat" => "hub in producer.hubs", - "bo-href" => "hub.path", "ofn-empties-cart" => "hub", - "bo-class" => "{primary: hub.active, secondary: !hub.active}"} - %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}} ) - - .columns.small-1.text-right - %a{"bo-href" => "hub.path"} - %i.ofn-i_007-caret-right +.row.active_table_row.link{"ng-show" => "open()", "bo-if" => "producer.hubs"} + .cta-container.columns.small-12 + .row + .columns.small-12 + %h5 Shop for {{ producer.name }} products at: + .row + .columns.small-12 + %a.button.hub{"ng-repeat" => "hub in producer.hubs", + "bo-href" => "hub.path", "ofn-empties-cart" => "hub", + "bo-class" => "{primary: hub.active, secondary: !hub.active}"} + %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] | printArray }} + %i.ofn-i_007-caret-right diff --git a/app/views/producers/index.haml b/app/views/producers/index.haml index 2c3253a141..b71013c425 100644 --- a/app/views/producers/index.haml +++ b/app/views/producers/index.haml @@ -1,6 +1,5 @@ += inject_enterprises .producers{"ng-controller" => "ProducersCtrl"} - = inject_enterprises - .row .small-12.columns.text-center.pad-top %h1 Producers diff --git a/app/views/shop/products/_form.html.haml b/app/views/shop/products/_form.html.haml index 65a02cbaca..e18c197594 100644 --- a/app/views/shop/products/_form.html.haml +++ b/app/views/shop/products/_form.html.haml @@ -1,9 +1,7 @@ %products.small-12.columns{"ng-controller" => "ProductsCtrl", "ng-show" => "order_cycle.order_cycle_id != null", "infinite-scroll" => "incrementLimit()", "infinite-scroll-distance" => "1"} - = inject_enterprises = form_for :order, :url => populate_orders_path, html: {:class => "custom"} do - .row .small-6.columns %input#search.text{"ng-model" => "query", diff --git a/app/views/shop/show.html.haml b/app/views/shop/show.html.haml index 8b1d08d08f..4057823d52 100644 --- a/app/views/shop/show.html.haml +++ b/app/views/shop/show.html.haml @@ -1,3 +1,5 @@ += inject_enterprises + %shop.darkswarm - content_for :order_cycle_form do diff --git a/app/views/shopping_shared/_about.html.haml b/app/views/shopping_shared/_about.html.haml index 232c70b519..397ae1f041 100644 --- a/app/views/shopping_shared/_about.html.haml +++ b/app/views/shopping_shared/_about.html.haml @@ -1,9 +1,9 @@ -.content#about +.content#about{"ng-controller" => "AboutUsCtrl", bindonce: true} .row - .small-12.large-9.columns - %p= current_distributor.long_description.andand.html_safe - - -#- if current_distributor.promo_image.exists? - -#.small-12.large-3.columns - -#%img.about.right{src: current_distributor.promo_image.url(:large)} - + .small-12.large-6.columns + %img.hero-img-small{"bo-src" => "CurrentHub.promo_image"} + %p.small-text{"bo-html" => "CurrentHub.long_description"} + .small-12.large-3.columns +   + .small-12.large-3.columns + %img{"bo-src" => "CurrentHub.logo", "bo-if" => "CurrentHub.logo"} diff --git a/app/views/shopping_shared/_producers.html.haml b/app/views/shopping_shared/_producers.html.haml index 5244032214..a736cac763 100644 --- a/app/views/shopping_shared/_producers.html.haml +++ b/app/views/shopping_shared/_producers.html.haml @@ -4,5 +4,5 @@ %h5 = "#{current_distributor.name}'s producers:" %ul.bullet-list - %li{"ng-repeat" => "producer in CurrentHub.producers"} + %li{"ng-repeat" => "enterprise in CurrentHub.producers"} = render partial: "modals/producer" diff --git a/config/application.rb b/config/application.rb index 45c6e2a540..1cddfcf3a1 100644 --- a/config/application.rb +++ b/config/application.rb @@ -89,7 +89,7 @@ module Openfoodnetwork # Instead, they must be explicitly included below # http://stackoverflow.com/questions/8012434/what-is-the-purpose-of-config-assets-precompile config.assets.initialize_on_precompile = true - config.assets.precompile += ['store/all.css', 'store/all.js', 'store/shop_front.js'] + config.assets.precompile += ['store/all.css', 'store/all.js', 'store/shop_front.js', 'iehack.js'] config.assets.precompile += ['admin/all.css', 'admin/restore_spree_from_cms.css', 'admin/*.js', 'admin/**/*.js'] config.assets.precompile += ['darkswarm/all.css', 'darkswarm/all.js'] config.assets.precompile += ['comfortable_mexican_sofa/*']