From 6c71ef8760d8fd0b1bc06970d44d73cc5016b695 Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Thu, 2 Mar 2017 13:49:08 +1100 Subject: [PATCH 1/3] Fix styling of error flash in admin section --- app/assets/stylesheets/admin/openfoodnetwork.css.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/admin/openfoodnetwork.css.scss b/app/assets/stylesheets/admin/openfoodnetwork.css.scss index 2d4db3e4aa..df55d3065b 100644 --- a/app/assets/stylesheets/admin/openfoodnetwork.css.scss +++ b/app/assets/stylesheets/admin/openfoodnetwork.css.scss @@ -28,8 +28,8 @@ text-angular .ta-editor { left: 275px; } -span.error, div.error { - color: #DA5354; +span.error, div.error:not(.flash) { + color: #DA5354; } /* Fix conflict between Spree and elRTE's styles */ From 7f982c0c90e3c4217b9230a478fa6f9ae57ee70f Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Thu, 27 Jul 2017 12:56:27 +0200 Subject: [PATCH 2/3] Complete seed data to purchase to Enterprise 2 --- lib/tasks/dev.rake | 85 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake index ee8c698c7b..78a9a2d4c2 100644 --- a/lib/tasks/dev.rake +++ b/lib/tasks/dev.rake @@ -168,6 +168,91 @@ namespace :openfoodnetwork do :enterprise_fee => Enterprise.is_distributor[2].enterprise_fees.first) end + + enterprise2 = Enterprise.find_by_name('Enterprise 2') + enterprise2.sells = 'any' + enterprise2.shipping_methods.build( + name: 'Pickup', + zone_id: 3, + require_ship_address: true, + calculator_type: 'OpenFoodNetwork::Calculator::Weight', + distributor_ids: [enterprise2.id] + ) + enterprise2.payment_methods << Spree::PaymentMethod.last + enterprise2.save! + + variants = Spree::Variant + .joins(:product) + .where('spree_products.supplier_id = ?', enterprise2.id) + + CreateOrderCycle.new(enterprise2, variants).call + end + + # Creates an order cycle for the provided enterprise and selecting all the + # variants specified for both incoming and outgoing exchanges + class CreateOrderCycle + + # Constructor + # + # @param enterprise [Enterprise] + # @param variants [Array] + def initialize(enterprise, variants) + @enterprise = enterprise + @variants = variants + end + + # Creates the order cycle + def call + incoming_exchange.order_cycle = order_cycle + incoming_exchange.variants << variants + + outgoing_exchange.order_cycle = order_cycle + outgoing_exchange.variants << variants + + order_cycle.exchanges << incoming_exchange + order_cycle.exchanges << outgoing_exchange + + order_cycle.save! + end + + private + + attr_reader :enterprise, :variants + + # Builds an order cycle for the next month, starting now + # + # @return [OrderCycle] + def order_cycle + @order_cycle ||= OrderCycle.new( + coordinator_id: enterprise.id, + name: 'Monthly order cycle', + orders_open_at: Time.zone.now, + orders_close_at: Time.zone.now + 1.month + ) + end + + # Builds an exchange with the enterprise both as sender and receiver + # + # @return [Exchange] + def incoming_exchange + @incoming_exchange ||= Exchange.new( + sender_id: enterprise.id, + receiver_id: enterprise.id, + incoming: true + ) + end + + # Builds an exchange with the enterprise both as sender and receiver + # + # @return [Exchange] + def outgoing_exchange + @outgoing_exchange ||= Exchange.new( + sender_id: enterprise.id, + receiver_id: enterprise.id, + pickup_time: '8 am', + incoming: false + ) + end end end end From 8c5ac4cb2315ee9893b99da8066a6dbf9cd9ed88 Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Thu, 10 Aug 2017 11:35:15 +0200 Subject: [PATCH 3/3] Fix extra empty line reported by rubocop --- lib/tasks/dev.rake | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake index 78a9a2d4c2..db5c2bad0c 100644 --- a/lib/tasks/dev.rake +++ b/lib/tasks/dev.rake @@ -191,7 +191,6 @@ namespace :openfoodnetwork do # Creates an order cycle for the provided enterprise and selecting all the # variants specified for both incoming and outgoing exchanges class CreateOrderCycle - # Constructor # # @param enterprise [Enterprise]