From 612017f143ee9f487592ccd2779dccd3c3b02be6 Mon Sep 17 00:00:00 2001 From: Rob H Date: Tue, 5 Feb 2013 15:01:45 +1100 Subject: [PATCH 02/25] WIP Upgrade to Spree 1.3 --- Gemfile | 5 +- Gemfile.lock | 141 ++--- .../stylesheets/store/variables.css.scss | 60 +-- app/controllers/base_controller.rb | 2 +- app/controllers/enterprises_controller.rb | 1 + .../spree/orders_controller_decorator.rb | 6 +- app/models/spree/order_decorator.rb | 2 +- app/views/spree/admin/shared/_tabs.html.erb | 11 +- app/views/spree/checkout/_address.html.erb | 175 ------- .../spree/orders/_inside_cart_form.html.haml | 2 +- .../20130201024428_spree_one_two.spree.rb | 482 ++++++++++++++++++ ...20130201024429_add_tax_rate_label.spree.rb | 6 + ...24430_add_toggle_tax_rate_display.spree.rb | 6 + ..._remove_unused_preference_columns.spree.rb | 9 + ...24432_add_lock_version_to_variant.spree.rb | 6 + ..._add_states_required_to_countries.spree.rb | 6 + ..._on_demand_to_product_and_variant.spree.rb | 7 + ..._constraint_from_products_on_hand.spree.rb | 12 + ...024436_split_prices_from_variants.spree.rb | 32 ++ ...not_null_from_spree_prices_amount.spree.rb | 10 + ...024438_add_currency_to_line_items.spree.rb | 6 + ...0201024439_add_currency_to_orders.spree.rb | 6 + ...440_add_cost_currency_to_variants.spree.rb | 6 + ...e_display_on_from_payment_methods.spree.rb | 6 + ...024442_add_position_to_taxonomies.spree.rb | 6 + ...24443_add_last_ip_to_spree_orders.spree.rb | 6 + ...splay_on_to_spree_payment_methods.spree.rb | 10 + ...name_api_key_to_spree_api_key.spree_api.rb | 8 + ...1024447_spree_promo_one_two.spree_promo.rb | 46 ++ ...00_add_api_key_to_spree_users.spree_api.rb | 8 + .../20130201220401_create_users.spree_auth.rb | 30 ++ db/schema.rb | 50 +- 32 files changed, 871 insertions(+), 298 deletions(-) delete mode 100644 app/views/spree/checkout/_address.html.erb create mode 100644 db/migrate/20130201024428_spree_one_two.spree.rb create mode 100644 db/migrate/20130201024429_add_tax_rate_label.spree.rb create mode 100644 db/migrate/20130201024430_add_toggle_tax_rate_display.spree.rb create mode 100644 db/migrate/20130201024431_remove_unused_preference_columns.spree.rb create mode 100644 db/migrate/20130201024432_add_lock_version_to_variant.spree.rb create mode 100644 db/migrate/20130201024433_add_states_required_to_countries.spree.rb create mode 100644 db/migrate/20130201024434_add_on_demand_to_product_and_variant.spree.rb create mode 100644 db/migrate/20130201024435_remove_not_null_constraint_from_products_on_hand.spree.rb create mode 100644 db/migrate/20130201024436_split_prices_from_variants.spree.rb create mode 100644 db/migrate/20130201024437_remove_not_null_from_spree_prices_amount.spree.rb create mode 100644 db/migrate/20130201024438_add_currency_to_line_items.spree.rb create mode 100644 db/migrate/20130201024439_add_currency_to_orders.spree.rb create mode 100644 db/migrate/20130201024440_add_cost_currency_to_variants.spree.rb create mode 100644 db/migrate/20130201024441_remove_display_on_from_payment_methods.spree.rb create mode 100644 db/migrate/20130201024442_add_position_to_taxonomies.spree.rb create mode 100644 db/migrate/20130201024443_add_last_ip_to_spree_orders.spree.rb create mode 100644 db/migrate/20130201024444_add_display_on_to_spree_payment_methods.spree.rb create mode 100644 db/migrate/20130201024446_rename_api_key_to_spree_api_key.spree_api.rb create mode 100644 db/migrate/20130201024447_spree_promo_one_two.spree_promo.rb create mode 100644 db/migrate/20130201220400_add_api_key_to_spree_users.spree_api.rb create mode 100644 db/migrate/20130201220401_create_users.spree_auth.rb diff --git a/Gemfile b/Gemfile index 00dcd00b2b..aaae276efe 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,11 @@ ruby "1.9.3" gem 'rails', '3.2.11' gem 'pg' -gem 'spree', :git => 'git://github.com/spree/spree.git', :branch => '1-1-stable' +gem 'spree', :git => 'git://github.com/spree/spree.git', :branch => '1-3-stable' gem 'spree_i18n', :git => 'git://github.com/spree/spree_i18n.git' -gem 'spree_paypal_express', :git => 'git://github.com/eaterprises/spree_paypal_express.git', :branch => '1-1-stable' +gem 'spree_paypal_express', :git => 'git://github.com/spree/spree_paypal_express.git', :branch => '1-3-stable' gem 'spree_last_address', :git => 'git://github.com/dancinglightning/spree-last-address.git' +gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '1-3-stable' gem 'comfortable_mexican_sofa' diff --git a/Gemfile.lock b/Gemfile.lock index 1e02f92a7e..c72794093c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -21,62 +21,49 @@ GIT aws-sdk (~> 1.3.4) spree_core (>= 0.70.0) -GIT - remote: git://github.com/eaterprises/spree_paypal_express.git - revision: 7dd46e6e549d82c4d603f685a7cb7fbb4af0d973 - branch: 1-1-stable - specs: - spree_paypal_express (1.1.0) - spree_auth (>= 1.0.0) - spree_core (>= 1.0.0) - GIT remote: git://github.com/spree/spree.git - revision: 46691e075129fd3d7b59e296d73149a9066c1b9d - branch: 1-1-stable + revision: cbba7d046061ceb14c2947d92774ded6d7b0980e + branch: 1-3-stable specs: - spree (1.1.3) - spree_api (= 1.1.3) - spree_auth (= 1.1.3) - spree_cmd (= 1.1.3) - spree_core (= 1.1.3) - spree_dash (= 1.1.3) - spree_promo (= 1.1.3) - spree_sample (= 1.1.3) - spree_api (1.1.3) - rabl (= 0.6.5) - spree_auth (= 1.1.3) - spree_core (= 1.1.3) - spree_auth (1.1.3) - cancan (= 1.6.7) - devise (~> 2.0.0) - spree_core (= 1.1.3) - spree_cmd (1.1.3) + spree (1.3.2.beta) + spree_api (= 1.3.2.beta) + spree_cmd (= 1.3.2.beta) + spree_core (= 1.3.2.beta) + spree_dash (= 1.3.2.beta) + spree_promo (= 1.3.2.beta) + spree_sample (= 1.3.2.beta) + spree_api (1.3.2.beta) + spree_core (= 1.3.2.beta) + versioncake (= 0.4.0) + spree_cmd (1.3.2.beta) thor (>= 0.14.6) - spree_core (1.1.3) - activemerchant (= 1.28.0) + spree_core (1.3.2.beta) + activemerchant (~> 1.29.3) acts_as_list (= 0.1.4) + awesome_nested_set (= 2.1.5) aws-sdk (~> 1.3.4) + cancan (= 1.6.8) deface (>= 0.9.0) ffaker (~> 1.12.0) highline (= 1.6.11) - jquery-rails (~> 2.0) + jquery-rails (~> 2.1.4) kaminari (= 0.13.0) - nested_set (= 1.7.0) + money (= 5.0.0) paperclip (~> 2.8) - rails (~> 3.2.8) - ransack (~> 0.6.0) + rabl (= 0.7.2) + rails (~> 3.2.11) + ransack (~> 0.7.2) + select2-rails (~> 3.2) state_machine (= 1.1.2) stringex (~> 1.3.2) - spree_dash (1.1.3) + spree_dash (1.3.2.beta) httparty (~> 0.8.1) - spree_auth (= 1.1.3) - spree_core (= 1.1.3) - spree_promo (1.1.3) - spree_auth (= 1.1.3) - spree_core (= 1.1.3) - spree_sample (1.1.3) - spree_core (= 1.1.3) + spree_core (= 1.3.2.beta) + spree_promo (1.3.2.beta) + spree_core (= 1.3.2.beta) + spree_sample (1.3.2.beta) + spree_core (= 1.3.2.beta) GIT remote: git://github.com/spree/spree_i18n.git @@ -86,6 +73,25 @@ GIT i18n (~> 0.5) spree (~> 1.1) +GIT + remote: git://github.com/spree/spree_paypal_express.git + revision: 483f6ababa9c8a1c574aad0a948c96cc21a591db + branch: 1-3-stable + specs: + spree_paypal_express (1.2.0) + spree_core (~> 1.3.0) + +GIT + remote: https://github.com/spree/spree_auth_devise.git + revision: ab03a7a22740b52f96bf0311a1e9f18a99ee02f2 + branch: 1-3-stable + specs: + spree_auth_devise (1.0.0) + cancan (~> 1.6.7) + devise (~> 2.2.3) + devise-encryptable (= 0.1.1) + spree_core + GEM remote: http://rubygems.org/ specs: @@ -106,9 +112,9 @@ GEM active_utils (1.0.5) activesupport (>= 2.3.11) i18n - activemerchant (1.28.0) + activemerchant (1.29.3) active_utils (>= 1.0.2) - activesupport (>= 2.3.11) + activesupport (>= 2.3.14) builder (>= 2.0.0) i18n json (>= 1.5.1) @@ -133,6 +139,8 @@ GEM andand (1.3.3) ansi (1.4.2) arel (3.0.2) + awesome_nested_set (2.1.5) + activerecord (>= 3.0.0) awesome_print (1.0.2) aws-sdk (1.3.9) httparty (~> 0.7) @@ -144,7 +152,7 @@ GEM httparty (>= 0.5, < 1.0) multi_json (~> 1.0) builder (3.0.4) - cancan (1.6.7) + cancan (1.6.8) capybara (2.0.2) mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -154,7 +162,10 @@ GEM xpath (~> 1.0.0) childprocess (0.3.6) ffi (~> 1.0, >= 1.0.6) - cocaine (0.4.2) + climate_control (0.0.3) + activesupport (>= 3.0) + cocaine (0.5.1) + climate_control (>= 0.0.3, < 1.0) coderay (1.0.7) coffee-rails (3.2.2) coffee-script (>= 2.2.0) @@ -179,11 +190,13 @@ GEM deface (0.9.1) nokogiri (~> 1.5.0) rails (~> 3.1) - devise (2.0.4) + devise (2.2.3) bcrypt-ruby (~> 3.0) - orm_adapter (~> 0.0.3) + orm_adapter (~> 0.1) railties (~> 3.1) - warden (~> 1.1.1) + warden (~> 1.2.1) + devise-encryptable (0.1.1) + devise (>= 2.1.0.rc) diff-lcs (1.1.3) erubis (2.7.0) execjs (1.4.0) @@ -205,9 +218,9 @@ GEM multi_xml i18n (0.6.1) journey (1.0.4) - jquery-rails (2.1.3) - railties (>= 3.1.0, < 5.0) - thor (~> 0.14) + jquery-rails (2.1.4) + railties (>= 3.0, < 5.0) + thor (>= 0.14, < 2.0) json (1.7.6) kaminari (0.13.0) actionpack (>= 3.0.0) @@ -232,12 +245,9 @@ GEM i18n (~> 0.4) json multi_json (1.5.0) - multi_xml (0.5.1) - nested_set (1.7.0) - activerecord (>= 3.0.0) - railties (>= 3.0.0) + multi_xml (0.5.2) nokogiri (1.5.6) - orm_adapter (0.0.7) + orm_adapter (0.4.0) paperclip (2.8.0) activerecord (>= 2.3.0) activesupport (>= 2.3.2) @@ -254,13 +264,13 @@ GEM pry-debugger (0.2.0) debugger (~> 1.1.3) pry (~> 0.9.9) - rabl (0.6.5) + rabl (0.7.2) activesupport (>= 2.3.14) multi_json (~> 1.0) rack (1.4.4) rack-cache (1.2) rack (>= 0.4) - rack-ssl (1.3.2) + rack-ssl (1.3.3) rack rack-test (0.6.2) rack (>= 1.0) @@ -281,7 +291,7 @@ GEM thor (>= 0.14.6, < 2.0) raindrops (0.9.0) rake (10.0.3) - ransack (0.6.0) + ransack (0.7.2) actionpack (~> 3.0) activerecord (~> 3.0) polyamorous (~> 0.5.0) @@ -314,6 +324,8 @@ GEM railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) + select2-rails (3.2.1) + thor (~> 0.14) selenium-webdriver (2.27.2) childprocess (>= 0.2.5) libwebsocket (~> 0.1.3) @@ -332,7 +344,7 @@ GEM stringex (1.3.3) therubyracer (0.10.1) libv8 (~> 3.3.10) - thor (0.16.0) + thor (0.17.0) tilt (1.3.3) treetop (1.4.12) polyglot @@ -349,7 +361,11 @@ GEM rack raindrops (~> 0.7) uuidtools (2.1.3) - warden (1.1.1) + versioncake (0.4.0) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + warden (1.2.1) rack (>= 1.0) websocket (1.0.6) xpath (1.0.0) @@ -382,6 +398,7 @@ DEPENDENCIES simple_form! spork (~> 1.0rc) spree! + spree_auth_devise! spree_heroku! spree_i18n! spree_last_address! diff --git a/app/assets/stylesheets/store/variables.css.scss b/app/assets/stylesheets/store/variables.css.scss index 33e0fac143..2d0000d74f 100644 --- a/app/assets/stylesheets/store/variables.css.scss +++ b/app/assets/stylesheets/store/variables.css.scss @@ -1,18 +1,18 @@ /*--------------------------------------*/ /* Colors /*--------------------------------------*/ -$c_green: #8dba53; /* Spree green */ -$c_red: #e45353; /* Error red */ +$c_green: #8dba53 !default; /* Spree green */ +$c_red: #e45353 !default; /* Error red */ -$layout_background_color: #FFFFFF; -$title_text_color: #404042; -$body_text_color: #404042; -$link_text_color: #006066; +$layout_background_color: #FFFFFF !default; +$title_text_color: #404042 !default; +$body_text_color: #404042 !default; +$link_text_color: #00ADEE !default; -$product_background_color: #FFFFFF; -$product_title_text_color: #404042; -$product_body_text_color: #404042; -$product_link_text_color: #BBBBBB; +$product_background_color: #FFFFFF !default; +$product_title_text_color: #404042 !default; +$product_body_text_color: #404042 !default; +$product_link_text_color: #BBBBBB !default; /*--------------------------------------*/ /* Fonts import from remote @@ -22,37 +22,39 @@ $product_link_text_color: #BBBBBB; /*--------------------------------------*/ /* Font families /*--------------------------------------*/ -$ff_base: 'Ubuntu', sans-serif; +$ff_base: 'Ubuntu', sans-serif !default; /*-------------------------------------- | Font sizes |-------------------------------------- |- Navigation | */ - $header_navigation_font_size: 14px; - $horizontal_navigation_font_size: 16px; - $main_navigation_header_font_size: 14px; - $main_navigation_font_size: 12px; + $header_navigation_font_size: 14px !default; + $horizontal_navigation_font_size: 16px !default; + $main_navigation_header_font_size: 14px !default; + $main_navigation_font_size: 12px !default; /*|------------------------------------ |- Product Listing | */ - $product_list_name_font_size: 12px; - $product_list_price_font_size: 16px; - $product_list_header_font_size: 20px; - $product_list_search_font_size: 14px; + $product_list_name_font_size: 12px !default; + $product_list_price_font_size: 16px !default; + $product_list_header_font_size: 20px !default; + $product_list_search_font_size: 14px !default; /*|------------------------------------ |- Product Details | */ - $product_detail_name_font_size: 24px; - $product_detail_description_font_size: 12px; - $product_detail_price_font_size: 20px; - $product_detail_title_font_size: 14px; + $product_detail_name_font_size: 24px !default; + $product_detail_description_font_size: 12px !default; + $product_detail_price_font_size: 20px !default; + $product_detail_title_font_size: 14px !default; /*|------------------------------------ |- Basic | */ - $heading_font_size: 24px; - $sub_heading_font_size: 14px; - $button_font_size: 12px; - $input_box_font_size: 13px; - $base_font_size: 12px; - $button_border_color: rgba(0, 138, 189, .75); + $heading_font_size: 24px !default; + $sub_heading_font_size: 14px !default; + $button_font_size: 12px !default; + $input_box_font_size: 13px !default; + $base_font_size: 12px !default; + $border_color: lighten($body_text_color, 60); + $default_border: 1px solid $border_color; + $button_border_color: rgba(0, 138, 189, .75) !default; diff --git a/app/controllers/base_controller.rb b/app/controllers/base_controller.rb index 8c951f993a..5617a35918 100644 --- a/app/controllers/base_controller.rb +++ b/app/controllers/base_controller.rb @@ -1,6 +1,6 @@ class BaseController < ApplicationController include Spree::Core::ControllerHelpers - include Spree::Core::RespondWith + include Spree::Core::ControllerHelpers::RespondWith helper 'spree/base' diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rb index 1290530ddd..9e66072564 100644 --- a/app/controllers/enterprises_controller.rb +++ b/app/controllers/enterprises_controller.rb @@ -1,3 +1,4 @@ +include Spree::ProductsHelper class EnterprisesController < BaseController def index @enterprises = Enterprise.all diff --git a/app/controllers/spree/orders_controller_decorator.rb b/app/controllers/spree/orders_controller_decorator.rb index ca7978e64a..730d96b279 100644 --- a/app/controllers/spree/orders_controller_decorator.rb +++ b/app/controllers/spree/orders_controller_decorator.rb @@ -19,7 +19,7 @@ Spree::OrdersController.class_eval do def populate_order_count_on_hand params[:products].each do |product_id, variant_id| product = Spree::Product.find product_id - if product.count_on_hand < params[:quantity].to_i + if product.count_on_hand < params[:quantity].to_i && product.has_variants? == false flash[:error] = "Unfortunately " + (product.count_on_hand == 0 ? "no" : "only" + product.count_on_hand.to_s ) + " units of the selected item remain." redirect_populate_to_first_product end @@ -37,14 +37,14 @@ Spree::OrdersController.class_eval do def populate_variant_attributes if params.key? :variant_attributes params[:variant_attributes].each do |variant_id, attributes| - @order.set_variant_attributes(Spree::Variant.find(variant_id), attributes) + current_order.set_variant_attributes(Spree::Variant.find(variant_id), attributes) end end if params.key? :quantity params[:products].each do |product_id, variant_id| max_quantity = params[:max_quantity].to_i - @order.set_variant_attributes(Spree::Variant.find(variant_id), {:max_quantity => max_quantity}) + current_order.set_variant_attributes(Spree::Variant.find(variant_id), {:max_quantity => max_quantity}) end end end diff --git a/app/models/spree/order_decorator.rb b/app/models/spree/order_decorator.rb index 17dbe09405..85c75771b3 100644 --- a/app/models/spree/order_decorator.rb +++ b/app/models/spree/order_decorator.rb @@ -21,7 +21,7 @@ Spree::Order.class_eval do end def set_variant_attributes(variant, attributes) - line_item = contains?(variant) + line_item = find_line_item_by_variant(variant) if attributes.key?(:max_quantity) && attributes[:max_quantity].to_i < line_item.quantity attributes[:max_quantity] = line_item.quantity diff --git a/app/views/spree/admin/shared/_tabs.html.erb b/app/views/spree/admin/shared/_tabs.html.erb index 71eec3fb97..fef894389f 100644 --- a/app/views/spree/admin/shared/_tabs.html.erb +++ b/app/views/spree/admin/shared/_tabs.html.erb @@ -1,6 +1,5 @@ -<%= tab :overview, :route => :admin %> -<%= tab :orders, :payments, :creditcard_payments, :shipments, :creditcards, :return_authorizations, {:url => admin_orders_path('q[s]' => 'completed_at desc')} %> -<%= tab :products , :option_types, :properties, :prototypes, :variants, :product_properties, :taxons %> -<%= tab :reports %> -<%= tab :configurations, :general_settings, :mail_methods, :tax_categories, :zones, :states, :payment_methods, :inventory_settings, :taxonomies, :shipping_methods, :trackers, :label => 'configuration' %> -<%= tab :users %> +<%= tab :overview, :route => :admin, :icon => 'icon-dashboard' %> +<%= tab :orders, :payments, :creditcard_payments, :shipments, :credit_cards, :return_authorizations, :url => admin_orders_path('q[s]' => 'completed_at desc'), :icon => 'icon-shopping-cart' %> +<%= tab :products , :option_types, :properties, :prototypes, :variants, :product_properties, :taxons, :icon => 'icon-th-large' %> +<%= tab :reports, :icon => 'icon-file' %> +<%= tab :configurations, :general_settings, :mail_methods, :tax_categories, :zones, :states, :payment_methods, :inventory_settings, :taxonomies, :shipping_methods, :trackers, :label => 'configuration', :icon => 'icon-wrench', :url => edit_admin_general_settings_path %> diff --git a/app/views/spree/checkout/_address.html.erb b/app/views/spree/checkout/_address.html.erb deleted file mode 100644 index 77c035150e..0000000000 --- a/app/views/spree/checkout/_address.html.erb +++ /dev/null @@ -1,175 +0,0 @@ - - -
-
- <%= form.fields_for :bill_address do |bill_form| %> - <%= t(:billing_address) %> -
-

- <%= bill_form.label :firstname, t(:first_name) %>*
- <%= bill_form.text_field :firstname, :class => 'required' %> -

-

- <%= bill_form.label :lastname, t(:last_name) %>*
- <%= bill_form.text_field :lastname, :class => 'required' %> -

- <% if Spree::Config[:company] %> -

- <%= bill_form.label :company, t(:company) %>
- <%= bill_form.text_field :company %> -

- <% end %> -

- <%= bill_form.label :address1, t(:street_address) %>*
- <%= bill_form.text_field :address1, :class => 'required' %> -

-

- <%= bill_form.label :address2, t(:street_address_2) %>
- <%= bill_form.text_field :address2 %> -

- -

- <%= bill_form.label :city, t(:city) %>*
- <%= bill_form.text_field :city, :class => 'required' %> -

- -

- <%= bill_form.label :country_id, t(:country) %>*
- - <%= bill_form.collection_select :country_id, available_countries, :id, :name, {}, {:class => 'required'} %> - -

- - <% if Spree::Config[:address_requires_state] %> -

- <% have_states = !@order.bill_address.country.states.empty? %> - <%= bill_form.label :state, t(:state) %>*
- <% state_elements = [ - bill_form.collection_select(:state_id, @order.bill_address.country.states, - :id, :name, - {:include_blank => true}, - {:class => have_states ? 'required' : 'hidden', - :disabled => !have_states}) + - bill_form.text_field(:state_name, - :class => !have_states ? 'required' : 'hidden', - :disabled => have_states) - ].join.gsub('"', "'").gsub("\n", "") - %> - <%= javascript_tag do -%> - document.write("<%== state_elements %>"); - <% end -%> -

- - <% end %> - -

- <%= bill_form.label :zipcode, t(:zip) %>*
- <%= bill_form.text_field :zipcode, :class => 'required' %> -

-

- <%= bill_form.label :phone, t(:phone) %>*
- <%= bill_form.text_field :phone, :class => 'required' %> -

- <% if Spree::Config[:alternative_billing_phone] %> -

- <%= bill_form.label :alternative_phone, t(:alternative_phone) %>
- <%= bill_form.text_field :alternative_phone %> -

- <% end %> -
- <% end %> -
-
- -
-
- <%= form.fields_for :ship_address do |ship_form| %> - <%= t(:shipping_address) %> -

- <%= check_box_tag 'order[use_billing]', '1', (!(@order.bill_address.empty? && @order.ship_address.empty?) && @order.bill_address.same_as?(@order.ship_address)) %> - <%= label_tag :order_use_billing, t(:use_billing_address), :id => 'use_billing' %> -

-
-

- <%= ship_form.label :firstname, t(:first_name) %>*
- <%= ship_form.text_field :firstname, :class => 'required' %> -

-

- <%= ship_form.label :lastname, t(:last_name) %>*
- <%= ship_form.text_field :lastname, :class => 'required' %> -

- <% if Spree::Config[:company] %> -

- <%= ship_form.label :company, t(:company) %>
- <%= ship_form.text_field :company %> -

- <% end %> -

- <%= ship_form.label :address1, t(:street_address) %>*
- <%= ship_form.text_field :address1, :class => 'required' %> -

-

- <%= ship_form.label :address2, t(:street_address_2) %>
- <%= ship_form.text_field :address2 %> -

- -

- <%= ship_form.label :city, t(:city) %>*
- <%= ship_form.text_field :city, :class => 'required' %> -

- -

- <%= ship_form.label :country_id, t(:country) %>*
- - <%= ship_form.collection_select :country_id, available_countries, :id, :name, {}, {:class => 'required'} %> - -

- - <% if Spree::Config[:address_requires_state] %> -

- <% have_states = !@order.ship_address.country.states.empty? %> - <%= ship_form.label :state, t(:state) %>*
- <% state_elements = [ - ship_form.collection_select(:state_id, @order.ship_address.country.states, - :id, :name, - {:include_blank => true}, - {:class => have_states ? 'required' : 'hidden', - :disabled => !have_states}) + - ship_form.text_field(:state_name, - :class => !have_states ? 'required' : 'hidden', - :disabled => have_states) - ].join.gsub('"', "'").gsub("\n", "") - %> - <%= javascript_tag do -%> - document.write("<%== state_elements %>"); - <% end %> -

- - <% end %> - -

- <%= ship_form.label :zipcode, t(:zip) %>*
- <%= ship_form.text_field :zipcode, :class => 'required' %> -

-

- <%= ship_form.label :phone, t(:phone) %>*
- <%= ship_form.text_field :phone, :class => 'required' %> -

- <% if Spree::Config[:alternative_shipping_phone] %> -

- <%= ship_form.label :alternative_phone, t(:alternative_phone) %>
- <%= ship_form.text_field :alternative_phone %> -

