diff --git a/Gemfile b/Gemfile index eb49f89c23..f28e8a8baa 100644 --- a/Gemfile +++ b/Gemfile @@ -21,7 +21,6 @@ gem 'spree_paypal_express', :github => "openfoodfoundation/better_spree_paypal_e gem 'delayed_job_active_record' gem 'daemons' -gem 'comfortable_mexican_sofa' # Fix bug in simple_form preventing collection_check_boxes usage within form_for block # When merged, revert to upstream gem diff --git a/Gemfile.lock b/Gemfile.lock index 07931312ab..a645196fc5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -121,7 +121,6 @@ GEM rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.2.1) - active_link_to (1.0.0) active_model_serializers (0.8.3) activemodel (>= 3.0) activemerchant (1.57.0) @@ -202,10 +201,6 @@ GEM coffee-script-source (1.10.0) colorize (0.7.7) columnize (0.9.0) - comfortable_mexican_sofa (1.6.24) - active_link_to (~> 1.0.0) - paperclip (>= 2.3.0) - rails (>= 3.0.0) compass (1.0.3) chunky_png (~> 1.2) compass-core (~> 1.0.2) @@ -226,7 +221,7 @@ GEM safe_yaml (~> 0.9.0) css_parser (1.3.5) addressable - css_splitter (0.4.1) + css_splitter (0.4.5) sprockets (>= 2.0.0) daemons (1.2.2) dalli (2.7.2) @@ -456,7 +451,7 @@ GEM railties (>= 3.1) money (5.1.1) i18n (~> 0.6.0) - multi_json (1.12.0) + multi_json (1.12.1) multi_xml (0.5.5) newrelic_rpm (3.12.0.288) nokogiri (1.6.7.2) @@ -659,7 +654,6 @@ DEPENDENCIES bugsnag capybara coffee-rails (~> 3.2.1) - comfortable_mexican_sofa compass-rails css_splitter custom_error_message! @@ -735,4 +729,4 @@ DEPENDENCIES wkhtmltopdf-binary BUNDLED WITH - 1.11.2 + 1.12.5 diff --git a/Rakefile b/Rakefile index 9ed55e022e..b462be57e6 100644 --- a/Rakefile +++ b/Rakefile @@ -2,7 +2,7 @@ # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require File.expand_path('../config/application', __FILE__) +require_relative 'config/application' Openfoodnetwork::Application.load_tasks diff --git a/app/assets/javascripts/darkswarm/controllers/cart_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/cart_controller.js.coffee index 1b8703899a..ebad820ebd 100644 --- a/app/assets/javascripts/darkswarm/controllers/cart_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/cart_controller.js.coffee @@ -1,10 +1,2 @@ Darkswarm.controller "CartCtrl", ($scope, Cart, $timeout) -> $scope.Cart = Cart - initializing = true - - $scope.$watchCollection "Cart.line_items_present()", -> - if initializing - $timeout -> - initializing = false - else - $scope.Cart.orderChanged() diff --git a/app/assets/javascripts/darkswarm/controllers/enterprises_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/enterprises_controller.js.coffee index fa11c0e92f..f0a174a47c 100644 --- a/app/assets/javascripts/darkswarm/controllers/enterprises_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/enterprises_controller.js.coffee @@ -1,4 +1,4 @@ -Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, Enterprises, Search, $document, HashNavigation, FilterSelectorsService, EnterpriseModal, enterpriseMatchesNameQueryFilter, distanceWithinKmFilter) -> +Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, $location, Enterprises, Search, $document, HashNavigation, FilterSelectorsService, EnterpriseModal, enterpriseMatchesNameQueryFilter, distanceWithinKmFilter) -> $scope.Enterprises = Enterprises $scope.producers_to_filter = Enterprises.producers $scope.filterSelectors = FilterSelectorsService.createSelectors() @@ -21,6 +21,12 @@ Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, Enterpris Enterprises.calculateDistance query, $scope.firstNameMatch() $rootScope.$broadcast 'enterprisesChanged' + $timeout -> + if $location.search()['show_closed']? + $scope.showClosedShops() + + $scope.$watch "filtersActive", (value) -> + $scope.$broadcast 'filtersToggled' $rootScope.$on "enterprisesChanged", -> $scope.filterEnterprises() @@ -30,7 +36,7 @@ Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, Enterpris # When filter settings change, this could change which name match is at the top, or even # result in no matches. This affects the reference point that the distance matches are # calculated from, so we need to recalculate distances. - $scope.$watch '[activeTaxons, shippingTypes, show_profiles]', -> + $scope.$watch '[activeTaxons, activeProperties, shippingTypes, show_profiles]', -> $timeout -> Enterprises.calculateDistance $scope.query, $scope.firstNameMatch() $rootScope.$broadcast 'enterprisesChanged' @@ -69,6 +75,8 @@ Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, Enterpris $scope.showClosedShops = -> delete $scope.filterExpression['active'] + $location.search('show_closed', '1') $scope.hideClosedShops = -> $scope.filterExpression['active'] = true + $location.search('show_closed', null) diff --git a/app/assets/javascripts/darkswarm/controllers/group_enterprises_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/group_enterprises_controller.js.coffee index 13c1017386..567767be7b 100644 --- a/app/assets/javascripts/darkswarm/controllers/group_enterprises_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/group_enterprises_controller.js.coffee @@ -8,3 +8,6 @@ Darkswarm.controller "GroupEnterprisesCtrl", ($scope, Search, FilterSelectorsSer $scope.$watch "query", (query)-> Search.search query + + $scope.$watch "filtersActive", (value) -> + $scope.$broadcast 'filtersToggled' diff --git a/app/assets/javascripts/darkswarm/controllers/line_item_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/line_item_controller.js.coffee deleted file mode 100644 index 864f25177a..0000000000 --- a/app/assets/javascripts/darkswarm/controllers/line_item_controller.js.coffee +++ /dev/null @@ -1,5 +0,0 @@ -Darkswarm.controller "LineItemCtrl", ($scope)-> - $scope.$watch '[line_item.quantity, line_item.max_quantity]', (newValue, oldValue)-> - if newValue != oldValue - $scope.Cart.orderChanged() - , true \ No newline at end of file diff --git a/app/assets/javascripts/darkswarm/controllers/products_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/products_controller.js.coffee index 4f149db1e5..34b65aa405 100644 --- a/app/assets/javascripts/darkswarm/controllers/products_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/products_controller.js.coffee @@ -1,18 +1,41 @@ -Darkswarm.controller "ProductsCtrl", ($scope, $rootScope, Products, OrderCycle, FilterSelectorsService, Cart, Taxons, Properties) -> +Darkswarm.controller "ProductsCtrl", ($scope, $filter, $rootScope, Products, OrderCycle, FilterSelectorsService, Cart, Taxons, Properties) -> $scope.Products = Products $scope.Cart = Cart + $scope.query = "" $scope.taxonSelectors = FilterSelectorsService.createSelectors() $scope.propertySelectors = FilterSelectorsService.createSelectors() $scope.filtersActive = true - $scope.limit = 3 + $scope.limit = 10 $scope.order_cycle = OrderCycle.order_cycle + # $scope.infiniteDisabled = true + + # All of this logic basically just replicates the functionality filtering an ng-repeat + # except that it allows us to filter a separate list before rendering, meaning that + # we can get much better performance when applying filters by resetting the limit on the + # number of products being rendered each time a filter is changed. $scope.$watch "Products.loading", (newValue, oldValue) -> + $scope.updateFilteredProducts() $scope.$broadcast("loadFilterSelectors") if !newValue $scope.incrementLimit = -> if $scope.limit < Products.products.length - $scope.limit = $scope.limit + 1 + $scope.limit += 10 + $scope.updateVisibleProducts() + + $scope.$watch 'query', -> $scope.updateFilteredProducts() + $scope.$watchCollection 'activeTaxons', -> $scope.updateFilteredProducts() + $scope.$watchCollection 'activeProperties', -> $scope.updateFilteredProducts() + + $scope.updateFilteredProducts = -> + $scope.limit = 10 + f1 = $filter('products')(Products.products, $scope.query) + f2 = $filter('taxons')(f1, $scope.activeTaxons) + $scope.filteredProducts = $filter('properties')(f2, $scope.activeProperties) + $scope.updateVisibleProducts() + + $scope.updateVisibleProducts = -> + $scope.visibleProducts = $filter('limitTo')($scope.filteredProducts, $scope.limit) $scope.searchKeypress = (e)-> code = e.keyCode || e.which diff --git a/app/assets/javascripts/darkswarm/directives/shop_variant.js.coffee b/app/assets/javascripts/darkswarm/directives/shop_variant.js.coffee index e4cbed11c5..d679e6c3f0 100644 --- a/app/assets/javascripts/darkswarm/directives/shop_variant.js.coffee +++ b/app/assets/javascripts/darkswarm/directives/shop_variant.js.coffee @@ -1,6 +1,9 @@ -Darkswarm.directive "shopVariant", -> +Darkswarm.directive "shopVariant", -> restrict: 'E' replace: true templateUrl: 'shop_variant.html' scope: variant: '=' + controller: ($scope, Cart) -> + $scope.$watchGroup ['variant.line_item.quantity', 'variant.line_item.max_quantity'], -> + Cart.adjust($scope.variant.line_item) diff --git a/app/assets/javascripts/darkswarm/directives/single_line_selectors.coffee b/app/assets/javascripts/darkswarm/directives/single_line_selectors.coffee index ea5d8568d2..9cc125a537 100644 --- a/app/assets/javascripts/darkswarm/directives/single_line_selectors.coffee +++ b/app/assets/javascripts/darkswarm/directives/single_line_selectors.coffee @@ -6,40 +6,15 @@ Darkswarm.directive 'singleLineSelectors', ($timeout, $filter) -> objects: "&" activeSelectors: "=" selectorName: "@activeSelectors" - link: (scope,element,attrs) -> + link: (scope, element, attrs) -> scope.fitting = false - scope.overFlowSelectors = -> - return [] unless scope.allSelectors? - $filter('filter')(scope.allSelectors, { fits: false }) - - scope.selectedOverFlowSelectors = -> - $filter('filter')(scope.overFlowSelectors(), { active: true }) - - # had to duplicate this to make overflow selectors work - scope.emit = -> - scope.activeSelectors = scope.allSelectors.filter (selector)-> - selector.active - .map (selector)-> - selector.object.id - - # From: http://stackoverflow.com/questions/4298612/jquery-how-to-call-resize-event-only-once-its-finished-resizing - debouncer = (func, timeout) -> - timeoutID = undefined - timeout = timeout or 50 - -> - subject = this - args = arguments - clearTimeout timeoutID - timeoutID = setTimeout(-> - func.apply subject, Array::slice.call(args) - , timeout) - - loadWidths = -> - $(element).find("li").not(".more").each (i) -> - scope.allSelectors[i].width = $(this).outerWidth(true) - return null # So we don't exit the loop weirdly - + scope.refit = -> + if scope.allSelectors? + scope.fitting = true + selector.fits = true for selector in scope.allSelectors + $timeout(loadWidths, 0, true).then -> + $timeout fit, 0, true fit = -> used = $(element).find("li.more").outerWidth(true) @@ -61,12 +36,45 @@ Darkswarm.directive 'singleLineSelectors', ($timeout, $filter) -> available += selector.width scope.fitting = false + loadWidths = -> + $(element).find("li").not(".more").each (i) -> + if i < scope.allSelectors.length + scope.allSelectors[i].width = $(this).outerWidth(true) + return null # So we don't exit the loop weirdly + + scope.overFlowSelectors = -> + return [] unless scope.allSelectors? + $filter('filter')(scope.allSelectors, { fits: false }) + + scope.selectedOverFlowSelectors = -> + $filter('filter')(scope.overFlowSelectors(), { active: true }) + + # had to duplicate this to make overflow selectors work + scope.emit = -> + scope.activeSelectors = scope.allSelectors.filter (selector)-> + selector.active + .map (selector) -> + selector.object.id + + # From: http://stackoverflow.com/questions/4298612/jquery-how-to-call-resize-event-only-once-its-finished-resizing + debouncer = (func, timeout) -> + timeoutID = undefined + timeout = timeout or 50 + -> + subject = this + args = arguments + clearTimeout timeoutID + timeoutID = setTimeout(-> + func.apply subject, Array::slice.call(args) + , timeout) + + + # -- Event management scope.$watchCollection "allSelectors", -> - if scope.allSelectors? - scope.fitting = true - selector.fits = true for selector in scope.allSelectors - $timeout(loadWidths, 0, true).then -> - $timeout fit, 0, true + scope.refit() + + scope.$on "filtersToggled", -> + scope.refit() $(window).resize debouncer (e) -> scope.fitting = true diff --git a/app/assets/javascripts/darkswarm/directives/smooth_scroll_to.js.coffee b/app/assets/javascripts/darkswarm/directives/smooth_scroll_to.js.coffee new file mode 100644 index 0000000000..c3bcc9590d --- /dev/null +++ b/app/assets/javascripts/darkswarm/directives/smooth_scroll_to.js.coffee @@ -0,0 +1,15 @@ +Darkswarm.directive "ofnSmoothScrollTo", ($location, $document)-> + # Onclick sets $location.hash to attrs.ofnScrollTo + # Then triggers $document.scrollTo + restrict: 'A' + link: (scope, element, attrs)-> + element.bind 'click', (ev)-> + ev.stopPropagation() + $location.hash attrs.ofnScrollTo + target = $("a[name='#{attrs.ofnSmoothScrollTo}']") + # Scrolling is confused by our position:fixed top bar and page alert bar + # - add an offset to scroll to the correct location, plus 5px buffer + offset = $("nav.top-bar").height() + offset += $(".page-alert.move-down").height() + offset += 5 + $document.scrollTo target, offset, 1000 diff --git a/app/assets/javascripts/darkswarm/filters/filter_products.js.coffee b/app/assets/javascripts/darkswarm/filters/filter_products.js.coffee index f65c8854dc..4cc325e483 100644 --- a/app/assets/javascripts/darkswarm/filters/filter_products.js.coffee +++ b/app/assets/javascripts/darkswarm/filters/filter_products.js.coffee @@ -2,6 +2,7 @@ Darkswarm.filter 'products', (Matcher) -> (products, text) -> products ||= [] text ?= "" + return products if text == "" products.filter (product) => propertiesToMatch = [product.name, product.supplier.name, product.primary_taxon.name] Matcher.match propertiesToMatch, text diff --git a/app/assets/javascripts/darkswarm/services/cart.js.coffee b/app/assets/javascripts/darkswarm/services/cart.js.coffee index 9ee03e26b3..456d567bb7 100644 --- a/app/assets/javascripts/darkswarm/services/cart.js.coffee +++ b/app/assets/javascripts/darkswarm/services/cart.js.coffee @@ -11,7 +11,15 @@ Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http, $modal, $roo for line_item in @line_items line_item.variant.line_item = line_item Variants.register line_item.variant - line_item.variant.extended_name = @extendedVariantName(line_item.variant) + + adjust: (line_item) => + line_item.total_price = line_item.variant.price_with_fees * line_item.quantity + if line_item.quantity > 0 + @line_items.push line_item unless line_item in @line_items + else + index = @line_items.indexOf(line_item) + @line_items.splice(index, 1) if index >= 0 + @orderChanged() orderChanged: => @unsaved() @@ -48,7 +56,7 @@ Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http, $modal, $roo # TODO: These changes to quantity/max_quantity trigger another cart update, which # is unnecessary. - for li in @line_items_present() + for li in @line_items when li.quantity > 0 if stockLevels[li.variant.id]? li.variant.count_on_hand = stockLevels[li.variant.id].on_hand if li.quantity > li.variant.count_on_hand @@ -67,7 +75,7 @@ Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http, $modal, $roo data: => variants = {} - for li in @line_items_present() + for li in @line_items when li.quantity > 0 variants[li.variant.id] = quantity: li.quantity max_quantity: li.max_quantity @@ -89,45 +97,21 @@ Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http, $modal, $roo $(window).bind "beforeunload", -> t 'order_not_saved_yet' - line_items_present: => - @line_items.filter (li)-> - li.quantity > 0 - total_item_count: => - @line_items_present().reduce (sum,li) -> + @line_items.reduce (sum,li) -> sum = sum + li.quantity , 0 empty: => - @line_items_present().length == 0 + @line_items.length == 0 total: => - @line_items_present().map (li)-> - li.variant.totalPrice() + @line_items.map (li)-> + li.total_price .reduce (t, price)-> t + price , 0 - register_variant: (variant)=> - exists = @line_items.some (li)-> li.variant == variant - @create_line_item(variant) unless exists - clear: -> @line_items = [] storage.clearAll() # One day this will have to be moar GRANULAR - - create_line_item: (variant)-> - variant.extended_name = @extendedVariantName(variant) - variant.line_item = - variant: variant - quantity: null - max_quantity: null - @line_items.push variant.line_item - - extendedVariantName: (variant) => - if variant.product_name == variant.name_to_display - variant.product_name - else - name = "#{variant.product_name} - #{variant.name_to_display}" - name += " (#{variant.options_text})" if variant.options_text - name diff --git a/app/assets/javascripts/darkswarm/services/products.js.coffee b/app/assets/javascripts/darkswarm/services/products.js.coffee index 475ed5be0b..b120cab737 100644 --- a/app/assets/javascripts/darkswarm/services/products.js.coffee +++ b/app/assets/javascripts/darkswarm/services/products.js.coffee @@ -17,7 +17,6 @@ Darkswarm.factory 'Products', ($resource, Enterprises, Dereferencer, Taxons, Pro @extend() @dereference() @registerVariants() - @registerVariantsWithCart() @loading = false extend: -> @@ -44,15 +43,7 @@ Darkswarm.factory 'Products', ($resource, Enterprises, Dereferencer, Taxons, Pro registerVariants: -> for product in @products if product.variants - product.variants = (Variants.register variant for variant in product.variants) - variant.product = product for variant in product.variants - if product.master - product.master.product = product - product.master = Variants.register product.master - - registerVariantsWithCart: -> - for product in @products - if product.variants - for variant in product.variants - Cart.register_variant variant - Cart.register_variant product.master if product.master + product.variants = for variant in product.variants + variant = Variants.register variant + variant.product = product + variant diff --git a/app/assets/javascripts/darkswarm/services/variants.js.coffee b/app/assets/javascripts/darkswarm/services/variants.js.coffee index 3048049ad5..441258dc1a 100644 --- a/app/assets/javascripts/darkswarm/services/variants.js.coffee +++ b/app/assets/javascripts/darkswarm/services/variants.js.coffee @@ -9,8 +9,21 @@ Darkswarm.factory 'Variants', -> @variants[variant.id] ||= @extend variant extend: (variant)-> - # Add totalPrice method to calculate line item total. This should be on a line item! - variant.totalPrice = -> - variant.price_with_fees * variant.line_item.quantity - variant.basePricePercentage = Math.round(variant.price / variant.price_with_fees * 100) + variant.extended_name = @extendedVariantName(variant) + variant.base_price_percentage = Math.round(variant.price / variant.price_with_fees * 100) + variant.line_item ||= @lineItemFor(variant) # line_item may have been initialised in Cart#constructor + variant.line_item.total_price = variant.price_with_fees * variant.line_item.quantity variant + + extendedVariantName: (variant) => + if variant.product_name == variant.name_to_display + variant.product_name + else + name = "#{variant.product_name} - #{variant.name_to_display}" + name += " (#{variant.options_text})" if variant.options_text + name + + lineItemFor: (variant) -> + variant: variant + quantity: null + max_quantity: null diff --git a/app/assets/javascripts/shared/ng-infinite-scroll.min.js b/app/assets/javascripts/shared/ng-infinite-scroll.min.js index d4410b93c0..3e69b49588 100644 --- a/app/assets/javascripts/shared/ng-infinite-scroll.min.js +++ b/app/assets/javascripts/shared/ng-infinite-scroll.min.js @@ -1,2 +1,2 @@ -/* ng-infinite-scroll - v1.0.0 - 2013-02-23 */ -var mod;mod=angular.module("infinite-scroll",[]),mod.directive("infiniteScroll",["$rootScope","$window","$timeout",function(i,n,e){return{link:function(t,l,o){var r,c,f,a;return n=angular.element(n),f=0,null!=o.infiniteScrollDistance&&t.$watch(o.infiniteScrollDistance,function(i){return f=parseInt(i,10)}),a=!0,r=!1,null!=o.infiniteScrollDisabled&&t.$watch(o.infiniteScrollDisabled,function(i){return a=!i,a&&r?(r=!1,c()):void 0}),c=function(){var e,c,u,d;return d=n.height()+n.scrollTop(),e=l.offset().top+l.height(),c=e-d,u=n.height()*f>=c,u&&a?i.$$phase?t.$eval(o.infiniteScroll):t.$apply(o.infiniteScroll):u?r=!0:void 0},n.on("scroll",c),t.$on("$destroy",function(){return n.off("scroll",c)}),e(function(){return o.infiniteScrollImmediateCheck?t.$eval(o.infiniteScrollImmediateCheck)?c():void 0:c()},0)}}}]); \ No newline at end of file +/* ng-infinite-scroll - v1.3.0 - 2016-06-30 */ +angular.module("infinite-scroll",[]).value("THROTTLE_MILLISECONDS",null).directive("infiniteScroll",["$rootScope","$window","$interval","THROTTLE_MILLISECONDS",function(a,b,c,d){return{scope:{infiniteScroll:"&",infiniteScrollContainer:"=",infiniteScrollDistance:"=",infiniteScrollDisabled:"=",infiniteScrollUseDocumentBottom:"=",infiniteScrollListenForEvent:"@"},link:function(e,f,g){var h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;return z=angular.element(b),u=null,v=null,j=null,k=null,r=!0,y=!1,x=null,i=!1,q=function(a){return a=a[0]||a,isNaN(a.offsetHeight)?a.document.documentElement.clientHeight:a.offsetHeight},s=function(a){if(a[0].getBoundingClientRect&&!a.css("none"))return a[0].getBoundingClientRect().top+t(a)},t=function(a){return a=a[0]||a,isNaN(window.pageYOffset)?a.document.documentElement.scrollTop:a.ownerDocument.defaultView.pageYOffset},p=function(){var b,d,g,h,l;return k===z?(b=q(k)+t(k[0].document.documentElement),g=s(f)+q(f)):(b=q(k),d=0,void 0!==s(k)&&(d=s(k)),g=s(f)-d+q(f)),y&&(g=q((f[0].ownerDocument||f[0].document).documentElement)),h=g-b,l=h<=q(k)*u+1,l?(j=!0,v?e.$$phase||a.$$phase?e.infiniteScroll():e.$apply(e.infiniteScroll):void 0):(i&&c.cancel(i),j=!1)},w=function(a,b){var d,e,f;return f=null,e=0,d=function(){return e=(new Date).getTime(),c.cancel(f),f=null,a.call()},function(){var g,h;return g=(new Date).getTime(),h=b-(g-e),h<=0?(c.cancel(f),f=null,e=g,a.call()):f?void 0:f=c(d,h,1)}},null!=d&&(p=w(p,d)),e.$on("$destroy",function(){if(k.unbind("scroll",p),null!=x&&(x(),x=null),i)return c.cancel(i)}),n=function(a){return u=parseFloat(a)||0},e.$watch("infiniteScrollDistance",n),n(e.infiniteScrollDistance),m=function(a){if(v=!a,v&&j)return j=!1,p()},e.$watch("infiniteScrollDisabled",m),m(e.infiniteScrollDisabled),o=function(a){return y=a},e.$watch("infiniteScrollUseDocumentBottom",o),o(e.infiniteScrollUseDocumentBottom),h=function(a){if(null!=k&&k.unbind("scroll",p),k=a,null!=a)return k.bind("scroll",p)},h(z),e.infiniteScrollListenForEvent&&(x=a.$on(e.infiniteScrollListenForEvent,p)),l=function(a){if(null!=a&&0!==a.length){if(a.nodeType&&1===a.nodeType?a=angular.element(a):"function"==typeof a.append?a=angular.element(a[a.length-1]):"string"==typeof a&&(a=angular.element(document.querySelector(a))),null!=a)return h(a);throw new Error("invalid infinite-scroll-container attribute.")}},e.$watch("infiniteScrollContainer",l),l(e.infiniteScrollContainer||[]),null!=g.infiniteScrollParent&&h(angular.element(f.parent())),null!=g.infiniteScrollImmediateCheck&&(r=e.$eval(g.infiniteScrollImmediateCheck)),i=c(function(){return r&&p(),c.cancel(i)})}}}]),"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="infinite-scroll"); diff --git a/app/assets/javascripts/templates/partials/shop_variant_no_group_buy.html.haml b/app/assets/javascripts/templates/partials/shop_variant_no_group_buy.html.haml index 3a52ba9d07..0441156c2c 100644 --- a/app/assets/javascripts/templates/partials/shop_variant_no_group_buy.html.haml +++ b/app/assets/javascripts/templates/partials/shop_variant_no_group_buy.html.haml @@ -9,4 +9,4 @@ "ng-model" => "variant.line_item.quantity", "ofn-on-hand" => "{{variant.on_demand && 9999 || variant.count_on_hand }}", "ng-disabled" => "!variant.on_demand && variant.count_on_hand == 0", - name: "variants[{{variant.id}}]", id: "variants_{{variant.id}}"} + name: "variants[{{::variant.id}}]", id: "variants_{{::variant.id}}"} diff --git a/app/assets/javascripts/templates/partials/shop_variant_with_group_buy.html.haml b/app/assets/javascripts/templates/partials/shop_variant_with_group_buy.html.haml index d4c88092b6..05bdf468b4 100644 --- a/app/assets/javascripts/templates/partials/shop_variant_with_group_buy.html.haml +++ b/app/assets/javascripts/templates/partials/shop_variant_with_group_buy.html.haml @@ -1,4 +1,5 @@ .small-5.medium-3.large-3.columns.text-right{"ng-if" => "::variant.product.group_buy"} + %span.bulk-input-container %span.bulk-input %input.bulk.first{type: :number, @@ -6,18 +7,18 @@ integer: true, min: 0, "ng-model" => "variant.line_item.quantity", - placeholder: "{{'shop_variant_quantity_min' | t}}", + placeholder: "{{::'shop_variant_quantity_min' | t}}", "ofn-disable-scroll" => true, "ofn-on-hand" => "{{variant.on_demand && 9999 || variant.count_on_hand }}", - name: "variants[{{variant.id}}]", id: "variants_{{variant.id}}"} + name: "variants[{{::variant.id}}]", id: "variants_{{::variant.id}}"} %span.bulk-input %input.bulk.second{type: :number, "ng-disabled" => "!variant.line_item.quantity", integer: true, min: 0, "ng-model" => "variant.line_item.max_quantity", - placeholder: "{{'shop_variant_quantity_max' | t}}", + placeholder: "{{::'shop_variant_quantity_max' | t}}", "ofn-disable-scroll" => true, min: "{{variant.line_item.quantity}}", - name: "variant_attributes[{{variant.id}}][max_quantity]", - id: "variants_{{variant.id}}_max"} + name: "variant_attributes[{{::variant.id}}][max_quantity]", + id: "variants_{{::variant.id}}_max"} diff --git a/app/assets/javascripts/templates/price_breakdown.html.haml b/app/assets/javascripts/templates/price_breakdown.html.haml index fa884cd4f0..48e0a8d5e0 100644 --- a/app/assets/javascripts/templates/price_breakdown.html.haml +++ b/app/assets/javascripts/templates/price_breakdown.html.haml @@ -2,7 +2,7 @@ %span.joyride-nub.right .joyride-content-wrapper .collapsed{"ng-show" => "!expanded"} - %price-percentage{percentage: 'variant.basePricePercentage'} + %price-percentage{percentage: 'variant.base_price_percentage'} %a{"ng-click" => "expanded = !expanded"} %span{"ng-bind" => "::'price_breakdown' | t"} %i.ofn-i_005-caret-down @@ -10,26 +10,26 @@ .expanded{"ng-show" => "expanded"} %ul %li.cost - .right {{ variant.price | localizeCurrency }} + .right {{ ::variant.price | localizeCurrency }} %span{"ng-bind" => "::'item_cost' | t"} %li.admin-fee{"ng-if" => "::variant.fees.admin"} - .right {{ variant.fees.admin | localizeCurrency }} + .right {{ ::variant.fees.admin | localizeCurrency }} %span{"ng-bind" => "::'admin_fee' | t"} %li.sales-fee{"ng-if" => "::variant.fees.sales"} - .right {{ variant.fees.sales | localizeCurrency }} + .right {{ ::variant.fees.sales | localizeCurrency }} %span{"ng-bind" => "::'sales_fee' | t"} %li.packing-fee{"ng-if" => "::variant.fees.packing"} - .right {{ variant.fees.packing | localizeCurrency }} + .right {{ ::variant.fees.packing | localizeCurrency }} %span{"ng-bind" => "::'packing_fee' | t"} %li.transport-fee{"ng-if" => "::variant.fees.transport"} - .right {{ variant.fees.transport | localizeCurrency }} + .right {{ ::variant.fees.transport | localizeCurrency }} %span{"ng-bind" => "::'transport_fee' | t"} %li.fundraising-fee{"ng-if" => "::variant.fees.fundraising"} - .right {{ variant.fees.fundraising | localizeCurrency }} + .right {{ ::variant.fees.fundraising | localizeCurrency }} %span{"ng-bind" => "::'fundraising_fee' | t"} %li.total %strong - .right = {{ variant.price_with_fees | localizeCurrency }} + .right = {{ ::variant.price_with_fees | localizeCurrency }}   %a{"ng-click" => "expanded = !expanded"} diff --git a/app/assets/javascripts/templates/price_percentage.html.haml b/app/assets/javascripts/templates/price_percentage.html.haml index 7892ebc0ab..f524103643 100644 --- a/app/assets/javascripts/templates/price_percentage.html.haml +++ b/app/assets/javascripts/templates/price_percentage.html.haml @@ -1,5 +1,4 @@ .progress - .right {{'fees' | t}} + .right {{::'fees' | t}} .meter - {{'item_cost' | t}} - + {{::'item_cost' | t}} diff --git a/app/assets/javascripts/templates/shop_variant.html.haml b/app/assets/javascripts/templates/shop_variant.html.haml index 1d06ffbb39..3214612e88 100644 --- a/app/assets/javascripts/templates/shop_variant.html.haml +++ b/app/assets/javascripts/templates/shop_variant.html.haml @@ -1,23 +1,23 @@ .variants.row .small-12.medium-4.large-4.columns.variant-name .table-cell - .inline {{ variant.name_to_display }} + .inline {{ ::variant.name_to_display }} .bulk-buy.inline{"ng-if" => "::variant.product.group_buy"} %i.ofn-i_056-bulk>< %em>< - \ {{'bulk' | t}} + \ {{::'bulk' | t}} %ng-include{src: "'partials/shop_variant_no_group_buy.html'"} %ng-include{src: "'partials/shop_variant_with_group_buy.html'"} .small-3.medium-1.large-1.columns.variant-unit .table-cell - %em {{ variant.unit_to_display }} + %em {{ ::variant.unit_to_display }} .small-4.medium-2.large-2.columns.variant-price .table-cell.price %i.ofn-i_009-close - {{ variant.price_with_fees | localizeCurrency }} + {{ ::variant.price_with_fees | localizeCurrency }} -# Now in a template in app/assets/javascripts/templates ! %price-breakdown{"price-breakdown" => "_", variant: "variant", @@ -27,5 +27,5 @@ .small-12.medium-2.large-2.columns.total-price.text-right .table-cell - %strong{"ng-class" => "{filled: variant.totalPrice()}"} - {{ variant.totalPrice() | localizeCurrency }} + %strong{"ng-class" => "{filled: variant.line_item.total_price}"} + {{ variant.line_item.total_price | localizeCurrency }} diff --git a/app/assets/stylesheets/admin/restore_spree_from_cms.css.scss b/app/assets/stylesheets/admin/restore_spree_from_cms.css.scss deleted file mode 100644 index a281031f02..0000000000 --- a/app/assets/stylesheets/admin/restore_spree_from_cms.css.scss +++ /dev/null @@ -1,4 +0,0 @@ -html { - height: auto; - background-color: transparent; -} diff --git a/app/assets/stylesheets/darkswarm/_shop-filters.css.sass b/app/assets/stylesheets/darkswarm/_shop-filters.css.sass index cf80c63035..3c4f9a514d 100644 --- a/app/assets/stylesheets/darkswarm/_shop-filters.css.sass +++ b/app/assets/stylesheets/darkswarm/_shop-filters.css.sass @@ -92,6 +92,12 @@ span.filter-label opacity: 0.75 +// singleLineSelectors directive provides a drop-down that can overlap +// content. Ensure that the dropdown appears above the content. +.filter-row + position: relative + z-index: 100 + .filter-shopfront &.taxon-selectors, &.property-selectors background: transparent diff --git a/app/assets/stylesheets/darkswarm/footer.sass b/app/assets/stylesheets/darkswarm/footer.sass index a0d2244c0e..80681cedfb 100644 --- a/app/assets/stylesheets/darkswarm/footer.sass +++ b/app/assets/stylesheets/darkswarm/footer.sass @@ -30,7 +30,7 @@ footer background-color: transparent border: none padding: 0 - a.alert-cta + .alert-cta @include csstrans width: 100% border: 1px solid rgba($dark-grey, 0.35) @@ -44,7 +44,7 @@ footer color: #333 strong letter-spacing: 0.5px - &:hover, &:active, &:focus + a:hover, a:active, a:focus text-decoration: none border-color: white &, & * diff --git a/app/assets/stylesheets/darkswarm/groups.css.sass b/app/assets/stylesheets/darkswarm/groups.css.sass index 765689049d..7243112b67 100644 --- a/app/assets/stylesheets/darkswarm/groups.css.sass +++ b/app/assets/stylesheets/darkswarm/groups.css.sass @@ -4,11 +4,7 @@ // Search page #groups - background-color: lighten($clr-brick, 56%) - background-image: url("/assets/groups.svg") - background-position: center 50px - background-repeat: no-repeat - background-size: 922px 922px + @include groupsbg @include sidepaddingSm @include panepadding h1, p.text @@ -23,13 +19,13 @@ text-align: right a font-size: 1.5em - + .groups-header border: 2px solid $clr-brick-light-bright @include border-radius-mixed(0.5em, 0.5em, 0, 0) margin: -1rem 0 1rem padding: 1rem 0.9375rem - @media screen and (min-width: 640px) + @media screen and (min-width: 640px) border: 0 none @include border-radius(0) margin: 0 @@ -44,12 +40,12 @@ .ofn-i_035-groups font-size: 120% vertical-align: middle - + // Individual Page #group-page .group-logo, .group-header - text-align: center - .group-logo + text-align: center + .group-logo padding-bottom: 1em max-height: 200px .group-name @@ -57,7 +53,7 @@ @media screen and (min-width: 768px) .group-logo, .group-header text-align: left - .group-logo + .group-logo max-height: 120px float: left padding-right: 1em @@ -72,18 +68,18 @@ margin-right: 2px text-transform: capitalize @include headingFont - @include border-radius(1em 0.25em 0 0) + @include border-radius(1em 0.25em 0 0) @include gradient($disabled-light, $disabled-bright) @media screen and (min-width: 768px) .tabs dd a padding: 0.5rem 1rem 0.25em font-size: 0.875rem - @include border-radius(1.5em 0.25em 0 0) + @include border-radius(1.5em 0.25em 0 0) @media screen and (min-width: 1024px) .tabs dd a padding: 0.75rem 1.5rem 0.5em font-size: 1rem - @include border-radius(2em 0.25em 0 0) + @include border-radius(2em 0.25em 0 0) .tabs dd.active a @include gradient(white, white) margin-bottom: -1px @@ -110,4 +106,3 @@ background-image: none padding-top: 0 padding-bottom: 0 - diff --git a/app/assets/stylesheets/darkswarm/home_panes.css.sass b/app/assets/stylesheets/darkswarm/home_panes.css.sass index ed74450317..4bb9c19aa6 100644 --- a/app/assets/stylesheets/darkswarm/home_panes.css.sass +++ b/app/assets/stylesheets/darkswarm/home_panes.css.sass @@ -4,7 +4,6 @@ @import animations @import variables - // Styling for big panes on homepage \\ #panes .pane @@ -22,9 +21,15 @@ #system.pane background-color: white -#brand-story.pane, #cta.pane, #shops.pane +#brand-story.pane, #cta.pane, #shops.pane, #sell.pane @include tiledPane +#connect.pane + @include groupsbg + +#learn.pane + @include hubsbg + #stats.pane background-image: url("/assets/home/background-blurred-oranges.jpg") background-position: center center @@ -94,10 +99,6 @@ @media all and (max-width: 640px) font-size: 45px - - a - color: $brand-colour - .home-icon-box-bottom margin-top: 1rem width: 100% @@ -147,3 +148,9 @@ #shops-signup.pane background-color: $brand-colour + +#sell-detail.pane + margin: 50px 0 + .row + padding-top: 25px + padding-bottom: 25px diff --git a/app/assets/stylesheets/darkswarm/mixins.sass b/app/assets/stylesheets/darkswarm/mixins.sass index 4e779bd2a5..d35c5aa1a7 100644 --- a/app/assets/stylesheets/darkswarm/mixins.sass +++ b/app/assets/stylesheets/darkswarm/mixins.sass @@ -170,3 +170,23 @@ // W3C filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='$gradient-clr1', endColorstr='$gradient-clr2',GradientType=0 ) // IE6-8 + + +@mixin producersbg + background-color: lighten($clr-turquoise, 68%) + background-image: url("/assets/producers.svg") + background-position: center 50px + background-repeat: no-repeat + background-size: 922px 763px + +@mixin hubsbg + background-color: $brand-colour + background-image: url("/assets/hubs-bg.jpg") + background-position: center center + +@mixin groupsbg + background-color: lighten($clr-brick, 56%) + background-image: url("/assets/groups.svg") + background-position: center 50px + background-repeat: no-repeat + background-size: 922px 922px diff --git a/app/assets/stylesheets/darkswarm/page_alert.css.sass b/app/assets/stylesheets/darkswarm/page_alert.css.sass index b7d6ea643e..7e66d35518 100644 --- a/app/assets/stylesheets/darkswarm/page_alert.css.sass +++ b/app/assets/stylesheets/darkswarm/page_alert.css.sass @@ -21,13 +21,13 @@ font-size: 10px line-height: 24px - a.alert-cta + .alert-cta &, & * @include csstrans color: #333 strong letter-spacing: 0.5px - &:hover, &:active, &:focus + a:hover, a:active, a:focus &, & * text-decoration: none color: white diff --git a/app/assets/stylesheets/darkswarm/producers.css.sass b/app/assets/stylesheets/darkswarm/producers.css.sass index dce972629b..caa31f224d 100644 --- a/app/assets/stylesheets/darkswarm/producers.css.sass +++ b/app/assets/stylesheets/darkswarm/producers.css.sass @@ -2,11 +2,7 @@ @import mixins .producers - background-color: lighten($clr-turquoise, 68%) - background-image: url("/assets/producers.svg") - background-position: center 50px - background-repeat: no-repeat - background-size: 922px 763px + @include producersbg @include sidepaddingSm @include panepadding a diff --git a/app/assets/stylesheets/darkswarm/signup.css.sass b/app/assets/stylesheets/darkswarm/signup.css.sass index cd6ebf458a..12c01d0325 100644 --- a/app/assets/stylesheets/darkswarm/signup.css.sass +++ b/app/assets/stylesheets/darkswarm/signup.css.sass @@ -18,11 +18,9 @@ #producer-case-studies, #shops-case-studies + @include hubsbg padding-top: 100px padding-bottom: 100px - background-color: $brand-colour - background-image: url("/assets/hubs-bg.jpg") - background-position: center center -webkit-filter: brightness(1.1) filter: brightness(1.1) h2 diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rb index 70d240abd1..6c38cfe83a 100644 --- a/app/controllers/enterprises_controller.rb +++ b/app/controllers/enterprises_controller.rb @@ -26,13 +26,14 @@ class EnterprisesController < BaseController end def check_permalink - return render text: params[:permalink], status: 409 if Enterprise.find_by_permalink params[:permalink] + render text: params[:permalink], status: 409 and return if Enterprise.find_by_permalink params[:permalink] - path = Rails.application.routes.recognize_path("/#{params[:permalink].to_s}") - if path && path[:controller] == "cms_content" - render text: params[:permalink], status: 200 - else + begin + Rails.application.routes.recognize_path( "/#{ params[:permalink].to_s }" ) render text: params[:permalink], status: 409 + + rescue ActionController::RoutingError + render text: params[:permalink], status: 200 end end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 07ba097f85..fbf1819277 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -9,4 +9,8 @@ class HomeController < BaseController @num_orders = Spree::Order.complete.count end end + + def sell + end + end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 15c20dfd55..af68240432 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,14 +1,10 @@ module ApplicationHelper include FoundationRailsHelper::FlashHelper - - def home_page_cms_content - if controller.controller_name == 'home' && controller.action_name == 'index' - cms_page_content(:content, Cms::Page.find_by_full_path('/')) - end + def feature?(feature) + OpenFoodNetwork::FeatureToggle.enabled? feature end - def ng_form_for(name, *args, &block) options = args.extract_options! diff --git a/app/helpers/order_cycles_helper.rb b/app/helpers/order_cycles_helper.rb index 18222ee1f0..031fdf4736 100644 --- a/app/helpers/order_cycles_helper.rb +++ b/app/helpers/order_cycles_helper.rb @@ -67,10 +67,6 @@ module OrderCyclesHelper @order_cycles_simple_form ||= @order_cycle.coordinator.sells == 'own' end - def order_cycles_enabled? - OpenFoodNetwork::FeatureToggle.enabled? :order_cycles - end - def pickup_time(order_cycle = current_order_cycle) order_cycle.exchanges.to_enterprises(current_distributor).outgoing.first.pickup_time end diff --git a/app/models/spree/order_decorator.rb b/app/models/spree/order_decorator.rb index a4995274b3..fccbc639b2 100644 --- a/app/models/spree/order_decorator.rb +++ b/app/models/spree/order_decorator.rb @@ -74,11 +74,7 @@ Spree::Order.class_eval do # -- Methods def products_available_from_new_distribution # Check that the line_items in the current order are available from a newly selected distribution - if OpenFoodNetwork::FeatureToggle.enabled? :order_cycles - errors.add(:base, "Distributor or order cycle cannot supply the products in your cart") unless DistributionChangeValidator.new(self).can_change_to_distribution?(distributor, order_cycle) - else - errors.add(:distributor_id, "cannot supply the products in your cart") unless DistributionChangeValidator.new(self).can_change_to_distributor?(distributor) - end + errors.add(:base, "Distributor or order cycle cannot supply the products in your cart") unless DistributionChangeValidator.new(self).can_change_to_distribution?(distributor, order_cycle) end def empty_with_clear_shipping_and_payments! diff --git a/app/overrides/add_cms_admin_tab.rb b/app/overrides/add_cms_admin_tab.rb deleted file mode 100644 index f13d100502..0000000000 --- a/app/overrides/add_cms_admin_tab.rb +++ /dev/null @@ -1,5 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/admin/shared/_configuration_menu", - :name => "add_cms_admin_to_admin_configurations_menu", - :insert_bottom => "[data-hook='admin_configurations_sidebar_menu']", - :text => "
  • <%= link_to 'CMS Admin', main_app.cms_admin_path %>
  • ", - :original => '29e0ab9c171ffab1988cb439b5d42300b78fe088' ) diff --git a/app/overrides/add_cms_checkout_distribution.rb b/app/overrides/add_cms_checkout_distribution.rb deleted file mode 100644 index bd4c3afbaa..0000000000 --- a/app/overrides/add_cms_checkout_distribution.rb +++ /dev/null @@ -1,5 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/checkout/_delivery", - :insert_before => "fieldset#shipping_method", - :text => "<%= cms_snippet_content(Cms::Snippet.find_by_identifier('distribution')) %>", - :name => "add_cms_checkout_distribution", - :original => '3b417788fb9a63f464fdaeb8202f483f20518f80') \ No newline at end of file diff --git a/app/overrides/add_cms_tabs_to_main_nav_bar.rb b/app/overrides/add_cms_tabs_to_main_nav_bar.rb deleted file mode 100644 index 47d67141f7..0000000000 --- a/app/overrides/add_cms_tabs_to_main_nav_bar.rb +++ /dev/null @@ -1,5 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/shared/_main_nav_bar", - :name => "add_cms_tabs_to_main_nav_bar", - :insert_after => "li#home-link", - :partial => "spree/shared/cms_tabs", - :original => '05c6495f8760e58eb68e2cce67433cf7f5299fa4') \ No newline at end of file diff --git a/app/overrides/add_cms_to_cart.rb b/app/overrides/add_cms_to_cart.rb deleted file mode 100644 index 3ff7341a33..0000000000 --- a/app/overrides/add_cms_to_cart.rb +++ /dev/null @@ -1,5 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/orders/edit", - :insert_after => "h1", - :text => "<%= cms_snippet_content(Cms::Snippet.find_by_identifier('cart')) %>", - :name => "add_cms_to_cart", - :original => '206a92e6f50966b057e877321b573bc293787894') \ No newline at end of file diff --git a/app/overrides/add_multi_cart_to_home.rb b/app/overrides/add_multi_cart_to_home.rb deleted file mode 100644 index e11cfaa728..0000000000 --- a/app/overrides/add_multi_cart_to_home.rb +++ /dev/null @@ -1,9 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/products/index", - :insert_after => "[data-hook='homepage_products']", - :partial => 'spree/shared/multi_cart.html', - :name => 'multi_cart_home') - -Deface::Override.new(:virtual_path => "spree/home/index", - :insert_after => "[data-hook='homepage_products']", - :partial => 'spree/shared/multi_cart.html', - :name => 'multi_cart_products') diff --git a/app/overrides/order_cycle_selection.rb b/app/overrides/order_cycle_selection.rb deleted file mode 100644 index 7ad4025bac..0000000000 --- a/app/overrides/order_cycle_selection.rb +++ /dev/null @@ -1,14 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/home/index", - :insert_before => "[data-hook='homepage_products']", - :partial => "order_cycles/selection", - :name => "order_cycle_selection_home") - -Deface::Override.new(:virtual_path => "spree/products/index", - :insert_before => "[data-hook='homepage_products']", - :partial => "order_cycles/selection", - :name => "order_cycle_selection_products") - -Deface::Override.new(:virtual_path => "spree/taxons/show", - :insert_top => "[data-hook='homepage_products']", - :partial => "order_cycles/selection", - :name => "order_cycle_selection_taxon") diff --git a/app/overrides/sidebar_home_index.rb b/app/overrides/sidebar_home_index.rb deleted file mode 100644 index 7965478336..0000000000 --- a/app/overrides/sidebar_home_index.rb +++ /dev/null @@ -1,7 +0,0 @@ -# In sidebar, always render both taxonomies and filters - -Deface::Override.new(:virtual_path => "spree/home/index", - :replace => "[data-hook='homepage_sidebar_navigation']", - :partial => 'spree/sidebar', - :name => 'sidebar_home_index', - :original => 'f5a06c5f558ec681c172ad62ddcf8f84ad0a99c4') \ No newline at end of file diff --git a/app/overrides/sidebar_product_index.rb b/app/overrides/sidebar_product_index.rb deleted file mode 100644 index 94fdd92b95..0000000000 --- a/app/overrides/sidebar_product_index.rb +++ /dev/null @@ -1,7 +0,0 @@ -# In sidebar, always render both taxonomies and filters - -Deface::Override.new(:virtual_path => "spree/products/index", - :replace => "[data-hook='homepage_sidebar_navigation']", - :partial => 'spree/sidebar', - :name => 'sidebar_product_index', - :original => 'd9d1b3d18721e1c68eeaac898ca006bf8afb176c') \ No newline at end of file diff --git a/app/overrides/sidebar_taxons_show.rb b/app/overrides/sidebar_taxons_show.rb deleted file mode 100644 index 510b24ef1d..0000000000 --- a/app/overrides/sidebar_taxons_show.rb +++ /dev/null @@ -1,7 +0,0 @@ -# In sidebar, always render both taxonomies and filters - -Deface::Override.new(:virtual_path => "spree/taxons/show", - :replace => "[data-hook='taxon_sidebar_navigation']", - :partial => 'spree/sidebar', - :name => 'sidebar_taxons_show', - :original => '697641363ffdb1fce91d8eea7cc883e983236ed2') \ No newline at end of file diff --git a/app/overrides/split_products_by_distributor_on_home.rb b/app/overrides/split_products_by_distributor_on_home.rb deleted file mode 100644 index 1481c17799..0000000000 --- a/app/overrides/split_products_by_distributor_on_home.rb +++ /dev/null @@ -1,5 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/home/index", - :replace => "[data-hook='homepage_products']", - :partial => "spree/shared/products_by_distribution", - :name => "split_products_by_distribution_on_home", - :original => '589053f6f3e534b0be729081bdfc0378beb29cca') diff --git a/app/overrides/split_products_by_distributor_on_products_home.rb b/app/overrides/split_products_by_distributor_on_products_home.rb deleted file mode 100644 index b8f9d90e2b..0000000000 --- a/app/overrides/split_products_by_distributor_on_products_home.rb +++ /dev/null @@ -1,5 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/products/index", - :replace => "[data-hook='homepage_products']", - :partial => "spree/shared/products_by_distribution", - :name => "split_products_by_distribution_on_products_home", - :original => '22097416de0a5851d43c572301779de06ed84d17') diff --git a/app/overrides/split_products_by_distributor_on_products_search.rb b/app/overrides/split_products_by_distributor_on_products_search.rb deleted file mode 100644 index 21937310da..0000000000 --- a/app/overrides/split_products_by_distributor_on_products_search.rb +++ /dev/null @@ -1,5 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/products/index", - :replace => "[data-hook='search_results']", - :partial => "spree/shared/products_by_distribution", - :name => "split_products_by_distribution_on_products_search", - :original => '5a764faee41bd3f2bb13b60bfeb61e63fede9fac') diff --git a/app/overrides/split_products_by_distributor_on_taxons_show.rb b/app/overrides/split_products_by_distributor_on_taxons_show.rb deleted file mode 100644 index c2c9419391..0000000000 --- a/app/overrides/split_products_by_distributor_on_taxons_show.rb +++ /dev/null @@ -1,5 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/taxons/show", - :replace => "[data-hook='taxon_products']", - :partial => "spree/shared/products_by_distribution", - :name => "split_products_by_distribution_on_taxons_show", - :original => '27b6ecd3954022246568b3ddf5e80462aa511ece') diff --git a/app/overrides/spree/products/index/change_product_render_logic.html.haml.deface b/app/overrides/spree/products/index/change_product_render_logic.html.haml.deface deleted file mode 100644 index 55f7f62d08..0000000000 --- a/app/overrides/spree/products/index/change_product_render_logic.html.haml.deface +++ /dev/null @@ -1,7 +0,0 @@ -/ replace_contents "[data-hook='homepage_products']" - -- if current_order_cycle - - if @products.empty? - %h6.search-results-title= t(:no_products_found) - - else - = render :partial => 'spree/shared/products', :locals => { :products => @products, :taxon => @taxon } diff --git a/app/serializers/api/enterprise_serializer.rb b/app/serializers/api/enterprise_serializer.rb index 127aee1a08..d30c2d8677 100644 --- a/app/serializers/api/enterprise_serializer.rb +++ b/app/serializers/api/enterprise_serializer.rb @@ -21,6 +21,7 @@ end class Api::UncachedEnterpriseSerializer < ActiveModel::Serializer attributes :orders_close_at, :active + has_many :properties, serializer: Api::PropertySerializer def orders_close_at options[:data].earliest_closing_times[object.id] @@ -29,6 +30,14 @@ class Api::UncachedEnterpriseSerializer < ActiveModel::Serializer def active options[:data].active_distributors.andand.include? object end + + def properties + # This results in 3 queries per enterprise + product_properties = Spree::Property.applied_by(object) + producer_properties = object.properties + + OpenFoodNetwork::PropertyMerge.merge product_properties, producer_properties + end end class Api::CachedEnterpriseSerializer < ActiveModel::Serializer @@ -49,8 +58,6 @@ class Api::CachedEnterpriseSerializer < ActiveModel::Serializer attributes :taxons, :supplied_taxons has_one :address, serializer: Api::AddressSerializer - has_many :properties, serializer: Api::PropertySerializer - def taxons ids_to_objs options[:data].distributed_taxons[object.id] end @@ -59,14 +66,6 @@ class Api::CachedEnterpriseSerializer < ActiveModel::Serializer ids_to_objs options[:data].supplied_taxons[object.id] end - def properties - # This results in 3 queries per enterprise - product_properties = Spree::Property.applied_by(object) - producer_properties = object.properties - - OpenFoodNetwork::PropertyMerge.merge product_properties, producer_properties - end - def pickup services = options[:data].shipping_method_services[object.id] services ? services[:pickup] : false diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index a21bdb7460..ef9e281155 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -67,7 +67,7 @@ .small-12.columns .active_table %producer.active_table_node.row.animate-repeat{id: "{{producer.path}}", - "ng-repeat" => "producer in filteredEnterprises = (group_producers | searchEnterprises:query | taxons:activeTaxons)", + "ng-repeat" => "producer in filteredEnterprises = (group_producers | searchEnterprises:query | taxons:activeTaxons | properties:activeProperties)", "ng-controller" => "GroupEnterpriseNodeCtrl", "ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !producer.active}", id: "{{producer.hash}}"} diff --git a/app/views/home/_connect.html.haml b/app/views/home/_connect.html.haml new file mode 100644 index 0000000000..6afcb1ae96 --- /dev/null +++ b/app/views/home/_connect.html.haml @@ -0,0 +1,7 @@ +#connect.pane + .row + .small-12.medium-6.medium-offset-3.columns.text-center + %h2= t :label_connect + %p.text-normal= t :connect_body + %a.button.transparent{href: "https://openfoodnetwork.org/au/connect/"} + = t :connect_cta diff --git a/app/views/home/_learn.html.haml b/app/views/home/_learn.html.haml new file mode 100644 index 0000000000..f6d3061e20 --- /dev/null +++ b/app/views/home/_learn.html.haml @@ -0,0 +1,7 @@ +#learn.pane + .row + .small-12.medium-6.medium-offset-3.columns.text-center + %h2= t :label_learn + %p.text-normal= t :learn_body + %a.button.transparent{href: "https://openfoodnetwork.org/au/learn/"} + = t :learn_cta diff --git a/app/views/home/_tagline.html.haml b/app/views/home/_tagline.html.haml new file mode 100644 index 0000000000..817afdd051 --- /dev/null +++ b/app/views/home/_tagline.html.haml @@ -0,0 +1,9 @@ +#tagline + .row + .small-12.text-center.columns + %h1 + / TODO: Rohan - logo asset & width is content manageable: + %img{src: "/assets/logo-white-notext.png", width: "250", title: Spree::Config.site_name} + %br/ + %a.button.transparent{href: "/shops"} + = t :home_shop diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index cfb3015179..2dcaf58bd5 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -3,23 +3,21 @@ %div{"ng-controller" => "HomeCtrl"} - = render partial: "shared/menu/alert" - - #tagline - .row - .small-12.text-center.columns - %h1 - / TODO: Rohan - logo asset & width is content manageable: - %img{src: "/assets/logo-white-notext.png", width: "250", title: Spree::Config.site_name} - %br/ - %a.button.transparent{href: "/shops"} - = t :home_shop - + = render "shared/menu/alert" + = render "home/tagline" #panes - = render partial: "home/brandstory" - = render partial: "home/system" - = render partial: "home/cta" - = render partial: "home/stats" + = render "home/brandstory" - = render partial: "shared/footer" + - if feature? :connect_learn_homepage + = render "home/learn" + = render "home/connect" + = render "home/system" + - else + = render "home/system" + = render "home/cta" + + = render "home/stats" + + + = render "shared/footer" diff --git a/app/views/home/sell.html.haml b/app/views/home/sell.html.haml new file mode 100644 index 0000000000..64c71f01c1 --- /dev/null +++ b/app/views/home/sell.html.haml @@ -0,0 +1,50 @@ +- content_for(:title) do + = t :sell_title + +#panes + #sell.pane + .row.header + .small-12.medium-12.columns.text-center + %h2 + = t :sell_headline + .row.content + .small-12.medium-6.medium-offset-3.columns.text-center + %p.text-big + = t :sell_motivation + + #sell-detail.pane + .row + .small-12.medium-4.columns.text-center + %h3= t :sell_producers + %p + = t :sell_producers_detail + %a{href: "https://openfoodnetwork.org/user-guide/"}= t(:sell_user_guide) + %a.button.transparent{href: signup_producers_path} + = t :register_title + + .small-12.medium-4.columns.text-center + %h3= t :sell_hubs + %p + = t :sell_hubs_detail + %a{href: "https://openfoodnetwork.org/user-guide/"}= t(:sell_user_guide) + %a.button.transparent{href: signup_shops_path} + = t :register_title + + .small-12.medium-4.columns.text-center + %h3= t :sell_groups + %p + = t :sell_groups_detail + %a{href: "https://openfoodnetwork.org/user-guide/"}= t(:sell_user_guide) + %a.button.transparent{href: signup_groups_path} + = t :register_title + + .row + .small-12.medium-12.columns.text-center + %p= t :sell_listing_price + + %p + = t :sell_embed + %a{href: "hello@openfoodnetwork.org".reverse, target: '_blank', mailto: true} + = t :sell_ask_services + += render "shared/footer" diff --git a/app/views/layouts/_cms_nav_spree.html.haml b/app/views/layouts/_cms_nav_spree.html.haml deleted file mode 100644 index d0ab75eeaa..0000000000 --- a/app/views/layouts/_cms_nav_spree.html.haml +++ /dev/null @@ -1 +0,0 @@ -%li= link_to 'Spree Admin', spree.admin_path diff --git a/app/views/open_food_network/cart/_show.html.haml b/app/views/open_food_network/cart/_show.html.haml deleted file mode 100644 index 5cebd3f40c..0000000000 --- a/app/views/open_food_network/cart/_show.html.haml +++ /dev/null @@ -1,34 +0,0 @@ -/ %script = Spree.api_key = raw(try_spree_current_user.try(:spree_api_key).to_s.inspect) - -= t :ofn_cart_headline -= spree_current_user.andand.email -%div{ 'ng-app' => 'store', 'ng-controller' => 'CartCtrl', 'ng-init' => "loadCart(#{spree_current_user.andand.cart.andand.id});" } - {{cart}} {{state}} - %br - %br - %ul - %li(ng-repeat="order in cart.orders") - %strong - = t :ofn_cart_distributor - {{order.distributor}} - %strong - = t :ofn_cart_oc - {{order.order_cycle.andand.name}} - %strong - = t :ofn_cart_from - {{order.order_cycle.andand.orders_open_at}} - %strong - = t :ofn_cart_to - {{order.order_cycle.andand.orders_close_at}} - %ul - %li(ng-repeat="line_item in order.line_items") - %strong - = t :ofn_cart_product - {{line_item.name}} - %strong - = t :ofn_cart_quatity - {{line_item.quantity}} - %button - = t :ofn_cart_send - %br - diff --git a/app/views/order_cycles/_choice.html.haml b/app/views/order_cycles/_choice.html.haml deleted file mode 100644 index 7b1cfeb444..0000000000 --- a/app/views/order_cycles/_choice.html.haml +++ /dev/null @@ -1,18 +0,0 @@ - -- if order_cycles_enabled? - #distribution-choice - - if current_distributor.present? - %p - %strong - = t :ocs_choice_distributor - = current_distributor.name - - - if current_order_cycle.present? - %p - %strong - = t :ocs_choice_oc - = current_order_cycle.name - - - if current_distributor.nil? && current_order_cycle.nil? - %p - = t :ocs_choice_text diff --git a/app/views/order_cycles/_orders_closed.html.haml b/app/views/order_cycles/_orders_closed.html.haml deleted file mode 100644 index 782c680add..0000000000 --- a/app/views/order_cycles/_orders_closed.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -.columns.two= image_tag 'pickup.png' -.columns.nine - %h2 - = t :ocs_closed_headline - %p - - if most_recently_closed = OrderCycle.most_recently_closed_for(@enterprise) - = t :ocs_closed_time, time: distance_of_time_in_words_to_now(most_recently_closed.orders_close_at) - = t :ocs_closed_contact - - - if next_oc = OrderCycle.first_opening_for(@enterprise) - %h4 - = t :ocs_closed_opens, time: distance_of_time_in_words_to_now(next_oc.orders_open_at) - - %p - = t(:ocs_closed_email, email: current_distributor.email_address) if current_distributor.email_address - %br/ - = t(:ocs_closed_phone, phone: current_distributor.phone) if current_distributor.phone diff --git a/app/views/order_cycles/_orders_current.html.haml b/app/views/order_cycles/_orders_current.html.haml deleted file mode 100644 index 185011690d..0000000000 --- a/app/views/order_cycles/_orders_current.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -.columns.six - %h1 - = t :ocs_pickup_time, pickup_time: pickup_time - %i - = link_to t(:ocs_change_date), spree.clear_orders_path, :id => 'reset_order_cycle' - = t :ocs_change_date_notice -.columns.five - .row - %strong - = t :ocs_close_time - .countdown-panel - %h1= distance_of_time_in_words_to_now(current_order_cycle.orders_close_at) diff --git a/app/views/order_cycles/_orders_open.html.haml b/app/views/order_cycles/_orders_open.html.haml deleted file mode 100644 index 66ee9509e6..0000000000 --- a/app/views/order_cycles/_orders_open.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -.columns.two= image_tag 'pickup.png' -.columns.six - %h2 - = t :ocs_when_headline - %p - = t :ocs_when_text -.columns.three - = form_for current_order(true), :html => {:id => 'order_cycle_select'} do |f| - = f.hidden_field :distributor_id, :value => @enterprise.id - .order-cycles - = f.select :order_cycle_id, order_cycle_options, {include_blank: t(:ocs_when_closing)} - = hidden_field_tag :commit, t(:ocs_when_choose) diff --git a/app/views/order_cycles/_selection.html.haml b/app/views/order_cycles/_selection.html.haml deleted file mode 100644 index 949766a162..0000000000 --- a/app/views/order_cycles/_selection.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -- if order_cycles_enabled? - #distribution-selection.row - - - if current_order_cycle# && current_order_cycle.exchanges.to_enterprises(current_distributor).outgoing.any? - = render partial: "order_cycles/orders_current" - - - elsif order_cycle_options.empty? - = render partial: "order_cycles/orders_closed" - - - else - = render partial: "order_cycles/orders_open" - -%p - %strong= link_to t(:ocs_list), shop_path - diff --git a/app/views/producers/_filters.html.haml b/app/views/producers/_filters.html.haml index 97cc204cab..771ed932c9 100644 --- a/app/views/producers/_filters.html.haml +++ b/app/views/producers/_filters.html.haml @@ -3,7 +3,7 @@ .small-12.medium-6.columns.text-right   -.row.animate-show{"ng-show" => "filtersActive"} +.row.animate-show.filter-row{"ng-show" => "filtersActive"} .small-12.columns .row.filter-box .small-12.columns @@ -12,4 +12,12 @@ = t :producers_filter = t :producers_filter_type %filter-selector.small-block-grid-2.medium-block-grid-4.large-block-grid-6{"selector-set" => "filterSelectors", objects: "producers_to_filter | searchEnterprises:query | taxonsOf", "active-selectors" => "activeTaxons"} + + %h5.tdhead + .light + = t :producers_filter + = t :producers_filter_property + .filter-shopfront.property-selectors + %single-line-selectors{ selectors: "filterSelectors", objects: "producers_to_filter | searchEnterprises:query | propertiesOf", "active-selectors" => "activeProperties"} + = render partial: 'shared/components/filter_box' diff --git a/app/views/producers/index.html.haml b/app/views/producers/index.html.haml index 8b7fd5695e..04048ef77e 100644 --- a/app/views/producers/index.html.haml +++ b/app/views/producers/index.html.haml @@ -16,7 +16,7 @@ .small-12.columns .active_table %producer.active_table_node.row.animate-repeat{id: "{{producer.path}}", - "ng-repeat" => "producer in filteredEnterprises = (Enterprises.producers | visible | searchEnterprises:query | taxons:activeTaxons)", + "ng-repeat" => "producer in filteredEnterprises = (Enterprises.producers | visible | searchEnterprises:query | taxons:activeTaxons | properties:activeProperties)", "ng-controller" => "ProducerNodeCtrl", "ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !producer.active}", id: "{{producer.hash}}"} diff --git a/app/views/shared/_cms_elrte_head.html.haml b/app/views/shared/_cms_elrte_head.html.haml deleted file mode 100644 index f070625f8a..0000000000 --- a/app/views/shared/_cms_elrte_head.html.haml +++ /dev/null @@ -1,19 +0,0 @@ --# Include all stylesheets except reset (which overrides Spree styles) --# Then restore styles which override Spree's --# See cms/app/views/layouts/cms_admin/_head.html.erb -= stylesheet_link_tag 'comfortable_mexican_sofa/structure', - 'comfortable_mexican_sofa/typography', - 'comfortable_mexican_sofa/form', - 'comfortable_mexican_sofa/content', - 'comfortable_mexican_sofa/files', - 'comfortable_mexican_sofa/elrte', - 'comfortable_mexican_sofa/codemirror', - 'comfortable_mexican_sofa/jquery_ui', - 'comfortable_mexican_sofa/dialogs', - 'comfortable_mexican_sofa/widgets', - 'admin/restore_spree_from_cms' - -= javascript_include_tag('comfortable_mexican_sofa/application') - -%meta{:name => "cms-admin-path", :content => ComfortableMexicanSofa.config.admin_route_prefix} -%meta{:name => "cms-locale", :content => I18n.locale} diff --git a/app/views/shared/_connect_learn_call.html.haml b/app/views/shared/_connect_learn_call.html.haml new file mode 100644 index 0000000000..68152b2b8f --- /dev/null +++ b/app/views/shared/_connect_learn_call.html.haml @@ -0,0 +1,12 @@ +:css + .page-alert .alert-box { background-color: #fdddac; } + +.alert-cta + %h6 + Open Food Network + %strong + = link_to t(:label_connect), "https://openfoodnetwork.org/au/connect/", target: '_blank' + and + %strong + = link_to t(:label_learn), "https://openfoodnetwork.org/au/learn/", target: '_blank' + \- Go exploring and get inspired! diff --git a/app/views/shared/_footer.html.haml b/app/views/shared/_footer.html.haml index e3e1f44174..de352b444a 100644 --- a/app/views/shared/_footer.html.haml +++ b/app/views/shared/_footer.html.haml @@ -113,17 +113,9 @@ %h4 = t :footer_join_headline %p - %a{href: "/producers/signup"} - = t :footer_join_producers - %p - %a{href: "/shops/signup"} - = t :footer_join_hubs - %p - %a{href: "/groups/signup"} - = t :footer_join_groups - %p - %a{href: "http://www.openfoodnetwork.org/platform/food-system-partners/", target: "_blank"} - = t :footer_join_partners + = t :footer_join_body + %a{href: "/sell"} + = t :footer_join_cta .medium-2.columns.text-center / Placeholder diff --git a/app/views/shared/_page_alert.html.haml b/app/views/shared/_page_alert.html.haml new file mode 100644 index 0000000000..92def240e7 --- /dev/null +++ b/app/views/shared/_page_alert.html.haml @@ -0,0 +1,5 @@ +- if feature? :connect_learn_homepage + = render "shared/connect_learn_call" + +- else + = render "shared/register_call" diff --git a/app/views/shared/_register_call.html.haml b/app/views/shared/_register_call.html.haml index 8c2d95ed2e..f4c03b7b92 100644 --- a/app/views/shared/_register_call.html.haml +++ b/app/views/shared/_register_call.html.haml @@ -1,7 +1,8 @@ -%a.alert-cta{href: registration_path, target: "_blank"} +.alert-cta %h6 - = t '.selling_on_ofn' -   - %strong - = t '.register' - %i.ofn-i_054-point-right + %a{href: registration_path, target: "_blank"} + = t '.selling_on_ofn' +   + %strong + = t '.register' + %i.ofn-i_054-point-right diff --git a/app/views/shared/menu/_alert.html.haml b/app/views/shared/menu/_alert.html.haml index 6512358cc3..e3eb53fe74 100644 --- a/app/views/shared/menu/_alert.html.haml +++ b/app/views/shared/menu/_alert.html.haml @@ -1,4 +1,4 @@ .text-center.page-alert.fixed{ "ofn-page-alert" => true } .alert-box - = render 'shared/register_call' + = render 'shared/page_alert' %a.close{ ng: { click: "close()" } } × diff --git a/app/views/shared/menu/_cart.html.haml b/app/views/shared/menu/_cart.html.haml index f67ff2ffe1..73e9fe14be 100644 --- a/app/views/shared/menu/_cart.html.haml +++ b/app/views/shared/menu/_cart.html.haml @@ -17,8 +17,7 @@ %a.button.primary.tiny{href: checkout_path, "ng-disabled" => "Cart.dirty || Cart.empty()"} = t 'checkout' %table - %tr.product-cart{"ng-repeat" => "line_item in Cart.line_items_present()", - "ng-controller" => "LineItemCtrl", "id" => "cart-variant-{{ line_item.variant.id }}"} + %tr.product-cart{"ng-repeat" => "line_item in Cart.line_items", "id" => "cart-variant-{{ line_item.variant.id }}"} %td %small %strong @@ -33,9 +32,9 @@ %small \= %strong - .total-price.right {{ line_item.variant.totalPrice() | localizeCurrency }} + .total-price.right {{ line_item.total_price | localizeCurrency }} - %table{"ng-show" => "Cart.line_items_present().length > 0"} + %table{"ng-show" => "Cart.line_items.length > 0"} %tr.total-cart %td %em diff --git a/app/views/shared/menu/_large_menu.html.haml b/app/views/shared/menu/_large_menu.html.haml index 05209dff75..6a5be15a67 100644 --- a/app/views/shared/menu/_large_menu.html.haml +++ b/app/views/shared/menu/_large_menu.html.haml @@ -17,14 +17,25 @@ %a{href: main_app.producers_path} %span.nav-primary = t 'label_producers' - %li - %a{href: main_app.groups_path} - %span.nav-primary - = t 'label_groups' - %li - %a{href: ContentConfig.footer_about_url} - %span.nav-primary - = t 'label_about' + - if feature? :connect_learn_homepage + %li + %a{href: "https://openfoodnetwork.org/au/connect/"} + %span.nav-primary + = t 'label_connect' + %li + %a{href: "https://openfoodnetwork.org/au/learn/"} + %span.nav-primary + = t 'label_learn' + - else + %li + %a{href: main_app.groups_path} + %span.nav-primary + = t 'label_groups' + %li + %a{href: ContentConfig.footer_about_url} + %span.nav-primary + = t 'label_about' + %ul.right - if spree_current_user.nil? = render 'shared/signed_out' diff --git a/app/views/shared/menu/_mobile_menu.html.haml b/app/views/shared/menu/_mobile_menu.html.haml index 71fd8ea86f..1ae4439cd9 100644 --- a/app/views/shared/menu/_mobile_menu.html.haml +++ b/app/views/shared/menu/_mobile_menu.html.haml @@ -41,15 +41,15 @@ %i.ofn-i_036-producers = t 'label_producers' %li.li-menu - %a{href: main_app.groups_path} + %a{href: "https://openfoodnetwork.org/au/connect/"} %span.nav-primary %i.ofn-i_035-groups - = t 'label_groups' + = t 'label_connect' %li.li-menu - %a{href: ContentConfig.footer_about_url} + %a{href: "https://openfoodnetwork.org/au/learn/"} %span.nav-primary %i.ofn-i_013-help - = t 'label_about' + = t 'label_learn' %li - if spree_current_user.nil? diff --git a/app/views/shop/products/_form.html.haml b/app/views/shop/products/_form.html.haml index 1decc0a43c..2d5481b5f5 100644 --- a/app/views/shop/products/_form.html.haml +++ b/app/views/shop/products/_form.html.haml @@ -1,6 +1,5 @@ .footer-pad.small-12.columns - %products{"ng-controller" => "ProductsCtrl", "ng-show" => "order_cycle.order_cycle_id != null", "ng-cloak" => true, - "infinite-scroll" => "incrementLimit()", "infinite-scroll-distance" => "1"} + %products{"ng-controller" => "ProductsCtrl", "ng-show" => "order_cycle.order_cycle_id != null", "ng-cloak" => true } // TODO: Needs an ng-show to slide content down .row.animate-slide{ "ng-show" => "query || appliedPropertiesList() || appliedTaxonsList()" } @@ -29,12 +28,18 @@ .small-12.medium-6.large-6.large-offset-1.columns = render partial: "shop/products/filters" - %div.pad-top - %product.animate-repeat{"ng-controller" => "ProductNodeCtrl", "ng-repeat" => "product in filteredProducts = (Products.products | products:query | taxons:activeTaxons | properties: activeProperties) track by product.id ", "id" => "product-{{ product.id }}"} + %div.pad-top{ "infinite-scroll" => "incrementLimit()", "infinite-scroll-distance" => "1", "infinite-scroll-disabled" => 'filteredProducts.length <= limit' } + %product.animate-repeat{"ng-controller" => "ProductNodeCtrl", "ng-repeat" => "product in visibleProducts track by product.id", "id" => "product-{{ product.id }}"} = render "shop/products/summary" - %shop-variant{variant: 'product.master', "ng-if" => "::!product.hasVariants", "id" => "variant-{{ product.master.id }}"} %shop-variant{variant: 'variant', "ng-repeat" => "variant in product.variants track by variant.id", "id" => "variant-{{ variant.id }}", "ng-class" => "{'out-of-stock': !variant.on_demand && variant.count_on_hand == 0}"} + -# Load more button, which can be used to initiate infinite scrolling. + -# %product{ "ng-hide" => "Products.loading || !infiniteDisabled || limit >= filteredProducts.length" } + -# .row.summary + -# .small-12.columns.text-center + -# %a.button{ ng: { click: 'infiniteDisabled = false; incrementLimit();' } } + -# Load More Products + %product{"ng-show" => "Products.loading"} .row.summary .small-12.columns.text-center diff --git a/app/views/shop/products/_summary.html.haml b/app/views/shop/products/_summary.html.haml index 4dd5b3f224..09f9aa15d5 100644 --- a/app/views/shop/products/_summary.html.haml +++ b/app/views/shop/products/_summary.html.haml @@ -18,4 +18,4 @@ %span{"ng-bind" => "::enterprise.name"} .small-2.medium-2.large-1.columns.text-center .taxon-flag - %render-svg{path: "{{product.primary_taxon.icon}}"} + %render-svg{path: "{{::product.primary_taxon.icon}}"} diff --git a/app/views/spree/_sidebar.html.haml b/app/views/spree/_sidebar.html.haml deleted file mode 100644 index a7a11f5733..0000000000 --- a/app/views/spree/_sidebar.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -= render :partial => 'order_cycles/choice' -= render :partial => 'spree/shared/taxonomies' -= render :partial => 'spree/shared/filters' -= render :partial => 'spree/products/source_sidebar' diff --git a/app/views/spree/products/_add_to_cart.html.haml b/app/views/spree/products/_add_to_cart.html.haml index 621b999ddc..dd406ff50b 100644 --- a/app/views/spree/products/_add_to_cart.html.haml +++ b/app/views/spree/products/_add_to_cart.html.haml @@ -7,7 +7,7 @@ - elsif !distributor_available_for?(order, @product) = render 'add_to_cart_distributor_unavailable' - - elsif !order_cycle_available_for?(order, @product) and order_cycles_enabled? + - elsif !order_cycle_available_for?(order, @product) = render 'add_to_cart_order_cycle_unavailable' - else diff --git a/app/views/spree/products/_source_sidebar.html.haml b/app/views/spree/products/_source_sidebar.html.haml deleted file mode 100644 index 8a58a65ea1..0000000000 --- a/app/views/spree/products/_source_sidebar.html.haml +++ /dev/null @@ -1,28 +0,0 @@ -%nav#filters - %div#distributor_filter - %h6.filter_name Shop by Distributor - %ul.filter_choices - - order = current_order(false) - - validator = DistributionChangeValidator.new(order) - - @sidebar_distributors.each do |distributor| - %li.nowrap - - if order.nil? || order.distributor == distributor || validator.can_change_to_distributor?(distributor) - = link_to distributor.name, [main_app, distributor] - - else - %abbr(title="One or more of the products in your cart is not available from this distributor")= distributor.name - - if @total_distributors > @sidebar_distributors.length - - distributors_more = @total_distributors - @sidebar_distributors.length - %span.filter_more - = "#{distributors_more} more..." - = button_to 'Browse All Distributors', main_app.distributors_enterprises_path, :method => :get - - %div#supplier_filter - %h6.filter_name Shop by Supplier - %ul.filter_choices - - @sidebar_suppliers.each do |supplier| - %li.nowrap= link_to supplier.name, [main_app, supplier] - - if @total_suppliers > @sidebar_suppliers.length - - suppliers_more = @total_suppliers - @sidebar_suppliers.length - %span.filter_more - = "#{suppliers_more} more..." - = button_to 'Browse All Suppliers', main_app.suppliers_enterprises_path, :method => :get diff --git a/app/views/spree/shared/_cms_tabs.html.haml b/app/views/spree/shared/_cms_tabs.html.haml deleted file mode 100644 index 1921e8cfac..0000000000 --- a/app/views/spree/shared/_cms_tabs.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -- if @cms_site - - @cms_site.pages.root.children.published.each do |page| - %li= link_to page.label, page.full_path \ No newline at end of file diff --git a/app/views/spree/shared/_multi_cart.html.haml b/app/views/spree/shared/_multi_cart.html.haml deleted file mode 100644 index 6125d637b9..0000000000 --- a/app/views/spree/shared/_multi_cart.html.haml +++ /dev/null @@ -1,3 +0,0 @@ - -- if OpenFoodNetwork::FeatureToggle.enabled? :multi_cart - = render :partial => 'open_food_network/cart/show' \ No newline at end of file diff --git a/app/views/spree/shared/_products_by_distribution.html.haml b/app/views/spree/shared/_products_by_distribution.html.haml deleted file mode 100644 index 39a50f80ac..0000000000 --- a/app/views/spree/shared/_products_by_distribution.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%div(data-hook='homepage_products') - = home_page_cms_content - - - if @products - #products= render 'spree/shared/products', :products => @products, :taxon => @taxon - - else - #products-local - %h2 - = t :products - = t :products_in, oc: current_order_cycle.name if current_order_cycle - = t :products_at, distributor: current_distributor.name if current_distributor - = render 'spree/shared/products', :products => @products_local, :taxon => @taxon - #products-remote - %h2 - = t :products_elsewhere - = render 'spree/shared/products', :products => @products_remote, :taxon => @taxon diff --git a/config/application.rb b/config/application.rb index 6ffee13160..9abd0a3b9b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,4 +1,4 @@ -require File.expand_path('../boot', __FILE__) +require_relative 'boot' require 'rails/all' @@ -100,10 +100,9 @@ module Openfoodnetwork # 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', 'iehack.js'] - config.assets.precompile += ['admin/all.css', 'admin/restore_spree_from_cms.css', 'admin/*.js', 'admin/**/*.js'] + config.assets.precompile += ['admin/all.css', 'admin/*.js', 'admin/**/*.js'] config.assets.precompile += ['darkswarm/all.css', 'darkswarm/all_split2.css', 'darkswarm/all.js'] config.assets.precompile += ['mail/all.css'] - config.assets.precompile += ['comfortable_mexican_sofa/*'] config.assets.precompile += ['search/all.css', 'search/*.js'] config.assets.precompile += ['shared/*'] diff --git a/config/environment.rb b/config/environment.rb index 9f6b854161..f3522b8759 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ # Load the rails application -require File.expand_path('../application', __FILE__) +require_relative 'application' # Initialize the rails application Openfoodnetwork::Application.initialize! diff --git a/config/initializers/comfortable_mexican_sofa.rb b/config/initializers/comfortable_mexican_sofa.rb deleted file mode 100644 index 279648a093..0000000000 --- a/config/initializers/comfortable_mexican_sofa.rb +++ /dev/null @@ -1,135 +0,0 @@ -# encoding: utf-8 - -ComfortableMexicanSofa.configure do |config| - # Title of the admin area - # config.cms_title = 'ComfortableMexicanSofa CMS Engine' - - # Module responsible for authentication. You can replace it with your own. - # It simply needs to have #authenticate method. See http_auth.rb for reference. - config.admin_auth = 'CmsSpreeAuth' - - # Module responsible for public authentication. Similar to the above. You also - # will have access to @cms_site, @cms_layout, @cms_page so you can use them in - # your logic. Default module doesn't do anything. - # config.public_auth = 'ComfortableMexicanSofa::DummyAuth' - - # Default url to access admin area is http://yourhost/cms-admin/ - # You can change 'cms-admin' to 'admin', for example. To disable admin area - # entirely set this to '' or nil - # config.admin_route_prefix = 'cms-admin' - - # When arriving at /cms-admin you may chose to redirect to arbirtary path, - # for example '/cms-admin/users' - # config.admin_route_redirect = '' - - # Normally we include default routes from https://github.com/comfy/comfortable-mexican-sofa/blob/master/config/routes.rb - # If you want to include the routes manually set this to false - # config.use_default_routes = true - - # /sitemap.xml that is used by search engines for indexing. It's enabled by - # default, but you may turn it off. - # config.enable_sitemap = true - - # File uploads use Paperclip and can support filesystem or s3 uploads. Override - # the upload method and appropriate settings based on Paperclip. For S3 see: - # http://rdoc.info/gems/paperclip/2.3.8/Paperclip/Storage/S3, and for - # filesystem see: http://rdoc.info/gems/paperclip/2.3.8/Paperclip/Storage/Filesystem - config.upload_file_options = { - :storage => 's3', - :s3_protocol => :https, - :s3_credentials => { - :bucket => Spree::Config[:s3_bucket], - :access_key_id => Spree::Config[:s3_access_key], - :secret_access_key => Spree::Config[:s3_secret] - } - } - - # Sofa allows you to setup entire site from files. Database is updated with each - # request (if necessary). Please note that database entries are destroyed if there's - # no corresponding file. Fixtures are disabled by default. - # config.enable_fixtures = false - - # Path where fixtures can be located. - # config.fixtures_path = File.expand_path('db/cms_fixtures', Rails.root) - - # Importing fixtures into Database - # To load fixtures into the database just run this rake task: - # local: $ rake comfortable_mexican_sofa:fixtures:import FROM=example.local TO=localhost - # Heroku: $ heroku run rake comfortable_mexican_sofa:fixtures:import FROM=example.local TO=yourapp.herokuapp.com - # From indicates folder the fixtures are in and to is the Site hostname you have defined in the database. - - # Exporting fixtures into Files - # If you need to dump database contents into fixture files run: - # local: $ rake comfortable_mexican_sofa:fixtures:export FROM=localhost TO=example.local - # Heroku: $ heroku run rake comfortable_mexican_sofa:fixtures:export FROM=yourapp.herokuapp.com TO=example.local - # This will create example.local folder and dump all content from example.com Site. - - # Content for Layouts, Pages and Snippets has a revision history. You can revert - # a previous version using this system. You can control how many revisions per - # object you want to keep. Set it to 0 if you wish to turn this feature off. - # config.revisions_limit = 25 - - # Locale definitions. If you want to define your own locale merge - # {:locale => 'Locale Title'} with this. - # config.locales = {:en => 'English', :es => 'Español'} - - # Admin interface will respect the locale of the site being managed. However you can - # force it to English by setting this to `:en` - # config.admin_locale = nil - - # If you want to keep your CMS tables in a location other than the default database - # add a database_config. For example, setting it to 'cms' will look for a cms_#{Rails.env} - # definition in your database.yml file - # config.database_config = nil - - # A class that is included as a sweeper to admin base controller if it's set - # config.admin_cache_sweeper = nil - - # By default you cannot have irb code inside your layouts/pages/snippets. - # Generally this is to prevent putting something like this: - # <% User.delete_all %> but if you really want to allow it... - # config.allow_irb = false - - # Whitelist of all helper methods that can be used via {{cms:helper}} tag. By default - # all helpers are allowed except `eval`, `send`, `call` and few others. Empty array - # will prevent rendering of all helpers. - # config.allowed_helpers = nil - - # Whitelist of partials paths that can be used via {{cms:partial}} tag. All partials - # are accessible by default. Empty array will prevent rendering of all partials. - # config.allowed_partials = nil - - # Site aliases, if you want to have aliases for your site. Good for harmonizing - # production env with dev/testing envs. - # e.g. config.site_aliases = {'host.com' => 'host.inv', 'host_a.com' => ['host.lvh.me', 'host.dev']} - # Default is nil (not used) - # config.hostname_aliases = nil - -end - -module CmsSpreeAuth - def authenticate - unless spree_current_user && spree_current_user.has_spree_role?('admin') - redirect_to spree.login_path - end - end -end - -# Default credentials for ComfortableMexicanSofa::HttpAuth -# YOU REALLY WANT TO CHANGE THIS BEFORE PUTTING YOUR SITE LIVE -ComfortableMexicanSofa::HttpAuth.username = 'username' -ComfortableMexicanSofa::HttpAuth.password = 'password' - -# If you need to inject some html in cms admin views you can define what partial -# should be rendered into the following areas: -# ComfortableMexicanSofa::ViewHooks.add(:navigation, '/layouts/admin/navigation') -# ComfortableMexicanSofa::ViewHooks.add(:html_head, '/layouts/admin/html_head') -# ComfortableMexicanSofa::ViewHooks.add(:page_form, '/layouts/admin/page_form') -ComfortableMexicanSofa::ViewHooks.add(:navigation, 'layouts/cms_nav_spree') - -# Provide some Spree helpers to the CMS controller so it can render Spree's layout -ComfortableMexicanSofa::CmsContentController.class_eval do - helper 'spree/base' - include Spree::Core::ControllerHelpers - include Spree::Core::Engine.routes.url_helpers -end diff --git a/config/initializers/postgres.rb b/config/initializers/postgres.rb new file mode 100644 index 0000000000..f9f4ce3645 --- /dev/null +++ b/config/initializers/postgres.rb @@ -0,0 +1,9 @@ +module ActiveRecord + module ConnectionAdapters # :nodoc: + module SchemaStatements + def drop_table_cascade(table_name, options = {}) + execute "DROP TABLE #{quote_table_name(table_name)} CASCADE" + end + end + end +end diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml index eb49b9a89b..035d74ea1c 100644 --- a/config/locales/en-GB.yml +++ b/config/locales/en-GB.yml @@ -1,22 +1,26 @@ -# Localization file for British English. Add more files in this directory for other locales. -# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. +# English language file +# --------------------- +# +# This is the source language file maintained by the Australian OFN team. +# Visit Transifex to translate this file into other languages: +# +# https://www.transifex.com/open-food-foundation/open-food-network/ +# +# If you translate this file in a text editor, please share your results with us by +# +# - uploading the file to Transifex or +# - opening a pull request at GitHub. +# +# +# See http://community.openfoodnetwork.org/t/localisation-ofn-in-your-language/397 - -en-GB: +en_GB: activerecord: - errors: - models: - spree/user: - attributes: - password: - confirmation: you have successfully registered - too_short: pick a longer name # Overridden here due to a bug in spree i18n (Issue #870) attributes: spree/order: payment_state: Payment State shipment_state: Shipment State - devise: failure: invalid: | @@ -28,13 +32,18 @@ en-GB: not_confirmed: Your email address could not be confirmed. Perhaps you have already completed this step? confirmation_sent: "Confirmation email sent!" confirmation_not_sent: "Could not send a confirmation email." + enterprise_mailer: + confirmation_instructions: + subject: "Please confirm the email address for %{enterprise}" + welcome: + subject: "%{enterprise} is now on %{sitename}" home: "OFN" title: Open Food Network welcome_to: 'Welcome to ' - site_meta_description: "We begin from the ground up. With farmers and growers ready to tell their stories proudly and truly. With distributors ready to connect people with products fairly and honestly. With buyers who believe that better weekly shopping decisions can…" + site_meta_description: "We begin from the ground up. With farmers and growers ready to tell their stories proudly and truly. With distributors ready to connect people with products fairly and honestly. With buyers who believe that better weekly shopping decisions can seriously change the world." search_by_name: Search by name... - producers: UK Producers - producers_join: UK producers are now welcome to join Open Food Network UK. + producers: 'UK Producers' + producers_join: UK producers are now welcome to join Open Food Network UK. #FIXME charges_sales_tax: Charges VAT? print_invoice: "Print Invoice" send_invoice: "Send Invoice" @@ -45,6 +54,7 @@ en-GB: cancel_order: "Cancel Order" confirm_send_invoice: "An invoice for this order will be sent to the customer. Are you sure you want to continue?" confirm_resend_order_confirmation: "Are you sure you want to resend the order confirmation email?" + must_have_valid_business_number: "Please enter your company number." invoice: "Invoice" percentage_of_sales: "%{percentage} of sales" percentage_of_turnover: "Percentage of turnover" @@ -53,31 +63,41 @@ en-GB: per_month: "per month" free: "free" free_trial: "free trial" - plus_tax: "plus GST" - total_monthly_bill_incl_tax: "Total Monthly Bill (Incl. Tax)" + plus_tax: "plus VAT" + total_monthly_bill_incl_tax: "Total Monthly Bill (Incl. VAT)" min_bill_turnover_desc: "once turnover exceeds %{mbt_amount}" + business_model_configuration: "Business model configuration" say_no: "No" say_yes: "Yes" then: then sort_order_cycles_on_shopfront_by: "Sort Order Cycles On Shopfront By" - # To customise text in emails. - producer_mail_greeting: "Dear" - producer_mail_text_before: "We now have all the consumer orders for the next food drop." - producer_mail_order_text: "Here is a summary of the orders for your products:" - producer_mail_delivery_instructions: "Stock pickup/delivery instructions:" - producer_mail_text_after: "Please confirm that you have got this email. Please send me an invoice for this amount so that we can send you payment. If you need to phone me on the day, please use the number below." - producer_mail_signoff: "Thanks and best wishes" admin: + # Common properties / models + date: Date + email: Email + name: Name + on_hand: In Stock + on_demand: On Demand + on_demand?: On Demand? + order_cycle: Order Cycle + phone: Phone + price: Price + producer: Producer + product: Product + quantity: Quantity + shop: Shop + sku: SKU + tags: Tags + variant: Variant + # General form elements quick_search: Quick Search clear_all: Clear All - producer: Producer - shop: Shop - product: Product - variant: Variant + start_date: "Start Date" + end_date: "End Date" columns: Columns actions: Actions @@ -85,42 +105,86 @@ en-GB: whats_this: What's this? + tag_has_rules: "Existing rules for this tag: %{num}" + has_one_rule: "has one rule" + has_n_rules: "has %{num} rules" + customers: index: - add_customer: "Add customer" + add_customer: "Add Customer" + new_customer: "New Customer" customer_placeholder: "customer@example.org" - inventory: - title: Inventory - description: Use this page to manage inventories for your enterprises. Any product details set here will override those set on the 'Products' page - sku: SKU - price: Price - on_hand: On Hand - on_demand: On Demand? - enable_reset: Enable Stock Level Reset? - inherit: Inherit? - add: Add - hide: Hide - select_a_shop: Select A Shop - review_now: Review Now - new_products_alert_message: There are %{new_product_count} new products available to add to your inventory. - currently_empty: Your inventory is currently empty - no_matching_products: No matching products found in your inventory - no_hidden_products: No products have been hidden from this inventory - no_matching_hidden_products: No hidden products match your search criteria - no_new_products: No new products are available to add to this inventory - no_matching_new_products: No new products match your search criteria - inventory_powertip: This is your inventory of products. To add products to your inventory, select 'New Products' from the Viewing dropdown. - hidden_powertip: These products have been hidden from your inventory and will not be available to add to your shop. You can click 'Add' to add a product to you inventory. - new_powertip: These products are available to be added to your inventory. Click 'Add' to add a product to your inventory, or 'Hide' to hide it from view. You can always change your mind later! + valid_email_error: Please enter a valid email address + add_a_new_customer_for: Add a new customer for %{shop_name} + code: Code + duplicate_code: "This code is used already." + products: + bulk_edit: + unit: Unit + display_as: Display As + category: Category + tax_category: Tax Category + inherits_properties?: Inherits Properties? + available_on: Available On + av_on: "Av. On" - order_cycle: - choose_products_from: "Choose Products From:" + variant_overrides: + index: + title: Inventory + description: Use this page to manage inventories for your enterprises. Any product details set here will override those set on the 'Products' page + enable_reset?: Enable Stock Reset? + inherit?: Inherit? + add: Add + hide: Hide + select_a_shop: Select A Shop + review_now: Review Now + new_products_alert_message: '' + currently_empty: Your inventory is currently empty + no_matching_products: No matching products found in your inventory + no_hidden_products: No products have been hidden from this inventory + no_matching_hidden_products: No hidden products match your search criteria + no_new_products: No new products are available to add to this inventory + no_matching_new_products: No new products match your search criteria + inventory_powertip: This is your inventory of products. To add products to your inventory, select 'New Products' from the Viewing dropdown. + hidden_powertip: These products have been hidden from your inventory and will not be available to add to your shop. You can click 'Add' to add a product to you inventory. + new_powertip: These products are available to be added to your inventory. Click 'Add' to add a product to your inventory, or 'Hide' to hide it from view. You can always change your mind later! + + orders: + bulk_management: + tip: "Use this page to alter product quantities across multiple orders. Products may also be removed from orders entirely, if required." + shared: "Shared Resource?" + order_no: "Order No." + order_date: "Order Date" + max: "Max" + product_unit: "Product: Unit" + weight_volume: "Weight/Volume" + ask: "Ask?" + page_title: "Bulk Order Management" + actions_delete: "Delete Selected" + loading: "Loading orders" + no_results: "No orders found." + group_buy_unit_size: "Group Buy Unit Size" + total_qtt_ordered: "Total Quantity Ordered" + max_qtt_ordered: "Max Quantity Ordered" + current_fulfilled_units: "Current Fulfilled Units" + max_fulfilled_units: "Max Fulfilled Units" + order_error: "Some errors must be resolved before you can update orders.\nAny fields with red borders contain errors." + variants_without_unit_value: "WARNING: Some variants do not have a unit value" + + order_cycles: + edit: + choose_products_from: "Choose Products From:" enterprise: select_outgoing_oc_products_from: Select outgoing OC products from enterprises: + index: + producer?: '' + package: '' + status: '' + manage: '' form: primary_details: shopfront_requires_login: "Shopfront requires login?" @@ -135,7 +199,7 @@ en-GB: show_on_map: "Show all on the map" shared: register_call: - selling_on_ofn: "Interested in getting on the Open Food Network?" + selling_on_ofn: "Interested in selling through the Open Food Network?" register: "Register here" shop: messages: @@ -157,7 +221,7 @@ en-GB: logo_mobile_svg: "Mobile logo (SVG)" #FIXME home_hero: "Hero image" home_show_stats: "Show statistics" - footer_logo: "Logo (220x76)" + footer_logo: "Logo (220x76)" #FIXME footer_facebook_url: "Facebook URL" footer_twitter_url: "Twitter URL" footer_instagram_url: "Instagram URL" @@ -183,11 +247,9 @@ en-GB: country: Country unauthorized: Unauthorized terms_of_service: "Terms of service" - on_demand: On demand + on_demand: To Order none: None - alert_selling_on_ofn: "Interested in selling food on the Open Food Network?" - alert_start_here: "Start here" label_shops: "Shops" label_map: "Map" label_producers: "Producers" @@ -200,8 +262,9 @@ en-GB: label_administration: "Administration" label_admin: "Admin" label_account: "Account" - label_more: "More" + label_more: "Show more" label_less: "Show less" + label_notices: "Community Forum" items: "items" cart_headline: "Your shopping cart" @@ -308,7 +371,7 @@ en-GB: checkout_cart_total: Cart total checkout_shipping_price: Shipping checkout_total_price: Total - checkout_back_to_cart: "Back to Cart" + checkout_back_to_cart: "Back to cart" order_paid: PAID order_not_paid: NOT PAID @@ -319,28 +382,12 @@ en-GB: order_delivery_address: Delivery address order_special_instructions: "Your notes:" order_pickup_time: Ready for collection - order_pickup_instructions: Collection Instructions + order_pickup_instructions: Collection instructions order_produce: Produce order_total_price: Total order_includes_tax: (includes tax) order_payment_paypal_successful: Your payment via PayPal has been processed successfully. - order_hub_info: Hub Info - - bom_tip: "Use this page to alter product quantities across multiple orders. Products may also be removed from orders entirely, if required." - bom_shared: "Shared Resource?" - bom_page_title: "Bulk Order Management" - bom_no: "Order no." - bom_date: "Order date" - bom_cycle: "Order cycle" - bom_max: "Max" - bom_hub: "Hub" - bom_variant: "Product: Unit" - bom_final_weigth_volume: "Weight/Volume" - bom_quantity: "Quantity" - bom_actions_delete: "Delete Selected" - bom_loading: "Loading orders" - bom_no_results: "No orders found." - bom_order_error: "Some errors must be resolved before you can update orders.\nAny fields with red borders contain errors." + order_hub_info: Hub info unsaved_changes_warning: "Unsaved changes exist and will be lost if you continue." unsaved_changes_error: "Fields with red borders contain errors." @@ -353,19 +400,15 @@ en-GB: email_welcome: "Welcome" email_confirmed: "Thank you for confirming your email address." email_registered: "is now part of" - email_userguide_html: "The User Guide with detailed support for setting up your Producer or Hub is here: -%{link}" + email_userguide_html: "The User Guide with detailed support for setting up your Producer or Hub is here: %{link}" email_admin_html: "You can manage your account by logging into the %{link} or by clicking on the cog in the top right hand side of the homepage, and selecting Administration." - email_community_html: "We also have an online forum for community discussion related to OFN software and the unique challenges of running a food enterprise. You are encouraged to join in. We are constantly evolving and your input into this forum will shape what happens next. -%{link}" + email_community_html: "We also have an online forum for community discussion related to OFN software and the unique challenges of running a food enterprise. You are encouraged to join in. We are constantly evolving and your input into this forum will shape what happens next. %{link}" email_help: "If you have any difficulties, check out our FAQs, browse the forum or post a 'Support' topic and someone will help you out!" email_confirmation_greeting: "Hi, %{contact}!" - email_confirmation_profile_created: "A profile for %{name} has been successfully created! -To activate your Profile we need to confirm this email address." + email_confirmation_profile_created: "A profile for %{name} has been successfully created! To activate your Profile we need to confirm this email address." email_confirmation_click_link: "Please click the link below to confirm your email and to continue setting up your profile." email_confirmation_link_label: "Confirm this email address »" - email_confirmation_help_html: "After confirming your email you can access your administration account for this enterprise. -See the %{link} to find out more about %{sitename}'s features and to start using your profile or online store." + email_confirmation_help_html: "After confirming your email you can access your administration account for this enterprise. See the %{link} to find out more about %{sitename}'s features and to start using your profile or online store." email_confirmation_userguide: "User Guide" email_social: "Connect with Us:" email_contact: "Email us:" @@ -402,11 +445,16 @@ See the %{link} to find out more about %{sitename}'s features and to start using email_signup_login: Your login email_signup_email: Your login email is email_signup_shop_html: "You can start shopping online now at %{link}." - email_signup_text: "Thanks for joining the network. - If you are a customer, we look forward to introducing you to many fantastic farmers, wonderful food hubs and delicious food! - If you are a producer or food enterprise, we are excited to have you as a part of the network." + email_signup_text: "Thanks for joining the network. If you are a customer, we look forward to introducing you to many fantastic farmers, wonderful food hubs and delicious food! If you are a producer or food enterprise, we are excited to have you as a part of the network." email_signup_help_html: "We welcome all your questions and feedback; you can use the Send Feedback button on the site or email us at" + producer_mail_greeting: "" + producer_mail_text_before: "" + producer_mail_order_text: "" + producer_mail_delivery_instructions: "" + producer_mail_text_after: "" + producer_mail_signoff: "" + shopping_oc_closed: Orders are closed shopping_oc_closed_description: "Please wait until the next cycle opens (or contact us directly to see if we can accept any late orders)" shopping_oc_last_closed: "The last cycle closed %{distance_of_time} ago" @@ -532,9 +580,9 @@ See the %{link} to find out more about %{sitename}'s features and to start using ocs_close_time: "ORDERS CLOSE" ocs_when_headline: When do you want your order? ocs_when_text: No products are displayed until you select a date. - ocs_when_closing: "Closing On" + ocs_when_closing: "Closing on" ocs_when_choose: "Choose Order Cycle" - ocs_list: "List View" + ocs_list: "List view" producers_about: About us producers_buy: Shop for @@ -561,20 +609,9 @@ See the %{link} to find out more about %{sitename}'s features and to start using products_description: Description products_variant: Variant products_quantity: Quantity - products_availabel: Available? + products_available: '' products_producer: "Producer" products_price: "Price" - products_sku: "SKU" - products_name: "name" - products_unit: "unit" - products_on_hand: "on hand" - products_on_demand: "On demand?" - products_category: "Category" - products_tax_category: "tax category" - products_available_on: "Available On" - products_inherit: "Inherit?" - products_inherits_properties: "Inherits Properties?" - products_stock_level_reset: "Enable Stock Level Reset?" register_title: Register @@ -592,7 +629,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using shops_signup_detail: Here's the detail. orders_fees: Fees... - orders_edit_title: Shopping Cart + orders_edit_title: Shopping cart orders_edit_headline: Your shopping cart orders_edit_time: Order ready for orders_edit_continue: Continue shopping @@ -620,14 +657,14 @@ See the %{link} to find out more about %{sitename}'s features and to start using products_oc_is: "Your order cycle for this order is %{name}." products_oc_error: "Please complete your order from %{link} before shopping in a different order cycle." products_oc_current: "your current order cycle" - products_quantity: Quantity products_max_quantity: Max quantity products_distributor: Distributor products_distributor_info: When you select a distributor for your order, their address and pickup times will be displayed here. - shop_trial_length: "Shop Trial Length (Days)" - shop_trial_expires_in: "Your shopfront trial expires in" - shop_trial_expired_notice: "Open Food Network UK is currently free while we prepare for our soft launch in April, 2016." + shop_trial_length: "" + shop_trial_expires_in: "" + shop_trial_expired_notice: "" + # keys used in javascript password: Password @@ -674,15 +711,15 @@ See the %{link} to find out more about %{sitename}'s features and to start using confirm_password: "Confirm password" action_signup: "Sign up now" welcome_to_ofn: "Welcome to the Open Food Network!" - signup_or_login: "Start By Signing Up (or logging in)" + signup_or_login: "Start By signing up (or logging in)" have_an_account: "Already have an account?" action_login: "Log in now." - forgot_password: "Forgot Password?" + forgot_password: "Forgot password?" password_reset_sent: "An email with instructions on resetting your password has been sent!" reset_password: "Reset password" registration_greeting: "Greetings!" who_is_managing_enterprise: "Who is responsible for managing %{enterprise}?" - enterprise_contact: "Primary Contact" + enterprise_contact: "Primary contact" enterprise_contact_required: "You need to enter a primary contact." enterprise_email_address: "Email address" enterprise_phone: "Phone number" @@ -692,20 +729,20 @@ See the %{link} to find out more about %{sitename}'s features and to start using limit_reached_message: "You have reached the limit!" limit_reached_text: "You have reached the limit for the number of enterprises you are allowed to own on the" limit_reached_action: "Return to the homepage" - select_promo_image: "Step 3. Select Promo Image" + select_promo_image: "Step 3. Select promo image" promo_image_tip: "Tip: Shown as a banner, preferred size is 1200×260px" promo_image_label: "Choose a promo image" action_or: "OR" promo_image_drag: "Drag and drop your promo here" - review_promo_image: "Step 4. Review Your Promo Banner" + review_promo_image: "Step 4. Review your promo banner" review_promo_image_tip: "Tip: for best results, your promo image should fill the available space" promo_image_placeholder: "Your logo will appear here for review once uploaded" uploading: "Uploading..." - select_logo: "Step 1. Select Logo Image" + select_logo: "Step 1. Select logo image" logo_tip: "Tip: Square images will work best, preferably at least 300×300px" logo_label: "Choose a logo image" logo_drag: "Drag and drop your logo here" - review_logo: "Step 2. Review Your Logo" + review_logo: "Step 2. Review your logo" review_logo_tip: "Tip: for best results, your logo should fill the available space" logo_placeholder: "Your logo will appear here for review once uploaded" enterprise_about_headline: "Nice one!" @@ -752,8 +789,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using registration_finished_thanks: "Thanks for filling out the details for %{enterprise}." registration_finished_login: "You can change or update your enterprise at any stage by logging into Open Food Network and going to Admin." registration_finished_activate: "Activate %{enterprise}." - registration_finished_activate_instruction_html: "We've sent a confirmation email to %{email} if it hasn't been activated before.
    -Please follow the instructions there to make your enterprise visible on the Open Food Network." + registration_finished_activate_instruction_html: "We've sent a confirmation email to %{email} if it hasn't been activated before.
    Please follow the instructions there to make your enterprise visible on the Open Food Network." registration_finished_action: "Open Food Network home" registration_type_headline: "Last step to add %{enterprise}!" registration_type_question: "Are you a producer?" @@ -762,14 +798,14 @@ Please follow the instructions there to make your enterprise visible on the Open registration_type_error: "Please choose one. Are you are producer?" registration_type_producer_help: "Producers make yummy things to eat and/or drink. You're a producer if you grow it, raise it, brew it, bake it, ferment it, milk it or mould it." registration_type_no_producer_help: "If you’re not a producer, you’re probably someone who sells and distributes food. You might be a hub, coop, buying group, retailer, wholesaler or other." - create_profile: "Create Profile" + create_profile: "Create profile" registration_images_headline: "Thanks!" registration_images_description: "Let's upload some pretty pictures so your profile looks great! :)" - registration_detail_headline: "Let's Get Started" + registration_detail_headline: "Let's get started" registration_detail_enterprise: "Woot! First we need to know a little bit about your enterprise:" registration_detail_producer: "Woot! First we need to know a little bit about your farm:" - registration_detail_name_enterprise: "Enterprise Name:" - registration_detail_name_producer: "Farm Name:" + registration_detail_name_enterprise: "Enterprise name:" + registration_detail_name_producer: "Farm name:" registration_detail_name_placeholder: "e.g. Charlie's Awesome Farm" registration_detail_name_error: "Please choose a unique name for your enterprise" registration_detail_address1: "Address line 1:" @@ -826,26 +862,23 @@ Please follow the instructions there to make your enterprise visible on the Open admin_entreprise_groups: "Enterprise Groups" admin_entreprise_groups_name: "Name" admin_entreprise_groups_owner: "Owner" - admin_entreprise_groups_on_front_page: "On front page ?" + admin_entreprise_groups_on_front_page: "On front page?" admin_entreprise_groups_entreprise: "Enterprises" - admin_entreprise_groups_primary_details: "Primary Details" admin_entreprise_groups_data_powertip: "The primary user responsible for this group." admin_entreprise_groups_data_powertip_logo: "This is the logo for the group" admin_entreprise_groups_data_powertip_promo_image: "This image is displayed at the top of the Group profile" - admin_entreprise_groups_about: "About" - admin_entreprise_groups_images: "Images" admin_entreprise_groups_contact: "Contact" admin_entreprise_groups_contact_phone_placeholder: "eg. 98 7654 3210" admin_entreprise_groups_contact_address1_placeholder: "eg. 123 High Street" admin_entreprise_groups_contact_city: "Suburb" - admin_entreprise_groups_contact_city_placeholder: "eg. Northcote" + admin_entreprise_groups_contact_city_placeholder: "eg. Camden" admin_entreprise_groups_contact_zipcode: "Postcode" - admin_entreprise_groups_contact_zipcode_placeholder: "eg. 3070" - admin_entreprise_groups_contact_state_id: "State" + admin_entreprise_groups_contact_zipcode_placeholder: "eg. NW1 0AA" + admin_entreprise_groups_contact_state_id: "County" admin_entreprise_groups_contact_country_id: "Country" admin_entreprise_groups_web: "Web Resources" - admin_entreprise_groups_web_twitter: "eg. @the_prof" - admin_entreprise_groups_web_website_placeholder: "eg. www.truffles.com" + admin_entreprise_groups_web_twitter: "eg. @openfoodnetuk" + admin_entreprise_groups_web_website_placeholder: "eg. www.truffles.co.uk" admin_order_cycles: "Admin Order Cycles" open: "Open" close: "Close" @@ -859,7 +892,7 @@ Please follow the instructions there to make your enterprise visible on the Open calculator: "Calculator" calculator_values: "Calculator values" new_order_cycles: "New Order Cycles" - select_a_coordinator_for_your_order_cycle: "select a coordinator for your order cycle" + select_a_coordinator_for_your_order_cycle: "" edit_order_cycle: "Edit Order Cycle" roles: "Roles" update: "Update" @@ -868,8 +901,8 @@ Please follow the instructions there to make your enterprise visible on the Open update_invoice: "Update Invoices" finalise_invoice: "Finalise Invoices" finalise_user_invoices: "Finalise User Invoices" - finalise_user_invoice_explained: "Use this button to finalize all invoices in the system for the previous calendar month. This task can be set up to run automatically once a month." - manually_run_task: "Manually Run Task " + finalise_user_invoice_explained: "Use this button to finalise all invoices in the system for the previous calendar month. This task can be set up to run automatically once a month." + manually_run_task: "Manually Run Task" update_user_invoices: "Update User Invoices" update_user_invoice_explained: "Use this button to immediately update invoices for the month to date for each enterprise user in the system. This task can be set up to run automatically every night." auto_finalise_invoices: "Auto-finalise invoices monthly on the 2nd at 1:30am" @@ -889,7 +922,7 @@ Please follow the instructions there to make your enterprise visible on the Open producer: "Producer" product: "Product" price: "Price" - on_hand: "On hand" + on_hand: "In stock" save_changes: "Save Changes" spree_admin_overview_enterprises_header: "My Enterprises" spree_admin_overview_enterprises_footer: "MANAGE MY ENTERPRISES" @@ -917,7 +950,7 @@ Please follow the instructions there to make your enterprise visible on the Open spree_admin_single_enterprise_alert_mail_confirmation: "Please confirm the email address for" spree_admin_single_enterprise_alert_mail_sent: "We've sent an email to" spree_admin_overview_action_required: "Action Required" - spree_admin_overview_check_your_inbox: "Please check you inbox for furher instructions. Thanks!" + spree_admin_overview_check_your_inbox: "Please check you inbox for further instructions. Thanks!" change_package: "Change Package" spree_admin_single_enterprise_hint: "Hint: To allow people to find you, turn on your visibility under" your_profil_live: "Your profile live" @@ -932,19 +965,7 @@ Please follow the instructions there to make your enterprise visible on the Open manage_products: "Manage products" edit_profile_details: "Edit profile details" edit_profile_details_etc: "Change your profile description, images, etc." - start_date: "Start Date" - end_date: "End Date" order_cycle: "Order Cycle" - group_buy_unit_size: "Group Buy Unit Size" - total_qtt_ordered: "Total Quantity Ordered" - max_qtt_ordered: "Max Quantity Ordered" - current_fulfilled_units: "Current Fulfilled Units" - max_fulfilled_units: "Max Fulfilled Units" - bulk_management_warning: "WARNING: Some variants do not have a unit value" - ask: "Ask?" - no_orders_found: "No orders found." - order_no: "Order No." - weight_volume: "Weight/Volume" remove_tax: "Remove tax" tax_settings: "Tax Settings" products_require_tax_category: "products require tax category" @@ -953,7 +974,7 @@ Please follow the instructions there to make your enterprise visible on the Open admin_share_city: "City" admin_share_zipcode: "Postcode" admin_share_country: "Country" - admin_share_state: "State" + admin_share_state: "County" hub_sidebar_hubs: "Hubs" hub_sidebar_none_available: "None Available" hub_sidebar_manage: "Manage" @@ -961,32 +982,32 @@ Please follow the instructions there to make your enterprise visible on the Open hub_sidebar_blue: "blue" hub_sidebar_red: "red" shop_trial_in_progress: "Your shopfront trial expires in %{days}." - shop_trial_expired: "Good news! We have decided to extend shopfront trials until further notice (probably around March 2015)." #FIXME + shop_trial_expired: "To view or change your current Open Food Network plan go to the Dashboard -> Change Package." #FIXME report_customers_distributor: "Distributor" report_customers_supplier: "Supplier" report_customers_cycle: "Order Cycle" report_customers_type: "Report Type" report_customers_csv: "Download as csv" - report_producers: "Producers: " - report_type: "Report Type: " - report_hubs: "Hubs: " - report_payment: "Payment Methods: " - report_distributor: "Distributor: " + report_producers: "Producers:" + report_type: "Report Type:" + report_hubs: "Hubs:" + report_payment: "Payment Methods:" + report_distributor: "Distributor:" report_payment_by: 'Payments By Type' report_itemised_payment: 'Itemised Payment Totals' report_payment_totals: 'Payment Totals' report_all: 'all' - report_order_cycle: "Order Cycle: " - report_entreprises: "Enterprises: " - report_users: "Users: " + report_order_cycle: "Order Cycle:" + report_entreprises: "Enterprises:" + report_users: "Users:" initial_invoice_number: "Initial invoice number:" invoice_date: "Invoice date:" - due_date: "Due date:" + due_date: "Invoice date:" account_code: "Account code:" equals: "Equals" contains: "contains" discount: "Discount" - filter_products: "Filter Products" + filter_products: " Filter Products" delete_product_variant: "The last variant cannot be deleted!" progress: "progress" saving: "Saving.." @@ -997,7 +1018,7 @@ Please follow the instructions there to make your enterprise visible on the Open products_unsaved: "Changes to %{n} products remain unsaved." add_manager: "Add a manager" is_already_manager: "is already a manager!" - no_change_to_save: " No change to save" + no_change_to_save: "No change to save" add_manager: "Add a manager" users: "Users" about: "About" @@ -1012,6 +1033,7 @@ Please follow the instructions there to make your enterprise visible on the Open properties: "Properties" shipping_methods: "Shipping Methods" payment_methods: "Payment Methods" + payment_method_fee: "" enterprise_fees: "Enterprise Fees" inventory_settings: "Inventory Settings" tag_rules: "Tag Rules" @@ -1039,7 +1061,7 @@ Please follow the instructions there to make your enterprise visible on the Open pending: pending processing: processing void: void - invalid: invalid + invalid: '' order_state: address: address adjustments: adjustments diff --git a/config/locales/en.yml b/config/locales/en.yml index 9f1b6cfabc..386f44ae8b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -255,6 +255,8 @@ en: label_producers: "Producers" label_groups: "Groups" label_about: "About" + label_connect: "Connect" + label_learn: "Learn" label_shopping: "Shopping" label_login: "Login" label_logout: "Logout" @@ -313,10 +315,8 @@ en: footer_nav_headline: "Navigate" footer_join_headline: "Join us" - footer_join_producers: "Producers sign-up" - footer_join_hubs: "Hubs sign-up" - footer_join_groups: "Groups sign-up" - footer_join_partners: "Food systems partners" + footer_join_body: "Create a listing, shop or group directory on the Open Food Network." + footer_join_cta: "Tell me more!" footer_legal_call: "Read our" footer_legal_tos: "Terms and conditions" @@ -334,7 +334,13 @@ en: brandstory_part5_strong: "We call it Open Food Network." brandstory_part6: "We all love food. Now we can love our food system too." - system_headline: "Here's how it works." + learn_body: "Explore models, stories and resources to support you to develop your fair food business or organisation. Find training, events and other opportunities to learn from peers." + learn_cta: "Get Inspired" + + connect_body: "Search our full directories of producers, hubs and groups to find fair food traders near you. List your business or organisation on the OFN so buyers can find you. Join the community to get advice and solve problems together." + connect_cta: "Go Exploring" + + system_headline: "Shopping - here's how it works." system_step1: "1. Search" system_step1_text: "Search our diverse, independent shops for seasonal local food. Search by neighbourhood and food category, or whether you prefer delivery or pickup." system_step2: "2. Shop" @@ -571,25 +577,6 @@ See the %{link} to find out more about %{sitename}'s features and to start using modal_producers: "Producers" modal_producers_explained: "Our producers make all the delicious food you can shop for on the Open Food Network." - ocs_choice_hub: "Hub:" - ocs_choice_oc: "Order Cycle:" - ocs_choice_text: "You have not yet picked where you will get your order from." - ocs_closed_headline: Orders are currently closed for this hub - ocs_closed_time: "The last cycle closed %{time} ago." - ocs_closed_contact: "Please contact your hub directly to see if they accept late orders, or wait until the next cycle opens." - ocs_closed_opens: "The next order cycle opens in %{time}" - ocs_closed_email: "Email: %{email}" - ocs_closed_phone: "Phone: %{phone}" - ocs_pickup_time: "Your order will be ready on %{pickup_time}" - ocs_change_date: "Change Collection Date" - ocs_change_date_notice: "(This will reset your cart)" - ocs_close_time: "ORDERS CLOSE" - ocs_when_headline: When do you want your order? - ocs_when_text: No products are displayed until you select a date. - ocs_when_closing: "Closing On" - ocs_when_choose: "Choose Order Cycle" - ocs_list: "List View" - producers_about: About us producers_buy: Shop for producers_contact: Contact @@ -598,6 +585,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using producers_buy_at_html: "Shop for %{enterprise} products at:" producers_filter: Filter by producers_filter_type: Type + producers_filter_property: Property producers_title: Producers producers_headline: Find local producers producers_signup_title: Sign up as a producer @@ -621,6 +609,20 @@ See the %{link} to find out more about %{sitename}'s features and to start using register_title: Register + sell_title: "Register" + sell_headline: "Get on the Open Food Network!" + sell_motivation: "Showcase your beautiful food." + sell_producers: "Producers" + sell_hubs: "Hubs" + sell_groups: "Groups" + sell_producers_detail: "Set up a profile for your business on the OFN in just minutes. At any time you can upgrade your profile to an online store and sell your products direct to customers." + sell_hubs_detail: "Set up a profile for your food enterprise or organisation on the OFN. At any time you can upgrade your profile to a multi-producer shop." + sell_groups_detail: "Set up a tailored directory of enterprises (producers and other food enterprises) for your region or for your organisation." + sell_user_guide: "Find out more in our user guide." + sell_listing_price: "Listing on the OFN is free. Opening and running a shop on OFN is free. Setting up a group directory on OFN for your organisation or regional network is free." + sell_embed: "We can also embed an OFN shop in your own customised website or build a customised local food network website for your region." + sell_ask_services: "Ask us about OFN services." + shops_title: Shops shops_headline: Shopping, transformed. shops_text: Food grows in cycles, farmers harvest in cycles, and we order food in cycles. If you find an order cycle closed, check back soon. diff --git a/config/routes.rb b/config/routes.rb index cd7c7780c4..5f37bbe831 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -15,10 +15,15 @@ Openfoodnetwork::Application.routes.draw do get "/discourse/sso", to: "discourse_sso#sso" get "/map", to: "map#index", as: :map + get "/sell", to: "home#sell", as: :sell get "/register", to: "registration#index", as: :registration get "/register/auth", to: "registration#authenticate", as: :registration_auth + # Redirects to global website + get "/connect", to: redirect("https://openfoodnetwork.org/#{ENV['DEFAULT_COUNTRY_CODE'].andand.downcase}/connect/") + get "/learn", to: redirect("https://openfoodnetwork.org/#{ENV['DEFAULT_COUNTRY_CODE'].andand.downcase}/learn/") + resource :shop, controller: "shop" do get :products post :order_cycle diff --git a/db/cms_fixtures/example.com/layouts/default/_default.yml b/db/cms_fixtures/example.com/layouts/default/_default.yml deleted file mode 100644 index 6f1626b7c0..0000000000 --- a/db/cms_fixtures/example.com/layouts/default/_default.yml +++ /dev/null @@ -1 +0,0 @@ -label: Default Fixture Layout \ No newline at end of file diff --git a/db/cms_fixtures/example.com/layouts/default/content.html b/db/cms_fixtures/example.com/layouts/default/content.html deleted file mode 100644 index f2707392b4..0000000000 --- a/db/cms_fixtures/example.com/layouts/default/content.html +++ /dev/null @@ -1,5 +0,0 @@ - - - {{ cms:page:content }} - - \ No newline at end of file diff --git a/db/cms_fixtures/example.com/layouts/default/css.css b/db/cms_fixtures/example.com/layouts/default/css.css deleted file mode 100644 index cd8b4f19df..0000000000 --- a/db/cms_fixtures/example.com/layouts/default/css.css +++ /dev/null @@ -1 +0,0 @@ -body{color: red} \ No newline at end of file diff --git a/db/cms_fixtures/example.com/layouts/default/js.js b/db/cms_fixtures/example.com/layouts/default/js.js deleted file mode 100644 index 6959d8bfc5..0000000000 --- a/db/cms_fixtures/example.com/layouts/default/js.js +++ /dev/null @@ -1 +0,0 @@ -// default js \ No newline at end of file diff --git a/db/cms_fixtures/example.com/layouts/default/nested/_nested.yml b/db/cms_fixtures/example.com/layouts/default/nested/_nested.yml deleted file mode 100644 index 754f082c41..0000000000 --- a/db/cms_fixtures/example.com/layouts/default/nested/_nested.yml +++ /dev/null @@ -1,2 +0,0 @@ -label: Default Fixture Nested Layout -position: 42 \ No newline at end of file diff --git a/db/cms_fixtures/example.com/layouts/default/nested/content.html b/db/cms_fixtures/example.com/layouts/default/nested/content.html deleted file mode 100644 index 350a3d016a..0000000000 --- a/db/cms_fixtures/example.com/layouts/default/nested/content.html +++ /dev/null @@ -1,2 +0,0 @@ -
    {{ cms:page:left }}
    -
    {{ cms:page:right }}
    \ No newline at end of file diff --git a/db/cms_fixtures/example.com/layouts/default/nested/css.css b/db/cms_fixtures/example.com/layouts/default/nested/css.css deleted file mode 100644 index 034f6fb9c2..0000000000 --- a/db/cms_fixtures/example.com/layouts/default/nested/css.css +++ /dev/null @@ -1 +0,0 @@ -div{float:left} \ No newline at end of file diff --git a/db/cms_fixtures/example.com/layouts/default/nested/js.js b/db/cms_fixtures/example.com/layouts/default/nested/js.js deleted file mode 100644 index 2508c22ed6..0000000000 --- a/db/cms_fixtures/example.com/layouts/default/nested/js.js +++ /dev/null @@ -1 +0,0 @@ -// nested js \ No newline at end of file diff --git a/db/cms_fixtures/example.com/pages/index/_index.yml b/db/cms_fixtures/example.com/pages/index/_index.yml deleted file mode 100644 index 548e85356b..0000000000 --- a/db/cms_fixtures/example.com/pages/index/_index.yml +++ /dev/null @@ -1,2 +0,0 @@ -label: Home Fixture Page -layout: default \ No newline at end of file diff --git a/db/cms_fixtures/example.com/pages/index/child/_child.yml b/db/cms_fixtures/example.com/pages/index/child/_child.yml deleted file mode 100644 index d8602e1484..0000000000 --- a/db/cms_fixtures/example.com/pages/index/child/_child.yml +++ /dev/null @@ -1,3 +0,0 @@ -label: Child Fixture Page -layout: nested -position: 42 diff --git a/db/cms_fixtures/example.com/pages/index/child/left.html b/db/cms_fixtures/example.com/pages/index/child/left.html deleted file mode 100644 index 15beb8f985..0000000000 --- a/db/cms_fixtures/example.com/pages/index/child/left.html +++ /dev/null @@ -1 +0,0 @@ -Child Page Left Fixture Content \ No newline at end of file diff --git a/db/cms_fixtures/example.com/pages/index/child/right.html b/db/cms_fixtures/example.com/pages/index/child/right.html deleted file mode 100644 index 3ac08e9ab7..0000000000 --- a/db/cms_fixtures/example.com/pages/index/child/right.html +++ /dev/null @@ -1 +0,0 @@ -Child Page Right Fixture Content \ No newline at end of file diff --git a/db/cms_fixtures/example.com/pages/index/content.html b/db/cms_fixtures/example.com/pages/index/content.html deleted file mode 100644 index fb97a42a71..0000000000 --- a/db/cms_fixtures/example.com/pages/index/content.html +++ /dev/null @@ -1,2 +0,0 @@ -Home Page Fixture Contént -{{ cms:snippet:default }} \ No newline at end of file diff --git a/db/cms_fixtures/example.com/snippets/default/_default.yml b/db/cms_fixtures/example.com/snippets/default/_default.yml deleted file mode 100644 index 64cc262bd9..0000000000 --- a/db/cms_fixtures/example.com/snippets/default/_default.yml +++ /dev/null @@ -1 +0,0 @@ -label: Default Fixture Snippet \ No newline at end of file diff --git a/db/cms_fixtures/example.com/snippets/default/content.html b/db/cms_fixtures/example.com/snippets/default/content.html deleted file mode 100644 index 48a4995fa8..0000000000 --- a/db/cms_fixtures/example.com/snippets/default/content.html +++ /dev/null @@ -1 +0,0 @@ -Fixture Content for Default Snippet \ No newline at end of file diff --git a/db/migrate/20160707023818_drop_cms.rb b/db/migrate/20160707023818_drop_cms.rb new file mode 100644 index 0000000000..018b755466 --- /dev/null +++ b/db/migrate/20160707023818_drop_cms.rb @@ -0,0 +1,154 @@ +class DropCms < ActiveRecord::Migration + + # Reverse of CreateCms in 20121009232513_create_cms.rb, including foreign keys defined + # in 20140402033428_add_foreign_keys.rb + + def up + drop_table_cascade :cms_sites + drop_table_cascade :cms_layouts + drop_table_cascade :cms_pages + drop_table_cascade :cms_snippets + drop_table_cascade :cms_blocks + drop_table_cascade :cms_files + drop_table_cascade :cms_revisions + drop_table_cascade :cms_categories + drop_table_cascade :cms_categorizations + end + + def down + text_limit = case ActiveRecord::Base.connection.adapter_name + when 'PostgreSQL' + { } + else + { :limit => 16777215 } + end + + # -- Sites -------------------------------------------------------------- + create_table :cms_sites do |t| + t.string :label, :null => false + t.string :identifier, :null => false + t.string :hostname, :null => false + t.string :path + t.string :locale, :null => false, :default => 'en' + t.boolean :is_mirrored, :null => false, :default => false + end + add_index :cms_sites, :hostname + add_index :cms_sites, :is_mirrored + + # -- Layouts ------------------------------------------------------------ + create_table :cms_layouts do |t| + t.integer :site_id, :null => false + t.integer :parent_id + t.string :app_layout + t.string :label, :null => false + t.string :identifier, :null => false + t.text :content, text_limit + t.text :css, text_limit + t.text :js, text_limit + t.integer :position, :null => false, :default => 0 + t.boolean :is_shared, :null => false, :default => false + t.timestamps + end + add_index :cms_layouts, [:parent_id, :position] + add_index :cms_layouts, [:site_id, :identifier], :unique => true + + # -- Pages -------------------------------------------------------------- + create_table :cms_pages do |t| + t.integer :site_id, :null => false + t.integer :layout_id + t.integer :parent_id + t.integer :target_page_id + t.string :label, :null => false + t.string :slug + t.string :full_path, :null => false + t.text :content, text_limit + t.integer :position, :null => false, :default => 0 + t.integer :children_count, :null => false, :default => 0 + t.boolean :is_published, :null => false, :default => true + t.boolean :is_shared, :null => false, :default => false + t.timestamps + end + add_index :cms_pages, [:site_id, :full_path] + add_index :cms_pages, [:parent_id, :position] + + # -- Page Blocks -------------------------------------------------------- + create_table :cms_blocks do |t| + t.integer :page_id, :null => false + t.string :identifier, :null => false + t.text :content + t.timestamps + end + add_index :cms_blocks, [:page_id, :identifier] + + # -- Snippets ----------------------------------------------------------- + create_table :cms_snippets do |t| + t.integer :site_id, :null => false + t.string :label, :null => false + t.string :identifier, :null => false + t.text :content, text_limit + t.integer :position, :null => false, :default => 0 + t.boolean :is_shared, :null => false, :default => false + t.timestamps + end + add_index :cms_snippets, [:site_id, :identifier], :unique => true + add_index :cms_snippets, [:site_id, :position] + + # -- Files -------------------------------------------------------------- + create_table :cms_files do |t| + t.integer :site_id, :null => false + t.integer :block_id + t.string :label, :null => false + t.string :file_file_name, :null => false + t.string :file_content_type, :null => false + t.integer :file_file_size, :null => false + t.string :description, :limit => 2048 + t.integer :position, :null => false, :default => 0 + t.timestamps + end + add_index :cms_files, [:site_id, :label] + add_index :cms_files, [:site_id, :file_file_name] + add_index :cms_files, [:site_id, :position] + add_index :cms_files, [:site_id, :block_id] + + # -- Revisions ----------------------------------------------------------- + create_table :cms_revisions, :force => true do |t| + t.string :record_type, :null => false + t.integer :record_id, :null => false + t.text :data, text_limit + t.datetime :created_at + end + add_index :cms_revisions, [:record_type, :record_id, :created_at] + + # -- Categories --------------------------------------------------------- + create_table :cms_categories, :force => true do |t| + t.integer :site_id, :null => false + t.string :label, :null => false + t.string :categorized_type, :null => false + end + add_index :cms_categories, [:site_id, :categorized_type, :label], :unique => true + + create_table :cms_categorizations, :force => true do |t| + t.integer :category_id, :null => false + t.string :categorized_type, :null => false + t.integer :categorized_id, :null => false + end + add_index :cms_categorizations, [:category_id, :categorized_type, :categorized_id], :unique => true, + :name => 'index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id' + + + # -- Foreign keys, from 20140402033428_add_foreign_keys.rb + add_foreign_key "cms_blocks", "cms_pages", name: "cms_blocks_page_id_fk", column: "page_id" + add_foreign_key "cms_categories", "cms_sites", name: "cms_categories_site_id_fk", column: "site_id", dependent: :delete + add_foreign_key "cms_categorizations", "cms_categories", name: "cms_categorizations_category_id_fk", column: "category_id" + add_foreign_key "cms_files", "cms_blocks", name: "cms_files_block_id_fk", column: "block_id" + add_foreign_key "cms_files", "cms_sites", name: "cms_files_site_id_fk", column: "site_id" + add_foreign_key "cms_layouts", "cms_layouts", name: "cms_layouts_parent_id_fk", column: "parent_id" + add_foreign_key "cms_layouts", "cms_sites", name: "cms_layouts_site_id_fk", column: "site_id", dependent: :delete + add_foreign_key "cms_pages", "cms_layouts", name: "cms_pages_layout_id_fk", column: "layout_id" + add_foreign_key "cms_pages", "cms_pages", name: "cms_pages_parent_id_fk", column: "parent_id" + add_foreign_key "cms_pages", "cms_sites", name: "cms_pages_site_id_fk", column: "site_id", dependent: :delete + add_foreign_key "cms_pages", "cms_pages", name: "cms_pages_target_page_id_fk", column: "target_page_id" + add_foreign_key "cms_snippets", "cms_sites", name: "cms_snippets_site_id_fk", column: "site_id", dependent: :delete + + end +end diff --git a/db/schema.rb b/db/schema.rb index 002e367dd6..d0403533fd 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160527012603) do +ActiveRecord::Schema.define(:version => 20160707023818) do create_table "account_invoices", :force => true do |t| t.integer "user_id", :null => false @@ -59,123 +59,6 @@ ActiveRecord::Schema.define(:version => 20160527012603) do add_index "carts", ["user_id"], :name => "index_carts_on_user_id" - create_table "cms_blocks", :force => true do |t| - t.integer "page_id", :null => false - t.string "identifier", :null => false - t.text "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "cms_blocks", ["page_id", "identifier"], :name => "index_cms_blocks_on_page_id_and_identifier" - - create_table "cms_categories", :force => true do |t| - t.integer "site_id", :null => false - t.string "label", :null => false - t.string "categorized_type", :null => false - end - - add_index "cms_categories", ["site_id", "categorized_type", "label"], :name => "index_cms_categories_on_site_id_and_categorized_type_and_label", :unique => true - - create_table "cms_categorizations", :force => true do |t| - t.integer "category_id", :null => false - t.string "categorized_type", :null => false - t.integer "categorized_id", :null => false - end - - add_index "cms_categorizations", ["category_id", "categorized_type", "categorized_id"], :name => "index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id", :unique => true - - create_table "cms_files", :force => true do |t| - t.integer "site_id", :null => false - t.integer "block_id" - t.string "label", :null => false - t.string "file_file_name", :null => false - t.string "file_content_type", :null => false - t.integer "file_file_size", :null => false - t.string "description", :limit => 2048 - t.integer "position", :default => 0, :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "cms_files", ["site_id", "block_id"], :name => "index_cms_files_on_site_id_and_block_id" - add_index "cms_files", ["site_id", "file_file_name"], :name => "index_cms_files_on_site_id_and_file_file_name" - add_index "cms_files", ["site_id", "label"], :name => "index_cms_files_on_site_id_and_label" - add_index "cms_files", ["site_id", "position"], :name => "index_cms_files_on_site_id_and_position" - - create_table "cms_layouts", :force => true do |t| - t.integer "site_id", :null => false - t.integer "parent_id" - t.string "app_layout" - t.string "label", :null => false - t.string "identifier", :null => false - t.text "content" - t.text "css" - t.text "js" - t.integer "position", :default => 0, :null => false - t.boolean "is_shared", :default => false, :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "cms_layouts", ["parent_id", "position"], :name => "index_cms_layouts_on_parent_id_and_position" - add_index "cms_layouts", ["site_id", "identifier"], :name => "index_cms_layouts_on_site_id_and_identifier", :unique => true - - create_table "cms_pages", :force => true do |t| - t.integer "site_id", :null => false - t.integer "layout_id" - t.integer "parent_id" - t.integer "target_page_id" - t.string "label", :null => false - t.string "slug" - t.string "full_path", :null => false - t.text "content" - t.integer "position", :default => 0, :null => false - t.integer "children_count", :default => 0, :null => false - t.boolean "is_published", :default => true, :null => false - t.boolean "is_shared", :default => false, :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "cms_pages", ["parent_id", "position"], :name => "index_cms_pages_on_parent_id_and_position" - add_index "cms_pages", ["site_id", "full_path"], :name => "index_cms_pages_on_site_id_and_full_path" - - create_table "cms_revisions", :force => true do |t| - t.string "record_type", :null => false - t.integer "record_id", :null => false - t.text "data" - t.datetime "created_at" - end - - add_index "cms_revisions", ["record_type", "record_id", "created_at"], :name => "index_cms_revisions_on_record_type_and_record_id_and_created_at" - - create_table "cms_sites", :force => true do |t| - t.string "label", :null => false - t.string "identifier", :null => false - t.string "hostname", :null => false - t.string "path" - t.string "locale", :default => "en", :null => false - t.boolean "is_mirrored", :default => false, :null => false - end - - add_index "cms_sites", ["hostname"], :name => "index_cms_sites_on_hostname" - add_index "cms_sites", ["is_mirrored"], :name => "index_cms_sites_on_is_mirrored" - - create_table "cms_snippets", :force => true do |t| - t.integer "site_id", :null => false - t.string "label", :null => false - t.string "identifier", :null => false - t.text "content" - t.integer "position", :default => 0, :null => false - t.boolean "is_shared", :default => false, :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "cms_snippets", ["site_id", "identifier"], :name => "index_cms_snippets_on_site_id_and_identifier", :unique => true - add_index "cms_snippets", ["site_id", "position"], :name => "index_cms_snippets_on_site_id_and_position" - create_table "column_preferences", :force => true do |t| t.integer "user_id", :null => false t.string "action_name", :null => false @@ -694,9 +577,9 @@ ActiveRecord::Schema.define(:version => 20160527012603) do t.string "email" t.text "special_instructions" t.integer "distributor_id" - t.integer "order_cycle_id" t.string "currency" t.string "last_ip_address" + t.integer "order_cycle_id" t.integer "cart_id" t.integer "customer_id" end @@ -1224,25 +1107,6 @@ ActiveRecord::Schema.define(:version => 20160527012603) do add_foreign_key "carts", "spree_users", name: "carts_user_id_fk", column: "user_id" - add_foreign_key "cms_blocks", "cms_pages", name: "cms_blocks_page_id_fk", column: "page_id" - - add_foreign_key "cms_categories", "cms_sites", name: "cms_categories_site_id_fk", column: "site_id", dependent: :delete - - add_foreign_key "cms_categorizations", "cms_categories", name: "cms_categorizations_category_id_fk", column: "category_id" - - add_foreign_key "cms_files", "cms_blocks", name: "cms_files_block_id_fk", column: "block_id" - add_foreign_key "cms_files", "cms_sites", name: "cms_files_site_id_fk", column: "site_id" - - add_foreign_key "cms_layouts", "cms_layouts", name: "cms_layouts_parent_id_fk", column: "parent_id" - add_foreign_key "cms_layouts", "cms_sites", name: "cms_layouts_site_id_fk", column: "site_id", dependent: :delete - - add_foreign_key "cms_pages", "cms_layouts", name: "cms_pages_layout_id_fk", column: "layout_id" - add_foreign_key "cms_pages", "cms_pages", name: "cms_pages_parent_id_fk", column: "parent_id" - add_foreign_key "cms_pages", "cms_pages", name: "cms_pages_target_page_id_fk", column: "target_page_id" - add_foreign_key "cms_pages", "cms_sites", name: "cms_pages_site_id_fk", column: "site_id", dependent: :delete - - add_foreign_key "cms_snippets", "cms_sites", name: "cms_snippets_site_id_fk", column: "site_id", dependent: :delete - add_foreign_key "coordinator_fees", "enterprise_fees", name: "coordinator_fees_enterprise_fee_id_fk" add_foreign_key "coordinator_fees", "order_cycles", name: "coordinator_fees_order_cycle_id_fk" diff --git a/knapsack_rspec_report.json b/knapsack_rspec_report.json index 9578580ffd..5d71fa12e2 100644 --- a/knapsack_rspec_report.json +++ b/knapsack_rspec_report.json @@ -1,173 +1,213 @@ { - "spec/controllers/admin/accounts_and_billing_settings_controller_spec.rb": 5.547292709350586, - "spec/controllers/admin/business_model_configuration_controller_spec.rb": 0.3683593273162842, - "spec/controllers/admin/customers_controller_spec.rb": 0.8933048248291016, - "spec/controllers/admin/enterprises_controller_spec.rb": 5.984264850616455, - "spec/controllers/admin/order_cycles_controller_spec.rb": 2.839667558670044, - "spec/controllers/api/enterprises_controller_spec.rb": 0.2780017852783203, - "spec/controllers/api/order_cycles_controller_spec.rb": 1.8730568885803223, - "spec/controllers/base_controller_spec.rb": 0.02932429313659668, - "spec/controllers/cart_controller_spec.rb": 1.062530517578125, - "spec/controllers/checkout_controller_spec.rb": 1.6658811569213867, - "spec/controllers/enterprise_confirmations_controller_spec.rb": 1.1228001117706299, - "spec/controllers/enterprises_controller_spec.rb": 2.2625372409820557, - "spec/controllers/groups_controller_spec.rb": 0.40616846084594727, - "spec/controllers/registration_controller_spec.rb": 0.2145981788635254, - "spec/controllers/shop_controller_spec.rb": 5.298644304275513, - "spec/controllers/shops_controller_spec.rb": 0.2002561092376709, - "spec/controllers/spree/admin/adjustments_controller_spec.rb": 1.023233413696289, - "spec/controllers/spree/admin/base_controller_spec.rb": 0.28871917724609375, - "spec/controllers/spree/admin/line_items_controller_spec.rb": 14.042466402053833, - "spec/controllers/spree/admin/orders_controller_spec.rb": 12.639750480651855, - "spec/controllers/spree/admin/overview_controller_spec.rb": 0.691641092300415, - "spec/controllers/spree/admin/payment_methods_controller_spec.rb": 0.7098217010498047, - "spec/controllers/spree/admin/products_controller_spec.rb": 1.4383087158203125, - "spec/controllers/spree/admin/reports_controller_spec.rb": 47.79633665084839, - "spec/controllers/spree/admin/search_controller_spec.rb": 0.9386723041534424, - "spec/controllers/spree/admin/variants_controller_spec.rb": 2.0663084983825684, - "spec/controllers/spree/api/line_items_controller_spec.rb": 0.4743325710296631, - "spec/controllers/spree/api/products_controller_spec.rb": 8.339523792266846, - "spec/controllers/spree/api/variants_controller_spec.rb": 4.835069179534912, - "spec/controllers/spree/checkout_controller_spec.rb": 0.687798023223877, - "spec/controllers/spree/orders_controller_spec.rb": 1.7623963356018066, - "spec/controllers/spree/paypal_controller_spec.rb": 0.437147855758667, - "spec/controllers/spree/store_controller_spec.rb": 0.03699040412902832, - "spec/controllers/spree/user_sessions_controller_spec.rb": 0.09967947006225586, - "spec/controllers/user_passwords_controller_spec.rb": 0.31070899963378906, - "spec/controllers/user_registrations_controller_spec.rb": 0.36581993103027344, - "spec/features/admin/account_spec.rb": 0.32449865341186523, - "spec/features/admin/accounts_and_billing_settings_spec.rb": 15.864763259887695, - "spec/features/admin/adjustments_spec.rb": 6.825028896331787, - "spec/features/admin/authentication_spec.rb": 22.29801869392395, - "spec/features/admin/bulk_order_management_spec.rb": 112.38913011550903, - "spec/features/admin/bulk_product_update_spec.rb": 59.00568914413452, - "spec/features/admin/business_model_configuration_spec.rb": 2.5152199268341064, - "spec/features/admin/cms_spec.rb": 2.5085999965667725, - "spec/features/admin/content_spec.rb": 1.2907540798187256, - "spec/features/admin/customers_spec.rb": 33.99929761886597, - "spec/features/admin/enterprise_fees_spec.rb": 13.33712100982666, - "spec/features/admin/enterprise_groups_spec.rb": 8.689672231674194, - "spec/features/admin/enterprise_relationships_spec.rb": 7.257282733917236, - "spec/features/admin/enterprise_roles_spec.rb": 5.535412788391113, - "spec/features/admin/enterprise_user_spec.rb": 2.5493221282958984, - "spec/features/admin/enterprises/index_spec.rb": 5.77092719078064, - "spec/features/admin/enterprises_spec.rb": 34.78606820106506, - "spec/features/admin/image_settings_spec.rb": 0.4501008987426758, - "spec/features/admin/order_cycles_spec.rb": 64.186044216156, - "spec/features/admin/orders_spec.rb": 49.190918922424316, - "spec/features/admin/overview_spec.rb": 5.788672208786011, - "spec/features/admin/payment_method_spec.rb": 15.959310531616211, - "spec/features/admin/products_spec.rb": 21.46337914466858, - "spec/features/admin/reports_spec.rb": 150.51152086257935, - "spec/features/admin/shipping_methods_spec.rb": 8.671862363815308, - "spec/features/admin/tax_settings_spec.rb": 0.7941949367523193, - "spec/features/admin/variant_overrides_spec.rb": 29.70982050895691, - "spec/features/admin/variants_spec.rb": 5.565031290054321, - "spec/features/consumer/authentication_spec.rb": 12.449390649795532, - "spec/features/consumer/groups_spec.rb": 1.545715093612671, - "spec/features/consumer/producers_spec.rb": 3.3242862224578857, - "spec/features/consumer/registration_spec.rb": 2.421873092651367, - "spec/features/consumer/shopping/cart_spec.rb": 1.6924467086791992, - "spec/features/consumer/shopping/checkout_auth_spec.rb": 8.496914863586426, - "spec/features/consumer/shopping/checkout_spec.rb": 39.204933881759644, - "spec/features/consumer/shopping/shopping_spec.rb": 23.358332633972168, - "spec/features/consumer/shopping/variant_overrides_spec.rb": 58.16736888885498, - "spec/features/consumer/shops_spec.rb": 6.636866092681885, - "spec/helpers/admin/business_model_configuration_helper_spec.rb": 0.2595028877258301, - "spec/helpers/checkout_helper_spec.rb": 0.10617446899414062, - "spec/helpers/groups_helper_spec.rb": 0.007729053497314453, - "spec/helpers/html_helper_spec.rb": 0.05157279968261719, - "spec/helpers/injection_helper_spec.rb": 0.6142556667327881, - "spec/helpers/navigation_helper_spec.rb": 0.02951979637145996, - "spec/helpers/order_cycles_helper_spec.rb": 0.5953588485717773, - "spec/helpers/products_helper_spec.rb": 0.009511232376098633, - "spec/helpers/shared_helper_spec.rb": 0.017564058303833008, - "spec/helpers/shop_helper_spec.rb": 0.05760025978088379, - "spec/jobs/confirm_order_job_spec.rb": 0.0458524227142334, - "spec/jobs/confirm_signup_job_spec.rb": 0.021564006805419922, - "spec/jobs/finalize_account_invoices_spec.rb": 4.505181312561035, - "spec/jobs/order_cycle_notification_job_spec.rb": 2.0606272220611572, - "spec/jobs/update_account_invoices_spec.rb": 18.434475898742676, - "spec/jobs/update_billable_periods_spec.rb": 4.850176572799683, - "spec/jobs/welcome_enterprise_job_spec.rb": 0.07065534591674805, - "spec/lib/open_food_network/bulk_coop_report_spec.rb": 4.789663553237915, - "spec/lib/open_food_network/customers_report_spec.rb": 2.419727325439453, - "spec/lib/open_food_network/distribution_change_validator_spec.rb": 0.10607743263244629, - "spec/lib/open_food_network/enterprise_fee_applicator_spec.rb": 0.7333858013153076, - "spec/lib/open_food_network/enterprise_fee_calculator_spec.rb": 7.406745195388794, - "spec/lib/open_food_network/enterprise_injection_data_spec.rb": 0.291548490524292, - "spec/lib/open_food_network/enterprise_issue_validator_spec.rb": 0.09764814376831055, - "spec/lib/open_food_network/feature_toggle_spec.rb": 0.010193109512329102, - "spec/lib/open_food_network/group_buy_report_spec.rb": 3.708569049835205, - "spec/lib/open_food_network/last_used_address_spec.rb": 0.0254666805267334, - "spec/lib/open_food_network/lettuce_share_report_spec.rb": 2.3206725120544434, - "spec/lib/open_food_network/option_value_namer_spec.rb": 0.06185555458068848, - "spec/lib/open_food_network/order_and_distributor_report_spec.rb": 1.0406858921051025, - "spec/lib/open_food_network/order_cycle_form_applicator_spec.rb": 4.533008337020874, - "spec/lib/open_food_network/order_cycle_management_report_spec.rb": 2.036308526992798, - "spec/lib/open_food_network/order_cycle_permissions_spec.rb": 23.74185061454773, - "spec/lib/open_food_network/order_grouper_spec.rb": 0.029039621353149414, - "spec/lib/open_food_network/orders_and_fulfillments_report_spec.rb": 5.135573148727417, - "spec/lib/open_food_network/packing_report_spec.rb": 5.088447093963623, - "spec/lib/open_food_network/permissions_spec.rb": 8.881855249404907, - "spec/lib/open_food_network/products_and_inventory_report_spec.rb": 3.55375337600708, - "spec/lib/open_food_network/referer_parser_spec.rb": 0.014271259307861328, - "spec/lib/open_food_network/reports/report_spec.rb": 0.02238297462463379, - "spec/lib/open_food_network/reports/row_spec.rb": 0.0031762123107910156, - "spec/lib/open_food_network/reports/rule_spec.rb": 0.013959169387817383, - "spec/lib/open_food_network/sales_tax_report_spec.rb": 0.10717129707336426, - "spec/lib/open_food_network/scope_variant_to_hub_spec.rb": 2.4846229553222656, - "spec/lib/open_food_network/user_balance_calculator_spec.rb": 3.4277901649475098, - "spec/lib/open_food_network/users_and_enterprises_report_spec.rb": 0.40532779693603516, - "spec/lib/open_food_network/xero_invoices_report_spec.rb": 1.1586685180664062, - "spec/lib/spree/product_filters_spec.rb": 0.13163042068481445, - "spec/mailers/enterprise_mailer_spec.rb": 0.4537942409515381, - "spec/mailers/order_mailer_spec.rb": 1.452355146408081, - "spec/mailers/producer_mailer_spec.rb": 8.775528192520142, - "spec/mailers/user_mailer_spec.rb": 0.057527780532836914, - "spec/models/adjustment_metadata_spec.rb": 0.22016620635986328, - "spec/models/billable_period_spec.rb": 2.06524658203125, - "spec/models/calculator/weight_spec.rb": 0.009344100952148438, - "spec/models/cart_spec.rb": 4.099429130554199, - "spec/models/customer_spec.rb": 0.07328605651855469, - "spec/models/enterprise_caching_spec.rb": 0.8475983142852783, - "spec/models/enterprise_fee_spec.rb": 3.1999905109405518, - "spec/models/enterprise_group_spec.rb": 0.30861926078796387, - "spec/models/enterprise_relationship_spec.rb": 2.1849746704101562, - "spec/models/enterprise_spec.rb": 17.679611682891846, - "spec/models/exchange_spec.rb": 13.899227857589722, - "spec/models/model_set_spec.rb": 0.22760748863220215, - "spec/models/order_cycle_spec.rb": 10.680967569351196, - "spec/models/product_distribution_spec.rb": 2.227938413619995, - "spec/models/spree/ability_spec.rb": 15.278357028961182, - "spec/models/spree/addresses_spec.rb": 0.055602312088012695, - "spec/models/spree/adjustment_spec.rb": 9.196375846862793, - "spec/models/spree/classification_spec.rb": 0.161299467086792, - "spec/models/spree/image_spec.rb": 0.007464408874511719, - "spec/models/spree/line_item_spec.rb": 13.545411586761475, - "spec/models/spree/order_populator_spec.rb": 1.635932207107544, - "spec/models/spree/order_spec.rb": 10.645411968231201, - "spec/models/spree/payment_method_spec.rb": 0.0733034610748291, - "spec/models/spree/payment_spec.rb": 1.691227912902832, - "spec/models/spree/preferences/file_configuration_spec.rb": 0.03429675102233887, - "spec/models/spree/product_spec.rb": 17.406191110610962, - "spec/models/spree/shipping_method_spec.rb": 3.0447566509246826, - "spec/models/spree/tax_rate_spec.rb": 0.44750261306762695, - "spec/models/spree/taxon_spec.rb": 0.553098201751709, - "spec/models/spree/user_spec.rb": 1.2693369388580322, - "spec/models/spree/variant_spec.rb": 13.75825023651123, - "spec/models/variant_override_spec.rb": 4.086935520172119, - "spec/performance/injection_helper_spec.rb": 6.890667676925659, - "spec/performance/orders_controller_spec.rb": 0.031180143356323242, - "spec/performance/shop_controller_spec.rb": 18.19426918029785, - "spec/requests/large_request_spec.rb": 0.02229022979736328, - "spec/requests/shop_spec.rb": 1.0012562274932861, - "spec/serializers/admin/enterprise_serializer_spec.rb": 0.10484433174133301, - "spec/serializers/admin/exchange_serializer_spec.rb": 0.7569985389709473, - "spec/serializers/admin/for_order_cycle/enterprise_serializer_spec.rb": 0.4293792247772217, - "spec/serializers/admin/index_enterprise_serializer_spec.rb": 1.2506742477416992, - "spec/serializers/admin/variant_override_serializer_spec.rb": 0.38981151580810547, - "spec/serializers/enterprise_serializer_spec.rb": 0.3511006832122803, - "spec/serializers/spree/product_serializer_spec.rb": 0.26622653007507324, - "spec/serializers/spree/variant_serializer_spec.rb": 0.30304574966430664 -} + "spec/controllers/admin/accounts_and_billing_settings_controller_spec.rb": 4.729289770126343, + "spec/controllers/admin/business_model_configuration_controller_spec.rb": 0.3204472064971924, + "spec/controllers/admin/column_preferences_controller_spec.rb": 0.21457862854003906, + "spec/controllers/admin/customers_controller_spec.rb": 1.2570579051971436, + "spec/controllers/admin/enterprises_controller_spec.rb": 6.453823804855347, + "spec/controllers/admin/inventory_items_controller_spec.rb": 3.3494999408721924, + "spec/controllers/admin/order_cycles_controller_spec.rb": 3.2418012619018555, + "spec/controllers/admin/tag_rules_controller_spec.rb": 0.278639554977417, + "spec/controllers/admin/variant_overrides_controller_spec.rb": 4.334253549575806, + "spec/controllers/api/enterprises_controller_spec.rb": 0.4233386516571045, + "spec/controllers/api/order_cycles_controller_spec.rb": 1.9799659252166748, + "spec/controllers/api/statuses_controller_spec.rb": 0.0580599308013916, + "spec/controllers/base_controller_spec.rb": 0.025392770767211914, + "spec/controllers/cart_controller_spec.rb": 1.188997507095337, + "spec/controllers/checkout_controller_spec.rb": 1.7111992835998535, + "spec/controllers/enterprise_confirmations_controller_spec.rb": 1.057147741317749, + "spec/controllers/enterprises_controller_spec.rb": 3.9115149974823, + "spec/controllers/groups_controller_spec.rb": 0.4256296157836914, + "spec/controllers/registration_controller_spec.rb": 0.1444110870361328, + "spec/controllers/shop_controller_spec.rb": 2.8928422927856445, + "spec/controllers/shops_controller_spec.rb": 0.23369908332824707, + "spec/controllers/spree/admin/adjustments_controller_spec.rb": 1.0890753269195557, + "spec/controllers/spree/admin/base_controller_spec.rb": 0.1624138355255127, + "spec/controllers/spree/admin/line_items_controller_spec.rb": 16.208045721054077, + "spec/controllers/spree/admin/orders_controller_spec.rb": 15.907819509506226, + "spec/controllers/spree/admin/overview_controller_spec.rb": 0.8662476539611816, + "spec/controllers/spree/admin/payment_methods_controller_spec.rb": 0.4896993637084961, + "spec/controllers/spree/admin/products_controller_spec.rb": 2.074070930480957, + "spec/controllers/spree/admin/reports_controller_spec.rb": 55.07741975784302, + "spec/controllers/spree/admin/search_controller_spec.rb": 0.5158224105834961, + "spec/controllers/spree/admin/variants_controller_spec.rb": 1.990790605545044, + "spec/controllers/spree/api/line_items_controller_spec.rb": 0.3319206237792969, + "spec/controllers/spree/api/products_controller_spec.rb": 6.679011106491089, + "spec/controllers/spree/api/variants_controller_spec.rb": 3.7782905101776123, + "spec/controllers/spree/checkout_controller_spec.rb": 0.9790353775024414, + "spec/controllers/spree/orders_controller_spec.rb": 4.158925294876099, + "spec/controllers/spree/paypal_controller_spec.rb": 0.020407676696777344, + "spec/controllers/spree/store_controller_spec.rb": 0.03319215774536133, + "spec/controllers/spree/user_sessions_controller_spec.rb": 0.07898402214050293, + "spec/controllers/user_passwords_controller_spec.rb": 0.717381477355957, + "spec/controllers/user_registrations_controller_spec.rb": 0.2160170078277588, + "spec/features/admin/account_spec.rb": 0.2934560775756836, + "spec/features/admin/accounts_and_billing_settings_spec.rb": 15.889720678329468, + "spec/features/admin/adjustments_spec.rb": 5.175323009490967, + "spec/features/admin/authentication_spec.rb": 18.345781087875366, + "spec/features/admin/bulk_order_management_spec.rb": 111.50722217559814, + "spec/features/admin/bulk_product_update_spec.rb": 63.564337730407715, + "spec/features/admin/business_model_configuration_spec.rb": 2.1073272228240967, + "spec/features/admin/caching_spec.rb": 0.8505651950836182, + "spec/features/admin/content_spec.rb": 1.1712932586669922, + "spec/features/admin/customers_spec.rb": 71.91736245155334, + "spec/features/admin/enterprise_fees_spec.rb": 15.482876300811768, + "spec/features/admin/enterprise_groups_spec.rb": 8.615704774856567, + "spec/features/admin/enterprise_relationships_spec.rb": 11.908889293670654, + "spec/features/admin/enterprise_roles_spec.rb": 5.027954578399658, + "spec/features/admin/enterprise_user_spec.rb": 2.158304214477539, + "spec/features/admin/enterprises/index_spec.rb": 5.7792346477508545, + "spec/features/admin/enterprises_spec.rb": 39.01360893249512, + "spec/features/admin/external_services_spec.rb": 0.41648149490356445, + "spec/features/admin/image_settings_spec.rb": 0.4291551113128662, + "spec/features/admin/order_cycles_spec.rb": 66.84531092643738, + "spec/features/admin/orders_spec.rb": 50.86089587211609, + "spec/features/admin/overview_spec.rb": 4.884965896606445, + "spec/features/admin/payment_method_spec.rb": 14.099174499511719, + "spec/features/admin/products_spec.rb": 17.05465793609619, + "spec/features/admin/reports_spec.rb": 142.85665917396545, + "spec/features/admin/shipping_methods_spec.rb": 6.785600900650024, + "spec/features/admin/tag_rules_spec.rb": 21.80374526977539, + "spec/features/admin/tax_settings_spec.rb": 0.5856199264526367, + "spec/features/admin/variant_overrides_spec.rb": 54.87969517707825, + "spec/features/admin/variants_spec.rb": 4.425906658172607, + "spec/features/consumer/account_spec.rb": 14.138294458389282, + "spec/features/consumer/authentication_spec.rb": 15.800535440444946, + "spec/features/consumer/external_services_spec.rb": 0.47263646125793457, + "spec/features/consumer/groups_spec.rb": 2.167065143585205, + "spec/features/consumer/producers_spec.rb": 8.219613790512085, + "spec/features/consumer/registration_spec.rb": 3.2899246215820312, + "spec/features/consumer/shopping/cart_spec.rb": 7.931907653808594, + "spec/features/consumer/shopping/checkout_auth_spec.rb": 10.027384042739868, + "spec/features/consumer/shopping/checkout_spec.rb": 60.93560552597046, + "spec/features/consumer/shopping/shopping_spec.rb": 64.26991128921509, + "spec/features/consumer/shopping/variant_overrides_spec.rb": 71.18549585342407, + "spec/features/consumer/shops_spec.rb": 12.581299543380737, + "spec/helpers/admin/business_model_configuration_helper_spec.rb": 0.4121088981628418, + "spec/helpers/checkout_helper_spec.rb": 0.017447471618652344, + "spec/helpers/enterprises_helper_spec.rb": 3.16050124168396, + "spec/helpers/groups_helper_spec.rb": 0.008687734603881836, + "spec/helpers/html_helper_spec.rb": 0.12075495719909668, + "spec/helpers/injection_helper_spec.rb": 13.099636316299438, + "spec/helpers/navigation_helper_spec.rb": 0.037546634674072266, + "spec/helpers/order_cycles_helper_spec.rb": 0.5602025985717773, + "spec/helpers/products_helper_spec.rb": 0.009445667266845703, + "spec/helpers/shared_helper_spec.rb": 0.021656036376953125, + "spec/helpers/shop_helper_spec.rb": 0.06465697288513184, + "spec/jobs/confirm_order_job_spec.rb": 0.04894542694091797, + "spec/jobs/confirm_signup_job_spec.rb": 0.15027284622192383, + "spec/jobs/finalize_account_invoices_spec.rb": 4.740641832351685, + "spec/jobs/heartbeat_job_spec.rb": 0.020777225494384766, + "spec/jobs/order_cycle_notification_job_spec.rb": 2.3326029777526855, + "spec/jobs/products_cache_integrity_checker_job_spec.rb": 2.176734685897827, + "spec/jobs/refresh_products_cache_job_spec.rb": 0.14060688018798828, + "spec/jobs/update_account_invoices_spec.rb": 18.77696418762207, + "spec/jobs/update_billable_periods_spec.rb": 5.19831395149231, + "spec/jobs/welcome_enterprise_job_spec.rb": 0.05716228485107422, + "spec/lib/open_food_network/bulk_coop_report_spec.rb": 5.522400140762329, + "spec/lib/open_food_network/cached_products_renderer_spec.rb": 0.0779104232788086, + "spec/lib/open_food_network/customers_report_spec.rb": 2.789498805999756, + "spec/lib/open_food_network/distribution_change_validator_spec.rb": 0.12454366683959961, + "spec/lib/open_food_network/enterprise_fee_applicator_spec.rb": 1.0582823753356934, + "spec/lib/open_food_network/enterprise_fee_calculator_spec.rb": 9.390950918197632, + "spec/lib/open_food_network/enterprise_injection_data_spec.rb": 0.30153727531433105, + "spec/lib/open_food_network/enterprise_issue_validator_spec.rb": 0.09757637977600098, + "spec/lib/open_food_network/feature_toggle_spec.rb": 0.011552810668945312, + "spec/lib/open_food_network/group_buy_report_spec.rb": 4.40512228012085, + "spec/lib/open_food_network/last_used_address_spec.rb": 0.4271695613861084, + "spec/lib/open_food_network/lettuce_share_report_spec.rb": 2.5144362449645996, + "spec/lib/open_food_network/option_value_namer_spec.rb": 0.47345566749572754, + "spec/lib/open_food_network/order_and_distributor_report_spec.rb": 1.1131298542022705, + "spec/lib/open_food_network/order_cycle_form_applicator_spec.rb": 7.482408761978149, + "spec/lib/open_food_network/order_cycle_management_report_spec.rb": 2.9279346466064453, + "spec/lib/open_food_network/order_cycle_permissions_spec.rb": 27.034855365753174, + "spec/lib/open_food_network/order_grouper_spec.rb": 0.0347137451171875, + "spec/lib/open_food_network/orders_and_fulfillments_report_spec.rb": 6.190460443496704, + "spec/lib/open_food_network/packing_report_spec.rb": 5.795913934707642, + "spec/lib/open_food_network/permissions_spec.rb": 9.981389284133911, + "spec/lib/open_food_network/products_and_inventory_report_spec.rb": 4.536849737167358, + "spec/lib/open_food_network/products_cache_refreshment_spec.rb": 0.3400561809539795, + "spec/lib/open_food_network/products_cache_spec.rb": 13.676804304122925, + "spec/lib/open_food_network/products_renderer_spec.rb": 5.883910894393921, + "spec/lib/open_food_network/property_merge_spec.rb": 0.28261804580688477, + "spec/lib/open_food_network/referer_parser_spec.rb": 0.016553640365600586, + "spec/lib/open_food_network/reports/report_spec.rb": 0.027279138565063477, + "spec/lib/open_food_network/reports/row_spec.rb": 0.004057884216308594, + "spec/lib/open_food_network/reports/rule_spec.rb": 0.018927812576293945, + "spec/lib/open_food_network/sales_tax_report_spec.rb": 0.1267712116241455, + "spec/lib/open_food_network/scope_variant_to_hub_spec.rb": 5.346986532211304, + "spec/lib/open_food_network/tag_rule_applicator_spec.rb": 2.972744941711426, + "spec/lib/open_food_network/user_balance_calculator_spec.rb": 6.290127754211426, + "spec/lib/open_food_network/users_and_enterprises_report_spec.rb": 0.435042142868042, + "spec/lib/open_food_network/xero_invoices_report_spec.rb": 1.327892780303955, + "spec/lib/spree/product_filters_spec.rb": 0.14480209350585938, + "spec/mailers/enterprise_mailer_spec.rb": 1.2255680561065674, + "spec/mailers/order_mailer_spec.rb": 1.9922146797180176, + "spec/mailers/producer_mailer_spec.rb": 28.504019021987915, + "spec/mailers/user_mailer_spec.rb": 0.06116366386413574, + "spec/models/adjustment_metadata_spec.rb": 0.22940421104431152, + "spec/models/billable_period_spec.rb": 5.919523477554321, + "spec/models/calculator/weight_spec.rb": 0.011056900024414062, + "spec/models/cart_spec.rb": 4.7867491245269775, + "spec/models/column_preference_spec.rb": 0.12476158142089844, + "spec/models/content_configuration_spec.rb": 0.0069255828857421875, + "spec/models/coordinator_fee_spec.rb": 0.1413099765777588, + "spec/models/customer_spec.rb": 0.9213364124298096, + "spec/models/enterprise_caching_spec.rb": 0.8015868663787842, + "spec/models/enterprise_fee_spec.rb": 3.8326468467712402, + "spec/models/enterprise_group_spec.rb": 0.35931992530822754, + "spec/models/enterprise_relationship_spec.rb": 7.324019908905029, + "spec/models/enterprise_spec.rb": 20.723163843154907, + "spec/models/exchange_fee_spec.rb": 0.24502134323120117, + "spec/models/exchange_spec.rb": 15.133025646209717, + "spec/models/inventory_item_spec.rb": 0.2637319564819336, + "spec/models/model_set_spec.rb": 0.2381300926208496, + "spec/models/order_cycle_spec.rb": 19.834176540374756, + "spec/models/producer_property_spec.rb": 0.12196111679077148, + "spec/models/product_distribution_spec.rb": 2.8120880126953125, + "spec/models/spree/ability_spec.rb": 16.657139778137207, + "spec/models/spree/addresses_spec.rb": 0.06702327728271484, + "spec/models/spree/adjustment_spec.rb": 13.998104333877563, + "spec/models/spree/classification_spec.rb": 0.7607810497283936, + "spec/models/spree/image_spec.rb": 2.1546812057495117, + "spec/models/spree/line_item_spec.rb": 18.319732189178467, + "spec/models/spree/option_type_spec.rb": 0.38923072814941406, + "spec/models/spree/option_value_spec.rb": 0.4280354976654053, + "spec/models/spree/order_populator_spec.rb": 1.4095511436462402, + "spec/models/spree/order_spec.rb": 9.809221029281616, + "spec/models/spree/payment_method_spec.rb": 0.5280671119689941, + "spec/models/spree/payment_spec.rb": 2.4764130115509033, + "spec/models/spree/preference_spec.rb": 0.059625864028930664, + "spec/models/spree/preferences/file_configuration_spec.rb": 0.038376808166503906, + "spec/models/spree/price_spec.rb": 0.5022625923156738, + "spec/models/spree/product_property_spec.rb": 0.3601999282836914, + "spec/models/spree/product_spec.rb": 16.564993381500244, + "spec/models/spree/property_spec.rb": 1.6884117126464844, + "spec/models/spree/shipping_method_spec.rb": 2.2080821990966797, + "spec/models/spree/tax_rate_spec.rb": 0.37114739418029785, + "spec/models/spree/taxon_spec.rb": 1.0655884742736816, + "spec/models/spree/user_spec.rb": 16.094335317611694, + "spec/models/spree/variant_spec.rb": 14.885905027389526, + "spec/models/tag_rule/filter_order_cycles_spec.rb": 0.21634840965270996, + "spec/models/tag_rule/filter_payment_methods_spec.rb": 0.4332749843597412, + "spec/models/tag_rule/filter_products_spec.rb": 0.21471834182739258, + "spec/models/tag_rule/filter_shipping_methods_spec.rb": 0.3680458068847656, + "spec/models/tag_rule_spec.rb": 0.05348682403564453, + "spec/models/variant_override_spec.rb": 5.598196029663086, + "spec/performance/injection_helper_spec.rb": 4.83400297164917, + "spec/performance/orders_controller_spec.rb": 0.028135061264038086, + "spec/performance/shop_controller_spec.rb": 14.35703420639038, + "spec/requests/large_request_spec.rb": 0.024456262588500977, + "spec/requests/shop_spec.rb": 1.0987565517425537, + "spec/serializers/admin/customer_serializer_spec.rb": 0.0909874439239502, + "spec/serializers/admin/enterprise_serializer_spec.rb": 0.06178736686706543, + "spec/serializers/admin/exchange_serializer_spec.rb": 2.586963653564453, + "spec/serializers/admin/for_order_cycle/enterprise_serializer_spec.rb": 0.8507771492004395, + "spec/serializers/admin/for_order_cycle/supplied_product_serializer_spec.rb": 0.6380510330200195, + "spec/serializers/admin/index_enterprise_serializer_spec.rb": 0.19609999656677246, + "spec/serializers/admin/variant_override_serializer_spec.rb": 0.27136850357055664, + "spec/serializers/enterprise_serializer_spec.rb": 0.22696876525878906, + "spec/serializers/order_serializer_spec.rb": 1.3858006000518799, + "spec/serializers/orders_by_distributor_serializer_spec.rb": 3.6581554412841797, + "spec/serializers/spree/product_serializer_spec.rb": 0.17654776573181152, + "spec/serializers/spree/variant_serializer_spec.rb": 0.2116224765777588 +} \ No newline at end of file diff --git a/lib/open_food_network/feature_toggle.rb b/lib/open_food_network/feature_toggle.rb index e95be176fc..be1a9b0065 100644 --- a/lib/open_food_network/feature_toggle.rb +++ b/lib/open_food_network/feature_toggle.rb @@ -1,17 +1,13 @@ module OpenFoodNetwork class FeatureToggle def self.enabled? feature - features[feature] + features.with_indifferent_access[feature] end private def self.features - {eaterprises: true, - local_organics: false, - order_cycles: true, - multi_cart: false, - enterprises_distributor_info_rich_text: true} + {connect_learn_homepage: false} end end end diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake index bfa57a07dd..ee8c698c7b 100644 --- a/lib/tasks/dev.rake +++ b/lib/tasks/dev.rake @@ -5,8 +5,8 @@ namespace :openfoodnetwork do desc 'load sample data' task :load_sample_data => :environment do - require File.expand_path('../../../spec/factories', __FILE__) - require File.expand_path('../../../spec/support/spree/init', __FILE__) + require_relative '../../spec/factories' + require_relative '../../spec/support/spree/init' task_name = "openfoodnetwork:dev:load_sample_data" # -- Shipping / payment information diff --git a/script/delayed_job b/script/delayed_job index edf195985f..cecd9acddd 100755 --- a/script/delayed_job +++ b/script/delayed_job @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) +require_relative '../config/environment' require 'delayed/command' Delayed::Command.new(ARGV).daemonize diff --git a/script/rails b/script/rails index f8da2cffd4..dc40bb7e84 100755 --- a/script/rails +++ b/script/rails @@ -2,5 +2,5 @@ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) +require_relative '../config/boot' require 'rails/commands' diff --git a/spec/factories.rb b/spec/factories.rb index 06f5dbd879..3b0c548923 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -383,39 +383,3 @@ FactoryGirl.modify do end end end - - -# -- CMS -FactoryGirl.define do - factory :cms_site, :class => Cms::Site do - identifier 'open-food-network' - label 'Open Food Network' - hostname 'localhost' - end - - factory :cms_layout, :class => Cms::Layout do - site { Cms::Site.first || create(:cms_site) } - label 'layout' - identifier 'layout' - content '{{ cms:page:content:text }}' - end - - factory :cms_page, :class => Cms::Page do - site { Cms::Site.first || create(:cms_site) } - label 'page' - sequence(:slug) { |n| "page-#{n}" } - layout { Cms::Layout.first || create(:cms_layout) } - - # Pass content through to block, where it is stored - after(:create) do |cms_page, evaluator| - cms_page.blocks.first.update_attribute(:content, evaluator.content) - cms_page.save! # set_cached_content - end - end - - factory :cms_block, :class => Cms::Block do - page { Cms::Page.first || create(:cms_page) } - identifier 'block' - content 'hello, block' - end -end diff --git a/spec/features/admin/cms_spec.rb b/spec/features/admin/cms_spec.rb deleted file mode 100644 index c200bc57e4..0000000000 --- a/spec/features/admin/cms_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -require 'spec_helper' - -feature %q{ - In order to provide content to users of the site - As an administrator - I want to access the CMS admin site -} do - include AuthenticationWorkflow - include WebHelper - - scenario "admin can access CMS admin and return to Spree admin" do - login_to_admin_section - click_link 'Configuration' - click_link 'CMS Admin' - page.should have_content "ComfortableMexicanSofa" - - click_link 'Spree Admin' - expect(page).to have_current_path /^\/admin/ - end - - scenario "anonymous user can't access CMS admin", js: true do - visit cms_admin_path - page.should_not have_content "ComfortableMexicanSofa" - page.should have_content "Login" - end - - scenario "non-admin user can't access CMS admin", js: true do - login_to_consumer_section - page.should_not have_content "Login" - visit cms_admin_path - page.should_not have_content "ComfortableMexicanSofa" - expect(page).to have_current_path root_path - end -end diff --git a/spec/features/consumer/cms_spec.rb b/spec/features/consumer/cms_spec.rb deleted file mode 100644 index 0f25bc549c..0000000000 --- a/spec/features/consumer/cms_spec.rb +++ /dev/null @@ -1,68 +0,0 @@ -require 'spec_helper' - -feature %q{ - In order to learn about food - As a user of the site - I want to see static content pages -}, skip: true do - include AuthenticationWorkflow - include WebHelper - let(:d) { create(:distributor_enterprise, :name => 'Edible garden') } - - background do - create_enterprise_group_for d - end - - scenario "viewing shop front does not display home page content" do - # Given a CMS home page - create(:cms_page, content: 'Home page content') - - # When I visit the home page - visit spree.root_path - - # and proceed to the shop front - click_on 'Edible garden' - visit enterprise_path d - - # Then I should not see the home page content - page.should_not have_content 'Home page content' - end - - scenario "viewing the menu of CMS pages" do - # Given some CMS pages - home_page = create(:cms_page, content: 'Home') - create(:cms_page, parent: home_page, label: 'One') - create(:cms_page, parent: home_page, label: 'Two') - create(:cms_page, parent: home_page, label: 'Three') - - # When I visit the home page - visit spree.root_path - # and proceed to the shop front - click_on "Edible garden" - visit enterprise_path d - - - # Then I should see a menu with these pages - page.should have_selector 'ul#main-nav-bar li', :text => 'One' - page.should have_selector 'ul#main-nav-bar li', :text => 'Two' - page.should have_selector 'ul#main-nav-bar li', :text => 'Three' - end - - scenario "viewing a page from the CMS menu" do - # Given some CMS pages - home_page = create(:cms_page, content: 'Home') - create(:cms_page, parent: home_page, label: 'One') - create(:cms_page, parent: home_page, label: 'Two', content: 'This is the page') - create(:cms_page, parent: home_page, label: 'Three') - - # When I go to one of the pages - visit spree.root_path - click_on "Edible garden" - visit enterprise_path d - click_link 'Two' - - # Then I should see the page - page.should have_content 'This is the page' - end - -end diff --git a/spec/features/consumer/groups_spec.rb b/spec/features/consumer/groups_spec.rb index 5ea96ac17e..039322b379 100644 --- a/spec/features/consumer/groups_spec.rb +++ b/spec/features/consumer/groups_spec.rb @@ -9,11 +9,49 @@ feature 'Groups', js: true do it "renders groups" do visit groups_path - page.should have_content group.name + expect(page).to have_content group.name end it "searches by URL" do visit groups_path(anchor: "/?query=xyzzy") expect(page).to have_content "No groups found" end + + describe "producers" do + describe "filtering by product property" do + let!(:producer1) { create(:supplier_enterprise) } + let!(:producer2) { create(:supplier_enterprise) } + + let!(:product1) { create(:simple_product, supplier: producer1) } + let!(:product2) { create(:simple_product, supplier: producer2) } + + before do + product1.set_property 'Organic', 'NASAA 12345' + product2.set_property 'Biodynamic', 'ABC123' + + producer1.set_producer_property 'Local', 'Victoria' + producer2.set_producer_property 'Fair Trade', 'FT123' + + group.enterprises << producer1 + group.enterprises << producer2 + + visit group_path(group, anchor: "/producers") + end + + it "filters" do + toggle_filters + + toggle_filter 'Organic' + + expect(page).to have_content producer1.name + expect(page).not_to have_content producer2.name + + toggle_filter 'Organic' + toggle_filter 'Fair Trade' + + expect(page).not_to have_content producer1.name + expect(page).to have_content producer2.name + end + end + end end diff --git a/spec/features/consumer/producers_spec.rb b/spec/features/consumer/producers_spec.rb index 5c89a23529..514c71d7c4 100644 --- a/spec/features/consumer/producers_spec.rb +++ b/spec/features/consumer/producers_spec.rb @@ -55,6 +55,23 @@ feature %q{ page.should_not have_content producer2.name end + describe "filtering by product property" do + it "filters" do + toggle_filters + + toggle_filter 'Organic' + + page.should have_content producer1.name + page.should_not have_content producer2.name + + toggle_filter 'Organic' + toggle_filter 'Biodynamic' + + page.should_not have_content producer1.name + page.should have_content producer2.name + end + end + it "shows all producers with expandable details" do page.should have_content producer1.name expand_active_table_node producer1.name @@ -76,16 +93,4 @@ feature %q{ page.should have_link shop.name end end - - - private - - def toggle_filters - find('a.filterbtn').click - end - - def toggle_filter(name) - page.find('span', text: name).click - end - end diff --git a/spec/features/consumer/shopping/variant_overrides_spec.rb b/spec/features/consumer/shopping/variant_overrides_spec.rb index b59cb6a613..ecb0c4efe8 100644 --- a/spec/features/consumer/shopping/variant_overrides_spec.rb +++ b/spec/features/consumer/shopping/variant_overrides_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature "shopping with variant overrides defined", js: true do +feature "shopping with variant overrides defined", js: true, retry: 3 do include AuthenticationWorkflow include WebHelper include ShopWorkflow @@ -191,7 +191,7 @@ feature "shopping with variant overrides defined", js: true do within "#payment" do choose pm.name end - + place_order expect(page).to have_content "Your order has been processed successfully" end @@ -199,7 +199,7 @@ feature "shopping with variant overrides defined", js: true do def click_checkout show_cart wait_until_enabled 'li.cart a.button' - click_link 'Checkout now', match: :first + first(:link, 'Checkout now').click end end diff --git a/spec/features/consumer/shops_spec.rb b/spec/features/consumer/shops_spec.rb index 0c5d3d7e09..adbbf05f9a 100644 --- a/spec/features/consumer/shops_spec.rb +++ b/spec/features/consumer/shops_spec.rb @@ -75,6 +75,19 @@ feature 'Shops', js: true do end end + describe "viewing closed shops by URL" do + before do + d1 + d2 + visit shops_path(anchor: "/?show_closed=1") + end + + it "shows closed shops" do + #click_link_and_ensure("Show closed shops", -> { page.has_selector? 'hub.inactive' }) + page.should have_selector 'hub.inactive', text: d2.name + end + end + private diff --git a/spec/javascripts/unit/darkswarm/controllers/products_controller_spec.js.coffee b/spec/javascripts/unit/darkswarm/controllers/products_controller_spec.js.coffee index 9e4237d1e7..1e188f4f16 100644 --- a/spec/javascripts/unit/darkswarm/controllers/products_controller_spec.js.coffee +++ b/spec/javascripts/unit/darkswarm/controllers/products_controller_spec.js.coffee @@ -30,9 +30,9 @@ describe 'ProductsCtrl', -> it "increments the limit up to the number of products", -> scope.limit = 0 scope.incrementLimit() - expect(scope.limit).toEqual 1 + expect(scope.limit).toEqual 10 scope.incrementLimit() - expect(scope.limit).toEqual 1 + expect(scope.limit).toEqual 10 it "blocks keypresses on code 13", -> event = diff --git a/spec/javascripts/unit/darkswarm/services/cart_spec.js.coffee b/spec/javascripts/unit/darkswarm/services/cart_spec.js.coffee index ce3fe7eec3..53ae64f437 100644 --- a/spec/javascripts/unit/darkswarm/services/cart_spec.js.coffee +++ b/spec/javascripts/unit/darkswarm/services/cart_spec.js.coffee @@ -33,18 +33,19 @@ describe 'Cart service', -> it "generates extended variant names", -> expect(Cart.line_items[0].variant.extended_name).toEqual "name" - it "creates and backreferences new line items if necessary", -> - Cart.register_variant(v2 = {id: 2}) - expect(Cart.line_items[1].variant).toBe v2 - expect(Cart.line_items[1].variant.line_item).toBe Cart.line_items[1] - - it "returns a list of items actually in the cart", -> - expect(Cart.line_items_present()).toEqual [] + it "adds item to and removes items from the cart", -> + Cart.line_items = [] + expect(Cart.line_items.length).toEqual 0 order.line_items[0].quantity = 1 - expect(Cart.line_items_present().length).toEqual + expect(Cart.line_items.length).toEqual 0 + Cart.adjust(order.line_items[0]) + expect(Cart.line_items.length).toEqual 1 + order.line_items[0].quantity = 0 + expect(Cart.line_items.length).toEqual 1 + Cart.adjust(order.line_items[0]) + expect(Cart.line_items.length).toEqual 0 it "sums the quantity of each line item for cart total", -> - expect(Cart.line_items_present()).toEqual [] order.line_items[0].quantity = 2 expect(Cart.total_item_count()).toEqual 2 @@ -130,62 +131,62 @@ describe 'Cart service', -> describe "when an item is out of stock", -> it "reduces the quantity in the cart", -> li = {variant: {id: 1}, quantity: 5} + Cart.line_items = [li] stockLevels = {1: {quantity: 0, max_quantity: 0, on_hand: 0}} - spyOn(Cart, 'line_items_present').and.returnValue [li] Cart.compareAndNotifyStockLevels stockLevels expect(li.quantity).toEqual 0 expect(li.max_quantity).toBeUndefined() it "reduces the max_quantity in the cart", -> li = {variant: {id: 1}, quantity: 5, max_quantity: 6} + Cart.line_items = [li] stockLevels = {1: {quantity: 0, max_quantity: 0, on_hand: 0}} - spyOn(Cart, 'line_items_present').and.returnValue [li] Cart.compareAndNotifyStockLevels stockLevels expect(li.max_quantity).toEqual 0 it "resets the count on hand available", -> li = {variant: {id: 1, count_on_hand: 10}, quantity: 5} + Cart.line_items = [li] stockLevels = {1: {quantity: 0, max_quantity: 0, on_hand: 0}} - spyOn(Cart, 'line_items_present').and.returnValue [li] Cart.compareAndNotifyStockLevels stockLevels expect(li.variant.count_on_hand).toEqual 0 describe "when the quantity available is less than that requested", -> it "reduces the quantity in the cart", -> li = {variant: {id: 1}, quantity: 6} + Cart.line_items = [li] stockLevels = {1: {quantity: 5, on_hand: 5}} - spyOn(Cart, 'line_items_present').and.returnValue [li] Cart.compareAndNotifyStockLevels stockLevels expect(li.quantity).toEqual 5 expect(li.max_quantity).toBeUndefined() it "does not reduce the max_quantity in the cart", -> li = {variant: {id: 1}, quantity: 6, max_quantity: 7} + Cart.line_items = [li] stockLevels = {1: {quantity: 5, max_quantity: 5, on_hand: 5}} - spyOn(Cart, 'line_items_present').and.returnValue [li] Cart.compareAndNotifyStockLevels stockLevels expect(li.max_quantity).toEqual 7 it "resets the count on hand available", -> li = {variant: {id: 1}, quantity: 6} + Cart.line_items = [li] stockLevels = {1: {quantity: 5, on_hand: 6}} - spyOn(Cart, 'line_items_present').and.returnValue [li] Cart.compareAndNotifyStockLevels stockLevels expect(li.variant.count_on_hand).toEqual 6 describe "when the client-side quantity has been increased during the request", -> it "does not reset the quantity", -> li = {variant: {id: 1}, quantity: 6} + Cart.line_items = [li] stockLevels = {1: {quantity: 5, on_hand: 6}} - spyOn(Cart, 'line_items_present').and.returnValue [li] Cart.compareAndNotifyStockLevels stockLevels expect(li.quantity).toEqual 6 expect(li.max_quantity).toBeUndefined() it "does not reset the max_quantity", -> li = {variant: {id: 1}, quantity: 5, max_quantity: 7} + Cart.line_items = [li] stockLevels = {1: {quantity: 5, max_quantity: 6, on_hand: 7}} - spyOn(Cart, 'line_items_present').and.returnValue [li] Cart.compareAndNotifyStockLevels stockLevels expect(li.quantity).toEqual 5 expect(li.max_quantity).toEqual 7 @@ -193,14 +194,14 @@ describe 'Cart service', -> describe "when the client-side quantity has been changed from 0 to 1 during the request", -> it "does not reset the quantity", -> li = {variant: {id: 1}, quantity: 1} - spyOn(Cart, 'line_items_present').and.returnValue [li] + Cart.line_items = [li] Cart.compareAndNotifyStockLevels {} expect(li.quantity).toEqual 1 expect(li.max_quantity).toBeUndefined() it "does not reset the max_quantity", -> li = {variant: {id: 1}, quantity: 1, max_quantity: 1} - spyOn(Cart, 'line_items_present').and.returnValue [li] + Cart.line_items = [li] Cart.compareAndNotifyStockLevels {} expect(li.quantity).toEqual 1 expect(li.max_quantity).toEqual 1 @@ -222,23 +223,3 @@ describe 'Cart service', -> expect(Cart.line_items).not.toEqual [] Cart.clear() expect(Cart.line_items).toEqual [] - - describe "generating an extended variant name", -> - it "returns the product name when it is the same as the variant name", -> - variant = {product_name: 'product_name', name_to_display: 'product_name'} - expect(Cart.extendedVariantName(variant)).toEqual "product_name" - - describe "when the product name and the variant name differ", -> - it "returns a combined name when there is no options text", -> - variant = - product_name: 'product_name' - name_to_display: 'name_to_display' - expect(Cart.extendedVariantName(variant)).toEqual "product_name - name_to_display" - - it "returns a combined name when there is some options text", -> - variant = - product_name: 'product_name' - name_to_display: 'name_to_display' - options_text: 'options_text' - - expect(Cart.extendedVariantName(variant)).toEqual "product_name - name_to_display (options_text)" diff --git a/spec/javascripts/unit/darkswarm/services/products_spec.js.coffee b/spec/javascripts/unit/darkswarm/services/products_spec.js.coffee index 778e701c7d..c5f9d64f12 100644 --- a/spec/javascripts/unit/darkswarm/services/products_spec.js.coffee +++ b/spec/javascripts/unit/darkswarm/services/products_spec.js.coffee @@ -82,12 +82,6 @@ describe 'Products service', -> $httpBackend.flush() expect(Products.products[0].variants[0]).toBe Variants.variants[1] - it "registers variants with the Cart", -> - product.variants = [{id: 8}] - $httpBackend.expectGET("/shop/products").respond([product]) - $httpBackend.flush() - expect(Cart.line_items[0].variant).toBe Products.products[0].variants[0] - it "sets primaryImageOrMissing when no images are provided", -> $httpBackend.expectGET("/shop/products").respond([product]) $httpBackend.flush() diff --git a/spec/javascripts/unit/darkswarm/services/variants_spec.js.coffee b/spec/javascripts/unit/darkswarm/services/variants_spec.js.coffee index a235bafaee..7d8047ecc9 100644 --- a/spec/javascripts/unit/darkswarm/services/variants_spec.js.coffee +++ b/spec/javascripts/unit/darkswarm/services/variants_spec.js.coffee @@ -21,11 +21,45 @@ describe 'Variants service', -> it "will return the same object as passed", -> expect(Variants.register(variant)).toBe variant + describe "initialising the line_item", -> + describe "when variant.line_item does not exist", -> + it "creates it", -> + line_item = Variants.register(variant).line_item + expect(line_item).toBeDefined() + expect(line_item.total_price).toEqual 0 + + describe "when variant.line_item already exists", -> + beforeEach -> + variant.line_item = { quantity: 4 } + + it "initialises the total_price", -> + expect(Variants.register(variant).line_item.total_price).toEqual 400 + it "initialises base price percentage", -> - expect(Variants.register(variant).basePricePercentage).toEqual 81 + expect(Variants.register(variant).base_price_percentage).toEqual 81 it "clears registered variants", -> Variants.register(variant) expect(Variants.variants[variant.id]).toBe variant Variants.clear() - expect(Variants.variants[variant.id]).toBeUndefined() \ No newline at end of file + expect(Variants.variants[variant.id]).toBeUndefined() + + describe "generating an extended variant name", -> + it "returns the product name when it is the same as the variant name", -> + variant = {product_name: 'product_name', name_to_display: 'product_name'} + expect(Variants.extendedVariantName(variant)).toEqual "product_name" + + describe "when the product name and the variant name differ", -> + it "returns a combined name when there is no options text", -> + variant = + product_name: 'product_name' + name_to_display: 'name_to_display' + expect(Variants.extendedVariantName(variant)).toEqual "product_name - name_to_display" + + it "returns a combined name when there is some options text", -> + variant = + product_name: 'product_name' + name_to_display: 'name_to_display' + options_text: 'options_text' + + expect(Variants.extendedVariantName(variant)).toEqual "product_name - name_to_display (options_text)" diff --git a/spec/jobs/finalize_account_invoices_spec.rb b/spec/jobs/finalize_account_invoices_spec.rb index d4b250d42f..5a51972d67 100644 --- a/spec/jobs/finalize_account_invoices_spec.rb +++ b/spec/jobs/finalize_account_invoices_spec.rb @@ -189,6 +189,7 @@ describe FinalizeAccountInvoices do Spree::Config.set(:account_invoices_monthly_fixed, 5) Spree::Config.set(:account_invoices_monthly_rate, 0.02) Spree::Config.set(:account_invoices_monthly_cap, 50) + Spree::Config.set(:minimum_billable_turnover, 0) end context "finalizing an invoice" do diff --git a/spec/models/spree/order_spec.rb b/spec/models/spree/order_spec.rb index 114c7d5fac..2140163f98 100644 --- a/spec/models/spree/order_spec.rb +++ b/spec/models/spree/order_spec.rb @@ -437,7 +437,7 @@ describe Spree::Order do subject.distributor = test_enterprise subject.should_not be_valid - subject.errors.messages.should == {:distributor_id => ["cannot supply the products in your cart"]} + subject.errors.messages.should == {:base => ["Distributor or order cycle cannot supply the products in your cart"]} end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f4c5b73fac..f1150cc485 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,7 +8,7 @@ Knapsack.tracker.config({enable_time_offset_warning: false}) unless ENV['CI'] Knapsack::Adapters::RSpecAdapter.bind ENV["RAILS_ENV"] ||= 'test' -require File.expand_path("../../config/environment", __FILE__) +require_relative "../config/environment" require 'rspec/rails' require 'capybara' require 'database_cleaner' @@ -103,6 +103,7 @@ RSpec.configure do |config| config.include Spree::Api::TestingSupport::Helpers, :type => :controller config.include OpenFoodNetwork::ControllerHelper, :type => :controller config.include OpenFoodNetwork::FeatureToggleHelper + config.include OpenFoodNetwork::FiltersHelper config.include OpenFoodNetwork::EnterpriseGroupsHelper config.include OpenFoodNetwork::ProductsHelper config.include OpenFoodNetwork::DistributionHelper diff --git a/spec/support/filters_helper.rb b/spec/support/filters_helper.rb new file mode 100644 index 0000000000..5e509568f7 --- /dev/null +++ b/spec/support/filters_helper.rb @@ -0,0 +1,14 @@ +module OpenFoodNetwork + # Helper for customer-facing filters (eg. producers, shops, groups, etc.) + module FiltersHelper + # Expand/collapse the filters dialog + def toggle_filters + find('a.filterbtn').click + end + + # Toggle one particular filter + def toggle_filter(name) + page.find('span', text: name).click + end + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb index 8bf1192ffe..7d57a78563 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,5 +1,5 @@ ENV["RAILS_ENV"] = "test" -require File.expand_path('../../config/environment', __FILE__) +require_relative '../config/environment' require 'rails/test_help' class ActiveSupport::TestCase