From a6cb5903d696b3df79a59f770eaa0efa6a899e0a Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Wed, 23 Oct 2019 12:16:34 +0100 Subject: [PATCH] Delete prototypes tables and all references in pages --- .../admin/product_properties/index.html.haml | 4 --- app/views/spree/admin/products/new.html.haml | 16 ------------ .../admin/shared/_product_sub_menu.html.haml | 1 - app/views/spree/admin/shared/_tabs.html.haml | 2 +- config/locales/en.yml | 1 - .../20191023105006_drop_prototypes_tables.rb | 25 +++++++++++++++++++ db/schema.rb | 24 +----------------- 7 files changed, 27 insertions(+), 46 deletions(-) create mode 100644 db/migrate/20191023105006_drop_prototypes_tables.rb diff --git a/app/views/spree/admin/product_properties/index.html.haml b/app/views/spree/admin/product_properties/index.html.haml index e97d559111..ce21a208ab 100644 --- a/app/views/spree/admin/product_properties/index.html.haml +++ b/app/views/spree/admin/product_properties/index.html.haml @@ -8,14 +8,10 @@ %ul.tollbar.inline-menu %li = link_to_add_fields Spree.t(:add_product_properties), 'tbody#product_properties', class: 'icon-plus button' - %li - %span#new_ptype_link - = link_to Spree.t(:select_from_prototype), available_admin_prototypes_url, remote: true, 'data-update' => 'prototypes', class: 'button icon-copy' = form_for @product, url: admin_product_url(@product), method: :put do |f| %fieldset.no-border-top .add_product_properties - #prototypes = image_tag 'select2-spinner.gif', plugin: 'spree', style: 'display:none;', id: 'busy_indicator' %table.index.sortable{"data-sortable-link" => update_positions_admin_product_product_properties_url} diff --git a/app/views/spree/admin/products/new.html.haml b/app/views/spree/admin/products/new.html.haml index 913b1dccbd..6b3259c5e4 100644 --- a/app/views/spree/admin/products/new.html.haml +++ b/app/views/spree/admin/products/new.html.haml @@ -101,19 +101,3 @@ angular.element(document.getElementById("new_product")).ready(function() { angular.bootstrap(document.getElementById("new_product"), ['admin.products']); }); -:javascript - (function($){ - var base_url = "#{admin_prototypes_url}"; - var prototype_select = $('#product_prototype_id'); - prototype_select.change(function() { - var id = prototype_select.val(); - if (id.length) { - $('#product-from-prototype').load([ base_url, id ].join("/")); - } else { - $('#product-from-prototype').empty(); - } - }) - if (prototype_select.html() == "") { - prototype_select.change(); - } - })(jQuery); diff --git a/app/views/spree/admin/shared/_product_sub_menu.html.haml b/app/views/spree/admin/shared/_product_sub_menu.html.haml index 15f688fddf..723c579df2 100644 --- a/app/views/spree/admin/shared/_product_sub_menu.html.haml +++ b/app/views/spree/admin/shared/_product_sub_menu.html.haml @@ -3,6 +3,5 @@ = tab :products, match_path: '/products' = tab :option_types, match_path: '/option_types' = tab :properties - = tab :prototypes = tab :variant_overrides, url: main_app.admin_inventory_path, match_path: '/inventory' = tab :import, url: main_app.admin_product_import_path, match_path: '/product_import' diff --git a/app/views/spree/admin/shared/_tabs.html.haml b/app/views/spree/admin/shared/_tabs.html.haml index 8292853af9..ad4fcde418 100644 --- a/app/views/spree/admin/shared/_tabs.html.haml +++ b/app/views/spree/admin/shared/_tabs.html.haml @@ -1,5 +1,5 @@ = tab :dashboard, :route => :admin, :icon => 'icon-dashboard' -= tab :products , :option_types, :properties, :prototypes, :variants, :product_properties, :taxons, :url => admin_products_path, :icon => 'icon-th-large' += tab :products, :option_types, :properties, :variants, :product_properties, :taxons, :url => admin_products_path, :icon => 'icon-th-large' = tab :order_cycles, :url => main_app.admin_order_cycles_path, :icon => 'icon-refresh' = tab :orders, :payments, :creditcard_payments, :shipments, :credit_cards, :return_authorizations, :url => admin_orders_path('q[s]' => 'completed_at desc'), :icon => 'icon-shopping-cart' = tab :reports, :icon => 'icon-file' diff --git a/config/locales/en.yml b/config/locales/en.yml index a763703196..28c9f248d2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2963,7 +2963,6 @@ See the %{link} to find out more about %{sitename}'s features and to start using products: "Products" option_types: "Option Types" properties: "Properties" - prototypes: "Prototypes" variant_overrides: "Inventory" reports: "Reports" configuration: "Configuration" diff --git a/db/migrate/20191023105006_drop_prototypes_tables.rb b/db/migrate/20191023105006_drop_prototypes_tables.rb new file mode 100644 index 0000000000..974cec87ea --- /dev/null +++ b/db/migrate/20191023105006_drop_prototypes_tables.rb @@ -0,0 +1,25 @@ +class DropPrototypesTables < ActiveRecord::Migration + def up + drop_table :spree_option_types_prototypes + drop_table :spree_properties_prototypes + drop_table :spree_prototypes + end + + def down + create_table :spree_prototypes do |t| + t.string :name + t.datetime :created_at, null: false + t.datetime :updated_at, null: false + end + + create_table :spree_option_types_prototypes, id: false do |t| + t.integer :prototype_id + t.integer :option_type_id + end + + create_table :spree_properties_prototypes, id: false do |t| + t.integer :prototype_id + t.integer :property_id + end + end +end diff --git a/db/schema.rb b/db/schema.rb index a409919d7c..1d6ef5f445 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 => 20191023172424) do +ActiveRecord::Schema.define(:version => 20191023105006) do create_table "adjustment_metadata", :force => true do |t| t.integer "adjustment_id" @@ -521,11 +521,6 @@ ActiveRecord::Schema.define(:version => 20191023172424) do t.integer "position", :default => 0, :null => false end - create_table "spree_option_types_prototypes", :id => false, :force => true do |t| - t.integer "prototype_id" - t.integer "option_type_id" - end - create_table "spree_option_values", :force => true do |t| t.integer "position" t.string "name" @@ -785,17 +780,6 @@ ActiveRecord::Schema.define(:version => 20191023172424) do t.datetime "updated_at", :null => false end - create_table "spree_properties_prototypes", :id => false, :force => true do |t| - t.integer "prototype_id" - t.integer "property_id" - end - - create_table "spree_prototypes", :force => true do |t| - t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "spree_return_authorizations", :force => true do |t| t.string "number" t.string "state" @@ -1292,9 +1276,6 @@ ActiveRecord::Schema.define(:version => 20191023172424) do add_foreign_key "spree_line_items", "spree_orders", name: "spree_line_items_order_id_fk", column: "order_id" add_foreign_key "spree_line_items", "spree_variants", name: "spree_line_items_variant_id_fk", column: "variant_id" - add_foreign_key "spree_option_types_prototypes", "spree_option_types", name: "spree_option_types_prototypes_option_type_id_fk", column: "option_type_id" - add_foreign_key "spree_option_types_prototypes", "spree_prototypes", name: "spree_option_types_prototypes_prototype_id_fk", column: "prototype_id" - add_foreign_key "spree_option_values", "spree_option_types", name: "spree_option_values_option_type_id_fk", column: "option_type_id" add_foreign_key "spree_option_values_variants", "spree_option_values", name: "spree_option_values_variants_option_value_id_fk", column: "option_value_id" @@ -1336,9 +1317,6 @@ ActiveRecord::Schema.define(:version => 20191023172424) do add_foreign_key "spree_promotion_rules", "spree_activators", name: "spree_promotion_rules_activator_id_fk", column: "activator_id" - add_foreign_key "spree_properties_prototypes", "spree_properties", name: "spree_properties_prototypes_property_id_fk", column: "property_id" - add_foreign_key "spree_properties_prototypes", "spree_prototypes", name: "spree_properties_prototypes_prototype_id_fk", column: "prototype_id" - add_foreign_key "spree_return_authorizations", "spree_orders", name: "spree_return_authorizations_order_id_fk", column: "order_id" add_foreign_key "spree_roles_users", "spree_roles", name: "spree_roles_users_role_id_fk", column: "role_id"