- <% end %> -
- <% end %> -
-
-
-
- <%= submit_tag t(:save_and_continue), :class => 'continue button primary' %> -
diff --git a/app/views/spree/orders/_inside_cart_form.html.haml b/app/views/spree/orders/_inside_cart_form.html.haml index 117b0fed9e..3ae636eb85 100644 --- a/app/views/spree/orders/_inside_cart_form.html.haml +++ b/app/views/spree/orders/_inside_cart_form.html.haml @@ -14,7 +14,7 @@ %h4 Total \: - %span.order-total.grand-total= order_subtotal(@order) + %span.order-total.grand-total= @order.display_total .links{'data-hook' => "cart_buttons"} = button_tag :class => 'primary', :id => 'update-button' do diff --git a/db/migrate/20130201024428_spree_one_two.spree.rb b/db/migrate/20130201024428_spree_one_two.spree.rb new file mode 100644 index 0000000000..ad81bfeabe --- /dev/null +++ b/db/migrate/20130201024428_spree_one_two.spree.rb @@ -0,0 +1,482 @@ +# This migration comes from spree (originally 20120831092320) +class SpreeOneTwo < ActiveRecord::Migration + def up + # This migration is just a compressed version of all the previous + # migrations for spree_core. Do not run it if one of the core tables + # already exists. Assume the best. + return if table_exists?(:spree_addresses) + + + create_table :spree_activators do |t| + t.string :description + t.datetime :expires_at + t.datetime :starts_at + t.string :name + t.string :event_name + t.string :type + t.integer :usage_limit + t.string :match_policy, :default => 'all' + t.string :code + t.boolean :advertise, :default => false + t.string :path + t.timestamps + end + + create_table :spree_addresses do |t| + t.string :firstname + t.string :lastname + t.string :address1 + t.string :address2 + t.string :city + t.string :zipcode + t.string :phone + t.string :state_name + t.string :alternative_phone + t.string :company + t.references :state + t.references :country + t.timestamps + end + + add_index :spree_addresses, [:firstname], :name => 'index_addresses_on_firstname' + add_index :spree_addresses, [:lastname], :name => 'index_addresses_on_lastname' + + create_table :spree_adjustments do |t| + t.references :source, :polymorphic => true + t.references :adjustable, :polymorphic => true + t.references :originator, :polymorphic => true + t.decimal :amount, :precision => 8, :scale => 2 + t.string :label + t.boolean :mandatory + t.boolean :locked + t.boolean :eligible, :default => true + t.timestamps + end + + add_index :spree_adjustments, [:adjustable_id], :name => 'index_adjustments_on_order_id' + + create_table :spree_assets do |t| + t.references :viewable, :polymorphic => true + t.integer :attachment_width + t.integer :attachment_height + t.integer :attachment_file_size + t.integer :position + t.string :attachment_content_type + t.string :attachment_file_name + t.string :type, :limit => 75 + t.datetime :attachment_updated_at + t.text :alt + end + + add_index :spree_assets, [:viewable_id], :name => 'index_assets_on_viewable_id' + add_index :spree_assets, [:viewable_type, :type], :name => 'index_assets_on_viewable_type_and_type' + + create_table :spree_calculators do |t| + t.string :type + t.references :calculable, :polymorphic => true + t.timestamps + end + + create_table :spree_configurations do |t| + t.string :name + t.string :type, :limit => 50 + t.timestamps + end + + add_index :spree_configurations, [:name, :type], :name => 'index_spree_configurations_on_name_and_type' + + create_table :spree_countries do |t| + t.string :iso_name + t.string :iso + t.string :iso3 + t.string :name + t.integer :numcode + end + + create_table :spree_credit_cards do |t| + t.string :month + t.string :year + t.string :cc_type + t.string :last_digits + t.string :first_name + t.string :last_name + t.string :start_month + t.string :start_year + t.string :issue_number + t.references :address + t.string :gateway_customer_profile_id + t.string :gateway_payment_profile_id + t.timestamps + end + + create_table :spree_gateways do |t| + t.string :type + t.string :name + t.text :description + t.boolean :active, :default => true + t.string :environment, :default => 'development' + t.string :server, :default => 'test' + t.boolean :test_mode, :default => true + t.timestamps + end + + create_table :spree_inventory_units do |t| + t.integer :lock_version, :default => 0 + t.string :state + t.references :variant + t.references :order + t.references :shipment + t.references :return_authorization + t.timestamps + end + + add_index :spree_inventory_units, [:order_id], :name => 'index_inventory_units_on_order_id' + add_index :spree_inventory_units, [:shipment_id], :name => 'index_inventory_units_on_shipment_id' + add_index :spree_inventory_units, [:variant_id], :name => 'index_inventory_units_on_variant_id' + + create_table :spree_line_items do |t| + t.references :variant + t.references :order + t.integer :quantity, :null => false + t.decimal :price, :precision => 8, :scale => 2, :null => false + t.timestamps + end + + add_index :spree_line_items, [:order_id], :name => 'index_spree_line_items_on_order_id' + add_index :spree_line_items, [:variant_id], :name => 'index_spree_line_items_on_variant_id' + + create_table :spree_log_entries do |t| + t.references :source, :polymorphic => true + t.text :details + t.timestamps + end + + create_table :spree_mail_methods do |t| + t.string :environment + t.boolean :active, :default => true + t.timestamps + end + + create_table :spree_option_types do |t| + t.string :name, :limit => 100 + t.string :presentation, :limit => 100 + t.integer :position, :default => 0, :null => false + t.timestamps + end + + create_table :spree_option_types_prototypes, :id => false do |t| + t.references :prototype + t.references :option_type + end + + create_table :spree_option_values do |t| + t.integer :position + t.string :name + t.string :presentation + t.references :option_type + t.timestamps + end + + create_table :spree_option_values_variants, :id => false do |t| + t.references :variant + t.references :option_value + end + + add_index :spree_option_values_variants, [:variant_id, :option_value_id], :name => 'index_option_values_variants_on_variant_id_and_option_value_id' + add_index :spree_option_values_variants, [:variant_id], :name => 'index_spree_option_values_variants_on_variant_id' + + create_table :spree_orders do |t| + t.string :number, :limit => 15 + t.decimal :item_total, :precision => 8, :scale => 2, :default => 0.0, :null => false + t.decimal :total, :precision => 8, :scale => 2, :default => 0.0, :null => false + t.string :state + t.decimal :adjustment_total, :precision => 8, :scale => 2, :default => 0.0, :null => false + t.references :user + t.datetime :completed_at + t.references :bill_address + t.references :ship_address + t.decimal :payment_total, :precision => 8, :scale => 2, :default => 0.0 + t.references :shipping_method + t.string :shipment_state + t.string :payment_state + t.string :email + t.text :special_instructions + t.timestamps + end + + add_index :spree_orders, [:number], :name => 'index_spree_orders_on_number' + + create_table :spree_payment_methods do |t| + t.string :type + t.string :name + t.text :description + t.boolean :active, :default => true + t.string :environment, :default => 'development' + t.datetime :deleted_at + t.string :display_on + t.timestamps + end + + create_table :spree_payments do |t| + t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false + t.references :order + t.references :source, :polymorphic => true + t.references :payment_method + t.string :state + t.string :response_code + t.string :avs_response + t.timestamps + end + + create_table :spree_preferences do |t| + t.string :name, :limit => 100 + t.references :owner, :polymorphic => true + t.text :value + t.string :key + t.string :value_type + t.timestamps + end + + add_index :spree_preferences, [:key], :name => 'index_spree_preferences_on_key', :unique => true + + create_table :spree_product_option_types do |t| + t.integer :position + t.references :product + t.references :option_type + t.timestamps + end + + create_table :spree_product_properties do |t| + t.string :value + t.references :product + t.references :property + t.timestamps + end + + add_index :spree_product_properties, [:product_id], :name => 'index_product_properties_on_product_id' + + create_table :spree_products do |t| + t.string :name, :default => '', :null => false + t.text :description + t.datetime :available_on + t.datetime :deleted_at + t.string :permalink + t.string :meta_description + t.string :meta_keywords + t.references :tax_category + t.references :shipping_category + t.integer :count_on_hand, :default => 0, :null => false + t.timestamps + end + + add_index :spree_products, [:available_on], :name => 'index_spree_products_on_available_on' + add_index :spree_products, [:deleted_at], :name => 'index_spree_products_on_deleted_at' + add_index :spree_products, [:name], :name => 'index_spree_products_on_name' + add_index :spree_products, [:permalink], :name => 'index_spree_products_on_permalink' + + create_table :spree_products_taxons, :id => false do |t| + t.references :product + t.references :taxon + end + + add_index :spree_products_taxons, [:product_id], :name => 'index_spree_products_taxons_on_product_id' + add_index :spree_products_taxons, [:taxon_id], :name => 'index_spree_products_taxons_on_taxon_id' + + create_table :spree_properties do |t| + t.string :name + t.string :presentation, :null => false + t.timestamps + end + + create_table :spree_properties_prototypes, :id => false do |t| + t.references :prototype + t.references :property + end + + create_table :spree_prototypes do |t| + t.string :name + t.timestamps + end + + create_table :spree_return_authorizations do |t| + t.string :number + t.string :state + t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false + t.references :order + t.text :reason + t.timestamps + end + + create_table :spree_roles do |t| + t.string :name + end + + create_table :spree_roles_users, :id => false do |t| + t.references :role + t.references :user + end + + add_index :spree_roles_users, [:role_id], :name => 'index_spree_roles_users_on_role_id' + add_index :spree_roles_users, [:user_id], :name => 'index_spree_roles_users_on_user_id' + + create_table :spree_shipments do |t| + t.string :tracking + t.string :number + t.decimal :cost, :precision => 8, :scale => 2 + t.datetime :shipped_at + t.references :order + t.references :shipping_method + t.references :address + t.string :state + t.timestamps + end + + add_index :spree_shipments, [:number], :name => 'index_shipments_on_number' + + create_table :spree_shipping_categories do |t| + t.string :name + t.timestamps + end + + create_table :spree_shipping_methods do |t| + t.string :name + t.references :zone + t.string :display_on + t.references :shipping_category + t.boolean :match_none + t.boolean :match_all + t.boolean :match_one + t.datetime :deleted_at + t.timestamps + end + + create_table :spree_state_changes do |t| + t.string :name + t.string :previous_state + t.references :stateful + t.references :user + t.string :stateful_type + t.string :next_state + t.timestamps + end + + create_table :spree_states do |t| + t.string :name + t.string :abbr + t.references :country + end + + create_table :spree_tax_categories do |t| + t.string :name + t.string :description + t.boolean :is_default, :default => false + t.datetime :deleted_at + t.timestamps + end + + create_table :spree_tax_rates do |t| + t.decimal :amount, :precision => 8, :scale => 5 + t.references :zone + t.references :tax_category + t.boolean :included_in_price, :default => false + t.timestamps + end + + create_table :spree_taxonomies do |t| + t.string :name, :null => false + t.timestamps + end + + create_table :spree_taxons do |t| + t.references :parent + t.integer :position, :default => 0 + t.string :name, :null => false + t.string :permalink + t.references :taxonomy + t.integer :lft + t.integer :rgt + t.string :icon_file_name + t.string :icon_content_type + t.integer :icon_file_size + t.datetime :icon_updated_at + t.text :description + t.timestamps + end + + add_index :spree_taxons, [:parent_id], :name => 'index_taxons_on_parent_id' + add_index :spree_taxons, [:permalink], :name => 'index_taxons_on_permalink' + add_index :spree_taxons, [:taxonomy_id], :name => 'index_taxons_on_taxonomy_id' + + create_table :spree_tokenized_permissions, :force => true do |t| + t.references :permissable, :polymorphic => true + t.string :token + t.timestamps + end + + add_index :spree_tokenized_permissions, [:permissable_id, :permissable_type], :name => 'index_tokenized_name_and_type' + + create_table :spree_trackers do |t| + t.string :environment + t.string :analytics_id + t.boolean :active, :default => true + t.timestamps + end + + create_table :spree_users do |t| + t.string :encrypted_password, :limit => 128 + t.string :password_salt, :limit => 128 + t.string :email + t.string :remember_token + t.string :persistence_token + t.string :reset_password_token + t.string :perishable_token + t.integer :sign_in_count, :default => 0, :null => false + t.integer :failed_attempts, :default => 0, :null => false + t.datetime :last_request_at + t.datetime :current_sign_in_at + t.datetime :last_sign_in_at + t.string :current_sign_in_ip + t.string :last_sign_in_ip + t.string :login + t.references :ship_address + t.references :bill_address + t.string :authentication_token + t.string :unlock_token + t.datetime :locked_at + t.datetime :remember_created_at + t.datetime :reset_password_sent_at + t.timestamps + end + + create_table :spree_variants do |t| + t.string :sku, :default => '', :null => false + t.decimal :price, :precision => 8, :scale => 2, :null => false + t.decimal :weight, :precision => 8, :scale => 2 + t.decimal :height, :precision => 8, :scale => 2 + t.decimal :width, :precision => 8, :scale => 2 + t.decimal :depth, :precision => 8, :scale => 2 + t.datetime :deleted_at + t.boolean :is_master, :default => false + t.references :product + t.integer :count_on_hand, :default => 0, :null => false + t.decimal :cost_price, :precision => 8, :scale => 2 + t.integer :position + end + + add_index :spree_variants, [:product_id], :name => 'index_spree_variants_on_product_id' + + create_table :spree_zone_members do |t| + t.references :zoneable, :polymorphic => true + t.references :zone + t.timestamps + end + + create_table :spree_zones do |t| + t.string :name + t.string :description + t.boolean :default_tax, :default => false + t.integer :zone_members_count, :default => 0 + t.timestamps + end + end +end diff --git a/db/migrate/20130201024429_add_tax_rate_label.spree.rb b/db/migrate/20130201024429_add_tax_rate_label.spree.rb new file mode 100644 index 0000000000..c39a83c5ee --- /dev/null +++ b/db/migrate/20130201024429_add_tax_rate_label.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20120905145253) +class AddTaxRateLabel < ActiveRecord::Migration + def change + add_column :spree_tax_rates, :name, :string + end +end diff --git a/db/migrate/20130201024430_add_toggle_tax_rate_display.spree.rb b/db/migrate/20130201024430_add_toggle_tax_rate_display.spree.rb new file mode 100644 index 0000000000..83da18b4f4 --- /dev/null +++ b/db/migrate/20130201024430_add_toggle_tax_rate_display.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20120905151823) +class AddToggleTaxRateDisplay < ActiveRecord::Migration + def change + add_column :spree_tax_rates, :show_rate_in_label, :boolean, :default => true + end +end diff --git a/db/migrate/20130201024431_remove_unused_preference_columns.spree.rb b/db/migrate/20130201024431_remove_unused_preference_columns.spree.rb new file mode 100644 index 0000000000..6c049daa22 --- /dev/null +++ b/db/migrate/20130201024431_remove_unused_preference_columns.spree.rb @@ -0,0 +1,9 @@ +# This migration comes from spree (originally 20120929093553) +class RemoveUnusedPreferenceColumns < ActiveRecord::Migration + def change + # Columns have already been removed if the application was upgraded from an older version, but must be removed from new apps. + remove_column :spree_preferences, :name if ActiveRecord::Base.connection.column_exists?(:spree_preferences, :name) + remove_column :spree_preferences, :owner_id if ActiveRecord::Base.connection.column_exists?(:spree_preferences, :owner_id) + remove_column :spree_preferences, :owner_type if ActiveRecord::Base.connection.column_exists?(:spree_preferences, :owner_type) + end +end diff --git a/db/migrate/20130201024432_add_lock_version_to_variant.spree.rb b/db/migrate/20130201024432_add_lock_version_to_variant.spree.rb new file mode 100644 index 0000000000..0e8cc92328 --- /dev/null +++ b/db/migrate/20130201024432_add_lock_version_to_variant.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20121009142519) +class AddLockVersionToVariant < ActiveRecord::Migration + def change + add_column :spree_variants, :lock_version, :integer, :default => 0 + end +end diff --git a/db/migrate/20130201024433_add_states_required_to_countries.spree.rb b/db/migrate/20130201024433_add_states_required_to_countries.spree.rb new file mode 100644 index 0000000000..415001d170 --- /dev/null +++ b/db/migrate/20130201024433_add_states_required_to_countries.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20121010142909) +class AddStatesRequiredToCountries < ActiveRecord::Migration + def change + add_column :spree_countries, :states_required, :boolean,:default => true + end +end diff --git a/db/migrate/20130201024434_add_on_demand_to_product_and_variant.spree.rb b/db/migrate/20130201024434_add_on_demand_to_product_and_variant.spree.rb new file mode 100644 index 0000000000..ba258ebf26 --- /dev/null +++ b/db/migrate/20130201024434_add_on_demand_to_product_and_variant.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20121012071449) +class AddOnDemandToProductAndVariant < ActiveRecord::Migration + def change + add_column :spree_products, :on_demand, :boolean, :default => false + add_column :spree_variants, :on_demand, :boolean, :default => false + end +end diff --git a/db/migrate/20130201024435_remove_not_null_constraint_from_products_on_hand.spree.rb b/db/migrate/20130201024435_remove_not_null_constraint_from_products_on_hand.spree.rb new file mode 100644 index 0000000000..acbebfc6cb --- /dev/null +++ b/db/migrate/20130201024435_remove_not_null_constraint_from_products_on_hand.spree.rb @@ -0,0 +1,12 @@ +# This migration comes from spree (originally 20121017010007) +class RemoveNotNullConstraintFromProductsOnHand < ActiveRecord::Migration + def up + change_column :spree_products, :count_on_hand, :integer, :null => true + change_column :spree_variants, :count_on_hand, :integer, :null => true + end + + def down + change_column :spree_products, :count_on_hand, :integer, :null => false + change_column :spree_variants, :count_on_hand, :integer, :null => false + end +end diff --git a/db/migrate/20130201024436_split_prices_from_variants.spree.rb b/db/migrate/20130201024436_split_prices_from_variants.spree.rb new file mode 100644 index 0000000000..976141f531 --- /dev/null +++ b/db/migrate/20130201024436_split_prices_from_variants.spree.rb @@ -0,0 +1,32 @@ +# This migration comes from spree (originally 20121031162139) +class SplitPricesFromVariants < ActiveRecord::Migration + def up + create_table :spree_prices do |t| + t.integer :variant_id, :null => false + t.decimal :amount, :precision => 8, :scale => 2, :null => false + t.string :currency + end + + Spree::Variant.all.each do |variant| + Spree::Price.create!( + :variant_id => variant.id, + :amount => variant.price, + :currency => Spree::Config[:currency] + ) + end + + remove_column :spree_variants, :price + end + + def down + prices = ActiveRecord::Base.connection.execute("select variant_id, amount from spree_prices") + add_column :spree_variants, :price, :decimal, :after => :sku, :scale => 2, :precision => 8 + + prices.each do |price| + ActiveRecord::Base.connection.execute("update spree_variants set price = #{price['amount']} where id = #{price['variant_id']}") + end + + change_column :spree_variants, :price, :decimal, :after => :sku, :scale => 2, :precision => 8, :null => false + drop_table :spree_prices + end +end diff --git a/db/migrate/20130201024437_remove_not_null_from_spree_prices_amount.spree.rb b/db/migrate/20130201024437_remove_not_null_from_spree_prices_amount.spree.rb new file mode 100644 index 0000000000..beb5f7a85f --- /dev/null +++ b/db/migrate/20130201024437_remove_not_null_from_spree_prices_amount.spree.rb @@ -0,0 +1,10 @@ +# This migration comes from spree (originally 20121107003422) +class RemoveNotNullFromSpreePricesAmount < ActiveRecord::Migration + def up + change_column :spree_prices, :amount, :decimal, :precision => 8, :scale => 2, :null => true + end + + def down + change_column :spree_prices, :amount, :decimal, :precision => 8, :scale => 2, :null => false + end +end diff --git a/db/migrate/20130201024438_add_currency_to_line_items.spree.rb b/db/migrate/20130201024438_add_currency_to_line_items.spree.rb new file mode 100644 index 0000000000..b0732ee630 --- /dev/null +++ b/db/migrate/20130201024438_add_currency_to_line_items.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20121107184631) +class AddCurrencyToLineItems < ActiveRecord::Migration + def change + add_column :spree_line_items, :currency, :string + end +end diff --git a/db/migrate/20130201024439_add_currency_to_orders.spree.rb b/db/migrate/20130201024439_add_currency_to_orders.spree.rb new file mode 100644 index 0000000000..d84bc3b7cc --- /dev/null +++ b/db/migrate/20130201024439_add_currency_to_orders.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20121107194006) +class AddCurrencyToOrders < ActiveRecord::Migration + def change + add_column :spree_orders, :currency, :string + end +end diff --git a/db/migrate/20130201024440_add_cost_currency_to_variants.spree.rb b/db/migrate/20130201024440_add_cost_currency_to_variants.spree.rb new file mode 100644 index 0000000000..a31b96499d --- /dev/null +++ b/db/migrate/20130201024440_add_cost_currency_to_variants.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20121109173623) +class AddCostCurrencyToVariants < ActiveRecord::Migration + def change + add_column :spree_variants, :cost_currency, :string, :after => :cost_price + end +end diff --git a/db/migrate/20130201024441_remove_display_on_from_payment_methods.spree.rb b/db/migrate/20130201024441_remove_display_on_from_payment_methods.spree.rb new file mode 100644 index 0000000000..c45e413c1a --- /dev/null +++ b/db/migrate/20130201024441_remove_display_on_from_payment_methods.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20121111231553) +class RemoveDisplayOnFromPaymentMethods < ActiveRecord::Migration + def up + remove_column :spree_payment_methods, :display_on + end +end diff --git a/db/migrate/20130201024442_add_position_to_taxonomies.spree.rb b/db/migrate/20130201024442_add_position_to_taxonomies.spree.rb new file mode 100644 index 0000000000..177870b42a --- /dev/null +++ b/db/migrate/20130201024442_add_position_to_taxonomies.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20121124203911) +class AddPositionToTaxonomies < ActiveRecord::Migration + def change + add_column :spree_taxonomies, :position, :integer, :default => 0 + end +end diff --git a/db/migrate/20130201024443_add_last_ip_to_spree_orders.spree.rb b/db/migrate/20130201024443_add_last_ip_to_spree_orders.spree.rb new file mode 100644 index 0000000000..e85fc41ffe --- /dev/null +++ b/db/migrate/20130201024443_add_last_ip_to_spree_orders.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20121126040517) +class AddLastIpToSpreeOrders < ActiveRecord::Migration + def change + add_column :spree_orders, :last_ip_address, :string + end +end diff --git a/db/migrate/20130201024444_add_display_on_to_spree_payment_methods.spree.rb b/db/migrate/20130201024444_add_display_on_to_spree_payment_methods.spree.rb new file mode 100644 index 0000000000..240870bbb6 --- /dev/null +++ b/db/migrate/20130201024444_add_display_on_to_spree_payment_methods.spree.rb @@ -0,0 +1,10 @@ +# This migration comes from spree (originally 20130114053446) +class AddDisplayOnToSpreePaymentMethods < ActiveRecord::Migration + def self.up + add_column :spree_payment_methods, :display_on, :string + end + + def self.down + remove_column :spree_payment_methods, :display_on + end +end diff --git a/db/migrate/20130201024446_rename_api_key_to_spree_api_key.spree_api.rb b/db/migrate/20130201024446_rename_api_key_to_spree_api_key.spree_api.rb new file mode 100644 index 0000000000..7fd09d3b11 --- /dev/null +++ b/db/migrate/20130201024446_rename_api_key_to_spree_api_key.spree_api.rb @@ -0,0 +1,8 @@ +# This migration comes from spree_api (originally 20120530054546) +class RenameApiKeyToSpreeApiKey < ActiveRecord::Migration + def change + unless defined?(User) + rename_column :spree_users, :api_key, :spree_api_key + end + end +end diff --git a/db/migrate/20130201024447_spree_promo_one_two.spree_promo.rb b/db/migrate/20130201024447_spree_promo_one_two.spree_promo.rb new file mode 100644 index 0000000000..7e808c800b --- /dev/null +++ b/db/migrate/20130201024447_spree_promo_one_two.spree_promo.rb @@ -0,0 +1,46 @@ +# This migration comes from spree_promo (originally 20120831092359) +class SpreePromoOneTwo < ActiveRecord::Migration + def up + # This migration is just a compressed migration for all previous versions of spree_promo + return if table_exists?(:spree_products_promotion_rules) + + create_table :spree_products_promotion_rules, :id => false, :force => true do |t| + t.references :product + t.references :promotion_rule + end + + add_index :spree_products_promotion_rules, [:product_id], :name => 'index_products_promotion_rules_on_product_id' + add_index :spree_products_promotion_rules, [:promotion_rule_id], :name => 'index_products_promotion_rules_on_promotion_rule_id' + + create_table :spree_promotion_action_line_items, :force => true do |t| + t.references :promotion_action + t.references :variant + t.integer :quantity, :default => 1 + end + + create_table :spree_promotion_actions, :force => true do |t| + t.references :activator + t.integer :position + t.string :type + end + + create_table :spree_promotion_rules, :force => true do |t| + t.references :activator + t.references :user + t.references :product_group + t.string :type + t.timestamps + end + + add_index :spree_promotion_rules, [:product_group_id], :name => 'index_promotion_rules_on_product_group_id' + add_index :spree_promotion_rules, [:user_id], :name => 'index_promotion_rules_on_user_id' + + create_table :spree_promotion_rules_users, :id => false, :force => true do |t| + t.references :user + t.references :promotion_rule + end + + add_index :spree_promotion_rules_users, [:promotion_rule_id], :name => 'index_promotion_rules_users_on_promotion_rule_id' + add_index :spree_promotion_rules_users, [:user_id], :name => 'index_promotion_rules_users_on_user_id' + end +end diff --git a/db/migrate/20130201220400_add_api_key_to_spree_users.spree_api.rb b/db/migrate/20130201220400_add_api_key_to_spree_users.spree_api.rb new file mode 100644 index 0000000000..b9e3fe3884 --- /dev/null +++ b/db/migrate/20130201220400_add_api_key_to_spree_users.spree_api.rb @@ -0,0 +1,8 @@ +# This migration comes from spree_api (originally 20100107141738) +class AddApiKeyToSpreeUsers < ActiveRecord::Migration + def change + unless defined?(User) + add_column :spree_users, :api_key, :string, :limit => 40 + end + end +end diff --git a/db/migrate/20130201220401_create_users.spree_auth.rb b/db/migrate/20130201220401_create_users.spree_auth.rb new file mode 100644 index 0000000000..a4e8e602d2 --- /dev/null +++ b/db/migrate/20130201220401_create_users.spree_auth.rb @@ -0,0 +1,30 @@ +# This migration comes from spree_auth (originally 20101026184949) +class CreateUsers < ActiveRecord::Migration + def up + unless table_exists?("spree_users") + create_table "spree_users", :force => true do |t| + t.string "crypted_password", :limit => 128 + t.string "salt", :limit => 128 + t.string "email" + t.string "remember_token" + t.string "remember_token_expires_at" + t.string "persistence_token" + t.string "single_access_token" + t.string "perishable_token" + t.integer "login_count", :default => 0, :null => false + t.integer "failed_login_count", :default => 0, :null => false + t.datetime "last_request_at" + t.datetime "current_login_at" + t.datetime "last_login_at" + t.string "current_login_ip" + t.string "last_login_ip" + t.string "login" + t.integer "ship_address_id" + t.integer "bill_address_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "openid_identifier" + end + end + end +end diff --git a/db/schema.rb b/db/schema.rb index a03ce1b6eb..51e67a05b3 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 => 20130118031610) do +ActiveRecord::Schema.define(:version => 20130201220401) do create_table "cms_blocks", :force => true do |t| t.integer "page_id", :null => false @@ -296,6 +296,7 @@ ActiveRecord::Schema.define(:version => 20130118031610) do t.string "iso3" t.string "name" t.integer "numcode" + t.boolean "states_required", :default => true end create_table "spree_creditcards", :force => true do |t| @@ -351,6 +352,7 @@ ActiveRecord::Schema.define(:version => 20130118031610) do t.datetime "updated_at", :null => false t.integer "max_quantity" t.integer "shipping_method_id" + t.string "currency" end add_index "spree_line_items", ["order_id"], :name => "index_line_items_on_order_id" @@ -421,6 +423,8 @@ ActiveRecord::Schema.define(:version => 20130118031610) do t.string "email" t.text "special_instructions" t.integer "distributor_id" + t.string "currency" + t.string "last_ip_address" end add_index "spree_orders", ["number"], :name => "index_orders_on_number" @@ -466,9 +470,6 @@ ActiveRecord::Schema.define(:version => 20130118031610) do add_index "spree_pending_promotions", ["user_id"], :name => "index_spree_pending_promotions_on_user_id" create_table "spree_preferences", :force => true do |t| - t.string "name" - t.integer "owner_id" - t.string "owner_type" t.text "value" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false @@ -478,6 +479,12 @@ ActiveRecord::Schema.define(:version => 20130118031610) do add_index "spree_preferences", ["key"], :name => "index_spree_preferences_on_key", :unique => true + create_table "spree_prices", :force => true do |t| + t.integer "variant_id", :null => false + t.decimal "amount", :precision => 8, :scale => 2 + t.string "currency" + end + create_table "spree_product_groups", :force => true do |t| t.string "name" t.string "permalink" @@ -520,7 +527,7 @@ ActiveRecord::Schema.define(:version => 20130118031610) do add_index "spree_product_scopes", ["product_group_id"], :name => "index_product_scopes_on_product_group_id" create_table "spree_products", :force => true do |t| - t.string "name", :default => "", :null => false + t.string "name", :default => "", :null => false t.text "description" t.datetime "available_on" t.datetime "deleted_at" @@ -529,12 +536,13 @@ ActiveRecord::Schema.define(:version => 20130118031610) do t.string "meta_keywords" t.integer "tax_category_id" t.integer "shipping_category_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "count_on_hand", :default => 0, :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "count_on_hand", :default => 0 t.integer "supplier_id" t.boolean "group_buy" t.float "group_buy_unit_size" + t.boolean "on_demand", :default => false end add_index "spree_products", ["available_on"], :name => "index_products_on_available_on" @@ -702,18 +710,21 @@ ActiveRecord::Schema.define(:version => 20130118031610) do end create_table "spree_tax_rates", :force => true do |t| - t.decimal "amount", :precision => 8, :scale => 5 + t.decimal "amount", :precision => 8, :scale => 5 t.integer "zone_id" t.integer "tax_category_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "included_in_price", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "included_in_price", :default => false + t.string "name" + t.boolean "show_rate_in_label", :default => true end create_table "spree_taxonomies", :force => true do |t| - t.string "name", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.string "name", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "position", :default => 0 end create_table "spree_taxons", :force => true do |t| @@ -779,8 +790,9 @@ ActiveRecord::Schema.define(:version => 20130118031610) do t.string "unlock_token" t.datetime "locked_at" t.datetime "remember_created_at" - t.string "api_key", :limit => 48 + t.string "spree_api_key", :limit => 48 t.datetime "reset_password_sent_at" + t.string "api_key", :limit => 40 end add_index "spree_users", ["email"], :name => "email_idx_unique", :unique => true @@ -788,7 +800,6 @@ ActiveRecord::Schema.define(:version => 20130118031610) do create_table "spree_variants", :force => true do |t| t.string "sku", :default => "", :null => false - t.decimal "price", :precision => 8, :scale => 2, :null => false t.decimal "weight", :precision => 8, :scale => 2 t.decimal "height", :precision => 8, :scale => 2 t.decimal "width", :precision => 8, :scale => 2 @@ -796,9 +807,12 @@ ActiveRecord::Schema.define(:version => 20130118031610) do t.datetime "deleted_at" t.boolean "is_master", :default => false t.integer "product_id" - t.integer "count_on_hand", :default => 0, :null => false + t.integer "count_on_hand", :default => 0 t.decimal "cost_price", :precision => 8, :scale => 2 t.integer "position" + t.integer "lock_version", :default => 0 + t.boolean "on_demand", :default => false + t.string "cost_currency" end add_index "spree_variants", ["product_id"], :name => "index_variants_on_product_id" From 4b254a552910d115d10570e2f98034762551de60 Mon Sep 17 00:00:00 2001 From: Rob H Date: Wed, 6 Feb 2013 11:25:26 +1100 Subject: [PATCH 03/25] WIP: revise overrides following upgrade to Spree 1.3, update ':original' definitions and reconcile filename and :name --- app/overrides/add_cms_admin_tab.rb | 5 +++-- app/overrides/add_cms_checkout_distribution.rb | 3 ++- app/overrides/add_cms_to_cart.rb | 3 ++- app/overrides/add_distributor_details_js_to_product.rb | 5 +++++ app/overrides/add_distributor_details_to_product.rb | 8 ++------ app/overrides/add_distributor_fees_to_cart_form.rb | 5 +++-- app/overrides/add_distributor_to_add_to_cart_form.rb | 3 ++- app/overrides/add_distributor_to_admin_product.rb | 8 ++------ app/overrides/add_distributor_to_admin_product_new.rb | 5 +++++ .../add_enterprise_fees_to_admin_configurations_menu.rb | 9 +++++---- app/overrides/add_enterprises_admin_tab.rb | 5 +++++ app/overrides/add_feedback_script.rb | 2 +- app/overrides/add_order_cycles_admin_tab.rb | 5 +++-- app/overrides/enterprises_admin_tab.rb | 4 ---- .../enterprise_fees/_admin_configurations_menu.html.haml | 4 +--- 15 files changed, 41 insertions(+), 33 deletions(-) create mode 100644 app/overrides/add_distributor_details_js_to_product.rb create mode 100644 app/overrides/add_distributor_to_admin_product_new.rb create mode 100644 app/overrides/add_enterprises_admin_tab.rb delete mode 100644 app/overrides/enterprises_admin_tab.rb diff --git a/app/overrides/add_cms_admin_tab.rb b/app/overrides/add_cms_admin_tab.rb index f2bb052bbb..44ee153018 100644 --- a/app/overrides/add_cms_admin_tab.rb +++ b/app/overrides/add_cms_admin_tab.rb @@ -1,4 +1,5 @@ Deface::Override.new(:virtual_path => "spree/layouts/admin", - :name => "cms_admin_tab", + :name => "add_cms_admin_tab", :insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]", - :text => "
  • <%= link_to('CMS Admin', main_app.cms_admin_path) %>
  • ") + :text => "<%= tab 'CMS Admin', :url => main_app.cms_admin_path %>", + :original => '6999548b86c700f2cc5d4f9d297c94b3617fd981') \ No newline at end of file diff --git a/app/overrides/add_cms_checkout_distribution.rb b/app/overrides/add_cms_checkout_distribution.rb index e1c1d5b7b5..bd4c3afbaa 100644 --- a/app/overrides/add_cms_checkout_distribution.rb +++ b/app/overrides/add_cms_checkout_distribution.rb @@ -1,4 +1,5 @@ Deface::Override.new(:virtual_path => "spree/checkout/_delivery", :insert_before => "fieldset#shipping_method", :text => "<%= cms_snippet_content(Cms::Snippet.find_by_identifier('distribution')) %>", - :name => "cms_checkout_distribution") \ No newline at end of file + :name => "add_cms_checkout_distribution", + :original => '3b417788fb9a63f464fdaeb8202f483f20518f80') \ No newline at end of file diff --git a/app/overrides/add_cms_to_cart.rb b/app/overrides/add_cms_to_cart.rb index 9be4e4a65d..3ff7341a33 100644 --- a/app/overrides/add_cms_to_cart.rb +++ b/app/overrides/add_cms_to_cart.rb @@ -1,4 +1,5 @@ Deface::Override.new(:virtual_path => "spree/orders/edit", :insert_after => "h1", :text => "<%= cms_snippet_content(Cms::Snippet.find_by_identifier('cart')) %>", - :name => "cms_to_cart") \ No newline at end of file + :name => "add_cms_to_cart", + :original => '206a92e6f50966b057e877321b573bc293787894') \ No newline at end of file diff --git a/app/overrides/add_distributor_details_js_to_product.rb b/app/overrides/add_distributor_details_js_to_product.rb new file mode 100644 index 0000000000..7ef0dc0c3a --- /dev/null +++ b/app/overrides/add_distributor_details_js_to_product.rb @@ -0,0 +1,5 @@ +Deface::Override.new(:virtual_path => "spree/products/show", + :insert_after => "[data-hook='product_show']", + :text => "<%= javascript_include_tag main_app.distributors_enterprises_path(:format => :js) %>", + :name => "add_distributor_details_js_to_product", + :original => 'b05ac497efeeebd4464f29891fd2c4a0f60c24d9') \ No newline at end of file diff --git a/app/overrides/add_distributor_details_to_product.rb b/app/overrides/add_distributor_details_to_product.rb index d841c82ee3..dbe657bf96 100644 --- a/app/overrides/add_distributor_details_to_product.rb +++ b/app/overrides/add_distributor_details_to_product.rb @@ -1,9 +1,5 @@ Deface::Override.new(:virtual_path => "spree/products/show", :insert_before => "[data-hook='cart_form']", :partial => "spree/products/distributor_details", - :name => "product_distributor_details") - -Deface::Override.new(:virtual_path => "spree/products/show", - :insert_after => "[data-hook='product_show']", - :text => "<%= javascript_include_tag main_app.distributors_enterprises_path(:format => :js) %>", - :name => "product_distributor_details_js") + :name => "add_distributor_details_to_product", + :original => '789e3f5f6f36a8cd4115d7342752a37735659298') diff --git a/app/overrides/add_distributor_fees_to_cart_form.rb b/app/overrides/add_distributor_fees_to_cart_form.rb index 03ac901161..883f4622ed 100644 --- a/app/overrides/add_distributor_fees_to_cart_form.rb +++ b/app/overrides/add_distributor_fees_to_cart_form.rb @@ -1,4 +1,5 @@ Deface::Override.new(:virtual_path => "spree/orders/edit", - :insert_after => "#empty-cart", + :insert_after => "#empty-cart", :partial => "spree/orders/distributor_fees", - :name => "cart_distributor_fees") + :name => "add_distributor_fees_to_cart_form", + :original => 'b5a751777e66ccbd45d7f1b980ecd201af94cb5b') diff --git a/app/overrides/add_distributor_to_add_to_cart_form.rb b/app/overrides/add_distributor_to_add_to_cart_form.rb index 0b0bd07ac6..ad47700473 100644 --- a/app/overrides/add_distributor_to_add_to_cart_form.rb +++ b/app/overrides/add_distributor_to_add_to_cart_form.rb @@ -1,4 +1,5 @@ Deface::Override.new(:virtual_path => "spree/products/_cart_form", :replace => "[data-hook='product_price'] .add-to-cart", :partial => "spree/products/add_to_cart", - :name => "product_add_to_cart") + :name => "add_distributor_to_add_to_cart_form", + :original => '294014222132c795048fc6c7866971a332672c87') diff --git a/app/overrides/add_distributor_to_admin_product.rb b/app/overrides/add_distributor_to_admin_product.rb index 649f21f386..de56bb11b6 100644 --- a/app/overrides/add_distributor_to_admin_product.rb +++ b/app/overrides/add_distributor_to_admin_product.rb @@ -1,9 +1,5 @@ Deface::Override.new(:virtual_path => "spree/admin/products/_form", :insert_bottom => "[data-hook='admin_product_form_additional_fields']", :partial => "spree/admin/products/distributors_form", - :name => "distributors") - -Deface::Override.new(:virtual_path => "spree/admin/products/new", - :insert_after => "[data-hook='new_product_attrs']", - :partial => "spree/admin/products/distributors_form", - :name => "distributors") + :name => "add_distributor_to_admin_product_edit", + :original => '5a6c66358efbce3e73eb60a168ac4914a6bcc27f') diff --git a/app/overrides/add_distributor_to_admin_product_new.rb b/app/overrides/add_distributor_to_admin_product_new.rb new file mode 100644 index 0000000000..d5a16476f8 --- /dev/null +++ b/app/overrides/add_distributor_to_admin_product_new.rb @@ -0,0 +1,5 @@ +Deface::Override.new(:virtual_path => "spree/admin/products/new", + :insert_after => "[data-hook='new_product_attrs']", + :partial => "spree/admin/products/distributors_form", + :name => "add_distributor_to_admin_product_new", + :original => '59b7ed369769267bdedb596768fcfcc2cb94f122') \ No newline at end of file diff --git a/app/overrides/add_enterprise_fees_to_admin_configurations_menu.rb b/app/overrides/add_enterprise_fees_to_admin_configurations_menu.rb index a363758646..bb658c9a56 100644 --- a/app/overrides/add_enterprise_fees_to_admin_configurations_menu.rb +++ b/app/overrides/add_enterprise_fees_to_admin_configurations_menu.rb @@ -1,4 +1,5 @@ -Deface::Override.new(:virtual_path => "spree/admin/configurations/index", - :name => "add_enterprise_fees_to_admin_configurations_menu", - :insert_bottom => "[data-hook='admin_configurations_menu']", - :partial => 'enterprise_fees/admin_configurations_menu') +Deface::Override.new(:virtual_path => "spree/admin/shared/_configuration_menu", + :name => "add_enterprise_fees_to_admin_configurations_menu", + :insert_bottom => "[data-hook='admin_configurations_sidebar_menu']", + :partial => 'enterprise_fees/admin_configurations_menu', + :original => '29e0ab9c171ffab1988cb439b5d42300b78fe088') diff --git a/app/overrides/add_enterprises_admin_tab.rb b/app/overrides/add_enterprises_admin_tab.rb new file mode 100644 index 0000000000..41bf4c1ba6 --- /dev/null +++ b/app/overrides/add_enterprises_admin_tab.rb @@ -0,0 +1,5 @@ +Deface::Override.new(:virtual_path => "spree/layouts/admin", + :name => "add_enterprises_admin_tab", + :insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]", + :text => "<%= tab :enterprises, :url => main_app.admin_enterprises_path %>", + :original => '82e51ad38c8538eca88b683d6d874d8fdb5b5032') \ No newline at end of file diff --git a/app/overrides/add_feedback_script.rb b/app/overrides/add_feedback_script.rb index 5edf2d66fe..28933c7457 100644 --- a/app/overrides/add_feedback_script.rb +++ b/app/overrides/add_feedback_script.rb @@ -1,4 +1,4 @@ Deface::Override.new(:virtual_path => "spree/layouts/spree_application", :insert_bottom => "[data-hook='inside_head']", :partial => "layouts/feedback_script", - :name => "feedback_script") \ No newline at end of file + :name => "add_feedback_script") \ No newline at end of file diff --git a/app/overrides/add_order_cycles_admin_tab.rb b/app/overrides/add_order_cycles_admin_tab.rb index 1d0dd9b3a8..c7b860c366 100644 --- a/app/overrides/add_order_cycles_admin_tab.rb +++ b/app/overrides/add_order_cycles_admin_tab.rb @@ -1,4 +1,5 @@ Deface::Override.new(:virtual_path => "spree/layouts/admin", - :name => "cms_order_cycles_tab", + :name => "add_order_cycles_admin_tab", :insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]", - :text => "
  • <%= link_to('Order Cycles', main_app.admin_order_cycles_path) %>
  • ") + :text => "<%= tab 'Order Cycles', :url => main_app.admin_order_cycles_path %>", + :original => '3ff44d141dd4998561d0ff79b9df3b185207e325') \ No newline at end of file diff --git a/app/overrides/enterprises_admin_tab.rb b/app/overrides/enterprises_admin_tab.rb deleted file mode 100644 index 254f9d7d25..0000000000 --- a/app/overrides/enterprises_admin_tab.rb +++ /dev/null @@ -1,4 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/layouts/admin", - :name => "enterprises_admin_tabs", - :insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]", - :text => "<%= tab(:enterprises, :url => main_app.admin_enterprises_path) %>") diff --git a/app/views/enterprise_fees/_admin_configurations_menu.html.haml b/app/views/enterprise_fees/_admin_configurations_menu.html.haml index 13045a0fb2..5792f47e3a 100644 --- a/app/views/enterprise_fees/_admin_configurations_menu.html.haml +++ b/app/views/enterprise_fees/_admin_configurations_menu.html.haml @@ -1,3 +1 @@ -%tr - %td= link_to "Enterprise Fees", main_app.admin_enterprise_fees_path - %td Create and manage fees charged by enterprises on order cycles +%li= link_to "Enterprise Fees", main_app.admin_enterprise_fees_path From 3507c5414de901ea0985998f9e599904a2f6d60e Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 7 Feb 2013 09:25:29 +1100 Subject: [PATCH 04/25] Changed Sass variable: back to our green colour following upgrade --- app/assets/stylesheets/store/openfoodweb.css.scss | 2 +- app/assets/stylesheets/store/variables.css.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/store/openfoodweb.css.scss b/app/assets/stylesheets/store/openfoodweb.css.scss index 3e91985fe9..bf08508f82 100644 --- a/app/assets/stylesheets/store/openfoodweb.css.scss +++ b/app/assets/stylesheets/store/openfoodweb.css.scss @@ -1,4 +1,4 @@ -@import "screen"; +@import 'screen'; a:hover { color: lighten($link_text_color, 20) !important; diff --git a/app/assets/stylesheets/store/variables.css.scss b/app/assets/stylesheets/store/variables.css.scss index 2d0000d74f..4eab8c3ce2 100644 --- a/app/assets/stylesheets/store/variables.css.scss +++ b/app/assets/stylesheets/store/variables.css.scss @@ -7,7 +7,7 @@ $c_red: #e45353 !default; /* Error red */ $layout_background_color: #FFFFFF !default; $title_text_color: #404042 !default; $body_text_color: #404042 !default; -$link_text_color: #00ADEE !default; +$link_text_color: #006066 !default; $product_background_color: #FFFFFF !default; $product_title_text_color: #404042 !default; From 99b4530db27612d8bc184a2dc530d90de42a112a Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 7 Feb 2013 13:07:14 +1100 Subject: [PATCH 05/25] WIP: revise overrides following upgrade to Spree 1.3, update ':original' definitions and reconcile filename and :name --- app/overrides/add_cms_admin_tab.rb | 11 +++++----- ... add_distributor_to_admin_product_edit.rb} | 0 ...prise_fees_to_admin_configurations_menu.rb | 3 ++- app/overrides/add_enterprises_admin_tab.rb | 2 +- .../add_group_buy_to_admin_product.rb | 9 --------- .../add_group_buy_to_admin_product_edit.rb | 5 +++++ app/overrides/add_order_cycles_admin_tab.rb | 8 ++++---- app/overrides/add_source_to_product.rb | 3 ++- ...lier_and_group_buy_to_admin_product_new.rb | 5 +++++ .../add_supplier_to_admin_product.rb | 8 ++------ app/overrides/cart_item_description.rb | 3 ++- ...play_payment_information_after_purchase.rb | 4 ---- .../_admin_configurations_menu.html.haml | 1 - .../products/_distributors_form.html.haml | 2 +- .../admin/products/_group_buy_form.html.haml | 12 ++++++----- .../_supplier_and_group_buy_for_new.html.haml | 20 +++++++++++++++++++ .../admin/products/_supplier_form.html.haml | 2 +- .../_order_details_payment_info.html.haml | 2 -- .../shared/_order_details_steps_data.html.erb | 10 +++++----- 19 files changed, 63 insertions(+), 47 deletions(-) rename app/overrides/{add_distributor_to_admin_product.rb => add_distributor_to_admin_product_edit.rb} (100%) delete mode 100644 app/overrides/add_group_buy_to_admin_product.rb create mode 100644 app/overrides/add_group_buy_to_admin_product_edit.rb create mode 100644 app/overrides/add_supplier_and_group_buy_to_admin_product_new.rb delete mode 100644 app/overrides/display_payment_information_after_purchase.rb delete mode 100644 app/views/enterprise_fees/_admin_configurations_menu.html.haml create mode 100644 app/views/spree/admin/products/_supplier_and_group_buy_for_new.html.haml delete mode 100644 app/views/spree/shared/_order_details_payment_info.html.haml diff --git a/app/overrides/add_cms_admin_tab.rb b/app/overrides/add_cms_admin_tab.rb index 44ee153018..f0ed5691fd 100644 --- a/app/overrides/add_cms_admin_tab.rb +++ b/app/overrides/add_cms_admin_tab.rb @@ -1,5 +1,6 @@ -Deface::Override.new(:virtual_path => "spree/layouts/admin", - :name => "add_cms_admin_tab", - :insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]", - :text => "<%= tab 'CMS Admin', :url => main_app.cms_admin_path %>", - :original => '6999548b86c700f2cc5d4f9d297c94b3617fd981') \ No newline at end of file +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 %>
  • ", + :partial => 'enterprise_fees/admin_configurations_menu', + :original => '29e0ab9c171ffab1988cb439b5d42300b78fe088' ) diff --git a/app/overrides/add_distributor_to_admin_product.rb b/app/overrides/add_distributor_to_admin_product_edit.rb similarity index 100% rename from app/overrides/add_distributor_to_admin_product.rb rename to app/overrides/add_distributor_to_admin_product_edit.rb diff --git a/app/overrides/add_enterprise_fees_to_admin_configurations_menu.rb b/app/overrides/add_enterprise_fees_to_admin_configurations_menu.rb index bb658c9a56..b83ec644bf 100644 --- a/app/overrides/add_enterprise_fees_to_admin_configurations_menu.rb +++ b/app/overrides/add_enterprise_fees_to_admin_configurations_menu.rb @@ -1,5 +1,6 @@ Deface::Override.new(:virtual_path => "spree/admin/shared/_configuration_menu", :name => "add_enterprise_fees_to_admin_configurations_menu", :insert_bottom => "[data-hook='admin_configurations_sidebar_menu']", + :text => "
  • <%= link_to 'Enterprise Fees', main_app.admin_enterprise_fees_path %>
  • ", :partial => 'enterprise_fees/admin_configurations_menu', - :original => '29e0ab9c171ffab1988cb439b5d42300b78fe088') + :original => '8445a03cc903cacc832f395757ffcfaa7e99ca92') diff --git a/app/overrides/add_enterprises_admin_tab.rb b/app/overrides/add_enterprises_admin_tab.rb index 41bf4c1ba6..9fbb00f5f3 100644 --- a/app/overrides/add_enterprises_admin_tab.rb +++ b/app/overrides/add_enterprises_admin_tab.rb @@ -2,4 +2,4 @@ Deface::Override.new(:virtual_path => "spree/layouts/admin", :name => "add_enterprises_admin_tab", :insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]", :text => "<%= tab :enterprises, :url => main_app.admin_enterprises_path %>", - :original => '82e51ad38c8538eca88b683d6d874d8fdb5b5032') \ No newline at end of file + :original => '6999548b86c700f2cc5d4f9d297c94b3617fd981') \ No newline at end of file diff --git a/app/overrides/add_group_buy_to_admin_product.rb b/app/overrides/add_group_buy_to_admin_product.rb deleted file mode 100644 index ee4e94885d..0000000000 --- a/app/overrides/add_group_buy_to_admin_product.rb +++ /dev/null @@ -1,9 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/admin/products/_form", - :insert_top => "[data-hook='admin_product_form_right']", - :partial => "spree/admin/products/group_buy_form", - :name => "group buy") - -Deface::Override.new(:virtual_path => "spree/admin/products/new", - :insert_bottom => ".right", - :partial => "spree/admin/products/group_buy_form", - :name => "group buy") diff --git a/app/overrides/add_group_buy_to_admin_product_edit.rb b/app/overrides/add_group_buy_to_admin_product_edit.rb new file mode 100644 index 0000000000..773febdb0c --- /dev/null +++ b/app/overrides/add_group_buy_to_admin_product_edit.rb @@ -0,0 +1,5 @@ +Deface::Override.new(:virtual_path => "spree/admin/products/_form", + :insert_top => "[data-hook='admin_product_form_right']", + :partial => "spree/admin/products/group_buy_form", + :name => "add_group_buy_to_admin_product_edit", + :original => '0c0e8d714989e48ee246a8253fb2b362f108621a') \ No newline at end of file diff --git a/app/overrides/add_order_cycles_admin_tab.rb b/app/overrides/add_order_cycles_admin_tab.rb index c7b860c366..bab6566fe8 100644 --- a/app/overrides/add_order_cycles_admin_tab.rb +++ b/app/overrides/add_order_cycles_admin_tab.rb @@ -1,5 +1,5 @@ -Deface::Override.new(:virtual_path => "spree/layouts/admin", - :name => "add_order_cycles_admin_tab", +Deface::Override.new(:virtual_path => "spree/layouts/admin", + :name => "add_order_cycles_admin_tab", :insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]", - :text => "<%= tab 'Order Cycles', :url => main_app.admin_order_cycles_path %>", - :original => '3ff44d141dd4998561d0ff79b9df3b185207e325') \ No newline at end of file + :text => "<%= tab 'Order Cycles', :url => main_app.admin_order_cycles_path %>", + :original => 'd4e321201ecb543e92192a031c8896a45dde3576') \ No newline at end of file diff --git a/app/overrides/add_source_to_product.rb b/app/overrides/add_source_to_product.rb index 9229a278d9..ded798e840 100644 --- a/app/overrides/add_source_to_product.rb +++ b/app/overrides/add_source_to_product.rb @@ -1,4 +1,5 @@ Deface::Override.new(:virtual_path => "spree/products/show", :insert_bottom => "[data-hook='product_left_part_wrap']", :partial => "spree/products/source", - :name => "product_source") + :name => "add_source_to_product", + :original => 'bce3ba4847b3eac8ae061774a664ac4951d3d9db') diff --git a/app/overrides/add_supplier_and_group_buy_to_admin_product_new.rb b/app/overrides/add_supplier_and_group_buy_to_admin_product_new.rb new file mode 100644 index 0000000000..4fd7730b0d --- /dev/null +++ b/app/overrides/add_supplier_and_group_buy_to_admin_product_new.rb @@ -0,0 +1,5 @@ +Deface::Override.new(:virtual_path => "spree/admin/products/new", + :insert_before => "[data-hook='new_product_attrs']", + :partial => "spree/admin/products/supplier_and_group_buy_for_new", + :name => "add_supplier_and_group_buy_to_admin_product_new", + :original => '59b7ed369769267bdedb596768fcfcc2cb94f122') \ No newline at end of file diff --git a/app/overrides/add_supplier_to_admin_product.rb b/app/overrides/add_supplier_to_admin_product.rb index b5e2e6ae8f..a608f4e282 100644 --- a/app/overrides/add_supplier_to_admin_product.rb +++ b/app/overrides/add_supplier_to_admin_product.rb @@ -1,9 +1,5 @@ Deface::Override.new(:virtual_path => "spree/admin/products/_form", :insert_top => "[data-hook='admin_product_form_right']", :partial => "spree/admin/products/supplier_form", - :name => "supplier") - -Deface::Override.new(:virtual_path => "spree/admin/products/new", - :insert_bottom => ".right", - :partial => "spree/admin/products/supplier_form", - :name => "supplier") + :name => "add_supplier_to_admin_product", + :original => '18bd94de3eb8bdf8b669932bf04fc59e2e85288b') \ No newline at end of file diff --git a/app/overrides/cart_item_description.rb b/app/overrides/cart_item_description.rb index 9fd253c040..8ae809a183 100644 --- a/app/overrides/cart_item_description.rb +++ b/app/overrides/cart_item_description.rb @@ -1,4 +1,5 @@ Deface::Override.new(:virtual_path => "spree/orders/_line_item", :replace => "[data-hook='cart_item_description']", :partial => "spree/orders/cart_item_description", - :name => "cart_item_description") + :name => "cart_item_description", + :original => 'ce2b7ddab2a6a13b25159ea18f6ab50991409d3e') diff --git a/app/overrides/display_payment_information_after_purchase.rb b/app/overrides/display_payment_information_after_purchase.rb deleted file mode 100644 index d687e4e0f7..0000000000 --- a/app/overrides/display_payment_information_after_purchase.rb +++ /dev/null @@ -1,4 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/shared/_order_details", - :replace => "div.payment-info", - :partial => "spree/shared/order_details_payment_info", - :name => "order_details_payment_info") diff --git a/app/views/enterprise_fees/_admin_configurations_menu.html.haml b/app/views/enterprise_fees/_admin_configurations_menu.html.haml deleted file mode 100644 index 5792f47e3a..0000000000 --- a/app/views/enterprise_fees/_admin_configurations_menu.html.haml +++ /dev/null @@ -1 +0,0 @@ -%li= link_to "Enterprise Fees", main_app.admin_enterprise_fees_path diff --git a/app/views/spree/admin/products/_distributors_form.html.haml b/app/views/spree/admin/products/_distributors_form.html.haml index 04580f53ed..3131383d35 100644 --- a/app/views/spree/admin/products/_distributors_form.html.haml +++ b/app/views/spree/admin/products/_distributors_form.html.haml @@ -11,4 +11,4 @@ = label_tag "#{pd_form.object_name}[_destroy]", pd_form.object.distributor.name = pd_form.hidden_field :distributor_id %td - = pd_form.collection_select :shipping_method_id, Spree::ShippingMethod.all, :id, :name + = pd_form.collection_select :shipping_method_id, Spree::ShippingMethod.all, :id, :name, {}, :class => "select2" diff --git a/app/views/spree/admin/products/_group_buy_form.html.haml b/app/views/spree/admin/products/_group_buy_form.html.haml index 9ede3f8bf8..6669563d15 100644 --- a/app/views/spree/admin/products/_group_buy_form.html.haml +++ b/app/views/spree/admin/products/_group_buy_form.html.haml @@ -1,11 +1,13 @@ = f.field_container :group_buy do = f.label :group_buy, 'Group buy?' %br - = f.radio_button :group_buy, '1', :checked => f.object.group_buy - = f.label :group_buy_1, 'Yes' - = f.radio_button :group_buy, '0', :checked => !f.object.group_buy - = f.label :group_buy_0, 'No' - + .alpha.two.columns + = f.radio_button :group_buy, '1', :checked => f.object.group_buy + = f.label :group_buy_1, 'Yes' + .alpha.two.columns + = f.radio_button :group_buy, '0', :checked => !f.object.group_buy + = f.label :group_buy_0, 'No' +%br.clear = f.field_container :group_buy_unit_size do = f.label :group_buy_unit_size %br diff --git a/app/views/spree/admin/products/_supplier_and_group_buy_for_new.html.haml b/app/views/spree/admin/products/_supplier_and_group_buy_for_new.html.haml new file mode 100644 index 0000000000..8cf8569fbc --- /dev/null +++ b/app/views/spree/admin/products/_supplier_and_group_buy_for_new.html.haml @@ -0,0 +1,20 @@ +.row + .alpha.six.columns + = f.field_container :supplier do + = f.label :supplier + = f.collection_select(:supplier_id, Enterprise.is_primary_producer, :id, :name, {:include_blank => true}, {:class => "select2 fullwidth"}) + = f.error_message_on :supplier + .four.columns + = f.field_container :group_buy do + = f.label :group_buy, 'Group buy?' + %br + .alpha.two.columns + = f.radio_button :group_buy, '1', :checked => f.object.group_buy + = f.label :group_buy_1, 'Yes' + .omega.two.columns + = f.radio_button :group_buy, '0', :checked => !f.object.group_buy + = f.label :group_buy_0, 'No' + .omega.six.columns + = f.field_container :group_buy_unit_size do + = f.label :group_buy_unit_size + = f.text_field :group_buy_unit_size, :class => "fullwidth" \ No newline at end of file diff --git a/app/views/spree/admin/products/_supplier_form.html.haml b/app/views/spree/admin/products/_supplier_form.html.haml index aafb9175e1..0de2720a65 100644 --- a/app/views/spree/admin/products/_supplier_form.html.haml +++ b/app/views/spree/admin/products/_supplier_form.html.haml @@ -1,5 +1,5 @@ = f.field_container :supplier do = f.label :supplier %br - = f.collection_select(:supplier_id, Enterprise.is_primary_producer, :id, :name, :include_blank => true) + = f.collection_select(:supplier_id, Enterprise.is_primary_producer, :id, :name, {:include_blank => true}, {:class => "select2"}) = f.error_message_on :supplier diff --git a/app/views/spree/shared/_order_details_payment_info.html.haml b/app/views/spree/shared/_order_details_payment_info.html.haml deleted file mode 100644 index 9347237324..0000000000 --- a/app/views/spree/shared/_order_details_payment_info.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -- if order.payment_method.type == "Spree::PaymentMethod::Check" - = simple_format order.payment_method.description diff --git a/app/views/spree/shared/_order_details_steps_data.html.erb b/app/views/spree/shared/_order_details_steps_data.html.erb index 96214287f8..396e2be2fd 100644 --- a/app/views/spree/shared/_order_details_steps_data.html.erb +++ b/app/views/spree/shared/_order_details_steps_data.html.erb @@ -31,15 +31,15 @@
    Your payment via PayPal has been processed successfully.
    <% elsif order.payment_method.name.include? "EFT" %> <%= order.payment_method.description.html_safe %> - <% elsif order.creditcards.empty? == false %> + <% elsif order.credit_cards.empty? == false %> - <%= image_tag "creditcards/icons/#{order.creditcards.first.cc_type}.png" %> - <%= t(:ending_in)%> <%= order.creditcards.first.last_digits %> + <%= image_tag "credit_cards/icons/#{order.credit_cards.first.cc_type}.png" %> + <%= t(:ending_in)%> <%= order.credit_cards.first.last_digits %>
    - <%= order.creditcards.first.first_name %> - <%= order.creditcards.first.last_name %> + <%= order.credit_cards.first.first_name %> + <%= order.credit_cards.first.last_name %> <% elsif order.payment_method.type == "Spree::PaymentMethod::Check" %> <%= order.payment_method.description %> From 2a07d61e81017e8d61fb928113bfd03f30d2e26e Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 7 Feb 2013 15:09:25 +1100 Subject: [PATCH 06/25] Finish Deface review, two defaces which appear on orders/show remain unchecked due to Spree 1.2 migration issue --- ...ge_distributor_form_to_checkout_address.rb | 5 +++++ app/overrides/add_feedback_script.rb | 3 ++- app/overrides/product_filters.rb | 16 ---------------- app/overrides/rearrange_cart_form.rb | 10 ---------- app/overrides/rearrange_empty_cart_form.rb | 6 ++++++ app/overrides/rearrange_inside_cart_form.rb | 6 ++++++ .../replace_checkout_payment_button.rb | 5 +++-- app/overrides/replace_delivery_address.rb | 9 --------- ...g_address_form_with_distributor_details.rb | 5 +++++ app/overrides/set_auth_token_in_backend.rb | 5 +++++ app/overrides/set_auth_token_in_frontend.rb | 5 +++++ app/overrides/set_auth_token_in_test.rb | 9 --------- app/overrides/sidebar_home_index.rb | 7 +++++++ app/overrides/sidebar_product_index.rb | 7 +++++++ app/overrides/sidebar_taxons_show.rb | 7 +++++++ .../split_products_by_distributor.rb | 19 ------------------- .../split_products_by_distributor_on_home.rb | 5 +++++ ...roducts_by_distributor_on_products_home.rb | 5 +++++ ...ducts_by_distributor_on_products_search.rb | 5 +++++ ..._products_by_distributor_on_taxons_show.rb | 5 +++++ .../_process_my_order_button.html.erb | 1 - 21 files changed, 78 insertions(+), 67 deletions(-) create mode 100644 app/overrides/add_change_distributor_form_to_checkout_address.rb delete mode 100644 app/overrides/product_filters.rb delete mode 100644 app/overrides/rearrange_cart_form.rb create mode 100644 app/overrides/rearrange_empty_cart_form.rb create mode 100644 app/overrides/rearrange_inside_cart_form.rb delete mode 100644 app/overrides/replace_delivery_address.rb create mode 100644 app/overrides/replace_shipping_address_form_with_distributor_details.rb create mode 100644 app/overrides/set_auth_token_in_backend.rb create mode 100644 app/overrides/set_auth_token_in_frontend.rb delete mode 100644 app/overrides/set_auth_token_in_test.rb create mode 100644 app/overrides/sidebar_home_index.rb create mode 100644 app/overrides/sidebar_product_index.rb create mode 100644 app/overrides/sidebar_taxons_show.rb delete mode 100644 app/overrides/split_products_by_distributor.rb create mode 100644 app/overrides/split_products_by_distributor_on_home.rb create mode 100644 app/overrides/split_products_by_distributor_on_products_home.rb create mode 100644 app/overrides/split_products_by_distributor_on_products_search.rb create mode 100644 app/overrides/split_products_by_distributor_on_taxons_show.rb delete mode 100644 app/views/spree/checkout/_process_my_order_button.html.erb diff --git a/app/overrides/add_change_distributor_form_to_checkout_address.rb b/app/overrides/add_change_distributor_form_to_checkout_address.rb new file mode 100644 index 0000000000..8dd5a7f090 --- /dev/null +++ b/app/overrides/add_change_distributor_form_to_checkout_address.rb @@ -0,0 +1,5 @@ +Deface::Override.new(:virtual_path => "spree/checkout/edit", + :insert_after => "[data-hook='checkout_summary_box']", + :partial => "spree/checkout/other_available_distributors", + :name => "add_change_distributor_form_to_checkout_address", + :original => '60b9b1a39079f4efa85ff0425108edf671349d4f') \ No newline at end of file diff --git a/app/overrides/add_feedback_script.rb b/app/overrides/add_feedback_script.rb index 28933c7457..1bfb854c10 100644 --- a/app/overrides/add_feedback_script.rb +++ b/app/overrides/add_feedback_script.rb @@ -1,4 +1,5 @@ Deface::Override.new(:virtual_path => "spree/layouts/spree_application", :insert_bottom => "[data-hook='inside_head']", :partial => "layouts/feedback_script", - :name => "add_feedback_script") \ No newline at end of file + :name => "add_feedback_script", + :original => '429dfd9824ee588f51fb1b69013933424f149592') \ No newline at end of file diff --git a/app/overrides/product_filters.rb b/app/overrides/product_filters.rb deleted file mode 100644 index 051046cfd2..0000000000 --- a/app/overrides/product_filters.rb +++ /dev/null @@ -1,16 +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') - -Deface::Override.new(:virtual_path => "spree/products/index", - :replace => "[data-hook='homepage_sidebar_navigation']", - :partial => 'spree/sidebar', - :name => 'sidebar') - -Deface::Override.new(:virtual_path => "spree/taxons/show", - :replace => "[data-hook='taxon_sidebar_navigation']", - :partial => 'spree/sidebar', - :name => 'sidebar') diff --git a/app/overrides/rearrange_cart_form.rb b/app/overrides/rearrange_cart_form.rb deleted file mode 100644 index 9a23c00206..0000000000 --- a/app/overrides/rearrange_cart_form.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Remove column layout from cart form items so we can style it with CSS -Deface::Override.new(:virtual_path => "spree/orders/edit", - :replace => "[data-hook='inside_cart_form']", - :partial => "spree/orders/inside_cart_form", - :name => "inside_cart_form") - -Deface::Override.new(:virtual_path => "spree/orders/edit", - :replace => "#empty-cart[data-hook]", - :partial => "spree/orders/empty_cart_form", - :name => "empty_cart_form") diff --git a/app/overrides/rearrange_empty_cart_form.rb b/app/overrides/rearrange_empty_cart_form.rb new file mode 100644 index 0000000000..813173f489 --- /dev/null +++ b/app/overrides/rearrange_empty_cart_form.rb @@ -0,0 +1,6 @@ +# Remove column layout from cart form items so we can style it with CSS +Deface::Override.new(:virtual_path => "spree/orders/edit", + :replace => "#empty-cart[data-hook]", + :partial => "spree/orders/empty_cart_form", + :name => "rearrange_empty_cart_form", + :original => 'b5a751777e66ccbd45d7f1b980ecd201af94cb5b') \ No newline at end of file diff --git a/app/overrides/rearrange_inside_cart_form.rb b/app/overrides/rearrange_inside_cart_form.rb new file mode 100644 index 0000000000..fd4f873ad5 --- /dev/null +++ b/app/overrides/rearrange_inside_cart_form.rb @@ -0,0 +1,6 @@ +# Remove column layout from cart form items so we can style it with CSS +Deface::Override.new(:virtual_path => "spree/orders/edit", + :replace => "[data-hook='inside_cart_form']", + :partial => "spree/orders/inside_cart_form", + :name => "rearrange_inside_cart_form", + :original => 'e30b0e749869c51f004242b0cb7be582b45e044e') diff --git a/app/overrides/replace_checkout_payment_button.rb b/app/overrides/replace_checkout_payment_button.rb index 6f7912d087..cbc8e9c875 100644 --- a/app/overrides/replace_checkout_payment_button.rb +++ b/app/overrides/replace_checkout_payment_button.rb @@ -1,4 +1,5 @@ Deface::Override.new(:virtual_path => "spree/checkout/_payment", :replace => "code[erb-loud]:contains('submit_tag t(:save_and_continue)')", - :partial => "spree/checkout/process_my_order_button", - :name => "process_my_order_button") \ No newline at end of file + :text => "<%= submit_tag 'Process My Order', :class => 'continue button primary' %>", + :name => "replace_checkout_payment_button", + :original => 'ce2043a01931b3bc16b045302ebb0e0bb9150b67') \ No newline at end of file diff --git a/app/overrides/replace_delivery_address.rb b/app/overrides/replace_delivery_address.rb deleted file mode 100644 index 60b9883d5f..0000000000 --- a/app/overrides/replace_delivery_address.rb +++ /dev/null @@ -1,9 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/checkout/_address", - :replace => "[data-hook='shipping_fieldset_wrapper']", - :partial => "spree/checkout/distributor", - :name => "replace_shipping_form") - -Deface::Override.new(:virtual_path => "spree/checkout/edit", - :insert_after => "[data-hook='checkout_summary_box']", - :partial => "spree/checkout/other_available_distributors", - :name => "other_available_distributors") diff --git a/app/overrides/replace_shipping_address_form_with_distributor_details.rb b/app/overrides/replace_shipping_address_form_with_distributor_details.rb new file mode 100644 index 0000000000..c408dc8ed4 --- /dev/null +++ b/app/overrides/replace_shipping_address_form_with_distributor_details.rb @@ -0,0 +1,5 @@ +Deface::Override.new(:virtual_path => "spree/checkout/_address", + :replace => "[data-hook='shipping_fieldset_wrapper']", + :partial => "spree/checkout/distributor", + :name => "replace_shipping_address_form_with_distributor_details", + :original => '53e219f90a2e1ba702a767261d0c2afe100ac751') diff --git a/app/overrides/set_auth_token_in_backend.rb b/app/overrides/set_auth_token_in_backend.rb new file mode 100644 index 0000000000..d794d68b28 --- /dev/null +++ b/app/overrides/set_auth_token_in_backend.rb @@ -0,0 +1,5 @@ +Deface::Override.new(:virtual_path => "spree/layouts/admin", + :insert_bottom => "[data-hook='admin_inside_head']", + :partial => "layouts/auth_token_script", + :name => "set_auth_token_in_backend", + :original => '6bc2c5de1c8f7542d033548557437c9fe4b3ba02') \ No newline at end of file diff --git a/app/overrides/set_auth_token_in_frontend.rb b/app/overrides/set_auth_token_in_frontend.rb new file mode 100644 index 0000000000..6797955b36 --- /dev/null +++ b/app/overrides/set_auth_token_in_frontend.rb @@ -0,0 +1,5 @@ +Deface::Override.new(:virtual_path => "spree/layouts/spree_application", + :insert_bottom => "[data-hook='inside_head']", + :partial => "layouts/auth_token_script", + :name => "set_auth_token_in_frontend", + :original => '5659ac7dbf6ac6469907b005b85285b894677815') \ No newline at end of file diff --git a/app/overrides/set_auth_token_in_test.rb b/app/overrides/set_auth_token_in_test.rb deleted file mode 100644 index eb1b7128b3..0000000000 --- a/app/overrides/set_auth_token_in_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/layouts/spree_application", - :insert_bottom => "[data-hook='inside_head']", - :partial => "layouts/auth_token_script", - :name => "auth_token_script") - -Deface::Override.new(:virtual_path => "spree/layouts/admin", - :insert_bottom => "[data-hook='admin_inside_head']", - :partial => "layouts/auth_token_script", - :name => "auth_token_script") diff --git a/app/overrides/sidebar_home_index.rb b/app/overrides/sidebar_home_index.rb new file mode 100644 index 0000000000..7965478336 --- /dev/null +++ b/app/overrides/sidebar_home_index.rb @@ -0,0 +1,7 @@ +# 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 new file mode 100644 index 0000000000..94fdd92b95 --- /dev/null +++ b/app/overrides/sidebar_product_index.rb @@ -0,0 +1,7 @@ +# 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 new file mode 100644 index 0000000000..510b24ef1d --- /dev/null +++ b/app/overrides/sidebar_taxons_show.rb @@ -0,0 +1,7 @@ +# 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.rb b/app/overrides/split_products_by_distributor.rb deleted file mode 100644 index 7e57b1909a..0000000000 --- a/app/overrides/split_products_by_distributor.rb +++ /dev/null @@ -1,19 +0,0 @@ -Deface::Override.new(:virtual_path => "spree/home/index", - :replace => "[data-hook='homepage_products']", - :partial => "spree/shared/products_by_distributor", - :name => "products_home") - -Deface::Override.new(:virtual_path => "spree/products/index", - :replace => "[data-hook='homepage_products']", - :partial => "spree/shared/products_by_distributor", - :name => "products_products") - -Deface::Override.new(:virtual_path => "spree/products/index", - :replace => "[data-hook='search_results']", - :partial => "spree/shared/products_by_distributor", - :name => "products_search") - -Deface::Override.new(:virtual_path => "spree/taxons/show", - :replace => "[data-hook='taxon_products']", - :partial => "spree/shared/products_by_distributor", - :name => "products_taxon") diff --git a/app/overrides/split_products_by_distributor_on_home.rb b/app/overrides/split_products_by_distributor_on_home.rb new file mode 100644 index 0000000000..67a45f61b7 --- /dev/null +++ b/app/overrides/split_products_by_distributor_on_home.rb @@ -0,0 +1,5 @@ +Deface::Override.new(:virtual_path => "spree/home/index", + :replace => "[data-hook='homepage_products']", + :partial => "spree/shared/products_by_distributor", + :name => "split_products_by_distributor_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 new file mode 100644 index 0000000000..d21a61b150 --- /dev/null +++ b/app/overrides/split_products_by_distributor_on_products_home.rb @@ -0,0 +1,5 @@ +Deface::Override.new(:virtual_path => "spree/products/index", + :replace => "[data-hook='homepage_products']", + :partial => "spree/shared/products_by_distributor", + :name => "split_products_by_distributor_on_products_home", + :original => '22097416de0a5851d43c572301779de06ed84d17') \ No newline at end of file diff --git a/app/overrides/split_products_by_distributor_on_products_search.rb b/app/overrides/split_products_by_distributor_on_products_search.rb new file mode 100644 index 0000000000..81204a8311 --- /dev/null +++ b/app/overrides/split_products_by_distributor_on_products_search.rb @@ -0,0 +1,5 @@ +Deface::Override.new(:virtual_path => "spree/products/index", + :replace => "[data-hook='search_results']", + :partial => "spree/shared/products_by_distributor", + :name => "split_products_by_distributor_on_products_search", + :original => '5a764faee41bd3f2bb13b60bfeb61e63fede9fac') \ No newline at end of file diff --git a/app/overrides/split_products_by_distributor_on_taxons_show.rb b/app/overrides/split_products_by_distributor_on_taxons_show.rb new file mode 100644 index 0000000000..60459856e3 --- /dev/null +++ b/app/overrides/split_products_by_distributor_on_taxons_show.rb @@ -0,0 +1,5 @@ +Deface::Override.new(:virtual_path => "spree/taxons/show", + :replace => "[data-hook='taxon_products']", + :partial => "spree/shared/products_by_distributor", + :name => "split_products_by_distributor_on_taxons_show", + :original => '27b6ecd3954022246568b3ddf5e80462aa511ece') \ No newline at end of file diff --git a/app/views/spree/checkout/_process_my_order_button.html.erb b/app/views/spree/checkout/_process_my_order_button.html.erb deleted file mode 100644 index 8347497347..0000000000 --- a/app/views/spree/checkout/_process_my_order_button.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= submit_tag "Process My Order", :class => 'continue button primary' %> \ No newline at end of file From bdea85d1b42b37aea0f2177347d11036008b28a7 Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 7 Feb 2013 15:24:17 +1100 Subject: [PATCH 07/25] Rollback all Spree 1.3 migrations --- .../20130201024428_spree_one_two.spree.rb | 482 ------------------ ...20130201024429_add_tax_rate_label.spree.rb | 6 - ...24430_add_toggle_tax_rate_display.spree.rb | 6 - ..._remove_unused_preference_columns.spree.rb | 9 - ...24432_add_lock_version_to_variant.spree.rb | 6 - ..._add_states_required_to_countries.spree.rb | 6 - ..._on_demand_to_product_and_variant.spree.rb | 7 - ..._constraint_from_products_on_hand.spree.rb | 12 - ...024436_split_prices_from_variants.spree.rb | 32 -- ...not_null_from_spree_prices_amount.spree.rb | 10 - ...024438_add_currency_to_line_items.spree.rb | 6 - ...0201024439_add_currency_to_orders.spree.rb | 6 - ...440_add_cost_currency_to_variants.spree.rb | 6 - ...e_display_on_from_payment_methods.spree.rb | 6 - ...024442_add_position_to_taxonomies.spree.rb | 6 - ...24443_add_last_ip_to_spree_orders.spree.rb | 6 - ...splay_on_to_spree_payment_methods.spree.rb | 10 - ...name_api_key_to_spree_api_key.spree_api.rb | 8 - ...1024447_spree_promo_one_two.spree_promo.rb | 46 -- ...00_add_api_key_to_spree_users.spree_api.rb | 8 - .../20130201220401_create_users.spree_auth.rb | 30 -- 21 files changed, 714 deletions(-) delete mode 100644 db/migrate/20130201024428_spree_one_two.spree.rb delete mode 100644 db/migrate/20130201024429_add_tax_rate_label.spree.rb delete mode 100644 db/migrate/20130201024430_add_toggle_tax_rate_display.spree.rb delete mode 100644 db/migrate/20130201024431_remove_unused_preference_columns.spree.rb delete mode 100644 db/migrate/20130201024432_add_lock_version_to_variant.spree.rb delete mode 100644 db/migrate/20130201024433_add_states_required_to_countries.spree.rb delete mode 100644 db/migrate/20130201024434_add_on_demand_to_product_and_variant.spree.rb delete mode 100644 db/migrate/20130201024435_remove_not_null_constraint_from_products_on_hand.spree.rb delete mode 100644 db/migrate/20130201024436_split_prices_from_variants.spree.rb delete mode 100644 db/migrate/20130201024437_remove_not_null_from_spree_prices_amount.spree.rb delete mode 100644 db/migrate/20130201024438_add_currency_to_line_items.spree.rb delete mode 100644 db/migrate/20130201024439_add_currency_to_orders.spree.rb delete mode 100644 db/migrate/20130201024440_add_cost_currency_to_variants.spree.rb delete mode 100644 db/migrate/20130201024441_remove_display_on_from_payment_methods.spree.rb delete mode 100644 db/migrate/20130201024442_add_position_to_taxonomies.spree.rb delete mode 100644 db/migrate/20130201024443_add_last_ip_to_spree_orders.spree.rb delete mode 100644 db/migrate/20130201024444_add_display_on_to_spree_payment_methods.spree.rb delete mode 100644 db/migrate/20130201024446_rename_api_key_to_spree_api_key.spree_api.rb delete mode 100644 db/migrate/20130201024447_spree_promo_one_two.spree_promo.rb delete mode 100644 db/migrate/20130201220400_add_api_key_to_spree_users.spree_api.rb delete mode 100644 db/migrate/20130201220401_create_users.spree_auth.rb diff --git a/db/migrate/20130201024428_spree_one_two.spree.rb b/db/migrate/20130201024428_spree_one_two.spree.rb deleted file mode 100644 index ad81bfeabe..0000000000 --- a/db/migrate/20130201024428_spree_one_two.spree.rb +++ /dev/null @@ -1,482 +0,0 @@ -# This migration comes from spree (originally 20120831092320) -class SpreeOneTwo < ActiveRecord::Migration - def up - # This migration is just a compressed version of all the previous - # migrations for spree_core. Do not run it if one of the core tables - # already exists. Assume the best. - return if table_exists?(:spree_addresses) - - - create_table :spree_activators do |t| - t.string :description - t.datetime :expires_at - t.datetime :starts_at - t.string :name - t.string :event_name - t.string :type - t.integer :usage_limit - t.string :match_policy, :default => 'all' - t.string :code - t.boolean :advertise, :default => false - t.string :path - t.timestamps - end - - create_table :spree_addresses do |t| - t.string :firstname - t.string :lastname - t.string :address1 - t.string :address2 - t.string :city - t.string :zipcode - t.string :phone - t.string :state_name - t.string :alternative_phone - t.string :company - t.references :state - t.references :country - t.timestamps - end - - add_index :spree_addresses, [:firstname], :name => 'index_addresses_on_firstname' - add_index :spree_addresses, [:lastname], :name => 'index_addresses_on_lastname' - - create_table :spree_adjustments do |t| - t.references :source, :polymorphic => true - t.references :adjustable, :polymorphic => true - t.references :originator, :polymorphic => true - t.decimal :amount, :precision => 8, :scale => 2 - t.string :label - t.boolean :mandatory - t.boolean :locked - t.boolean :eligible, :default => true - t.timestamps - end - - add_index :spree_adjustments, [:adjustable_id], :name => 'index_adjustments_on_order_id' - - create_table :spree_assets do |t| - t.references :viewable, :polymorphic => true - t.integer :attachment_width - t.integer :attachment_height - t.integer :attachment_file_size - t.integer :position - t.string :attachment_content_type - t.string :attachment_file_name - t.string :type, :limit => 75 - t.datetime :attachment_updated_at - t.text :alt - end - - add_index :spree_assets, [:viewable_id], :name => 'index_assets_on_viewable_id' - add_index :spree_assets, [:viewable_type, :type], :name => 'index_assets_on_viewable_type_and_type' - - create_table :spree_calculators do |t| - t.string :type - t.references :calculable, :polymorphic => true - t.timestamps - end - - create_table :spree_configurations do |t| - t.string :name - t.string :type, :limit => 50 - t.timestamps - end - - add_index :spree_configurations, [:name, :type], :name => 'index_spree_configurations_on_name_and_type' - - create_table :spree_countries do |t| - t.string :iso_name - t.string :iso - t.string :iso3 - t.string :name - t.integer :numcode - end - - create_table :spree_credit_cards do |t| - t.string :month - t.string :year - t.string :cc_type - t.string :last_digits - t.string :first_name - t.string :last_name - t.string :start_month - t.string :start_year - t.string :issue_number - t.references :address - t.string :gateway_customer_profile_id - t.string :gateway_payment_profile_id - t.timestamps - end - - create_table :spree_gateways do |t| - t.string :type - t.string :name - t.text :description - t.boolean :active, :default => true - t.string :environment, :default => 'development' - t.string :server, :default => 'test' - t.boolean :test_mode, :default => true - t.timestamps - end - - create_table :spree_inventory_units do |t| - t.integer :lock_version, :default => 0 - t.string :state - t.references :variant - t.references :order - t.references :shipment - t.references :return_authorization - t.timestamps - end - - add_index :spree_inventory_units, [:order_id], :name => 'index_inventory_units_on_order_id' - add_index :spree_inventory_units, [:shipment_id], :name => 'index_inventory_units_on_shipment_id' - add_index :spree_inventory_units, [:variant_id], :name => 'index_inventory_units_on_variant_id' - - create_table :spree_line_items do |t| - t.references :variant - t.references :order - t.integer :quantity, :null => false - t.decimal :price, :precision => 8, :scale => 2, :null => false - t.timestamps - end - - add_index :spree_line_items, [:order_id], :name => 'index_spree_line_items_on_order_id' - add_index :spree_line_items, [:variant_id], :name => 'index_spree_line_items_on_variant_id' - - create_table :spree_log_entries do |t| - t.references :source, :polymorphic => true - t.text :details - t.timestamps - end - - create_table :spree_mail_methods do |t| - t.string :environment - t.boolean :active, :default => true - t.timestamps - end - - create_table :spree_option_types do |t| - t.string :name, :limit => 100 - t.string :presentation, :limit => 100 - t.integer :position, :default => 0, :null => false - t.timestamps - end - - create_table :spree_option_types_prototypes, :id => false do |t| - t.references :prototype - t.references :option_type - end - - create_table :spree_option_values do |t| - t.integer :position - t.string :name - t.string :presentation - t.references :option_type - t.timestamps - end - - create_table :spree_option_values_variants, :id => false do |t| - t.references :variant - t.references :option_value - end - - add_index :spree_option_values_variants, [:variant_id, :option_value_id], :name => 'index_option_values_variants_on_variant_id_and_option_value_id' - add_index :spree_option_values_variants, [:variant_id], :name => 'index_spree_option_values_variants_on_variant_id' - - create_table :spree_orders do |t| - t.string :number, :limit => 15 - t.decimal :item_total, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.decimal :total, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.string :state - t.decimal :adjustment_total, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.references :user - t.datetime :completed_at - t.references :bill_address - t.references :ship_address - t.decimal :payment_total, :precision => 8, :scale => 2, :default => 0.0 - t.references :shipping_method - t.string :shipment_state - t.string :payment_state - t.string :email - t.text :special_instructions - t.timestamps - end - - add_index :spree_orders, [:number], :name => 'index_spree_orders_on_number' - - create_table :spree_payment_methods do |t| - t.string :type - t.string :name - t.text :description - t.boolean :active, :default => true - t.string :environment, :default => 'development' - t.datetime :deleted_at - t.string :display_on - t.timestamps - end - - create_table :spree_payments do |t| - t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.references :order - t.references :source, :polymorphic => true - t.references :payment_method - t.string :state - t.string :response_code - t.string :avs_response - t.timestamps - end - - create_table :spree_preferences do |t| - t.string :name, :limit => 100 - t.references :owner, :polymorphic => true - t.text :value - t.string :key - t.string :value_type - t.timestamps - end - - add_index :spree_preferences, [:key], :name => 'index_spree_preferences_on_key', :unique => true - - create_table :spree_product_option_types do |t| - t.integer :position - t.references :product - t.references :option_type - t.timestamps - end - - create_table :spree_product_properties do |t| - t.string :value - t.references :product - t.references :property - t.timestamps - end - - add_index :spree_product_properties, [:product_id], :name => 'index_product_properties_on_product_id' - - create_table :spree_products do |t| - t.string :name, :default => '', :null => false - t.text :description - t.datetime :available_on - t.datetime :deleted_at - t.string :permalink - t.string :meta_description - t.string :meta_keywords - t.references :tax_category - t.references :shipping_category - t.integer :count_on_hand, :default => 0, :null => false - t.timestamps - end - - add_index :spree_products, [:available_on], :name => 'index_spree_products_on_available_on' - add_index :spree_products, [:deleted_at], :name => 'index_spree_products_on_deleted_at' - add_index :spree_products, [:name], :name => 'index_spree_products_on_name' - add_index :spree_products, [:permalink], :name => 'index_spree_products_on_permalink' - - create_table :spree_products_taxons, :id => false do |t| - t.references :product - t.references :taxon - end - - add_index :spree_products_taxons, [:product_id], :name => 'index_spree_products_taxons_on_product_id' - add_index :spree_products_taxons, [:taxon_id], :name => 'index_spree_products_taxons_on_taxon_id' - - create_table :spree_properties do |t| - t.string :name - t.string :presentation, :null => false - t.timestamps - end - - create_table :spree_properties_prototypes, :id => false do |t| - t.references :prototype - t.references :property - end - - create_table :spree_prototypes do |t| - t.string :name - t.timestamps - end - - create_table :spree_return_authorizations do |t| - t.string :number - t.string :state - t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.references :order - t.text :reason - t.timestamps - end - - create_table :spree_roles do |t| - t.string :name - end - - create_table :spree_roles_users, :id => false do |t| - t.references :role - t.references :user - end - - add_index :spree_roles_users, [:role_id], :name => 'index_spree_roles_users_on_role_id' - add_index :spree_roles_users, [:user_id], :name => 'index_spree_roles_users_on_user_id' - - create_table :spree_shipments do |t| - t.string :tracking - t.string :number - t.decimal :cost, :precision => 8, :scale => 2 - t.datetime :shipped_at - t.references :order - t.references :shipping_method - t.references :address - t.string :state - t.timestamps - end - - add_index :spree_shipments, [:number], :name => 'index_shipments_on_number' - - create_table :spree_shipping_categories do |t| - t.string :name - t.timestamps - end - - create_table :spree_shipping_methods do |t| - t.string :name - t.references :zone - t.string :display_on - t.references :shipping_category - t.boolean :match_none - t.boolean :match_all - t.boolean :match_one - t.datetime :deleted_at - t.timestamps - end - - create_table :spree_state_changes do |t| - t.string :name - t.string :previous_state - t.references :stateful - t.references :user - t.string :stateful_type - t.string :next_state - t.timestamps - end - - create_table :spree_states do |t| - t.string :name - t.string :abbr - t.references :country - end - - create_table :spree_tax_categories do |t| - t.string :name - t.string :description - t.boolean :is_default, :default => false - t.datetime :deleted_at - t.timestamps - end - - create_table :spree_tax_rates do |t| - t.decimal :amount, :precision => 8, :scale => 5 - t.references :zone - t.references :tax_category - t.boolean :included_in_price, :default => false - t.timestamps - end - - create_table :spree_taxonomies do |t| - t.string :name, :null => false - t.timestamps - end - - create_table :spree_taxons do |t| - t.references :parent - t.integer :position, :default => 0 - t.string :name, :null => false - t.string :permalink - t.references :taxonomy - t.integer :lft - t.integer :rgt - t.string :icon_file_name - t.string :icon_content_type - t.integer :icon_file_size - t.datetime :icon_updated_at - t.text :description - t.timestamps - end - - add_index :spree_taxons, [:parent_id], :name => 'index_taxons_on_parent_id' - add_index :spree_taxons, [:permalink], :name => 'index_taxons_on_permalink' - add_index :spree_taxons, [:taxonomy_id], :name => 'index_taxons_on_taxonomy_id' - - create_table :spree_tokenized_permissions, :force => true do |t| - t.references :permissable, :polymorphic => true - t.string :token - t.timestamps - end - - add_index :spree_tokenized_permissions, [:permissable_id, :permissable_type], :name => 'index_tokenized_name_and_type' - - create_table :spree_trackers do |t| - t.string :environment - t.string :analytics_id - t.boolean :active, :default => true - t.timestamps - end - - create_table :spree_users do |t| - t.string :encrypted_password, :limit => 128 - t.string :password_salt, :limit => 128 - t.string :email - t.string :remember_token - t.string :persistence_token - t.string :reset_password_token - t.string :perishable_token - t.integer :sign_in_count, :default => 0, :null => false - t.integer :failed_attempts, :default => 0, :null => false - t.datetime :last_request_at - t.datetime :current_sign_in_at - t.datetime :last_sign_in_at - t.string :current_sign_in_ip - t.string :last_sign_in_ip - t.string :login - t.references :ship_address - t.references :bill_address - t.string :authentication_token - t.string :unlock_token - t.datetime :locked_at - t.datetime :remember_created_at - t.datetime :reset_password_sent_at - t.timestamps - end - - create_table :spree_variants do |t| - t.string :sku, :default => '', :null => false - t.decimal :price, :precision => 8, :scale => 2, :null => false - t.decimal :weight, :precision => 8, :scale => 2 - t.decimal :height, :precision => 8, :scale => 2 - t.decimal :width, :precision => 8, :scale => 2 - t.decimal :depth, :precision => 8, :scale => 2 - t.datetime :deleted_at - t.boolean :is_master, :default => false - t.references :product - t.integer :count_on_hand, :default => 0, :null => false - t.decimal :cost_price, :precision => 8, :scale => 2 - t.integer :position - end - - add_index :spree_variants, [:product_id], :name => 'index_spree_variants_on_product_id' - - create_table :spree_zone_members do |t| - t.references :zoneable, :polymorphic => true - t.references :zone - t.timestamps - end - - create_table :spree_zones do |t| - t.string :name - t.string :description - t.boolean :default_tax, :default => false - t.integer :zone_members_count, :default => 0 - t.timestamps - end - end -end diff --git a/db/migrate/20130201024429_add_tax_rate_label.spree.rb b/db/migrate/20130201024429_add_tax_rate_label.spree.rb deleted file mode 100644 index c39a83c5ee..0000000000 --- a/db/migrate/20130201024429_add_tax_rate_label.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20120905145253) -class AddTaxRateLabel < ActiveRecord::Migration - def change - add_column :spree_tax_rates, :name, :string - end -end diff --git a/db/migrate/20130201024430_add_toggle_tax_rate_display.spree.rb b/db/migrate/20130201024430_add_toggle_tax_rate_display.spree.rb deleted file mode 100644 index 83da18b4f4..0000000000 --- a/db/migrate/20130201024430_add_toggle_tax_rate_display.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20120905151823) -class AddToggleTaxRateDisplay < ActiveRecord::Migration - def change - add_column :spree_tax_rates, :show_rate_in_label, :boolean, :default => true - end -end diff --git a/db/migrate/20130201024431_remove_unused_preference_columns.spree.rb b/db/migrate/20130201024431_remove_unused_preference_columns.spree.rb deleted file mode 100644 index 6c049daa22..0000000000 --- a/db/migrate/20130201024431_remove_unused_preference_columns.spree.rb +++ /dev/null @@ -1,9 +0,0 @@ -# This migration comes from spree (originally 20120929093553) -class RemoveUnusedPreferenceColumns < ActiveRecord::Migration - def change - # Columns have already been removed if the application was upgraded from an older version, but must be removed from new apps. - remove_column :spree_preferences, :name if ActiveRecord::Base.connection.column_exists?(:spree_preferences, :name) - remove_column :spree_preferences, :owner_id if ActiveRecord::Base.connection.column_exists?(:spree_preferences, :owner_id) - remove_column :spree_preferences, :owner_type if ActiveRecord::Base.connection.column_exists?(:spree_preferences, :owner_type) - end -end diff --git a/db/migrate/20130201024432_add_lock_version_to_variant.spree.rb b/db/migrate/20130201024432_add_lock_version_to_variant.spree.rb deleted file mode 100644 index 0e8cc92328..0000000000 --- a/db/migrate/20130201024432_add_lock_version_to_variant.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20121009142519) -class AddLockVersionToVariant < ActiveRecord::Migration - def change - add_column :spree_variants, :lock_version, :integer, :default => 0 - end -end diff --git a/db/migrate/20130201024433_add_states_required_to_countries.spree.rb b/db/migrate/20130201024433_add_states_required_to_countries.spree.rb deleted file mode 100644 index 415001d170..0000000000 --- a/db/migrate/20130201024433_add_states_required_to_countries.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20121010142909) -class AddStatesRequiredToCountries < ActiveRecord::Migration - def change - add_column :spree_countries, :states_required, :boolean,:default => true - end -end diff --git a/db/migrate/20130201024434_add_on_demand_to_product_and_variant.spree.rb b/db/migrate/20130201024434_add_on_demand_to_product_and_variant.spree.rb deleted file mode 100644 index ba258ebf26..0000000000 --- a/db/migrate/20130201024434_add_on_demand_to_product_and_variant.spree.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This migration comes from spree (originally 20121012071449) -class AddOnDemandToProductAndVariant < ActiveRecord::Migration - def change - add_column :spree_products, :on_demand, :boolean, :default => false - add_column :spree_variants, :on_demand, :boolean, :default => false - end -end diff --git a/db/migrate/20130201024435_remove_not_null_constraint_from_products_on_hand.spree.rb b/db/migrate/20130201024435_remove_not_null_constraint_from_products_on_hand.spree.rb deleted file mode 100644 index acbebfc6cb..0000000000 --- a/db/migrate/20130201024435_remove_not_null_constraint_from_products_on_hand.spree.rb +++ /dev/null @@ -1,12 +0,0 @@ -# This migration comes from spree (originally 20121017010007) -class RemoveNotNullConstraintFromProductsOnHand < ActiveRecord::Migration - def up - change_column :spree_products, :count_on_hand, :integer, :null => true - change_column :spree_variants, :count_on_hand, :integer, :null => true - end - - def down - change_column :spree_products, :count_on_hand, :integer, :null => false - change_column :spree_variants, :count_on_hand, :integer, :null => false - end -end diff --git a/db/migrate/20130201024436_split_prices_from_variants.spree.rb b/db/migrate/20130201024436_split_prices_from_variants.spree.rb deleted file mode 100644 index 976141f531..0000000000 --- a/db/migrate/20130201024436_split_prices_from_variants.spree.rb +++ /dev/null @@ -1,32 +0,0 @@ -# This migration comes from spree (originally 20121031162139) -class SplitPricesFromVariants < ActiveRecord::Migration - def up - create_table :spree_prices do |t| - t.integer :variant_id, :null => false - t.decimal :amount, :precision => 8, :scale => 2, :null => false - t.string :currency - end - - Spree::Variant.all.each do |variant| - Spree::Price.create!( - :variant_id => variant.id, - :amount => variant.price, - :currency => Spree::Config[:currency] - ) - end - - remove_column :spree_variants, :price - end - - def down - prices = ActiveRecord::Base.connection.execute("select variant_id, amount from spree_prices") - add_column :spree_variants, :price, :decimal, :after => :sku, :scale => 2, :precision => 8 - - prices.each do |price| - ActiveRecord::Base.connection.execute("update spree_variants set price = #{price['amount']} where id = #{price['variant_id']}") - end - - change_column :spree_variants, :price, :decimal, :after => :sku, :scale => 2, :precision => 8, :null => false - drop_table :spree_prices - end -end diff --git a/db/migrate/20130201024437_remove_not_null_from_spree_prices_amount.spree.rb b/db/migrate/20130201024437_remove_not_null_from_spree_prices_amount.spree.rb deleted file mode 100644 index beb5f7a85f..0000000000 --- a/db/migrate/20130201024437_remove_not_null_from_spree_prices_amount.spree.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from spree (originally 20121107003422) -class RemoveNotNullFromSpreePricesAmount < ActiveRecord::Migration - def up - change_column :spree_prices, :amount, :decimal, :precision => 8, :scale => 2, :null => true - end - - def down - change_column :spree_prices, :amount, :decimal, :precision => 8, :scale => 2, :null => false - end -end diff --git a/db/migrate/20130201024438_add_currency_to_line_items.spree.rb b/db/migrate/20130201024438_add_currency_to_line_items.spree.rb deleted file mode 100644 index b0732ee630..0000000000 --- a/db/migrate/20130201024438_add_currency_to_line_items.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20121107184631) -class AddCurrencyToLineItems < ActiveRecord::Migration - def change - add_column :spree_line_items, :currency, :string - end -end diff --git a/db/migrate/20130201024439_add_currency_to_orders.spree.rb b/db/migrate/20130201024439_add_currency_to_orders.spree.rb deleted file mode 100644 index d84bc3b7cc..0000000000 --- a/db/migrate/20130201024439_add_currency_to_orders.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20121107194006) -class AddCurrencyToOrders < ActiveRecord::Migration - def change - add_column :spree_orders, :currency, :string - end -end diff --git a/db/migrate/20130201024440_add_cost_currency_to_variants.spree.rb b/db/migrate/20130201024440_add_cost_currency_to_variants.spree.rb deleted file mode 100644 index a31b96499d..0000000000 --- a/db/migrate/20130201024440_add_cost_currency_to_variants.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20121109173623) -class AddCostCurrencyToVariants < ActiveRecord::Migration - def change - add_column :spree_variants, :cost_currency, :string, :after => :cost_price - end -end diff --git a/db/migrate/20130201024441_remove_display_on_from_payment_methods.spree.rb b/db/migrate/20130201024441_remove_display_on_from_payment_methods.spree.rb deleted file mode 100644 index c45e413c1a..0000000000 --- a/db/migrate/20130201024441_remove_display_on_from_payment_methods.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20121111231553) -class RemoveDisplayOnFromPaymentMethods < ActiveRecord::Migration - def up - remove_column :spree_payment_methods, :display_on - end -end diff --git a/db/migrate/20130201024442_add_position_to_taxonomies.spree.rb b/db/migrate/20130201024442_add_position_to_taxonomies.spree.rb deleted file mode 100644 index 177870b42a..0000000000 --- a/db/migrate/20130201024442_add_position_to_taxonomies.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20121124203911) -class AddPositionToTaxonomies < ActiveRecord::Migration - def change - add_column :spree_taxonomies, :position, :integer, :default => 0 - end -end diff --git a/db/migrate/20130201024443_add_last_ip_to_spree_orders.spree.rb b/db/migrate/20130201024443_add_last_ip_to_spree_orders.spree.rb deleted file mode 100644 index e85fc41ffe..0000000000 --- a/db/migrate/20130201024443_add_last_ip_to_spree_orders.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20121126040517) -class AddLastIpToSpreeOrders < ActiveRecord::Migration - def change - add_column :spree_orders, :last_ip_address, :string - end -end diff --git a/db/migrate/20130201024444_add_display_on_to_spree_payment_methods.spree.rb b/db/migrate/20130201024444_add_display_on_to_spree_payment_methods.spree.rb deleted file mode 100644 index 240870bbb6..0000000000 --- a/db/migrate/20130201024444_add_display_on_to_spree_payment_methods.spree.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from spree (originally 20130114053446) -class AddDisplayOnToSpreePaymentMethods < ActiveRecord::Migration - def self.up - add_column :spree_payment_methods, :display_on, :string - end - - def self.down - remove_column :spree_payment_methods, :display_on - end -end diff --git a/db/migrate/20130201024446_rename_api_key_to_spree_api_key.spree_api.rb b/db/migrate/20130201024446_rename_api_key_to_spree_api_key.spree_api.rb deleted file mode 100644 index 7fd09d3b11..0000000000 --- a/db/migrate/20130201024446_rename_api_key_to_spree_api_key.spree_api.rb +++ /dev/null @@ -1,8 +0,0 @@ -# This migration comes from spree_api (originally 20120530054546) -class RenameApiKeyToSpreeApiKey < ActiveRecord::Migration - def change - unless defined?(User) - rename_column :spree_users, :api_key, :spree_api_key - end - end -end diff --git a/db/migrate/20130201024447_spree_promo_one_two.spree_promo.rb b/db/migrate/20130201024447_spree_promo_one_two.spree_promo.rb deleted file mode 100644 index 7e808c800b..0000000000 --- a/db/migrate/20130201024447_spree_promo_one_two.spree_promo.rb +++ /dev/null @@ -1,46 +0,0 @@ -# This migration comes from spree_promo (originally 20120831092359) -class SpreePromoOneTwo < ActiveRecord::Migration - def up - # This migration is just a compressed migration for all previous versions of spree_promo - return if table_exists?(:spree_products_promotion_rules) - - create_table :spree_products_promotion_rules, :id => false, :force => true do |t| - t.references :product - t.references :promotion_rule - end - - add_index :spree_products_promotion_rules, [:product_id], :name => 'index_products_promotion_rules_on_product_id' - add_index :spree_products_promotion_rules, [:promotion_rule_id], :name => 'index_products_promotion_rules_on_promotion_rule_id' - - create_table :spree_promotion_action_line_items, :force => true do |t| - t.references :promotion_action - t.references :variant - t.integer :quantity, :default => 1 - end - - create_table :spree_promotion_actions, :force => true do |t| - t.references :activator - t.integer :position - t.string :type - end - - create_table :spree_promotion_rules, :force => true do |t| - t.references :activator - t.references :user - t.references :product_group - t.string :type - t.timestamps - end - - add_index :spree_promotion_rules, [:product_group_id], :name => 'index_promotion_rules_on_product_group_id' - add_index :spree_promotion_rules, [:user_id], :name => 'index_promotion_rules_on_user_id' - - create_table :spree_promotion_rules_users, :id => false, :force => true do |t| - t.references :user - t.references :promotion_rule - end - - add_index :spree_promotion_rules_users, [:promotion_rule_id], :name => 'index_promotion_rules_users_on_promotion_rule_id' - add_index :spree_promotion_rules_users, [:user_id], :name => 'index_promotion_rules_users_on_user_id' - end -end diff --git a/db/migrate/20130201220400_add_api_key_to_spree_users.spree_api.rb b/db/migrate/20130201220400_add_api_key_to_spree_users.spree_api.rb deleted file mode 100644 index b9e3fe3884..0000000000 --- a/db/migrate/20130201220400_add_api_key_to_spree_users.spree_api.rb +++ /dev/null @@ -1,8 +0,0 @@ -# This migration comes from spree_api (originally 20100107141738) -class AddApiKeyToSpreeUsers < ActiveRecord::Migration - def change - unless defined?(User) - add_column :spree_users, :api_key, :string, :limit => 40 - end - end -end diff --git a/db/migrate/20130201220401_create_users.spree_auth.rb b/db/migrate/20130201220401_create_users.spree_auth.rb deleted file mode 100644 index a4e8e602d2..0000000000 --- a/db/migrate/20130201220401_create_users.spree_auth.rb +++ /dev/null @@ -1,30 +0,0 @@ -# This migration comes from spree_auth (originally 20101026184949) -class CreateUsers < ActiveRecord::Migration - def up - unless table_exists?("spree_users") - create_table "spree_users", :force => true do |t| - t.string "crypted_password", :limit => 128 - t.string "salt", :limit => 128 - t.string "email" - t.string "remember_token" - t.string "remember_token_expires_at" - t.string "persistence_token" - t.string "single_access_token" - t.string "perishable_token" - t.integer "login_count", :default => 0, :null => false - t.integer "failed_login_count", :default => 0, :null => false - t.datetime "last_request_at" - t.datetime "current_login_at" - t.datetime "last_login_at" - t.string "current_login_ip" - t.string "last_login_ip" - t.string "login" - t.integer "ship_address_id" - t.integer "bill_address_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "openid_identifier" - end - end - end -end From 62d6745f02571baac75931e87896f10e8ebab136 Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 7 Feb 2013 15:24:59 +1100 Subject: [PATCH 08/25] Rollback all Spree 1.3 migrations (forgot db/schema.rb) --- db/schema.rb | 48 +++++++++++++++--------------------------------- 1 file changed, 15 insertions(+), 33 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 51e67a05b3..8b46632b86 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 => 20130201220401) do +ActiveRecord::Schema.define(:version => 20130118031610) do create_table "cms_blocks", :force => true do |t| t.integer "page_id", :null => false @@ -296,7 +296,6 @@ ActiveRecord::Schema.define(:version => 20130201220401) do t.string "iso3" t.string "name" t.integer "numcode" - t.boolean "states_required", :default => true end create_table "spree_creditcards", :force => true do |t| @@ -352,7 +351,6 @@ ActiveRecord::Schema.define(:version => 20130201220401) do t.datetime "updated_at", :null => false t.integer "max_quantity" t.integer "shipping_method_id" - t.string "currency" end add_index "spree_line_items", ["order_id"], :name => "index_line_items_on_order_id" @@ -423,8 +421,6 @@ ActiveRecord::Schema.define(:version => 20130201220401) do t.string "email" t.text "special_instructions" t.integer "distributor_id" - t.string "currency" - t.string "last_ip_address" end add_index "spree_orders", ["number"], :name => "index_orders_on_number" @@ -438,7 +434,6 @@ ActiveRecord::Schema.define(:version => 20130201220401) do t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.datetime "deleted_at" - t.string "display_on" end create_table "spree_payments", :force => true do |t| @@ -479,12 +474,6 @@ ActiveRecord::Schema.define(:version => 20130201220401) do add_index "spree_preferences", ["key"], :name => "index_spree_preferences_on_key", :unique => true - create_table "spree_prices", :force => true do |t| - t.integer "variant_id", :null => false - t.decimal "amount", :precision => 8, :scale => 2 - t.string "currency" - end - create_table "spree_product_groups", :force => true do |t| t.string "name" t.string "permalink" @@ -527,7 +516,7 @@ ActiveRecord::Schema.define(:version => 20130201220401) do add_index "spree_product_scopes", ["product_group_id"], :name => "index_product_scopes_on_product_group_id" create_table "spree_products", :force => true do |t| - t.string "name", :default => "", :null => false + t.string "name", :default => "", :null => false t.text "description" t.datetime "available_on" t.datetime "deleted_at" @@ -536,13 +525,12 @@ ActiveRecord::Schema.define(:version => 20130201220401) do t.string "meta_keywords" t.integer "tax_category_id" t.integer "shipping_category_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "count_on_hand", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "count_on_hand", :default => 0, :null => false t.integer "supplier_id" t.boolean "group_buy" t.float "group_buy_unit_size" - t.boolean "on_demand", :default => false end add_index "spree_products", ["available_on"], :name => "index_products_on_available_on" @@ -710,21 +698,18 @@ ActiveRecord::Schema.define(:version => 20130201220401) do end create_table "spree_tax_rates", :force => true do |t| - t.decimal "amount", :precision => 8, :scale => 5 + t.decimal "amount", :precision => 8, :scale => 5 t.integer "zone_id" t.integer "tax_category_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "included_in_price", :default => false - t.string "name" - t.boolean "show_rate_in_label", :default => true + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "included_in_price", :default => false end create_table "spree_taxonomies", :force => true do |t| - t.string "name", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "position", :default => 0 + t.string "name", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "spree_taxons", :force => true do |t| @@ -790,9 +775,8 @@ ActiveRecord::Schema.define(:version => 20130201220401) do t.string "unlock_token" t.datetime "locked_at" t.datetime "remember_created_at" - t.string "spree_api_key", :limit => 48 + t.string "api_key", :limit => 48 t.datetime "reset_password_sent_at" - t.string "api_key", :limit => 40 end add_index "spree_users", ["email"], :name => "email_idx_unique", :unique => true @@ -807,12 +791,10 @@ ActiveRecord::Schema.define(:version => 20130201220401) do t.datetime "deleted_at" t.boolean "is_master", :default => false t.integer "product_id" - t.integer "count_on_hand", :default => 0 + t.integer "count_on_hand", :default => 0, :null => false t.decimal "cost_price", :precision => 8, :scale => 2 t.integer "position" - t.integer "lock_version", :default => 0 - t.boolean "on_demand", :default => false - t.string "cost_currency" + t.decimal "price", :precision => 8, :scale => 2, :null => false end add_index "spree_variants", ["product_id"], :name => "index_variants_on_product_id" From 109d5cfe678881a84d229c0610d184da8f95be55 Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 7 Feb 2013 15:34:00 +1100 Subject: [PATCH 09/25] Upgrade database to Spree 1.2 --- Gemfile | 6 +- Gemfile.lock | 66 +++++++++---------- ...reate_tokenized_permissions_table.spree.rb | 17 +++++ ...ename_creditcards_to_credit_cards.spree.rb | 12 ++++ ...8_remove_credit_total_from_orders.spree.rb | 6 ++ ...20130207043039_add_tax_rate_label.spree.rb | 6 ++ ...43040_add_toggle_tax_rate_display.spree.rb | 6 ++ ...43041_add_lock_version_to_variant.spree.rb | 6 ++ ..._constraint_from_products_on_hand.spree.rb | 12 ++++ ...043043_add_position_to_taxonomies.spree.rb | 6 ++ ..._add_identifier_to_spree_payments.spree.rb | 6 ++ ...name_api_key_to_spree_api_key.spree_api.rb | 8 +++ .../20130207043047_create_users.spree_auth.rb | 30 +++++++++ db/schema.rb | 30 +++++---- 14 files changed, 166 insertions(+), 51 deletions(-) create mode 100644 db/migrate/20130207043036_create_tokenized_permissions_table.spree.rb create mode 100644 db/migrate/20130207043037_rename_creditcards_to_credit_cards.spree.rb create mode 100644 db/migrate/20130207043038_remove_credit_total_from_orders.spree.rb create mode 100644 db/migrate/20130207043039_add_tax_rate_label.spree.rb create mode 100644 db/migrate/20130207043040_add_toggle_tax_rate_display.spree.rb create mode 100644 db/migrate/20130207043041_add_lock_version_to_variant.spree.rb create mode 100644 db/migrate/20130207043042_remove_not_null_constraint_from_products_on_hand.spree.rb create mode 100644 db/migrate/20130207043043_add_position_to_taxonomies.spree.rb create mode 100644 db/migrate/20130207043044_add_identifier_to_spree_payments.spree.rb create mode 100644 db/migrate/20130207043046_rename_api_key_to_spree_api_key.spree_api.rb create mode 100644 db/migrate/20130207043047_create_users.spree_auth.rb diff --git a/Gemfile b/Gemfile index aaae276efe..a55c5cf3e4 100644 --- a/Gemfile +++ b/Gemfile @@ -4,11 +4,11 @@ ruby "1.9.3" gem 'rails', '3.2.11' gem 'pg' -gem 'spree', :git => 'git://github.com/spree/spree.git', :branch => '1-3-stable' +gem 'spree', :git => 'git://github.com/spree/spree.git', :branch => '1-2-stable' gem 'spree_i18n', :git => 'git://github.com/spree/spree_i18n.git' -gem 'spree_paypal_express', :git => 'git://github.com/spree/spree_paypal_express.git', :branch => '1-3-stable' +gem 'spree_paypal_express', :git => 'git://github.com/spree/spree_paypal_express.git', :branch => '1-2-stable' gem 'spree_last_address', :git => 'git://github.com/dancinglightning/spree-last-address.git' -gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '1-3-stable' +gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '1-2-stable' gem 'comfortable_mexican_sofa' diff --git a/Gemfile.lock b/Gemfile.lock index c72794093c..9eb8840235 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -23,27 +23,26 @@ GIT GIT remote: git://github.com/spree/spree.git - revision: cbba7d046061ceb14c2947d92774ded6d7b0980e - branch: 1-3-stable + revision: 42a98e2299e54b8d5ff73a047926612c816a6934 + branch: 1-2-stable specs: - spree (1.3.2.beta) - spree_api (= 1.3.2.beta) - spree_cmd (= 1.3.2.beta) - spree_core (= 1.3.2.beta) - spree_dash (= 1.3.2.beta) - spree_promo (= 1.3.2.beta) - spree_sample (= 1.3.2.beta) - spree_api (1.3.2.beta) - spree_core (= 1.3.2.beta) - versioncake (= 0.4.0) - spree_cmd (1.3.2.beta) + spree (1.2.4) + spree_api (= 1.2.4) + spree_cmd (= 1.2.4) + spree_core (= 1.2.4) + spree_dash (= 1.2.4) + spree_promo (= 1.2.4) + spree_sample (= 1.2.4) + spree_api (1.2.4) + spree_core (= 1.2.4) + spree_cmd (1.2.4) thor (>= 0.14.6) - spree_core (1.3.2.beta) + spree_core (1.2.4) activemerchant (~> 1.29.3) acts_as_list (= 0.1.4) awesome_nested_set (= 2.1.5) aws-sdk (~> 1.3.4) - cancan (= 1.6.8) + cancan (= 1.6.7) deface (>= 0.9.0) ffaker (~> 1.12.0) highline (= 1.6.11) @@ -54,16 +53,17 @@ GIT rabl (= 0.7.2) rails (~> 3.2.11) ransack (~> 0.7.2) + select2-rails (~> 3.0) select2-rails (~> 3.2) state_machine (= 1.1.2) stringex (~> 1.3.2) - spree_dash (1.3.2.beta) + spree_dash (1.2.4) httparty (~> 0.8.1) - spree_core (= 1.3.2.beta) - spree_promo (1.3.2.beta) - spree_core (= 1.3.2.beta) - spree_sample (1.3.2.beta) - spree_core (= 1.3.2.beta) + spree_core (= 1.2.4) + spree_promo (1.2.4) + spree_core (= 1.2.4) + spree_sample (1.2.4) + spree_core (= 1.2.4) GIT remote: git://github.com/spree/spree_i18n.git @@ -75,18 +75,18 @@ GIT GIT remote: git://github.com/spree/spree_paypal_express.git - revision: 483f6ababa9c8a1c574aad0a948c96cc21a591db - branch: 1-3-stable + revision: 524009008727ef2a4ad8f00baa2499ee47460a3b + branch: 1-2-stable specs: spree_paypal_express (1.2.0) - spree_core (~> 1.3.0) + spree_core (~> 1.2) GIT remote: https://github.com/spree/spree_auth_devise.git - revision: ab03a7a22740b52f96bf0311a1e9f18a99ee02f2 - branch: 1-3-stable + revision: 077029cedd48570e4423ba2d99f0fa38300f70ea + branch: 1-2-stable specs: - spree_auth_devise (1.0.0) + spree_auth_devise (1.2.0) cancan (~> 1.6.7) devise (~> 2.2.3) devise-encryptable (= 0.1.1) @@ -152,7 +152,7 @@ GEM httparty (>= 0.5, < 1.0) multi_json (~> 1.0) builder (3.0.4) - cancan (1.6.8) + cancan (1.6.7) capybara (2.0.2) mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -240,7 +240,7 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) method_source (0.8) - mime-types (1.19) + mime-types (1.20.1) money (5.0.0) i18n (~> 0.4) json @@ -291,11 +291,11 @@ GEM thor (>= 0.14.6, < 2.0) raindrops (0.9.0) rake (10.0.3) - ransack (0.7.2) + ransack (0.7.3) actionpack (~> 3.0) activerecord (~> 3.0) polyamorous (~> 0.5.0) - rdoc (3.12) + rdoc (3.12.1) json (~> 1.4) representative (1.0.5) activesupport (>= 2.2.2) @@ -361,10 +361,6 @@ GEM rack raindrops (~> 0.7) uuidtools (2.1.3) - versioncake (0.4.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) warden (1.2.1) rack (>= 1.0) websocket (1.0.6) diff --git a/db/migrate/20130207043036_create_tokenized_permissions_table.spree.rb b/db/migrate/20130207043036_create_tokenized_permissions_table.spree.rb new file mode 100644 index 0000000000..91c8ad18ab --- /dev/null +++ b/db/migrate/20130207043036_create_tokenized_permissions_table.spree.rb @@ -0,0 +1,17 @@ +# This migration comes from spree (originally 20120509055454) +class CreateTokenizedPermissionsTable < ActiveRecord::Migration + def change + unless Spree::TokenizedPermission.table_exists? + create_table :spree_tokenized_permissions do |t| + t.integer :permissable_id + t.string :permissable_type + t.string :token + + t.timestamps + end + + add_index :spree_tokenized_permissions, [:permissable_id, :permissable_type], :name => 'index_tokenized_name_and_type' + end + end +end + diff --git a/db/migrate/20130207043037_rename_creditcards_to_credit_cards.spree.rb b/db/migrate/20130207043037_rename_creditcards_to_credit_cards.spree.rb new file mode 100644 index 0000000000..b6d61a8a8c --- /dev/null +++ b/db/migrate/20130207043037_rename_creditcards_to_credit_cards.spree.rb @@ -0,0 +1,12 @@ +# This migration comes from spree (originally 20120530012000) +class RenameCreditcardsToCreditCards < ActiveRecord::Migration + def change + rename_table :spree_creditcards, :spree_credit_cards + execute("UPDATE spree_payments SET source_type = 'Spree::CreditCard' WHERE source_type = 'Spree::Creditcard'") + end + + def down + execute("UPDATE spree_payments SET source_type = 'Spree::Creditcard' WHERE source_type = 'Spree::CreditCard'") + rename_table :spree_credit_cards, :spree_creditcards + end +end diff --git a/db/migrate/20130207043038_remove_credit_total_from_orders.spree.rb b/db/migrate/20130207043038_remove_credit_total_from_orders.spree.rb new file mode 100644 index 0000000000..09559d50fa --- /dev/null +++ b/db/migrate/20130207043038_remove_credit_total_from_orders.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20120604203654) +class RemoveCreditTotalFromOrders < ActiveRecord::Migration + def change + remove_column :spree_orders, :credit_total + end +end diff --git a/db/migrate/20130207043039_add_tax_rate_label.spree.rb b/db/migrate/20130207043039_add_tax_rate_label.spree.rb new file mode 100644 index 0000000000..c39a83c5ee --- /dev/null +++ b/db/migrate/20130207043039_add_tax_rate_label.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20120905145253) +class AddTaxRateLabel < ActiveRecord::Migration + def change + add_column :spree_tax_rates, :name, :string + end +end diff --git a/db/migrate/20130207043040_add_toggle_tax_rate_display.spree.rb b/db/migrate/20130207043040_add_toggle_tax_rate_display.spree.rb new file mode 100644 index 0000000000..83da18b4f4 --- /dev/null +++ b/db/migrate/20130207043040_add_toggle_tax_rate_display.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20120905151823) +class AddToggleTaxRateDisplay < ActiveRecord::Migration + def change + add_column :spree_tax_rates, :show_rate_in_label, :boolean, :default => true + end +end diff --git a/db/migrate/20130207043041_add_lock_version_to_variant.spree.rb b/db/migrate/20130207043041_add_lock_version_to_variant.spree.rb new file mode 100644 index 0000000000..0e8cc92328 --- /dev/null +++ b/db/migrate/20130207043041_add_lock_version_to_variant.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20121009142519) +class AddLockVersionToVariant < ActiveRecord::Migration + def change + add_column :spree_variants, :lock_version, :integer, :default => 0 + end +end diff --git a/db/migrate/20130207043042_remove_not_null_constraint_from_products_on_hand.spree.rb b/db/migrate/20130207043042_remove_not_null_constraint_from_products_on_hand.spree.rb new file mode 100644 index 0000000000..acbebfc6cb --- /dev/null +++ b/db/migrate/20130207043042_remove_not_null_constraint_from_products_on_hand.spree.rb @@ -0,0 +1,12 @@ +# This migration comes from spree (originally 20121017010007) +class RemoveNotNullConstraintFromProductsOnHand < ActiveRecord::Migration + def up + change_column :spree_products, :count_on_hand, :integer, :null => true + change_column :spree_variants, :count_on_hand, :integer, :null => true + end + + def down + change_column :spree_products, :count_on_hand, :integer, :null => false + change_column :spree_variants, :count_on_hand, :integer, :null => false + end +end diff --git a/db/migrate/20130207043043_add_position_to_taxonomies.spree.rb b/db/migrate/20130207043043_add_position_to_taxonomies.spree.rb new file mode 100644 index 0000000000..177870b42a --- /dev/null +++ b/db/migrate/20130207043043_add_position_to_taxonomies.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20121124203911) +class AddPositionToTaxonomies < ActiveRecord::Migration + def change + add_column :spree_taxonomies, :position, :integer, :default => 0 + end +end diff --git a/db/migrate/20130207043044_add_identifier_to_spree_payments.spree.rb b/db/migrate/20130207043044_add_identifier_to_spree_payments.spree.rb new file mode 100644 index 0000000000..91a65d92cb --- /dev/null +++ b/db/migrate/20130207043044_add_identifier_to_spree_payments.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20130203232234) +class AddIdentifierToSpreePayments < ActiveRecord::Migration + def change + add_column :spree_payments, :identifier, :string + end +end diff --git a/db/migrate/20130207043046_rename_api_key_to_spree_api_key.spree_api.rb b/db/migrate/20130207043046_rename_api_key_to_spree_api_key.spree_api.rb new file mode 100644 index 0000000000..7fd09d3b11 --- /dev/null +++ b/db/migrate/20130207043046_rename_api_key_to_spree_api_key.spree_api.rb @@ -0,0 +1,8 @@ +# This migration comes from spree_api (originally 20120530054546) +class RenameApiKeyToSpreeApiKey < ActiveRecord::Migration + def change + unless defined?(User) + rename_column :spree_users, :api_key, :spree_api_key + end + end +end diff --git a/db/migrate/20130207043047_create_users.spree_auth.rb b/db/migrate/20130207043047_create_users.spree_auth.rb new file mode 100644 index 0000000000..a4e8e602d2 --- /dev/null +++ b/db/migrate/20130207043047_create_users.spree_auth.rb @@ -0,0 +1,30 @@ +# This migration comes from spree_auth (originally 20101026184949) +class CreateUsers < ActiveRecord::Migration + def up + unless table_exists?("spree_users") + create_table "spree_users", :force => true do |t| + t.string "crypted_password", :limit => 128 + t.string "salt", :limit => 128 + t.string "email" + t.string "remember_token" + t.string "remember_token_expires_at" + t.string "persistence_token" + t.string "single_access_token" + t.string "perishable_token" + t.integer "login_count", :default => 0, :null => false + t.integer "failed_login_count", :default => 0, :null => false + t.datetime "last_request_at" + t.datetime "current_login_at" + t.datetime "last_login_at" + t.string "current_login_ip" + t.string "last_login_ip" + t.string "login" + t.integer "ship_address_id" + t.integer "bill_address_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "openid_identifier" + end + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 8b46632b86..f0bdd176bc 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 => 20130118031610) do +ActiveRecord::Schema.define(:version => 20130207043047) do create_table "cms_blocks", :force => true do |t| t.integer "page_id", :null => false @@ -298,7 +298,7 @@ ActiveRecord::Schema.define(:version => 20130118031610) do t.integer "numcode" end - create_table "spree_creditcards", :force => true do |t| + create_table "spree_credit_cards", :force => true do |t| t.string "month" t.string "year" t.string "cc_type" @@ -407,7 +407,6 @@ ActiveRecord::Schema.define(:version => 20130118031610) do t.decimal "total", :precision => 8, :scale => 2, :default => 0.0, :null => false t.string "state" t.decimal "adjustment_total", :precision => 8, :scale => 2, :default => 0.0, :null => false - t.decimal "credit_total", :precision => 8, :scale => 2, :default => 0.0, :null => false t.integer "user_id" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false @@ -447,6 +446,7 @@ ActiveRecord::Schema.define(:version => 20130118031610) do t.string "state" t.string "response_code" t.string "avs_response" + t.string "identifier" end create_table "spree_paypal_accounts", :force => true do |t| @@ -527,7 +527,7 @@ ActiveRecord::Schema.define(:version => 20130118031610) do t.integer "shipping_category_id" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false - t.integer "count_on_hand", :default => 0, :null => false + t.integer "count_on_hand", :default => 0 t.integer "supplier_id" t.boolean "group_buy" t.float "group_buy_unit_size" @@ -698,18 +698,21 @@ ActiveRecord::Schema.define(:version => 20130118031610) do end create_table "spree_tax_rates", :force => true do |t| - t.decimal "amount", :precision => 8, :scale => 5 + t.decimal "amount", :precision => 8, :scale => 5 t.integer "zone_id" t.integer "tax_category_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "included_in_price", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "included_in_price", :default => false + t.string "name" + t.boolean "show_rate_in_label", :default => true end create_table "spree_taxonomies", :force => true do |t| - t.string "name", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.string "name", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "position", :default => 0 end create_table "spree_taxons", :force => true do |t| @@ -775,7 +778,7 @@ ActiveRecord::Schema.define(:version => 20130118031610) do t.string "unlock_token" t.datetime "locked_at" t.datetime "remember_created_at" - t.string "api_key", :limit => 48 + t.string "spree_api_key", :limit => 48 t.datetime "reset_password_sent_at" end @@ -791,10 +794,11 @@ ActiveRecord::Schema.define(:version => 20130118031610) do t.datetime "deleted_at" t.boolean "is_master", :default => false t.integer "product_id" - t.integer "count_on_hand", :default => 0, :null => false + t.integer "count_on_hand", :default => 0 t.decimal "cost_price", :precision => 8, :scale => 2 t.integer "position" t.decimal "price", :precision => 8, :scale => 2, :null => false + t.integer "lock_version", :default => 0 end add_index "spree_variants", ["product_id"], :name => "index_variants_on_product_id" From 1ead1dadaf5149ad840224f9a0cbd6769ff3cd9c Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 7 Feb 2013 15:58:15 +1100 Subject: [PATCH 10/25] Upgrade database to Spree 1.3 --- Gemfile | 6 +- Gemfile.lock | 64 +-- .../20130207043541_spree_one_two.spree.rb | 482 ++++++++++++++++++ ..._remove_unused_preference_columns.spree.rb | 9 + ..._add_states_required_to_countries.spree.rb | 6 + ..._on_demand_to_product_and_variant.spree.rb | 7 + ...043545_split_prices_from_variants.spree.rb | 32 ++ ...not_null_from_spree_prices_amount.spree.rb | 10 + ...043547_add_currency_to_line_items.spree.rb | 6 + ...0207043548_add_currency_to_orders.spree.rb | 6 + ...549_add_cost_currency_to_variants.spree.rb | 6 + ...43551_add_last_ip_to_spree_orders.spree.rb | 6 + ...splay_on_to_spree_payment_methods.spree.rb | 10 + ...dd_position_to_product_properties.spree.rb | 7 + ...54_add_api_key_to_spree_users.spree_api.rb | 8 + ...7043555_spree_promo_one_two.spree_promo.rb | 46 ++ db/schema.rb | 29 +- 17 files changed, 700 insertions(+), 40 deletions(-) create mode 100644 db/migrate/20130207043541_spree_one_two.spree.rb create mode 100644 db/migrate/20130207043542_remove_unused_preference_columns.spree.rb create mode 100644 db/migrate/20130207043543_add_states_required_to_countries.spree.rb create mode 100644 db/migrate/20130207043544_add_on_demand_to_product_and_variant.spree.rb create mode 100644 db/migrate/20130207043545_split_prices_from_variants.spree.rb create mode 100644 db/migrate/20130207043546_remove_not_null_from_spree_prices_amount.spree.rb create mode 100644 db/migrate/20130207043547_add_currency_to_line_items.spree.rb create mode 100644 db/migrate/20130207043548_add_currency_to_orders.spree.rb create mode 100644 db/migrate/20130207043549_add_cost_currency_to_variants.spree.rb create mode 100644 db/migrate/20130207043551_add_last_ip_to_spree_orders.spree.rb create mode 100644 db/migrate/20130207043552_add_display_on_to_spree_payment_methods.spree.rb create mode 100644 db/migrate/20130207043553_add_position_to_product_properties.spree.rb create mode 100644 db/migrate/20130207043554_add_api_key_to_spree_users.spree_api.rb create mode 100644 db/migrate/20130207043555_spree_promo_one_two.spree_promo.rb diff --git a/Gemfile b/Gemfile index a55c5cf3e4..aaae276efe 100644 --- a/Gemfile +++ b/Gemfile @@ -4,11 +4,11 @@ ruby "1.9.3" gem 'rails', '3.2.11' gem 'pg' -gem 'spree', :git => 'git://github.com/spree/spree.git', :branch => '1-2-stable' +gem 'spree', :git => 'git://github.com/spree/spree.git', :branch => '1-3-stable' gem 'spree_i18n', :git => 'git://github.com/spree/spree_i18n.git' -gem 'spree_paypal_express', :git => 'git://github.com/spree/spree_paypal_express.git', :branch => '1-2-stable' +gem 'spree_paypal_express', :git => 'git://github.com/spree/spree_paypal_express.git', :branch => '1-3-stable' gem 'spree_last_address', :git => 'git://github.com/dancinglightning/spree-last-address.git' -gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '1-2-stable' +gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '1-3-stable' gem 'comfortable_mexican_sofa' diff --git a/Gemfile.lock b/Gemfile.lock index 9eb8840235..ea20e69f92 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -23,47 +23,47 @@ GIT GIT remote: git://github.com/spree/spree.git - revision: 42a98e2299e54b8d5ff73a047926612c816a6934 - branch: 1-2-stable + revision: 36a59eb311470a2c24b9aa826ecad114c518c01f + branch: 1-3-stable specs: - spree (1.2.4) - spree_api (= 1.2.4) - spree_cmd (= 1.2.4) - spree_core (= 1.2.4) - spree_dash (= 1.2.4) - spree_promo (= 1.2.4) - spree_sample (= 1.2.4) - spree_api (1.2.4) - spree_core (= 1.2.4) - spree_cmd (1.2.4) + spree (1.3.3.beta) + spree_api (= 1.3.3.beta) + spree_cmd (= 1.3.3.beta) + spree_core (= 1.3.3.beta) + spree_dash (= 1.3.3.beta) + spree_promo (= 1.3.3.beta) + spree_sample (= 1.3.3.beta) + spree_api (1.3.3.beta) + spree_core (= 1.3.3.beta) + versioncake (= 0.4.0) + spree_cmd (1.3.3.beta) thor (>= 0.14.6) - spree_core (1.2.4) + spree_core (1.3.3.beta) activemerchant (~> 1.29.3) acts_as_list (= 0.1.4) awesome_nested_set (= 2.1.5) aws-sdk (~> 1.3.4) - cancan (= 1.6.7) + cancan (= 1.6.8) deface (>= 0.9.0) ffaker (~> 1.12.0) highline (= 1.6.11) - jquery-rails (~> 2.1.4) + jquery-rails (~> 2.2.0) kaminari (= 0.13.0) money (= 5.0.0) paperclip (~> 2.8) rabl (= 0.7.2) rails (~> 3.2.11) ransack (~> 0.7.2) - select2-rails (~> 3.0) select2-rails (~> 3.2) state_machine (= 1.1.2) stringex (~> 1.3.2) - spree_dash (1.2.4) + spree_dash (1.3.3.beta) httparty (~> 0.8.1) - spree_core (= 1.2.4) - spree_promo (1.2.4) - spree_core (= 1.2.4) - spree_sample (1.2.4) - spree_core (= 1.2.4) + spree_core (= 1.3.3.beta) + spree_promo (1.3.3.beta) + spree_core (= 1.3.3.beta) + spree_sample (1.3.3.beta) + spree_core (= 1.3.3.beta) GIT remote: git://github.com/spree/spree_i18n.git @@ -75,18 +75,18 @@ GIT GIT remote: git://github.com/spree/spree_paypal_express.git - revision: 524009008727ef2a4ad8f00baa2499ee47460a3b - branch: 1-2-stable + revision: 483f6ababa9c8a1c574aad0a948c96cc21a591db + branch: 1-3-stable specs: spree_paypal_express (1.2.0) - spree_core (~> 1.2) + spree_core (~> 1.3.0) GIT remote: https://github.com/spree/spree_auth_devise.git - revision: 077029cedd48570e4423ba2d99f0fa38300f70ea - branch: 1-2-stable + revision: ab03a7a22740b52f96bf0311a1e9f18a99ee02f2 + branch: 1-3-stable specs: - spree_auth_devise (1.2.0) + spree_auth_devise (1.0.0) cancan (~> 1.6.7) devise (~> 2.2.3) devise-encryptable (= 0.1.1) @@ -152,7 +152,7 @@ GEM httparty (>= 0.5, < 1.0) multi_json (~> 1.0) builder (3.0.4) - cancan (1.6.7) + cancan (1.6.8) capybara (2.0.2) mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -218,7 +218,7 @@ GEM multi_xml i18n (0.6.1) journey (1.0.4) - jquery-rails (2.1.4) + jquery-rails (2.2.0) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.7.6) @@ -361,6 +361,10 @@ GEM rack raindrops (~> 0.7) uuidtools (2.1.3) + versioncake (0.4.0) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) warden (1.2.1) rack (>= 1.0) websocket (1.0.6) diff --git a/db/migrate/20130207043541_spree_one_two.spree.rb b/db/migrate/20130207043541_spree_one_two.spree.rb new file mode 100644 index 0000000000..ad81bfeabe --- /dev/null +++ b/db/migrate/20130207043541_spree_one_two.spree.rb @@ -0,0 +1,482 @@ +# This migration comes from spree (originally 20120831092320) +class SpreeOneTwo < ActiveRecord::Migration + def up + # This migration is just a compressed version of all the previous + # migrations for spree_core. Do not run it if one of the core tables + # already exists. Assume the best. + return if table_exists?(:spree_addresses) + + + create_table :spree_activators do |t| + t.string :description + t.datetime :expires_at + t.datetime :starts_at + t.string :name + t.string :event_name + t.string :type + t.integer :usage_limit + t.string :match_policy, :default => 'all' + t.string :code + t.boolean :advertise, :default => false + t.string :path + t.timestamps + end + + create_table :spree_addresses do |t| + t.string :firstname + t.string :lastname + t.string :address1 + t.string :address2 + t.string :city + t.string :zipcode + t.string :phone + t.string :state_name + t.string :alternative_phone + t.string :company + t.references :state + t.references :country + t.timestamps + end + + add_index :spree_addresses, [:firstname], :name => 'index_addresses_on_firstname' + add_index :spree_addresses, [:lastname], :name => 'index_addresses_on_lastname' + + create_table :spree_adjustments do |t| + t.references :source, :polymorphic => true + t.references :adjustable, :polymorphic => true + t.references :originator, :polymorphic => true + t.decimal :amount, :precision => 8, :scale => 2 + t.string :label + t.boolean :mandatory + t.boolean :locked + t.boolean :eligible, :default => true + t.timestamps + end + + add_index :spree_adjustments, [:adjustable_id], :name => 'index_adjustments_on_order_id' + + create_table :spree_assets do |t| + t.references :viewable, :polymorphic => true + t.integer :attachment_width + t.integer :attachment_height + t.integer :attachment_file_size + t.integer :position + t.string :attachment_content_type + t.string :attachment_file_name + t.string :type, :limit => 75 + t.datetime :attachment_updated_at + t.text :alt + end + + add_index :spree_assets, [:viewable_id], :name => 'index_assets_on_viewable_id' + add_index :spree_assets, [:viewable_type, :type], :name => 'index_assets_on_viewable_type_and_type' + + create_table :spree_calculators do |t| + t.string :type + t.references :calculable, :polymorphic => true + t.timestamps + end + + create_table :spree_configurations do |t| + t.string :name + t.string :type, :limit => 50 + t.timestamps + end + + add_index :spree_configurations, [:name, :type], :name => 'index_spree_configurations_on_name_and_type' + + create_table :spree_countries do |t| + t.string :iso_name + t.string :iso + t.string :iso3 + t.string :name + t.integer :numcode + end + + create_table :spree_credit_cards do |t| + t.string :month + t.string :year + t.string :cc_type + t.string :last_digits + t.string :first_name + t.string :last_name + t.string :start_month + t.string :start_year + t.string :issue_number + t.references :address + t.string :gateway_customer_profile_id + t.string :gateway_payment_profile_id + t.timestamps + end + + create_table :spree_gateways do |t| + t.string :type + t.string :name + t.text :description + t.boolean :active, :default => true + t.string :environment, :default => 'development' + t.string :server, :default => 'test' + t.boolean :test_mode, :default => true + t.timestamps + end + + create_table :spree_inventory_units do |t| + t.integer :lock_version, :default => 0 + t.string :state + t.references :variant + t.references :order + t.references :shipment + t.references :return_authorization + t.timestamps + end + + add_index :spree_inventory_units, [:order_id], :name => 'index_inventory_units_on_order_id' + add_index :spree_inventory_units, [:shipment_id], :name => 'index_inventory_units_on_shipment_id' + add_index :spree_inventory_units, [:variant_id], :name => 'index_inventory_units_on_variant_id' + + create_table :spree_line_items do |t| + t.references :variant + t.references :order + t.integer :quantity, :null => false + t.decimal :price, :precision => 8, :scale => 2, :null => false + t.timestamps + end + + add_index :spree_line_items, [:order_id], :name => 'index_spree_line_items_on_order_id' + add_index :spree_line_items, [:variant_id], :name => 'index_spree_line_items_on_variant_id' + + create_table :spree_log_entries do |t| + t.references :source, :polymorphic => true + t.text :details + t.timestamps + end + + create_table :spree_mail_methods do |t| + t.string :environment + t.boolean :active, :default => true + t.timestamps + end + + create_table :spree_option_types do |t| + t.string :name, :limit => 100 + t.string :presentation, :limit => 100 + t.integer :position, :default => 0, :null => false + t.timestamps + end + + create_table :spree_option_types_prototypes, :id => false do |t| + t.references :prototype + t.references :option_type + end + + create_table :spree_option_values do |t| + t.integer :position + t.string :name + t.string :presentation + t.references :option_type + t.timestamps + end + + create_table :spree_option_values_variants, :id => false do |t| + t.references :variant + t.references :option_value + end + + add_index :spree_option_values_variants, [:variant_id, :option_value_id], :name => 'index_option_values_variants_on_variant_id_and_option_value_id' + add_index :spree_option_values_variants, [:variant_id], :name => 'index_spree_option_values_variants_on_variant_id' + + create_table :spree_orders do |t| + t.string :number, :limit => 15 + t.decimal :item_total, :precision => 8, :scale => 2, :default => 0.0, :null => false + t.decimal :total, :precision => 8, :scale => 2, :default => 0.0, :null => false + t.string :state + t.decimal :adjustment_total, :precision => 8, :scale => 2, :default => 0.0, :null => false + t.references :user + t.datetime :completed_at + t.references :bill_address + t.references :ship_address + t.decimal :payment_total, :precision => 8, :scale => 2, :default => 0.0 + t.references :shipping_method + t.string :shipment_state + t.string :payment_state + t.string :email + t.text :special_instructions + t.timestamps + end + + add_index :spree_orders, [:number], :name => 'index_spree_orders_on_number' + + create_table :spree_payment_methods do |t| + t.string :type + t.string :name + t.text :description + t.boolean :active, :default => true + t.string :environment, :default => 'development' + t.datetime :deleted_at + t.string :display_on + t.timestamps + end + + create_table :spree_payments do |t| + t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false + t.references :order + t.references :source, :polymorphic => true + t.references :payment_method + t.string :state + t.string :response_code + t.string :avs_response + t.timestamps + end + + create_table :spree_preferences do |t| + t.string :name, :limit => 100 + t.references :owner, :polymorphic => true + t.text :value + t.string :key + t.string :value_type + t.timestamps + end + + add_index :spree_preferences, [:key], :name => 'index_spree_preferences_on_key', :unique => true + + create_table :spree_product_option_types do |t| + t.integer :position + t.references :product + t.references :option_type + t.timestamps + end + + create_table :spree_product_properties do |t| + t.string :value + t.references :product + t.references :property + t.timestamps + end + + add_index :spree_product_properties, [:product_id], :name => 'index_product_properties_on_product_id' + + create_table :spree_products do |t| + t.string :name, :default => '', :null => false + t.text :description + t.datetime :available_on + t.datetime :deleted_at + t.string :permalink + t.string :meta_description + t.string :meta_keywords + t.references :tax_category + t.references :shipping_category + t.integer :count_on_hand, :default => 0, :null => false + t.timestamps + end + + add_index :spree_products, [:available_on], :name => 'index_spree_products_on_available_on' + add_index :spree_products, [:deleted_at], :name => 'index_spree_products_on_deleted_at' + add_index :spree_products, [:name], :name => 'index_spree_products_on_name' + add_index :spree_products, [:permalink], :name => 'index_spree_products_on_permalink' + + create_table :spree_products_taxons, :id => false do |t| + t.references :product + t.references :taxon + end + + add_index :spree_products_taxons, [:product_id], :name => 'index_spree_products_taxons_on_product_id' + add_index :spree_products_taxons, [:taxon_id], :name => 'index_spree_products_taxons_on_taxon_id' + + create_table :spree_properties do |t| + t.string :name + t.string :presentation, :null => false + t.timestamps + end + + create_table :spree_properties_prototypes, :id => false do |t| + t.references :prototype + t.references :property + end + + create_table :spree_prototypes do |t| + t.string :name + t.timestamps + end + + create_table :spree_return_authorizations do |t| + t.string :number + t.string :state + t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false + t.references :order + t.text :reason + t.timestamps + end + + create_table :spree_roles do |t| + t.string :name + end + + create_table :spree_roles_users, :id => false do |t| + t.references :role + t.references :user + end + + add_index :spree_roles_users, [:role_id], :name => 'index_spree_roles_users_on_role_id' + add_index :spree_roles_users, [:user_id], :name => 'index_spree_roles_users_on_user_id' + + create_table :spree_shipments do |t| + t.string :tracking + t.string :number + t.decimal :cost, :precision => 8, :scale => 2 + t.datetime :shipped_at + t.references :order + t.references :shipping_method + t.references :address + t.string :state + t.timestamps + end + + add_index :spree_shipments, [:number], :name => 'index_shipments_on_number' + + create_table :spree_shipping_categories do |t| + t.string :name + t.timestamps + end + + create_table :spree_shipping_methods do |t| + t.string :name + t.references :zone + t.string :display_on + t.references :shipping_category + t.boolean :match_none + t.boolean :match_all + t.boolean :match_one + t.datetime :deleted_at + t.timestamps + end + + create_table :spree_state_changes do |t| + t.string :name + t.string :previous_state + t.references :stateful + t.references :user + t.string :stateful_type + t.string :next_state + t.timestamps + end + + create_table :spree_states do |t| + t.string :name + t.string :abbr + t.references :country + end + + create_table :spree_tax_categories do |t| + t.string :name + t.string :description + t.boolean :is_default, :default => false + t.datetime :deleted_at + t.timestamps + end + + create_table :spree_tax_rates do |t| + t.decimal :amount, :precision => 8, :scale => 5 + t.references :zone + t.references :tax_category + t.boolean :included_in_price, :default => false + t.timestamps + end + + create_table :spree_taxonomies do |t| + t.string :name, :null => false + t.timestamps + end + + create_table :spree_taxons do |t| + t.references :parent + t.integer :position, :default => 0 + t.string :name, :null => false + t.string :permalink + t.references :taxonomy + t.integer :lft + t.integer :rgt + t.string :icon_file_name + t.string :icon_content_type + t.integer :icon_file_size + t.datetime :icon_updated_at + t.text :description + t.timestamps + end + + add_index :spree_taxons, [:parent_id], :name => 'index_taxons_on_parent_id' + add_index :spree_taxons, [:permalink], :name => 'index_taxons_on_permalink' + add_index :spree_taxons, [:taxonomy_id], :name => 'index_taxons_on_taxonomy_id' + + create_table :spree_tokenized_permissions, :force => true do |t| + t.references :permissable, :polymorphic => true + t.string :token + t.timestamps + end + + add_index :spree_tokenized_permissions, [:permissable_id, :permissable_type], :name => 'index_tokenized_name_and_type' + + create_table :spree_trackers do |t| + t.string :environment + t.string :analytics_id + t.boolean :active, :default => true + t.timestamps + end + + create_table :spree_users do |t| + t.string :encrypted_password, :limit => 128 + t.string :password_salt, :limit => 128 + t.string :email + t.string :remember_token + t.string :persistence_token + t.string :reset_password_token + t.string :perishable_token + t.integer :sign_in_count, :default => 0, :null => false + t.integer :failed_attempts, :default => 0, :null => false + t.datetime :last_request_at + t.datetime :current_sign_in_at + t.datetime :last_sign_in_at + t.string :current_sign_in_ip + t.string :last_sign_in_ip + t.string :login + t.references :ship_address + t.references :bill_address + t.string :authentication_token + t.string :unlock_token + t.datetime :locked_at + t.datetime :remember_created_at + t.datetime :reset_password_sent_at + t.timestamps + end + + create_table :spree_variants do |t| + t.string :sku, :default => '', :null => false + t.decimal :price, :precision => 8, :scale => 2, :null => false + t.decimal :weight, :precision => 8, :scale => 2 + t.decimal :height, :precision => 8, :scale => 2 + t.decimal :width, :precision => 8, :scale => 2 + t.decimal :depth, :precision => 8, :scale => 2 + t.datetime :deleted_at + t.boolean :is_master, :default => false + t.references :product + t.integer :count_on_hand, :default => 0, :null => false + t.decimal :cost_price, :precision => 8, :scale => 2 + t.integer :position + end + + add_index :spree_variants, [:product_id], :name => 'index_spree_variants_on_product_id' + + create_table :spree_zone_members do |t| + t.references :zoneable, :polymorphic => true + t.references :zone + t.timestamps + end + + create_table :spree_zones do |t| + t.string :name + t.string :description + t.boolean :default_tax, :default => false + t.integer :zone_members_count, :default => 0 + t.timestamps + end + end +end diff --git a/db/migrate/20130207043542_remove_unused_preference_columns.spree.rb b/db/migrate/20130207043542_remove_unused_preference_columns.spree.rb new file mode 100644 index 0000000000..6c049daa22 --- /dev/null +++ b/db/migrate/20130207043542_remove_unused_preference_columns.spree.rb @@ -0,0 +1,9 @@ +# This migration comes from spree (originally 20120929093553) +class RemoveUnusedPreferenceColumns < ActiveRecord::Migration + def change + # Columns have already been removed if the application was upgraded from an older version, but must be removed from new apps. + remove_column :spree_preferences, :name if ActiveRecord::Base.connection.column_exists?(:spree_preferences, :name) + remove_column :spree_preferences, :owner_id if ActiveRecord::Base.connection.column_exists?(:spree_preferences, :owner_id) + remove_column :spree_preferences, :owner_type if ActiveRecord::Base.connection.column_exists?(:spree_preferences, :owner_type) + end +end diff --git a/db/migrate/20130207043543_add_states_required_to_countries.spree.rb b/db/migrate/20130207043543_add_states_required_to_countries.spree.rb new file mode 100644 index 0000000000..415001d170 --- /dev/null +++ b/db/migrate/20130207043543_add_states_required_to_countries.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20121010142909) +class AddStatesRequiredToCountries < ActiveRecord::Migration + def change + add_column :spree_countries, :states_required, :boolean,:default => true + end +end diff --git a/db/migrate/20130207043544_add_on_demand_to_product_and_variant.spree.rb b/db/migrate/20130207043544_add_on_demand_to_product_and_variant.spree.rb new file mode 100644 index 0000000000..ba258ebf26 --- /dev/null +++ b/db/migrate/20130207043544_add_on_demand_to_product_and_variant.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20121012071449) +class AddOnDemandToProductAndVariant < ActiveRecord::Migration + def change + add_column :spree_products, :on_demand, :boolean, :default => false + add_column :spree_variants, :on_demand, :boolean, :default => false + end +end diff --git a/db/migrate/20130207043545_split_prices_from_variants.spree.rb b/db/migrate/20130207043545_split_prices_from_variants.spree.rb new file mode 100644 index 0000000000..f22753470f --- /dev/null +++ b/db/migrate/20130207043545_split_prices_from_variants.spree.rb @@ -0,0 +1,32 @@ +# This migration comes from spree (originally 20121031162139) +class SplitPricesFromVariants < ActiveRecord::Migration + def up + create_table :spree_prices do |t| + t.integer :variant_id, :null => false + t.decimal :amount, :precision => 8, :scale => 2, :null => false + t.string :currency + end + + Spree::Variant.all.each do |variant| + Spree::Price.create!( + :variant_id => variant.id, + :amount => variant[:price], + :currency => Spree::Config[:currency] + ) + end + + remove_column :spree_variants, :price + end + + def down + prices = ActiveRecord::Base.connection.execute("select variant_id, amount from spree_prices") + add_column :spree_variants, :price, :decimal, :after => :sku, :scale => 2, :precision => 8 + + prices.each do |price| + ActiveRecord::Base.connection.execute("update spree_variants set price = #{price['amount']} where id = #{price['variant_id']}") + end + + change_column :spree_variants, :price, :decimal, :after => :sku, :scale => 2, :precision => 8, :null => false + drop_table :spree_prices + end +end diff --git a/db/migrate/20130207043546_remove_not_null_from_spree_prices_amount.spree.rb b/db/migrate/20130207043546_remove_not_null_from_spree_prices_amount.spree.rb new file mode 100644 index 0000000000..beb5f7a85f --- /dev/null +++ b/db/migrate/20130207043546_remove_not_null_from_spree_prices_amount.spree.rb @@ -0,0 +1,10 @@ +# This migration comes from spree (originally 20121107003422) +class RemoveNotNullFromSpreePricesAmount < ActiveRecord::Migration + def up + change_column :spree_prices, :amount, :decimal, :precision => 8, :scale => 2, :null => true + end + + def down + change_column :spree_prices, :amount, :decimal, :precision => 8, :scale => 2, :null => false + end +end diff --git a/db/migrate/20130207043547_add_currency_to_line_items.spree.rb b/db/migrate/20130207043547_add_currency_to_line_items.spree.rb new file mode 100644 index 0000000000..b0732ee630 --- /dev/null +++ b/db/migrate/20130207043547_add_currency_to_line_items.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20121107184631) +class AddCurrencyToLineItems < ActiveRecord::Migration + def change + add_column :spree_line_items, :currency, :string + end +end diff --git a/db/migrate/20130207043548_add_currency_to_orders.spree.rb b/db/migrate/20130207043548_add_currency_to_orders.spree.rb new file mode 100644 index 0000000000..d84bc3b7cc --- /dev/null +++ b/db/migrate/20130207043548_add_currency_to_orders.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20121107194006) +class AddCurrencyToOrders < ActiveRecord::Migration + def change + add_column :spree_orders, :currency, :string + end +end diff --git a/db/migrate/20130207043549_add_cost_currency_to_variants.spree.rb b/db/migrate/20130207043549_add_cost_currency_to_variants.spree.rb new file mode 100644 index 0000000000..a31b96499d --- /dev/null +++ b/db/migrate/20130207043549_add_cost_currency_to_variants.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20121109173623) +class AddCostCurrencyToVariants < ActiveRecord::Migration + def change + add_column :spree_variants, :cost_currency, :string, :after => :cost_price + end +end diff --git a/db/migrate/20130207043551_add_last_ip_to_spree_orders.spree.rb b/db/migrate/20130207043551_add_last_ip_to_spree_orders.spree.rb new file mode 100644 index 0000000000..e85fc41ffe --- /dev/null +++ b/db/migrate/20130207043551_add_last_ip_to_spree_orders.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20121126040517) +class AddLastIpToSpreeOrders < ActiveRecord::Migration + def change + add_column :spree_orders, :last_ip_address, :string + end +end diff --git a/db/migrate/20130207043552_add_display_on_to_spree_payment_methods.spree.rb b/db/migrate/20130207043552_add_display_on_to_spree_payment_methods.spree.rb new file mode 100644 index 0000000000..240870bbb6 --- /dev/null +++ b/db/migrate/20130207043552_add_display_on_to_spree_payment_methods.spree.rb @@ -0,0 +1,10 @@ +# This migration comes from spree (originally 20130114053446) +class AddDisplayOnToSpreePaymentMethods < ActiveRecord::Migration + def self.up + add_column :spree_payment_methods, :display_on, :string + end + + def self.down + remove_column :spree_payment_methods, :display_on + end +end diff --git a/db/migrate/20130207043553_add_position_to_product_properties.spree.rb b/db/migrate/20130207043553_add_position_to_product_properties.spree.rb new file mode 100644 index 0000000000..93da5d87b1 --- /dev/null +++ b/db/migrate/20130207043553_add_position_to_product_properties.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20130120201805) +class AddPositionToProductProperties < ActiveRecord::Migration + def change + add_column :spree_product_properties, :position, :integer, :default => 0 + end +end + diff --git a/db/migrate/20130207043554_add_api_key_to_spree_users.spree_api.rb b/db/migrate/20130207043554_add_api_key_to_spree_users.spree_api.rb new file mode 100644 index 0000000000..b9e3fe3884 --- /dev/null +++ b/db/migrate/20130207043554_add_api_key_to_spree_users.spree_api.rb @@ -0,0 +1,8 @@ +# This migration comes from spree_api (originally 20100107141738) +class AddApiKeyToSpreeUsers < ActiveRecord::Migration + def change + unless defined?(User) + add_column :spree_users, :api_key, :string, :limit => 40 + end + end +end diff --git a/db/migrate/20130207043555_spree_promo_one_two.spree_promo.rb b/db/migrate/20130207043555_spree_promo_one_two.spree_promo.rb new file mode 100644 index 0000000000..7e808c800b --- /dev/null +++ b/db/migrate/20130207043555_spree_promo_one_two.spree_promo.rb @@ -0,0 +1,46 @@ +# This migration comes from spree_promo (originally 20120831092359) +class SpreePromoOneTwo < ActiveRecord::Migration + def up + # This migration is just a compressed migration for all previous versions of spree_promo + return if table_exists?(:spree_products_promotion_rules) + + create_table :spree_products_promotion_rules, :id => false, :force => true do |t| + t.references :product + t.references :promotion_rule + end + + add_index :spree_products_promotion_rules, [:product_id], :name => 'index_products_promotion_rules_on_product_id' + add_index :spree_products_promotion_rules, [:promotion_rule_id], :name => 'index_products_promotion_rules_on_promotion_rule_id' + + create_table :spree_promotion_action_line_items, :force => true do |t| + t.references :promotion_action + t.references :variant + t.integer :quantity, :default => 1 + end + + create_table :spree_promotion_actions, :force => true do |t| + t.references :activator + t.integer :position + t.string :type + end + + create_table :spree_promotion_rules, :force => true do |t| + t.references :activator + t.references :user + t.references :product_group + t.string :type + t.timestamps + end + + add_index :spree_promotion_rules, [:product_group_id], :name => 'index_promotion_rules_on_product_group_id' + add_index :spree_promotion_rules, [:user_id], :name => 'index_promotion_rules_on_user_id' + + create_table :spree_promotion_rules_users, :id => false, :force => true do |t| + t.references :user + t.references :promotion_rule + end + + add_index :spree_promotion_rules_users, [:promotion_rule_id], :name => 'index_promotion_rules_users_on_promotion_rule_id' + add_index :spree_promotion_rules_users, [:user_id], :name => 'index_promotion_rules_users_on_user_id' + end +end diff --git a/db/schema.rb b/db/schema.rb index f0bdd176bc..a35dd39545 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 => 20130207043047) do +ActiveRecord::Schema.define(:version => 20130207043555) do create_table "cms_blocks", :force => true do |t| t.integer "page_id", :null => false @@ -296,6 +296,7 @@ ActiveRecord::Schema.define(:version => 20130207043047) do t.string "iso3" t.string "name" t.integer "numcode" + t.boolean "states_required", :default => true end create_table "spree_credit_cards", :force => true do |t| @@ -351,6 +352,7 @@ ActiveRecord::Schema.define(:version => 20130207043047) do t.datetime "updated_at", :null => false t.integer "max_quantity" t.integer "shipping_method_id" + t.string "currency" end add_index "spree_line_items", ["order_id"], :name => "index_line_items_on_order_id" @@ -420,6 +422,8 @@ ActiveRecord::Schema.define(:version => 20130207043047) do t.string "email" t.text "special_instructions" t.integer "distributor_id" + t.string "currency" + t.string "last_ip_address" end add_index "spree_orders", ["number"], :name => "index_orders_on_number" @@ -433,6 +437,7 @@ ActiveRecord::Schema.define(:version => 20130207043047) do t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.datetime "deleted_at" + t.string "display_on" end create_table "spree_payments", :force => true do |t| @@ -474,6 +479,12 @@ ActiveRecord::Schema.define(:version => 20130207043047) do add_index "spree_preferences", ["key"], :name => "index_spree_preferences_on_key", :unique => true + create_table "spree_prices", :force => true do |t| + t.integer "variant_id", :null => false + t.decimal "amount", :precision => 8, :scale => 2 + t.string "currency" + end + create_table "spree_product_groups", :force => true do |t| t.string "name" t.string "permalink" @@ -500,8 +511,9 @@ ActiveRecord::Schema.define(:version => 20130207043047) do t.string "value" t.integer "product_id" t.integer "property_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "position", :default => 0 end add_index "spree_product_properties", ["product_id"], :name => "index_product_properties_on_product_id" @@ -516,7 +528,7 @@ ActiveRecord::Schema.define(:version => 20130207043047) do add_index "spree_product_scopes", ["product_group_id"], :name => "index_product_scopes_on_product_group_id" create_table "spree_products", :force => true do |t| - t.string "name", :default => "", :null => false + t.string "name", :default => "", :null => false t.text "description" t.datetime "available_on" t.datetime "deleted_at" @@ -525,12 +537,13 @@ ActiveRecord::Schema.define(:version => 20130207043047) do t.string "meta_keywords" t.integer "tax_category_id" t.integer "shipping_category_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "count_on_hand", :default => 0 t.integer "supplier_id" t.boolean "group_buy" t.float "group_buy_unit_size" + t.boolean "on_demand", :default => false end add_index "spree_products", ["available_on"], :name => "index_products_on_available_on" @@ -780,6 +793,7 @@ ActiveRecord::Schema.define(:version => 20130207043047) do t.datetime "remember_created_at" t.string "spree_api_key", :limit => 48 t.datetime "reset_password_sent_at" + t.string "api_key", :limit => 40 end add_index "spree_users", ["email"], :name => "email_idx_unique", :unique => true @@ -797,8 +811,9 @@ ActiveRecord::Schema.define(:version => 20130207043047) do t.integer "count_on_hand", :default => 0 t.decimal "cost_price", :precision => 8, :scale => 2 t.integer "position" - t.decimal "price", :precision => 8, :scale => 2, :null => false t.integer "lock_version", :default => 0 + t.boolean "on_demand", :default => false + t.string "cost_currency" end add_index "spree_variants", ["product_id"], :name => "index_variants_on_product_id" From c517469662608801aea46cb88b9d72eb333927cc Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 7 Feb 2013 22:54:07 +1100 Subject: [PATCH 11/25] Added down method to remove_display_on_from_payment_methods migration --- ...550_remove_display_on_from_payment_methods.spree.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 db/migrate/20130207043550_remove_display_on_from_payment_methods.spree.rb diff --git a/db/migrate/20130207043550_remove_display_on_from_payment_methods.spree.rb b/db/migrate/20130207043550_remove_display_on_from_payment_methods.spree.rb new file mode 100644 index 0000000000..a763d823e9 --- /dev/null +++ b/db/migrate/20130207043550_remove_display_on_from_payment_methods.spree.rb @@ -0,0 +1,10 @@ +# This migration comes from spree (originally 20121111231553) +class RemoveDisplayOnFromPaymentMethods < ActiveRecord::Migration + def up + remove_column :spree_payment_methods, :display_on + end + + def down + add_column :spree_payment_methods, :display_on, :string + end +end From 1d4fbe865b61326839306417b1499135fb45b166 Mon Sep 17 00:00:00 2001 From: Rob H Date: Sat, 9 Feb 2013 00:40:34 +1100 Subject: [PATCH 12/25] Finished revision of defaces --- app/overrides/order_item_description.rb | 3 ++- app/overrides/replace_order_details_steps_data.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/overrides/order_item_description.rb b/app/overrides/order_item_description.rb index ae1a28ecd2..4ec1f83a24 100644 --- a/app/overrides/order_item_description.rb +++ b/app/overrides/order_item_description.rb @@ -1,4 +1,5 @@ Deface::Override.new(:virtual_path => "spree/shared/_order_details", :replace => "[data-hook='order_item_description']", :partial => "spree/orders/order_item_description", - :name => "order_item_description") \ No newline at end of file + :name => "order_item_description", + :original => '1729abc5f441607b09cc0d44843a8dfd660ac5e0') \ No newline at end of file diff --git a/app/overrides/replace_order_details_steps_data.rb b/app/overrides/replace_order_details_steps_data.rb index 10b307cd1c..fe5f4cc8b4 100644 --- a/app/overrides/replace_order_details_steps_data.rb +++ b/app/overrides/replace_order_details_steps_data.rb @@ -1,4 +1,5 @@ Deface::Override.new(:virtual_path => "spree/shared/_order_details", :replace => "div.row.steps-data", :partial => "spree/shared/order_details_steps_data", - :name => "order_details_steps_data") \ No newline at end of file + :name => "replace_order_details_steps_data", + :original => '1a68aa5db3fee7f7bbb2b6b826749aeb69168cee') \ No newline at end of file From a3746c6c5948caf11a27abd0a227883616ddb412 Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 14 Feb 2013 12:10:31 +1100 Subject: [PATCH 13/25] Add analytics helper to Enterprises Controller --- app/controllers/enterprises_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rb index 9e66072564..a582d0e6c0 100644 --- a/app/controllers/enterprises_controller.rb +++ b/app/controllers/enterprises_controller.rb @@ -1,5 +1,7 @@ include Spree::ProductsHelper class EnterprisesController < BaseController + helper Spree::AnalyticsHelper + def index @enterprises = Enterprise.all end From d7c2bdfe229b7e597cdf97b1b672d14bd3482abf Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 14 Feb 2013 12:12:19 +1100 Subject: [PATCH 14/25] Change reference to method 'has_role' to 'has_spree_role' in CMS initialiser (required for Spree 1.3) --- config/initializers/comfortable_mexican_sofa.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/comfortable_mexican_sofa.rb b/config/initializers/comfortable_mexican_sofa.rb index ee69720dac..46dd0ad0a6 100644 --- a/config/initializers/comfortable_mexican_sofa.rb +++ b/config/initializers/comfortable_mexican_sofa.rb @@ -108,7 +108,7 @@ end module CmsSpreeAuth def authenticate - unless current_user && current_user.has_role?('admin') + unless current_user && current_user.has_spree_role?('admin') redirect_to spree.login_path end end From b924b0c817ed77bae63d35efdb0890a586ac80a0 Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 14 Feb 2013 12:24:01 +1100 Subject: [PATCH 15/25] Remove unnecessary include of Spree::Core::CurrentOrder (helper is now accessible by all controllers in Spree 1.3) --- .../enterprises_controller_spec.rb | 3 -- spec/controllers/orders_controller_spec.rb | 29 +++++++++---------- spec/support/spree/init.rb | 9 ++++++ 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/spec/controllers/enterprises_controller_spec.rb b/spec/controllers/enterprises_controller_spec.rb index a5709d3a74..6e45d4a58f 100644 --- a/spec/controllers/enterprises_controller_spec.rb +++ b/spec/controllers/enterprises_controller_spec.rb @@ -1,9 +1,6 @@ require 'spec_helper' -require 'spree/core/current_order' describe EnterprisesController do - include Spree::Core::CurrentOrder - before :each do stub!(:before_save_new_order) stub!(:after_save_new_order) diff --git a/spec/controllers/orders_controller_spec.rb b/spec/controllers/orders_controller_spec.rb index 440bf8fcbf..b8b2f51cad 100644 --- a/spec/controllers/orders_controller_spec.rb +++ b/spec/controllers/orders_controller_spec.rb @@ -1,9 +1,6 @@ require 'spec_helper' -require 'spree/core/current_order' describe Spree::OrdersController do - include Spree::Core::CurrentOrder - def current_user controller.current_user end @@ -15,7 +12,7 @@ describe Spree::OrdersController do spree_get :select_distributor, :id => d.id response.should be_redirect - order = current_order(false) + order = subject.current_order(false) order.distributor.should == d end @@ -23,7 +20,7 @@ describe Spree::OrdersController do d = create(:distributor_enterprise) p = create(:product, :distributors => [d]) - order = current_order(true) + order = subject.current_order(true) order.distributor = d order.save! @@ -59,7 +56,7 @@ describe Spree::OrdersController do distributor_no_product = create(:distributor_enterprise) p = create(:product, :distributors => [distributor_product]) - order = current_order(true) + order = subject.current_order(true) order.distributor = distributor_no_product order.save! @@ -79,7 +76,7 @@ describe Spree::OrdersController do spree_post :populate, :variants => {p.master.id => 1}, :distributor_id => d.id # Then our order should have its distributor set to the chosen distributor - current_order(false).distributor.should == d + subject.current_order(false).distributor.should == d end end @@ -91,8 +88,8 @@ describe Spree::OrdersController do # And the product is in the cart spree_post :populate, :variants => {@product.master.id => 1}, :distributor_id => @distributor.id - current_order(false).line_items.reload.map { |li| li.product }.should == [@product] - current_order(false).distributor.reload.should == @distributor + subject.current_order(false).line_items.reload.map { |li| li.product }.should == [@product] + subject.current_order(false).distributor.reload.should == @distributor end it "does not add the product if the product is not available at the order's distributor" do @@ -104,8 +101,8 @@ describe Spree::OrdersController do spree_post :populate, :variants => {p2.master.id => 1}, :distributor_id => d2.id # Then the product should not be added to the cart - current_order(false).line_items.reload.map { |li| li.product }.should == [@product] - current_order(false).distributor.reload.should == @distributor + subject.current_order(false).line_items.reload.map { |li| li.product }.should == [@product] + subject.current_order(false).distributor.reload.should == @distributor end it "does not add the product if the product is not available at the given distributor" do @@ -117,8 +114,8 @@ describe Spree::OrdersController do spree_post :populate, :variants => {p2.master.id => 1}, :distributor_id => @distributor.id # Then the product should not be added to the cart - current_order(false).line_items.reload.map { |li| li.product }.should == [@product] - current_order(false).distributor.reload.should == @distributor + subject.current_order(false).line_items.reload.map { |li| li.product }.should == [@product] + subject.current_order(false).distributor.reload.should == @distributor end it "does not add the product if the chosen distributor is different from the order's distributor" do @@ -130,8 +127,8 @@ describe Spree::OrdersController do spree_post :populate, :variants => {p2.master.id => 1}, :distributor_id => d2 # Then the product should not be added to the cart - current_order(false).line_items.reload.map { |li| li.product }.should == [@product] - current_order(false).distributor.reload.should == @distributor + subject.current_order(false).line_items.reload.map { |li| li.product }.should == [@product] + subject.current_order(false).distributor.reload.should == @distributor end end @@ -140,7 +137,7 @@ describe Spree::OrdersController do distributor_product = create(:distributor_enterprise) p = create(:product, :distributors => [distributor_product], :group_buy => true) - order = current_order(true) + order = subject.current_order(true) order.should_receive(:set_variant_attributes).with(p.master, {'max_quantity' => '3'}) controller.stub(:current_order).and_return(order) diff --git a/spec/support/spree/init.rb b/spec/support/spree/init.rb index 0614e5085b..e667b402c9 100644 --- a/spec/support/spree/init.rb +++ b/spec/support/spree/init.rb @@ -8,3 +8,12 @@ ProductDistribution.class_eval do self.shipping_method ||= Spree::ShippingMethod.first || FactoryGirl.create(:shipping_method) end end + +# Create a default shipping method, required when creating orders +Spree::Order.class_eval do + before_create :init_shipping_method + + def init_shipping_method + FactoryGirl.create(:itemwise_shipping_method) if Spree::ShippingMethod.where("display_on != 'back_end'").empty? + end +end \ No newline at end of file From 290f2276cd28417f917ff11ebf7f31fefca16729 Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 14 Feb 2013 14:03:14 +1100 Subject: [PATCH 16/25] Update cms_admin spec work after Spree 1.3 upgrade broke it --- spec/features/admin/cms_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/features/admin/cms_spec.rb b/spec/features/admin/cms_spec.rb index 0db46cd70b..8faa8c37fb 100644 --- a/spec/features/admin/cms_spec.rb +++ b/spec/features/admin/cms_spec.rb @@ -11,11 +11,12 @@ feature %q{ 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' - page.should have_selector 'h1', :text => 'Administration' + current_path.should == spree.admin_path end scenario "anonymous user can't access CMS admin" do From c956706d7844d65636d97d76320b9ef922ed2acf Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 14 Feb 2013 15:12:50 +1100 Subject: [PATCH 17/25] Move set_current_order override to new location in lib (Spree 1.3 Upgrade), and update home controller test --- .../spree/base_controller_decorator.rb | 25 ------------------- .../controller_helpers/order_decorator.rb | 20 +++++++++++++++ spec/controllers/home_controller_spec.rb | 8 +++--- 3 files changed, 24 insertions(+), 29 deletions(-) delete mode 100644 app/controllers/spree/base_controller_decorator.rb create mode 100644 lib/spree/core/controller_helpers/order_decorator.rb diff --git a/app/controllers/spree/base_controller_decorator.rb b/app/controllers/spree/base_controller_decorator.rb deleted file mode 100644 index f745df6582..0000000000 --- a/app/controllers/spree/base_controller_decorator.rb +++ /dev/null @@ -1,25 +0,0 @@ -module Spree - BaseController.class_eval do - - # Override definition in spree/auth/app/controllers/spree/base_controller_decorator.rb - # Do not attempt to merge incomplete and current orders when they have differing distributors - # Instead, destroy the incomplete orders, otherwise they are restored after checkout, causing much confusion - def set_current_order - if current_user - if current_user.respond_to?(:last_incomplete_order) - last_incomplete_order = current_user.last_incomplete_order - if session[:order_id].nil? && last_incomplete_order - session[:order_id] = last_incomplete_order.id - elsif current_order && last_incomplete_order && current_order != last_incomplete_order - if current_order.distributor.nil? || current_order.distributor == last_incomplete_order.distributor - current_order.set_distributor! last_incomplete_order.distributor if current_order.distributor.nil? - current_order.merge!(last_incomplete_order) - else - last_incomplete_order.destroy - end - end - end - end - end - end -end diff --git a/lib/spree/core/controller_helpers/order_decorator.rb b/lib/spree/core/controller_helpers/order_decorator.rb new file mode 100644 index 0000000000..5bc52358fe --- /dev/null +++ b/lib/spree/core/controller_helpers/order_decorator.rb @@ -0,0 +1,20 @@ +Spree::Core::ControllerHelpers::Order.class_eval do + # Override definition in spree/auth/app/controllers/spree/base_controller_decorator.rb + # Do not attempt to merge incomplete and current orders when they have differing distributors + # Instead, destroy the incomplete orders, otherwise they are restored after checkout, causing much confusion + def set_current_order + if user = try_spree_current_user + last_incomplete_order = user.last_incomplete_spree_order + if session[:order_id].nil? && last_incomplete_order + session[:order_id] = last_incomplete_order.id + elsif current_order && last_incomplete_order && current_order != last_incomplete_order + if current_order.distributor.nil? || current_order.distributor == last_incomplete_order.distributor + current_order.set_distributor! last_incomplete_order.distributor if current_order.distributor.nil? + current_order.merge!(last_incomplete_order) + else + last_incomplete_order.destroy + end + end + end + end +end \ No newline at end of file diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index b52dcae435..11569269fd 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -31,8 +31,8 @@ describe Spree::HomeController do incomplete_order = double(:order, distributor: 1) current_order = double(:order, distributor: 2) - user = double(:user, last_incomplete_order: incomplete_order) - controller.stub(:current_user).and_return(user) + user = double(:user, last_incomplete_spree_order: incomplete_order) + controller.stub(:try_spree_current_user).and_return(user) controller.stub(:current_order).and_return(current_order) incomplete_order.should_receive(:destroy) @@ -48,8 +48,8 @@ describe Spree::HomeController do incomplete_order = double(:order, distributor: 1) current_order = double(:order, distributor: nil) - user = double(:user, last_incomplete_order: incomplete_order) - controller.stub(:current_user).and_return(user) + user = double(:user, last_incomplete_spree_order: incomplete_order) + controller.stub(:try_spree_current_user).and_return(user) controller.stub(:current_order).and_return(current_order) current_order.should_receive(:set_distributor!).with(1) From 9e9199643ebf6c825bc6a4248cfd1ba887f2613c Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 14 Feb 2013 15:35:50 +1100 Subject: [PATCH 18/25] Remove unneeded :partial from override --- app/overrides/add_cms_admin_tab.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/overrides/add_cms_admin_tab.rb b/app/overrides/add_cms_admin_tab.rb index f0ed5691fd..f13d100502 100644 --- a/app/overrides/add_cms_admin_tab.rb +++ b/app/overrides/add_cms_admin_tab.rb @@ -2,5 +2,4 @@ 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 %>
  • ", - :partial => 'enterprise_fees/admin_configurations_menu', :original => '29e0ab9c171ffab1988cb439b5d42300b78fe088' ) From 2cdf458d6ae498a7c5f267a86dacbb7f22d928aa Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 14 Feb 2013 15:42:47 +1100 Subject: [PATCH 19/25] Move additional of tabs to main nav bar to defaces, rather than overriding view directly --- app/overrides/add_cms_tabs_to_main_nav_bar.rb | 5 +++++ .../add_current_distributor_to_main_nav_bar.rb | 5 +++++ app/views/spree/shared/_cms_tabs.html.haml | 3 +++ .../spree/shared/_current_distributor.html.haml | 4 ++++ app/views/spree/shared/_store_menu.html.haml | 14 -------------- 5 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 app/overrides/add_cms_tabs_to_main_nav_bar.rb create mode 100644 app/overrides/add_current_distributor_to_main_nav_bar.rb create mode 100644 app/views/spree/shared/_cms_tabs.html.haml create mode 100644 app/views/spree/shared/_current_distributor.html.haml delete mode 100644 app/views/spree/shared/_store_menu.html.haml diff --git a/app/overrides/add_cms_tabs_to_main_nav_bar.rb b/app/overrides/add_cms_tabs_to_main_nav_bar.rb new file mode 100644 index 0000000000..47d67141f7 --- /dev/null +++ b/app/overrides/add_cms_tabs_to_main_nav_bar.rb @@ -0,0 +1,5 @@ +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_current_distributor_to_main_nav_bar.rb b/app/overrides/add_current_distributor_to_main_nav_bar.rb new file mode 100644 index 0000000000..371b09247e --- /dev/null +++ b/app/overrides/add_current_distributor_to_main_nav_bar.rb @@ -0,0 +1,5 @@ +Deface::Override.new(:virtual_path => "spree/shared/_main_nav_bar", + :name => "add_current_distributor_to_main_nav_bar", + :insert_after => "li#link-to-cart", + :partial => "spree/shared/current_distributor", + :original => '0d843946b3a53643c5a7da90a3a21610208db866') \ No newline at end of file diff --git a/app/views/spree/shared/_cms_tabs.html.haml b/app/views/spree/shared/_cms_tabs.html.haml new file mode 100644 index 0000000000..1921e8cfac --- /dev/null +++ b/app/views/spree/shared/_cms_tabs.html.haml @@ -0,0 +1,3 @@ +- 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/_current_distributor.html.haml b/app/views/spree/shared/_current_distributor.html.haml new file mode 100644 index 0000000000..1b556e7e4f --- /dev/null +++ b/app/views/spree/shared/_current_distributor.html.haml @@ -0,0 +1,4 @@ +- if current_distributor + %li#current-distributor{'data-hook' => ''} + You are shopping at + = link_to current_distributor.name, root_path \ No newline at end of file diff --git a/app/views/spree/shared/_store_menu.html.haml b/app/views/spree/shared/_store_menu.html.haml deleted file mode 100644 index 1e1a2ba67e..0000000000 --- a/app/views/spree/shared/_store_menu.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%li#home-link{'data-hook' => ''} - = link_to t(:home), root_path - -- if @cms_site - - @cms_site.pages.root.children.published.each do |page| - %li= link_to page.label, page.full_path - -%li#link-to-cart{'data-hook' => ''} - = link_to_cart - -- if current_distributor - %li#current-distributor{'data-hook' => ''} - You are shopping at - = link_to current_distributor.name, root_path From 2f1a9094bf26f0c8b7cfa45598718ebb913ec5ce Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 14 Feb 2013 16:49:28 +1100 Subject: [PATCH 20/25] Fix StaleObjectError in order model test --- spec/models/order_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/models/order_spec.rb b/spec/models/order_spec.rb index e3d52db8bb..dcd7f360aa 100644 --- a/spec/models/order_spec.rb +++ b/spec/models/order_spec.rb @@ -50,6 +50,7 @@ describe Spree::Order do line_item1 = FactoryGirl.create(:line_item, order: subject, variant: variant11) line_item2 = FactoryGirl.create(:line_item, order: subject, variant: variant12) line_item3 = FactoryGirl.create(:line_item, order: subject, variant: variant31) + subject.reload subject.line_items = [line_item1,line_item2,line_item3] test_enterprise = FactoryGirl.create(:enterprise, id: 2, :name => "Test Enterprise") From 1ded1bac3fe3d9b4b08e23c5da4a8e7f26cec4e6 Mon Sep 17 00:00:00 2001 From: Rob H Date: Fri, 15 Feb 2013 10:31:41 +1100 Subject: [PATCH 21/25] Lengthen Capybara.default_wait_time for tests that fail due to long load time --- spec/features/admin/enterprises_spec.rb | 10 +++++++++- spec/features/admin/order_cycles_spec.rb | 9 +++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/spec/features/admin/enterprises_spec.rb b/spec/features/admin/enterprises_spec.rb index 5c4b433852..3f7e72ba88 100644 --- a/spec/features/admin/enterprises_spec.rb +++ b/spec/features/admin/enterprises_spec.rb @@ -6,7 +6,15 @@ feature %q{ } do include AuthenticationWorkflow include WebHelper - + + before :all do + @default_wait_time = Capybara.default_wait_time + Capybara.default_wait_time = 5 + end + + after :all do + Capybara.default_wait_time = @default_wait_time + end scenario "listing enterprises" do e = create(:enterprise) diff --git a/spec/features/admin/order_cycles_spec.rb b/spec/features/admin/order_cycles_spec.rb index 7f55a02795..adf7d270dd 100644 --- a/spec/features/admin/order_cycles_spec.rb +++ b/spec/features/admin/order_cycles_spec.rb @@ -6,6 +6,15 @@ feature %q{ }, js: true do include AuthenticationWorkflow include WebHelper + + before :all do + @default_wait_time = Capybara.default_wait_time + Capybara.default_wait_time = 5 + end + + after :all do + Capybara.default_wait_time = @default_wait_time + end scenario "listing order cycles" do # Given an order cycle From 68246e08d2f12ccc987c0a160655aef32f6fb6ca Mon Sep 17 00:00:00 2001 From: Rob H Date: Fri, 15 Feb 2013 10:34:17 +1100 Subject: [PATCH 22/25] Fix stack overflow error in admin shipping method test --- spec/features/admin/shipping_methods_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/features/admin/shipping_methods_spec.rb b/spec/features/admin/shipping_methods_spec.rb index d794e382c2..f0c4fd8aef 100644 --- a/spec/features/admin/shipping_methods_spec.rb +++ b/spec/features/admin/shipping_methods_spec.rb @@ -17,7 +17,8 @@ feature 'shipping methods' do end scenario "deleting a shipping method referenced by an order" do - o = create(:order, shipping_method: @sm) + o = create(:order) + o.shipping_method = @sm visit_delete spree.admin_shipping_method_path(@sm) From 046eb256ff98fee2c772106850a6b699a0a4a845 Mon Sep 17 00:00:00 2001 From: Rob H Date: Fri, 15 Feb 2013 14:10:56 +1100 Subject: [PATCH 23/25] Fix issues causing enterprise fee tests to break --- app/assets/javascripts/admin/enterprise_fees.js | 3 ++- app/views/admin/enterprise_fees/index.html.haml | 4 ++-- spec/features/admin/enterprise_fees_spec.rb | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/admin/enterprise_fees.js b/app/assets/javascripts/admin/enterprise_fees.js index e73ff0dfcf..730df4be7c 100644 --- a/app/assets/javascripts/admin/enterprise_fees.js +++ b/app/assets/javascripts/admin/enterprise_fees.js @@ -23,7 +23,8 @@ angular.module('enterprise_fees', []) return function(scope, element, attrs) { if(scope.enterprise_fee.id) { var url = "/admin/enterprise_fees/" + scope.enterprise_fee.id - var html = 'Delete Delete'; + var html = ''; + //var html = 'Delete Delete'; element.append(html); } } diff --git a/app/views/admin/enterprise_fees/index.html.haml b/app/views/admin/enterprise_fees/index.html.haml index 82a133fa4f..8bf3135b8a 100644 --- a/app/views/admin/enterprise_fees/index.html.haml +++ b/app/views/admin/enterprise_fees/index.html.haml @@ -17,7 +17,7 @@ %th Name %th Calculator %th Calculator values - %th + %th.actions %tbody = enterprise_fee_set_form.ng_fields_for :collection do |f| %tr{'ng-repeat' => 'enterprise_fee in enterprise_fees | filter:query'} @@ -28,6 +28,6 @@ %td= f.ng_text_field :name %td= f.ng_collection_select :calculator_type, @calculators, :name, :description, 'enterprise_fee.calculator_type', {'class' => 'calculator_type', 'ng-model' => 'calculatorType', 'spree-ensure-calculator-preferences-match-type' => "1"} %td{'ng-bind-html-unsafe-compiled' => 'enterprise_fee.calculator_settings'} - %td{'spree-delete-resource' => "1"} + %td.actions{'spree-delete-resource' => "1"} = enterprise_fee_set_form.submit 'Update' diff --git a/spec/features/admin/enterprise_fees_spec.rb b/spec/features/admin/enterprise_fees_spec.rb index 39451624c0..35e8d95407 100644 --- a/spec/features/admin/enterprise_fees_spec.rb +++ b/spec/features/admin/enterprise_fees_spec.rb @@ -83,7 +83,7 @@ feature %q{ click_link 'Enterprise Fees' # And I click delete - click_link 'Delete' + find("a.delete-resource").click page.driver.browser.switch_to.alert.accept # Then my enterprise fee should have been deleted From 055c07a46692146dfbda5a8303dee2e7d3406ffb Mon Sep 17 00:00:00 2001 From: Rob H Date: Wed, 20 Feb 2013 14:04:10 +1100 Subject: [PATCH 24/25] Add before_payment method to checkout controller (fixes issues with spree_paypal_express) --- app/controllers/spree/checkout_controller_decorator.rb | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 app/controllers/spree/checkout_controller_decorator.rb diff --git a/app/controllers/spree/checkout_controller_decorator.rb b/app/controllers/spree/checkout_controller_decorator.rb new file mode 100644 index 0000000000..b288b2da24 --- /dev/null +++ b/app/controllers/spree/checkout_controller_decorator.rb @@ -0,0 +1,5 @@ +Spree::CheckoutController.class_eval do + def before_payment + current_order.payments.destroy_all if request.put? + end +end \ No newline at end of file From a59b136864ef4c1a83639b840e57fe59f647ef3e Mon Sep 17 00:00:00 2001 From: Rob H Date: Wed, 20 Feb 2013 15:16:43 +1100 Subject: [PATCH 25/25] Spree 1.3 upgrade: fix final failing tests --- spec/features/admin/enterprise_fees_spec.rb | 11 ++++++++++- spec/features/consumer/checkout_spec.rb | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/spec/features/admin/enterprise_fees_spec.rb b/spec/features/admin/enterprise_fees_spec.rb index 35e8d95407..cf06faf061 100644 --- a/spec/features/admin/enterprise_fees_spec.rb +++ b/spec/features/admin/enterprise_fees_spec.rb @@ -6,6 +6,15 @@ feature %q{ }, js: true do include AuthenticationWorkflow include WebHelper + + before :all do + @default_wait_time = Capybara.default_wait_time + Capybara.default_wait_time = 5 + end + + after :all do + Capybara.default_wait_time = @default_wait_time + end scenario "listing enterprise fees" do fee = create(:enterprise_fee) @@ -14,7 +23,7 @@ feature %q{ click_link 'Configuration' click_link 'Enterprise Fees' - page.should have_selector "option[selected]", text: fee.enterprise.name + page.should have_selector "#enterprise_fee_set_collection_attributes_0_enterprise_id", :text => fee.enterprise.name page.should have_selector "option[selected]", text: 'Packing' page.should have_selector "input[value='$0.50 / kg']" page.should have_selector "option[selected]", text: 'Weight (per kg)' diff --git a/spec/features/consumer/checkout_spec.rb b/spec/features/consumer/checkout_spec.rb index c88f0da8ca..24dae83677 100644 --- a/spec/features/consumer/checkout_spec.rb +++ b/spec/features/consumer/checkout_spec.rb @@ -7,6 +7,15 @@ feature %q{ } do include AuthenticationWorkflow include WebHelper + + before :all do + @default_wait_time = Capybara.default_wait_time + Capybara.default_wait_time = 5 + end + + after :all do + Capybara.default_wait_time = @default_wait_time + end background do @distributor = create(:distributor_enterprise, :name => 'Edible garden',