From f344b7893de991921df288bac361e4c39939fa56 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Sun, 15 Jul 2018 20:48:12 +0100 Subject: [PATCH] Remove Product Import guide page --- .../admin/product_import_controller.rb | 6 -- .../admin/product_import/guide.html.haml | 69 ------------ .../product_import/guide/_columns.html.haml | 100 ------------------ .../product_import/guide/_units.html.haml | 54 ---------- .../product_import/guide/_variants.html.haml | 54 ---------- .../admin/product_import/index.html.haml | 6 -- config/routes.rb | 1 - 7 files changed, 290 deletions(-) delete mode 100644 app/views/admin/product_import/guide.html.haml delete mode 100644 app/views/admin/product_import/guide/_columns.html.haml delete mode 100644 app/views/admin/product_import/guide/_units.html.haml delete mode 100644 app/views/admin/product_import/guide/_variants.html.haml diff --git a/app/controllers/admin/product_import_controller.rb b/app/controllers/admin/product_import_controller.rb index 4037bcd85b..f2b1972a9c 100644 --- a/app/controllers/admin/product_import_controller.rb +++ b/app/controllers/admin/product_import_controller.rb @@ -4,12 +4,6 @@ module Admin class ProductImportController < Spree::Admin::BaseController before_filter :validate_upload_presence, except: %i[index guide validate_data] - def guide - @product_categories = Spree::Taxon.order('name ASC').pluck(:name).uniq - @tax_categories = Spree::TaxCategory.order('name ASC').pluck(:name) - @shipping_categories = Spree::ShippingCategory.order('name ASC').pluck(:name) - end - def import # Save uploaded file to tmp directory @filepath = save_uploaded_file(params[:file]) diff --git a/app/views/admin/product_import/guide.html.haml b/app/views/admin/product_import/guide.html.haml deleted file mode 100644 index aab0350606..0000000000 --- a/app/views/admin/product_import/guide.html.haml +++ /dev/null @@ -1,69 +0,0 @@ -- content_for :page_title do - Product Import Guide - -- content_for :page_actions do - %div.toolbar{ 'data-hook' => "toolbar" } - %ul.actions.header-action-links.inline-menu - %li - = button_link_to 'Back to Import', main_app.admin_product_import_path - -= render partial: 'spree/admin/shared/product_sub_menu' - -.product-import-introduction - - %h5 Spreadsheet Columns - - = render 'admin/product_import/guide/columns' - - %h5 Weight, volume, or single items - - %p - When creating a product you can specify a number of options. If the product is measured - by weight, unit_value should be set to a number and unit_type should be set to either - g for grams, Kg for kilograms, or T for tonnes. - - %p - For items such as liquids, the unit_type can be ml for millilitres, L for litres or - Kl for kilolitres. - - %p - For other items that are sold in different units such as "a bunch of carrots", you can - enter 1 for units, leave unit_type blank, and enter a name in the variant_unit_name - column such as "loaf" or "bunch". - - %h6 Example spreadsheet data: - - = render 'admin/product_import/guide/units' - - - %h5 Product Variants - - %p - Variants are distinguished by the units and display_name fields and grouped by product name. - The example below shows a salad that comes in 500g and 750g variants, and a cake that comes in - multiple flavours. - - %h6 Example spreadsheet data: - - = render 'admin/product_import/guide/variants' - - - %h5 Category Values - - %p - Listed below are the available Product categories, as well as Tax and Shipping categories. - - %h6 Product Categories - - - @product_categories.each do |pc| - %span.category= pc - - %h6 Tax Categories - - - @tax_categories.each do |tc| - %span.category= tc - - %h6 Shipping Categories - - - @shipping_categories.each do |sc| - %span.category= sc diff --git a/app/views/admin/product_import/guide/_columns.html.haml b/app/views/admin/product_import/guide/_columns.html.haml deleted file mode 100644 index c79a881162..0000000000 --- a/app/views/admin/product_import/guide/_columns.html.haml +++ /dev/null @@ -1,100 +0,0 @@ -%table.product-import-columns - %thead - %tr - %th Column Title - %th Required - %th Examples - %th Description - %th Notes - %tbody - %tr - %td - %strong name - %td Yes - %td Potatoes - %td The name of the product - %td - %tr - %td - %strong supplier - %td Yes - %td Pennylane Farm - %td The name of the product's supplier - %td - %tr - %td - %strong category - %td Yes - %td Vegetables - %td The product category - %td See below for a list of available categories - %tr - %td - %strong on_hand - %td Yes - %td 15 - %td The amount currently in stock - %td - %tr - %td - %strong price - %td Yes - %td 2.50 - %td The price of the product - %td - %tr - %td - %strong units - %td Yes - %td 750 - %td The weight or volume value. - %td - %tr - %td - %strong unit_type - %td Yes - %td g - %td The unit type, i.e. g for grams, Kg for Kilograms, ml for millilitres. Can be blank (see notes). - %td If unit_type is left blank, a variant_unit_name must be given. - %tr - %td - %strong variant_unit_name - %td Maybe - %td bunch - %td If the product is sold as an item such as "bunch", "loaf" or "case", that goes here. - %td Used for products that don't use a unit_type for weight or volume. - %tr - %td - %strong display_name - %td No - %td Orange - %td Used to name product variants, if they have a distinct name. - %td - %tr - %td - %strong on_demand - %td No - %td 1 - %td Flag the product as "made on demand". The product will not use stock levels. - %td 1 for active, 0 for disabled, or leave blank to ignore. - %tr - %td - %strong tax_category - %td No - %td (Various, see notes) - %td Sets the product tax category - %td See below for a list of available categories - %tr - %td - %strong shipping_category - %td No - %td (Various, see notes) - %td Sets the product shipping category - %td See below for a list of available categories - %tr - %td - %strong available_on - %td No - %td 2018-05-21 - %td Sets the date from which the product will be available - %td Date format is: YYYY-MM-DD diff --git a/app/views/admin/product_import/guide/_units.html.haml b/app/views/admin/product_import/guide/_units.html.haml deleted file mode 100644 index 07161bdb1c..0000000000 --- a/app/views/admin/product_import/guide/_units.html.haml +++ /dev/null @@ -1,54 +0,0 @@ -%table - %thead - %tr - %th - %th name - %th category - %th supplier - %th on_hand - %th price - %th units - %th unit_type - %th variant_unit_name - %tbody - %tr - %td 1 - %td Salad Bag - %td Salads - %td Sue's Salads - %td 26 - %td 3.50 - %td 500 - %td g - %td - %tr - %td 2 - %td Fruit Juice - %td Drinks - %td Country Juices - %td 12 - %td 3.50 - %td 300 - %td ml - %td - %tr - %td 3 - %td Potatoes - %td Vegetables - %td Fernwell Farm - %td 67 - %td 4.20 - %td 1 - %td kg - %td - - %tr - %td 3 - %td Wholemeal Bread - %td Baked goods - %td Tim's Bakery - %td 66 - %td 3.00 - %td 1 - %td - %td loaf diff --git a/app/views/admin/product_import/guide/_variants.html.haml b/app/views/admin/product_import/guide/_variants.html.haml deleted file mode 100644 index dfd95879c1..0000000000 --- a/app/views/admin/product_import/guide/_variants.html.haml +++ /dev/null @@ -1,54 +0,0 @@ -%table - %thead - %tr - %th - %th name - %th category - %th supplier - %th on_hand - %th price - %th units - %th unit_type - %th display_name - %tbody - %tr - %td 1 - %td Salad Bag - %td Salads - %td Sue's Salads - %td 26 - %td 3.50 - %td 500 - %td g - %td - %tr - %td 2 - %td Salad Bag - %td Salads - %td Sue's Salads - %td 44 - %td 5.50 - %td 750 - %td g - %td - %tr - %td 3 - %td Cake - %td Baked goods - %td Tim's Cakes - %td 10 - %td 4 - %td 500 - %td g - %td Banana and Walnut - %tr - %td 4 - %td Cake - %td Baked goods - %td Tim's Cakes - %td 18 - %td 4 - %td 500 - %td g - %td Carrot - diff --git a/app/views/admin/product_import/index.html.haml b/app/views/admin/product_import/index.html.haml index f2e8e5208b..fd17684ef0 100644 --- a/app/views/admin/product_import/index.html.haml +++ b/app/views/admin/product_import/index.html.haml @@ -1,12 +1,6 @@ - content_for :page_title do #{t('admin.product_import.title')} -- content_for :page_actions do - %div.toolbar{ 'data-hook' => "toolbar" } - %ul.actions.header-action-links.inline-menu - %li - = button_link_to 'View Guide', main_app.admin_product_import_guide_path - = render partial: 'spree/admin/shared/product_sub_menu' = render 'upload_form' diff --git a/config/routes.rb b/config/routes.rb index 7e2bc47a32..229b26e331 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -133,7 +133,6 @@ Openfoodnetwork::Application.routes.draw do get '/inventory', to: 'variant_overrides#index' get '/product_import', to: 'product_import#index' - get '/product_import/guide', to: 'product_import#guide', as: 'product_import_guide' post '/product_import', to: 'product_import#import' post '/product_import/validate_data', to: 'product_import#validate_data', as: 'product_import_process_async' post '/product_import/save_data', to: 'product_import#save_data', as: 'product_import_save_async'