From d6341b65e50b1d37bbad481c803107332cfe09f2 Mon Sep 17 00:00:00 2001 From: Rob H Date: Fri, 20 Jun 2014 16:22:55 +1000 Subject: [PATCH 01/11] Add edit button to Order cycles index --- app/views/admin/order_cycles/_row.html.haml | 2 ++ app/views/admin/order_cycles/index.html.haml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/views/admin/order_cycles/_row.html.haml b/app/views/admin/order_cycles/_row.html.haml index 4396fabcba..75e84de025 100644 --- a/app/views/admin/order_cycles/_row.html.haml +++ b/app/views/admin/order_cycles/_row.html.haml @@ -21,5 +21,7 @@ %br/ %span.with-tip{'data-powertip' => variant_images}= "#{order_cycle.variants.count} variants" + %td.actions + = link_to '', main_app.edit_admin_order_cycle_path(order_cycle), class: 'edit-order-cycle icon-edit no-text' %td.actions = link_to '', main_app.clone_admin_order_cycle_path(order_cycle), class: 'clone-order-cycle icon-copy no-text' diff --git a/app/views/admin/order_cycles/index.html.haml b/app/views/admin/order_cycles/index.html.haml index c3f4bc0b8f..22edccf0e7 100644 --- a/app/views/admin/order_cycles/index.html.haml +++ b/app/views/admin/order_cycles/index.html.haml @@ -18,6 +18,7 @@ %col %col %col + %col %thead %tr @@ -29,6 +30,7 @@ %th Distributors %th Products %th.actions + %th.actions %tbody = f.fields_for :collection do |order_cycle_form| From 4b437e2ab52924e2936372731d878d783c4ed1cc Mon Sep 17 00:00:00 2001 From: Rob H Date: Fri, 20 Jun 2014 16:38:10 +1000 Subject: [PATCH 02/11] Realign enterprises social media form components --- app/views/admin/enterprises/_form.html.haml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/admin/enterprises/_form.html.haml b/app/views/admin/enterprises/_form.html.haml index 9864225743..bc4d119e4d 100644 --- a/app/views/admin/enterprises/_form.html.haml +++ b/app/views/admin/enterprises/_form.html.haml @@ -126,19 +126,19 @@ .omega.eight.columns = f.text_field :website, { placeholder: "eg. www.truffles.com"} .row - .alpha.two.columns + .alpha.three.columns = f.label :facebook, 'Facebook' - .omega.four.columns + .omega.eight.columns = f.text_field :facebook .row - .alpha.two.columns + .alpha.three.columns = f.label :instagram, 'Instagram' - .omega.four.columns + .omega.eight.columns = f.text_field :instagram .row - .alpha.two.columns + .alpha.three.columns = f.label :linkedin, 'LinkedIn' - .omega.four.columns + .omega.eight.columns = f.text_field :linkedin .row .alpha.three.columns From d71966b5c0e8d0c354ceb79e3c3f4482a45c75ef Mon Sep 17 00:00:00 2001 From: Rob H Date: Fri, 20 Jun 2014 16:39:09 +1000 Subject: [PATCH 03/11] Change show link to edit link on admin enterprises index --- app/views/admin/enterprises/index.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/enterprises/index.html.haml b/app/views/admin/enterprises/index.html.haml index b358011d89..db6f7707a0 100644 --- a/app/views/admin/enterprises/index.html.haml +++ b/app/views/admin/enterprises/index.html.haml @@ -26,10 +26,10 @@ = f.fields_for :collection do |enterprise_form| - enterprise = enterprise_form.object %tr{class: "enterprise-#{enterprise.id}"} - %td= link_to enterprise.name, main_app.admin_enterprise_path(enterprise) + %td= link_to enterprise.name, main_app.edit_admin_enterprise_path(enterprise) %td - if enterprise.is_primary_producer && enterprise.is_distributor - Producer & Distributor + Producer & Distributor - elsif enterprise.is_distributor Distributor - elsif enterprise.is_primary_producer From a448ccdad461e95f4573cd9c6d0b7c7219d4fa8f Mon Sep 17 00:00:00 2001 From: Rob H Date: Fri, 20 Jun 2014 16:53:04 +1000 Subject: [PATCH 04/11] Remove unused enterprise show page --- app/views/admin/enterprises/show.html.haml | 51 ---------------------- 1 file changed, 51 deletions(-) delete mode 100644 app/views/admin/enterprises/show.html.haml diff --git a/app/views/admin/enterprises/show.html.haml b/app/views/admin/enterprises/show.html.haml deleted file mode 100644 index d4a4ed0743..0000000000 --- a/app/views/admin/enterprises/show.html.haml +++ /dev/null @@ -1,51 +0,0 @@ -%h1 Enterprise -%table - %tr - %th Name: - %td= @enterprise.name - %tr - %th Description: - %td= @enterprise.description - %tr{"data-hook" => "long_description"} - %th Extended Description: - %td= @enterprise.long_description.andand.html_safe - %tr - %th Primary producer? - %td= @enterprise.is_primary_producer ? 'Yes' : 'No' - %tr - %th Distributor? - %td= @enterprise.is_distributor ? 'Yes' : 'No' - %tr - %th Contact person: - %td= @enterprise.contact - %tr - %th Phone number: - %td= @enterprise.phone - %tr - %th Email: - %td= @enterprise.email - %tr - %th Website: - %td= @enterprise.website - %tr - %th Twitter: - %td= @enterprise.twitter - %tr - %th ABN: - %td= @enterprise.abn - %tr - %th ACN: - %td= @enterprise.acn - %tr - %th Address: - %td= render 'spree/shared/address', :address => @enterprise.address - %tr - %th Regular pickup times: - %td= @enterprise.pickup_times - %tr - %th Next collection date/time: - %td= @enterprise.next_collection_at -%p - = link_to :Edit, main_app.edit_admin_enterprise_path(@enterprise), :class => 'edit_enterprise' - = t(:or) - = link_to t(:back), main_app.admin_enterprises_path From 9f285b1d8c0bb52a717312221939a382752b9db2 Mon Sep 17 00:00:00 2001 From: Rob H Date: Fri, 20 Jun 2014 17:00:07 +1000 Subject: [PATCH 05/11] Add plus icon to new enterprises button --- app/views/admin/enterprises/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/enterprises/index.html.haml b/app/views/admin/enterprises/index.html.haml index db6f7707a0..42f12e8632 100644 --- a/app/views/admin/enterprises/index.html.haml +++ b/app/views/admin/enterprises/index.html.haml @@ -3,7 +3,7 @@ - content_for :page_actions do %li#new_product_link - = button_link_to "New Enterprise", main_app.new_admin_enterprise_path, :icon => 'add', :id => 'admin_new_enterprise_link' + = button_link_to "New Enterprise", main_app.new_admin_enterprise_path, :icon => 'icon-plus', :id => 'admin_new_enterprise_link' = render 'admin/shared/enterprises_sub_menu' From 0785509bc4e1b486019ff40ca853c6ca3e50ebfe Mon Sep 17 00:00:00 2001 From: Rob H Date: Fri, 20 Jun 2014 17:00:36 +1000 Subject: [PATCH 06/11] Add plus icon to new order cycles button --- app/views/admin/order_cycles/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/order_cycles/index.html.haml b/app/views/admin/order_cycles/index.html.haml index 22edccf0e7..1fac06f507 100644 --- a/app/views/admin/order_cycles/index.html.haml +++ b/app/views/admin/order_cycles/index.html.haml @@ -3,7 +3,7 @@ = content_for :page_actions do %li#new_order_cycle_link - = button_link_to "New Order Cycle", main_app.new_admin_order_cycle_path, :icon => 'add', :id => 'admin_new_order_cycle_link' + = button_link_to "New Order Cycle", main_app.new_admin_order_cycle_path, :icon => 'icon-plus', :id => 'admin_new_order_cycle_link' From a21c2c20f75f20d1eb21ea501062c85f1c5ac728 Mon Sep 17 00:00:00 2001 From: Rob H Date: Mon, 23 Jun 2014 11:26:46 +1000 Subject: [PATCH 07/11] Change 'Spree' in admin page title to 'OFN' --- .../admin/shared/_head/replace_spree_title.html.haml.deface | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 app/overrides/spree/admin/shared/_head/replace_spree_title.html.haml.deface diff --git a/app/overrides/spree/admin/shared/_head/replace_spree_title.html.haml.deface b/app/overrides/spree/admin/shared/_head/replace_spree_title.html.haml.deface new file mode 100644 index 0000000000..757bfa797f --- /dev/null +++ b/app/overrides/spree/admin/shared/_head/replace_spree_title.html.haml.deface @@ -0,0 +1,4 @@ +/ replace_contents "title" + += "OFN #{t(:administration)}:" += t(controller.controller_name, :default => controller.controller_name.titleize) \ No newline at end of file From 9b126df5b6fa052eadf7ad56cb86222cd7e55d5e Mon Sep 17 00:00:00 2001 From: Rob H Date: Mon, 23 Jun 2014 14:31:16 +1000 Subject: [PATCH 08/11] Add variant display_name to reports --- .../admin/reports_controller_decorator.rb | 36 +++++++++---------- app/models/spree/variant_decorator.rb | 5 +++ .../products_and_inventory_report.rb | 2 +- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/app/controllers/spree/admin/reports_controller_decorator.rb b/app/controllers/spree/admin/reports_controller_decorator.rb index 038b5dd1b0..62cfb585cd 100644 --- a/app/controllers/spree/admin/reports_controller_decorator.rb +++ b/app/controllers/spree/admin/reports_controller_decorator.rb @@ -113,7 +113,7 @@ Spree::Admin::ReportsController.class_eval do columns = [ proc { |lis| lis.first.variant.product.supplier.name }, proc { |lis| lis.first.variant.product.name }, proc { |lis| lis.first.variant.product.group_buy ? (lis.first.variant.product.group_buy_unit_size || 0.0) : "" }, - proc { |lis| lis.first.variant.options_text }, + proc { |lis| lis.first.variant.full_name }, proc { |lis| lis.first.variant.weight || 0 }, proc { |lis| lis.sum { |li| li.quantity } }, proc { |lis| lis.sum { |li| li.max_quantity || 0 } }, @@ -134,7 +134,7 @@ Spree::Admin::ReportsController.class_eval do proc { |lis| ( (lis.first.variant.product.group_buy_unit_size || 0).zero? ? 0 : ( lis.sum { |li| ( [li.max_quantity || 0, li.quantity || 0].max ) * (li.variant.weight || 0) } / lis.first.variant.product.group_buy_unit_size ) ).floor }, proc { |lis| lis.sum { |li| ( [li.max_quantity || 0, li.quantity || 0].max) * (li.variant.weight || 0) } - ( ( (lis.first.variant.product.group_buy_unit_size || 0).zero? ? 0 : ( lis.sum { |li| ( [li.max_quantity || 0, li.quantity || 0].max) * (li.variant.weight || 0) } / lis.first.variant.product.group_buy_unit_size ) ).floor * (lis.first.variant.product.group_buy_unit_size || 0) ) } ] }, { group_by: proc { |li| li.variant }, - sort_by: proc { |variant| variant.options_text } } ] + sort_by: proc { |variant| variant.full_name } } ] when "bulk_coop_allocation" @@ -143,7 +143,7 @@ Spree::Admin::ReportsController.class_eval do columns = [ proc { |lis| lis.first.order.bill_address.firstname + " " + lis.first.order.bill_address.lastname }, proc { |lis| lis.first.variant.product.name }, proc { |lis| lis.first.variant.product.group_buy ? (lis.first.variant.product.group_buy_unit_size || 0.0) : "" }, - proc { |lis| lis.first.variant.options_text }, + proc { |lis| lis.first.variant.full_name }, proc { |lis| lis.first.variant.weight || 0 }, proc { |lis| lis.sum { |li| li.quantity } }, proc { |lis| lis.sum { |li| li.max_quantity || 0 } }, @@ -162,7 +162,7 @@ Spree::Admin::ReportsController.class_eval do proc { |lis| ( (lis.first.variant.product.group_buy_unit_size || 0).zero? ? 0 : ( lis.sum { |li| ( [li.max_quantity || 0, li.quantity || 0].max ) * (li.variant.weight || 0) } / lis.first.variant.product.group_buy_unit_size ) ).floor * (lis.first.variant.product.group_buy_unit_size || 0) }, proc { |lis| lis.sum { |li| ( [li.max_quantity || 0, li.quantity || 0].max ) * (li.variant.weight || 0) } - ( ( (lis.first.variant.product.group_buy_unit_size || 0).zero? ? 0 : ( lis.sum { |li| ( [li.max_quantity || 0, li.quantity || 0].max ) * (li.variant.weight || 0) } / lis.first.variant.product.group_buy_unit_size ) ).floor * (lis.first.variant.product.group_buy_unit_size || 0) ) } ] }, { group_by: proc { |li| li.variant }, - sort_by: proc { |variant| variant.options_text } }, + sort_by: proc { |variant| variant.full_name } }, { group_by: proc { |li| li.order }, sort_by: proc { |order| order.to_s } } ] @@ -172,13 +172,13 @@ Spree::Admin::ReportsController.class_eval do columns = [ proc { |lis| lis.first.order.bill_address.firstname + " " + lis.first.order.bill_address.lastname }, proc { |lis| lis.first.variant.product.name }, - proc { |lis| lis.first.variant.options_text }, + proc { |lis| lis.first.variant.full_name }, proc { |lis| lis.sum { |li| li.quantity } } ] rules = [ { group_by: proc { |li| li.variant.product }, sort_by: proc { |product| product.name } }, { group_by: proc { |li| li.variant }, - sort_by: proc { |variant| variant.options_text } }, + sort_by: proc { |variant| variant.full_name } }, { group_by: proc { |li| li.order }, sort_by: proc { |order| order.to_s } } ] @@ -202,7 +202,7 @@ Spree::Admin::ReportsController.class_eval do columns = [ proc { |lis| lis.first.variant.product.supplier.name }, proc { |lis| lis.first.variant.product.name }, proc { |lis| lis.first.variant.product.group_buy ? (lis.first.variant.product.group_buy_unit_size || 0.0) : "" }, - proc { |lis| lis.first.variant.options_text }, + proc { |lis| lis.first.variant.full_name }, proc { |lis| lis.first.variant.weight || 0 }, proc { |lis| lis.sum { |li| li.quantity } }, proc { |lis| lis.sum { |li| li.max_quantity || 0 } }, @@ -223,7 +223,7 @@ Spree::Admin::ReportsController.class_eval do proc { |lis| ( (lis.first.variant.product.group_buy_unit_size || 0).zero? ? 0 : ( lis.sum { |li| ( [li.max_quantity || 0, li.quantity || 0].max ) * (li.variant.weight || 0) } / lis.first.variant.product.group_buy_unit_size ) ).floor }, proc { |lis| lis.sum { |li| ( [li.max_quantity || 0, li.quantity || 0].max ) * (li.variant.weight || 0) } - ( ( (lis.first.variant.product.group_buy_unit_size || 0).zero? ? 0 : ( lis.sum { |li| ( [li.max_quantity || 0, li.quantity || 0].max ) * (li.variant.weight || 0) } / lis.first.variant.product.group_buy_unit_size ) ).floor * (lis.first.variant.product.group_buy_unit_size || 0) ) } ] }, { group_by: proc { |li| li.variant }, - sort_by: proc { |variant| variant.options_text } } ] + sort_by: proc { |variant| variant.full_name } } ] end @@ -390,7 +390,7 @@ Spree::Admin::ReportsController.class_eval do columns = [ proc { |line_items| line_items.first.variant.product.supplier.name }, proc { |line_items| line_items.first.variant.product.name }, - proc { |line_items| line_items.first.variant.options_text }, + proc { |line_items| line_items.first.variant.full_name }, proc { |line_items| line_items.sum { |li| li.quantity } }, proc { |line_items| line_items.first.variant.price }, proc { |line_items| line_items.sum { |li| li.quantity * li.price } }, @@ -402,7 +402,7 @@ Spree::Admin::ReportsController.class_eval do { group_by: proc { |line_item| line_item.variant.product }, sort_by: proc { |product| product.name } }, { group_by: proc { |line_item| line_item.variant }, - sort_by: proc { |variant| variant.options_text } } ] + sort_by: proc { |variant| variant.full_name } } ] when "order_cycle_supplier_totals_by_distributor" table_items = @line_items @@ -412,7 +412,7 @@ Spree::Admin::ReportsController.class_eval do columns = [ proc { |line_items| line_items.first.variant.product.supplier.name }, proc { |line_items| line_items.first.variant.product.name }, - proc { |line_items| line_items.first.variant.options_text }, + proc { |line_items| line_items.first.variant.full_name }, proc { |line_items| line_items.first.order.distributor.name }, proc { |line_items| line_items.sum { |li| li.quantity } }, proc { |line_items| line_items.first.variant.price }, @@ -424,7 +424,7 @@ Spree::Admin::ReportsController.class_eval do { group_by: proc { |line_item| line_item.variant.product }, sort_by: proc { |product| product.name } }, { group_by: proc { |line_item| line_item.variant }, - sort_by: proc { |variant| variant.options_text }, + sort_by: proc { |variant| variant.full_name }, summary_columns: [ proc { |line_items| "" }, proc { |line_items| "" }, proc { |line_items| "" }, @@ -445,7 +445,7 @@ Spree::Admin::ReportsController.class_eval do columns = [ proc { |line_items| line_items.first.order.distributor.name }, proc { |line_items| line_items.first.variant.product.supplier.name }, proc { |line_items| line_items.first.variant.product.name }, - proc { |line_items| line_items.first.variant.options_text }, + proc { |line_items| line_items.first.variant.full_name }, proc { |line_items| line_items.sum { |li| li.quantity } }, proc { |line_items| line_items.first.variant.price }, proc { |line_items| line_items.sum { |li| li.quantity * li.price } }, @@ -468,7 +468,7 @@ Spree::Admin::ReportsController.class_eval do { group_by: proc { |line_item| line_item.variant.product }, sort_by: proc { |product| product.name } }, { group_by: proc { |line_item| line_item.variant }, - sort_by: proc { |variant| variant.options_text } } ] + sort_by: proc { |variant| variant.full_name } } ] when "order_cycle_customer_totals" table_items = @line_items @@ -485,7 +485,7 @@ Spree::Admin::ReportsController.class_eval do proc { |line_items| line_items.first.order.bill_address.phone }, proc { |line_items| line_items.first.variant.product.supplier.name }, proc { |line_items| line_items.first.variant.product.name }, - proc { |line_items| line_items.first.variant.options_text }, + proc { |line_items| line_items.first.variant.full_name }, proc { |line_items| line_items.sum { |li| li.quantity } }, proc { |line_items| line_items.sum { |li| li.quantity * li.price } }, proc { |line_items| "" }, @@ -530,7 +530,7 @@ Spree::Admin::ReportsController.class_eval do { group_by: proc { |line_item| line_item.variant.product }, sort_by: proc { |product| product.name } }, { group_by: proc { |line_item| line_item.variant }, - sort_by: proc { |variant| variant.options_text } } ] + sort_by: proc { |variant| variant.full_name } } ] else table_items = @line_items @@ -540,7 +540,7 @@ Spree::Admin::ReportsController.class_eval do columns = [ proc { |line_items| line_items.first.variant.product.supplier.name }, proc { |line_items| line_items.first.variant.product.name }, - proc { |line_items| line_items.first.variant.options_text }, + proc { |line_items| line_items.first.variant.full_name }, proc { |line_items| line_items.sum { |li| li.quantity } }, proc { |line_items| line_items.first.variant.price }, proc { |line_items| line_items.sum { |li| li.quantity * li.price } }, @@ -552,7 +552,7 @@ Spree::Admin::ReportsController.class_eval do { group_by: proc { |line_item| line_item.variant.product }, sort_by: proc { |product| product.name } }, { group_by: proc { |line_item| line_item.variant }, - sort_by: proc { |variant| variant.options_text } } ] + sort_by: proc { |variant| variant.full_name } } ] end diff --git a/app/models/spree/variant_decorator.rb b/app/models/spree/variant_decorator.rb index 9410c14902..81977bc05a 100644 --- a/app/models/spree/variant_decorator.rb +++ b/app/models/spree/variant_decorator.rb @@ -45,6 +45,11 @@ Spree::Variant.class_eval do self.option_values.destroy ovs end + def full_name + return unit_to_display if display_name.blank? + display_name + " (" + unit_to_display + ")" + end + def name_to_display display_name || product.name end diff --git a/lib/open_food_network/products_and_inventory_report.rb b/lib/open_food_network/products_and_inventory_report.rb index 2e6260f82f..bd8e80ca0c 100644 --- a/lib/open_food_network/products_and_inventory_report.rb +++ b/lib/open_food_network/products_and_inventory_report.rb @@ -26,7 +26,7 @@ module OpenFoodNetwork variant.product.supplier.address.city, variant.product.name, variant.product.properties.map(&:name).join(", "), - variant.options_text, + variant.full_name, variant.price, variant.product.group_buy_unit_size, "" From 7d1acc23ade8da0ed9dd896009b0bf03c47f4050 Mon Sep 17 00:00:00 2001 From: Rob H Date: Mon, 23 Jun 2014 15:54:14 +1000 Subject: [PATCH 09/11] Cancel button on new product form redirects to BPE --- .../spree/admin/products/new/replace_form.html.haml.deface | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/overrides/spree/admin/products/new/replace_form.html.haml.deface b/app/overrides/spree/admin/products/new/replace_form.html.haml.deface index 7e4c0f0b3e..a4e073d40d 100644 --- a/app/overrides/spree/admin/products/new/replace_form.html.haml.deface +++ b/app/overrides/spree/admin/products/new/replace_form.html.haml.deface @@ -73,7 +73,7 @@ = button "Create And Add Another", 'icon-repeat', :submit, value: 'add_another' %span.or = t(:or) - = link_to_with_icon 'icon-remove', t('actions.cancel'), collection_url, :class => 'button' + = link_to_with_icon 'icon-remove', t('actions.cancel'), bulk_edit_admin_products_path, :class => 'button' :javascript From 753a867142bb069f7862dfcb62e7494776565d1e Mon Sep 17 00:00:00 2001 From: Rob H Date: Mon, 23 Jun 2014 15:54:53 +1000 Subject: [PATCH 10/11] 'Back to Products List' on product edit page returns user to BPE --- .../products/edit/return_to_bulk_product_edit.html.haml.deface | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 app/overrides/spree/admin/products/edit/return_to_bulk_product_edit.html.haml.deface diff --git a/app/overrides/spree/admin/products/edit/return_to_bulk_product_edit.html.haml.deface b/app/overrides/spree/admin/products/edit/return_to_bulk_product_edit.html.haml.deface new file mode 100644 index 0000000000..f02a460660 --- /dev/null +++ b/app/overrides/spree/admin/products/edit/return_to_bulk_product_edit.html.haml.deface @@ -0,0 +1,3 @@ +/ replace "code[erb-loud]:contains('button_link_to t(:back_to_products_list)')" + += button_link_to t(:back_to_products_list), bulk_edit_admin_products_path, :icon => 'icon-arrow-left' \ No newline at end of file From 51d3f659349f6f21497c1a0ba0c71f3000f77d47 Mon Sep 17 00:00:00 2001 From: Rob H Date: Mon, 23 Jun 2014 22:01:19 +1000 Subject: [PATCH 11/11] Remove spree's product tab for all but admin users --- ...dd_bulk_edit_tab_to_products_admin_sub_menu.rb | 4 ---- .../add_products_tab.html.haml.deface | 4 ++++ .../replace_products_tab.html.haml.deface | 3 +++ spec/features/admin/products_spec.rb | 8 ++------ spec/features/admin/variants_spec.rb | 15 +++------------ .../products_and_inventory_report_spec.rb | 2 +- 6 files changed, 13 insertions(+), 23 deletions(-) delete mode 100644 app/overrides/add_bulk_edit_tab_to_products_admin_sub_menu.rb create mode 100644 app/overrides/spree/admin/shared/_product_sub_menu/add_products_tab.html.haml.deface create mode 100644 app/overrides/spree/admin/shared/_product_sub_menu/replace_products_tab.html.haml.deface diff --git a/app/overrides/add_bulk_edit_tab_to_products_admin_sub_menu.rb b/app/overrides/add_bulk_edit_tab_to_products_admin_sub_menu.rb deleted file mode 100644 index d5b43071d4..0000000000 --- a/app/overrides/add_bulk_edit_tab_to_products_admin_sub_menu.rb +++ /dev/null @@ -1,4 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/admin/shared/_product_sub_menu", - :name => "add_bulk_edit_tab_to_products_admin_sub_menu", - :insert_bottom => "[data-hook='admin_product_sub_tabs']", - :text => "<%= tab :bulk_product_edit, :url => bulk_edit_admin_products_path, :match_path => '/products/bulk_edit' %>") diff --git a/app/overrides/spree/admin/shared/_product_sub_menu/add_products_tab.html.haml.deface b/app/overrides/spree/admin/shared/_product_sub_menu/add_products_tab.html.haml.deface new file mode 100644 index 0000000000..074a76f3ed --- /dev/null +++ b/app/overrides/spree/admin/shared/_product_sub_menu/add_products_tab.html.haml.deface @@ -0,0 +1,4 @@ +/ insert_bottom "[data-hook='admin_product_sub_tabs']" + +- if spree_current_user.admin? + = tab :spree_products, url: admin_products_path, :match_path => '/products' \ No newline at end of file diff --git a/app/overrides/spree/admin/shared/_product_sub_menu/replace_products_tab.html.haml.deface b/app/overrides/spree/admin/shared/_product_sub_menu/replace_products_tab.html.haml.deface new file mode 100644 index 0000000000..ec97ae63fe --- /dev/null +++ b/app/overrides/spree/admin/shared/_product_sub_menu/replace_products_tab.html.haml.deface @@ -0,0 +1,3 @@ +/ replace "code[erb-loud]:contains('tab :products')" + += tab :products, url: bulk_edit_admin_products_path, :match_path => '/products' \ No newline at end of file diff --git a/spec/features/admin/products_spec.rb b/spec/features/admin/products_spec.rb index 18aed5bf52..201381f852 100644 --- a/spec/features/admin/products_spec.rb +++ b/spec/features/admin/products_spec.rb @@ -99,9 +99,7 @@ feature %q{ context "additional fields" do it "should have a notes field" do product = create(:simple_product, supplier: @supplier2) - click_link 'Products' - within('#sub_nav') { click_link 'Products' } - click_link product.name + visit spree.edit_admin_product_path product page.should have_content "Notes" end end @@ -132,9 +130,7 @@ feature %q{ scenario "editing product distributions" do product = create(:simple_product, supplier: @supplier2) - click_link 'Products' - within('#sub_nav') { click_link 'Products' } - click_link product.name + visit spree.edit_admin_product_path product within('#sidebar') { click_link 'Product Distributions' } check @distributors[0].name diff --git a/spec/features/admin/variants_spec.rb b/spec/features/admin/variants_spec.rb index 07a8580022..1904f3d5af 100644 --- a/spec/features/admin/variants_spec.rb +++ b/spec/features/admin/variants_spec.rb @@ -13,10 +13,7 @@ feature %q{ # When I create a variant on the product login_to_admin_section - click_link 'Products' - within('#sub_nav') { click_link 'Products' } - click_link p.name - click_link 'Variants' + visit spree.admin_product_variants_path p click_link 'New Variant' fill_in 'variant_unit_value', with: '1' @@ -38,10 +35,7 @@ feature %q{ # When I view the variant login_to_admin_section - click_link 'Products' - within('#sub_nav') { click_link 'Products' } - click_link p.name - click_link 'Variants' + visit spree.admin_product_variants_path p page.find('table.index .icon-edit').click # Then I should not see a traditional option value field for the unit-related option value @@ -73,10 +67,7 @@ feature %q{ # When I view the variant login_to_admin_section - click_link 'Products' - within('#sub_nav') { click_link 'Products' } - click_link p.name - click_link 'Variants' + visit spree.admin_product_variants_path p page.find('table.index .icon-edit').click # Then I should not see unit value and description fields diff --git a/spec/lib/open_food_network/products_and_inventory_report_spec.rb b/spec/lib/open_food_network/products_and_inventory_report_spec.rb index 33b507faab..39328b87e7 100644 --- a/spec/lib/open_food_network/products_and_inventory_report_spec.rb +++ b/spec/lib/open_food_network/products_and_inventory_report_spec.rb @@ -27,7 +27,7 @@ module OpenFoodNetwork it "should build a table from a list of variants" do variant = double(:variant, sku: "sku", - options_text: "Variant Name", + full_name: "Variant Name", count_on_hand: 10, price: 100) variant.stub_chain(:product, :supplier, :name).and_return("Supplier")