solidus_frontend 1.0.7 → 1.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_frontend might be problematic. Click here for more details.

Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/frontend/checkout/address.js.coffee +6 -5
  3. data/app/controllers/spree/checkout_controller.rb +5 -3
  4. data/app/controllers/spree/store_controller.rb +2 -1
  5. data/app/views/spree/address/_form.html.erb +15 -15
  6. data/lib/spree/frontend.rb +0 -2
  7. metadata +9 -79
  8. data/CHANGELOG.md +0 -1
  9. data/Gemfile +0 -6
  10. data/Rakefile +0 -15
  11. data/lib/spree/frontend/preference_rescue.rb +0 -25
  12. data/script/rails +0 -9
  13. data/solidus_frontend.gemspec +0 -30
  14. data/spec/controllers/controller_extension_spec.rb +0 -126
  15. data/spec/controllers/controller_helpers_spec.rb +0 -26
  16. data/spec/controllers/spree/checkout_controller_spec.rb +0 -447
  17. data/spec/controllers/spree/checkout_controller_with_views_spec.rb +0 -36
  18. data/spec/controllers/spree/content_controller_spec.rb +0 -7
  19. data/spec/controllers/spree/current_order_tracking_spec.rb +0 -44
  20. data/spec/controllers/spree/home_controller_spec.rb +0 -27
  21. data/spec/controllers/spree/orders_controller_ability_spec.rb +0 -104
  22. data/spec/controllers/spree/orders_controller_spec.rb +0 -134
  23. data/spec/controllers/spree/orders_controller_transitions_spec.rb +0 -31
  24. data/spec/controllers/spree/products_controller_spec.rb +0 -36
  25. data/spec/controllers/spree/taxons_controller_spec.rb +0 -12
  26. data/spec/features/address_spec.rb +0 -76
  27. data/spec/features/automatic_promotion_adjustments_spec.rb +0 -47
  28. data/spec/features/caching/products_spec.rb +0 -55
  29. data/spec/features/caching/taxons_spec.rb +0 -22
  30. data/spec/features/cart_spec.rb +0 -81
  31. data/spec/features/checkout_spec.rb +0 -513
  32. data/spec/features/checkout_unshippable_spec.rb +0 -35
  33. data/spec/features/coupon_code_spec.rb +0 -227
  34. data/spec/features/currency_spec.rb +0 -18
  35. data/spec/features/free_shipping_promotions_spec.rb +0 -59
  36. data/spec/features/locale_spec.rb +0 -60
  37. data/spec/features/order_spec.rb +0 -73
  38. data/spec/features/products_spec.rb +0 -260
  39. data/spec/features/promotion_code_invalidation_spec.rb +0 -51
  40. data/spec/features/quantity_promotions_spec.rb +0 -128
  41. data/spec/features/taxons_spec.rb +0 -135
  42. data/spec/features/template_rendering_spec.rb +0 -19
  43. data/spec/fixtures/thinking-cat.jpg +0 -0
  44. data/spec/helpers/base_helper_spec.rb +0 -11
  45. data/spec/spec_helper.rb +0 -121
  46. data/spec/support/shared_contexts/checkout_setup.rb +0 -9
  47. data/spec/support/shared_contexts/custom_products.rb +0 -25
  48. data/spec/support/shared_contexts/product_prototypes.rb +0 -30
  49. data/spec/views/spree/checkout/_summary_spec.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d69d090e995c26e97c4b9eed6a36205ba4c8721e
4
- data.tar.gz: 51856049c68819c9f9a2dfc1fdcccb569e037c02
3
+ metadata.gz: aef95541ce55ae65eb3f48f04ced3fc99e333c10
4
+ data.tar.gz: c4d27a4c94dae740f03711efb1eb6b2496c4b760
5
5
  SHA512:
6
- metadata.gz: 525ef3dfd169cd8b2df4ac37387658dce47392811e89afe4e1ae0fe677bc1d5a313de1d5ddb9bffcb2015bb885d2948ac46b113055632c91eb25fb2bc5501d94
7
- data.tar.gz: 13dea3731b3f1d2a754aa0b70964f8ff1293753fc23bce330e779b221d3605e243a96bb35e0af8d05d345fb4cd96bd9d8799db7897159440e50a5690c5d3bce6
6
+ metadata.gz: c83e0ceac48b02e4eb053b0732e915ff97180c5ecd508bb970b72ac83881031b1fc5a49b743abe91a7f54de5e8400942b90d6af28ef6db730a2aa32fae5b97bd
7
+ data.tar.gz: f8264d48702fcf8fc86718f3fcb0c8be1371f34c7aef7d3968df76ccfb8d9bad968b7e7ddb2f2898716ac0c8438396b76ee3a6a9fc074f63925851073180673b
@@ -1,8 +1,5 @@
1
1
  $ ->
2
2
  if $('#checkout_form_address').is('*')
3
- # Hidden by default to support browsers with javascript disabled
4
- $('.js-address-fields').show()
5
-
6
3
  $('#checkout_form_address').validate()
7
4
 
8
5
  getCountryId = (region) ->
@@ -46,8 +43,12 @@ $ ->
46
43
  stateSelect.prop('disabled', false).show()
47
44
  stateInput.hide().prop 'disabled', true
48
45
  statePara.show()
49
- stateSpanRequired.show()
50
- stateSelect.addClass('required') if statesRequired
46
+ if statesRequired
47
+ stateSelect.addClass('required')
48
+ stateSpanRequired.show()
49
+ else
50
+ stateSelect.removeClass('required')
51
+ stateSpanRequired.hide()
51
52
  stateSelect.removeClass('hidden')
52
53
  stateInput.removeClass('required')
53
54
  else
@@ -25,7 +25,8 @@ module Spree
25
25
 
26
26
  # Updates the order and advances to the next state (when possible.)
27
27
  def update
28
- if @order.update_from_params(params, permitted_checkout_attributes, request.headers.env)
28
+ massaged_params = move_payment_source_into_payments_attributes(params)
29
+ if @order.update_from_params(massaged_params, permitted_checkout_attributes, request.headers.env)
29
30
  @order.temporary_address = !params[:save_user_address]
30
31
  success = if @order.state == 'confirm'
31
32
  @order.complete
@@ -116,8 +117,9 @@ module Spree
116
117
  def before_address
117
118
  # if the user has a default address, a callback takes care of setting
118
119
  # that; but if he doesn't, we need to build an empty one here
119
- @order.bill_address ||= Address.build_default
120
- @order.ship_address ||= Address.build_default if @order.checkout_steps.include?('delivery')
120
+ default = {country_id: Country.default.id}
121
+ @order.build_bill_address(default) unless @order.bill_address
122
+ @order.build_ship_address(default) if @order.checkout_steps.include?('delivery') && !@order.ship_address
121
123
  end
122
124
 
123
125
  def before_delivery
@@ -13,7 +13,8 @@ module Spree
13
13
  fresh_when(simple_current_order)
14
14
  end
15
15
 
16
- protected
16
+ private
17
+
17
18
  # This method is placed here so that the CheckoutController
18
19
  # and OrdersController can both reference it (or any other controller
19
20
  # which needs it)
@@ -38,24 +38,24 @@
38
38
  <% have_states = !address.country.states.empty? %>
39
39
  <%= form.label :state, Spree.t(:state) %><span class='required' id=<%="#{address_id}state-required"%>>*</span><br/>
40
40
 
41
- <span class="js-address-fields" style="display: none;">
42
- <%= form.collection_select(
43
- :state_id, address.country.states, :id, :name,
44
- {include_blank: true},
45
- {
46
- class: have_states ? 'required' : 'hidden',
47
- disabled: !have_states
48
- }) %>
49
- <%= form.text_field(
50
- :state_name,
51
- class: !have_states ? 'required' : 'hidden',
52
- disabled: have_states) %>
53
- </span>
54
-
41
+ <% state_elements = [
42
+ form.collection_select(:state_id, address.country.states,
43
+ :id, :name,
44
+ {:include_blank => true},
45
+ {:class => have_states ? 'required' : 'hidden',
46
+ :disabled => !have_states}) +
47
+ form.text_field(:state_name,
48
+ :class => !have_states ? 'required' : 'hidden',
49
+ :disabled => have_states)
50
+ ].join.gsub('"', "'").gsub("\n", "")
51
+ %>
52
+ <%= javascript_tag do -%>
53
+ $('#<%="#{address_id}state" %>').append("<%== state_elements %>");
54
+ <% end %>
55
+ </p>
55
56
  <noscript>
56
57
  <%= form.text_field :state_name, :class => 'required' %>
57
58
  </noscript>
58
- </p>
59
59
  <% end %>
60
60
 
61
61
  <p class="field" id=<%="#{address_id}zipcode" %>>
@@ -2,8 +2,6 @@ require 'rails/all'
2
2
  require 'jquery-rails'
3
3
  require 'canonical-rails'
4
4
  require 'deface'
5
- require 'coffee-rails'
6
- require 'sass-rails'
7
5
 
8
6
  require 'spree/core'
9
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.1.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-12 00:00:00.000000000 Z
11
+ date: 2015-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.7
19
+ version: 1.1.0.beta1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.7
26
+ version: 1.1.0.beta1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: solidus_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.7
33
+ version: 1.1.0.beta1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 1.0.7
40
+ version: 1.1.0.beta1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: canonical-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,34 +66,6 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: sass-rails
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: coffee-rails
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
69
  - !ruby/object:Gem::Dependency
98
70
  name: capybara-accessible
99
71
  requirement: !ruby/object:Gem::Requirement
@@ -114,11 +86,8 @@ executables: []
114
86
  extensions: []
115
87
  extra_rdoc_files: []
116
88
  files:
117
- - CHANGELOG.md
118
- - Gemfile
119
89
  - LICENSE
120
90
  - README.md
121
- - Rakefile
122
91
  - app/assets/images/credit_cards/amex_cid.gif
123
92
  - app/assets/images/credit_cards/credit_card.gif
124
93
  - app/assets/images/credit_cards/discover_cid.gif
@@ -221,48 +190,9 @@ files:
221
190
  - lib/spree/frontend.rb
222
191
  - lib/spree/frontend/engine.rb
223
192
  - lib/spree/frontend/middleware/seo_assist.rb
224
- - lib/spree/frontend/preference_rescue.rb
225
193
  - lib/spree_frontend.rb
226
194
  - lib/tasks/rake_util.rb
227
195
  - lib/tasks/taxon.rake
228
- - script/rails
229
- - solidus_frontend.gemspec
230
- - spec/controllers/controller_extension_spec.rb
231
- - spec/controllers/controller_helpers_spec.rb
232
- - spec/controllers/spree/checkout_controller_spec.rb
233
- - spec/controllers/spree/checkout_controller_with_views_spec.rb
234
- - spec/controllers/spree/content_controller_spec.rb
235
- - spec/controllers/spree/current_order_tracking_spec.rb
236
- - spec/controllers/spree/home_controller_spec.rb
237
- - spec/controllers/spree/orders_controller_ability_spec.rb
238
- - spec/controllers/spree/orders_controller_spec.rb
239
- - spec/controllers/spree/orders_controller_transitions_spec.rb
240
- - spec/controllers/spree/products_controller_spec.rb
241
- - spec/controllers/spree/taxons_controller_spec.rb
242
- - spec/features/address_spec.rb
243
- - spec/features/automatic_promotion_adjustments_spec.rb
244
- - spec/features/caching/products_spec.rb
245
- - spec/features/caching/taxons_spec.rb
246
- - spec/features/cart_spec.rb
247
- - spec/features/checkout_spec.rb
248
- - spec/features/checkout_unshippable_spec.rb
249
- - spec/features/coupon_code_spec.rb
250
- - spec/features/currency_spec.rb
251
- - spec/features/free_shipping_promotions_spec.rb
252
- - spec/features/locale_spec.rb
253
- - spec/features/order_spec.rb
254
- - spec/features/products_spec.rb
255
- - spec/features/promotion_code_invalidation_spec.rb
256
- - spec/features/quantity_promotions_spec.rb
257
- - spec/features/taxons_spec.rb
258
- - spec/features/template_rendering_spec.rb
259
- - spec/fixtures/thinking-cat.jpg
260
- - spec/helpers/base_helper_spec.rb
261
- - spec/spec_helper.rb
262
- - spec/support/shared_contexts/checkout_setup.rb
263
- - spec/support/shared_contexts/custom_products.rb
264
- - spec/support/shared_contexts/product_prototypes.rb
265
- - spec/views/spree/checkout/_summary_spec.rb
266
196
  - vendor/assets/images/datepicker/cal.gif
267
197
  - vendor/assets/images/flags/ad.png
268
198
  - vendor/assets/images/flags/ae.png
@@ -579,13 +509,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
579
509
  version: 2.1.0
580
510
  required_rubygems_version: !ruby/object:Gem::Requirement
581
511
  requirements:
582
- - - ">="
512
+ - - ">"
583
513
  - !ruby/object:Gem::Version
584
- version: '0'
514
+ version: 1.3.1
585
515
  requirements:
586
516
  - none
587
517
  rubyforge_project: solidus_frontend
588
- rubygems_version: 2.6.11
518
+ rubygems_version: 2.4.5
589
519
  signing_key:
590
520
  specification_version: 4
591
521
  summary: Cart and storefront for the Solidus e-commerce project.
data/CHANGELOG.md DELETED
@@ -1 +0,0 @@
1
- ## Spree 2.4.0 (unreleased) ##
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- eval(File.read(File.dirname(__FILE__) + '/../common_spree_dependencies.rb'))
2
-
3
- gem 'solidus_core', :path => '../core'
4
- gem 'solidus_api', :path => '../api'
5
-
6
- gemspec
data/Rakefile DELETED
@@ -1,15 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rake/testtask'
4
- require 'rspec/core/rake_task'
5
- require 'spree/testing_support/common_rake'
6
-
7
- RSpec::Core::RakeTask.new
8
-
9
- task :default => :spec
10
-
11
- desc "Generates a dummy app for testing"
12
- task :test_app do
13
- ENV['LIB_NAME'] = 'spree/frontend'
14
- Rake::Task['common:test_app'].invoke
15
- end
@@ -1,25 +0,0 @@
1
- module Spree
2
- class OldPrefs < ActiveRecord::Base
3
- self.table_name = "spree_preferences"
4
- belongs_to :owner, :polymorphic => true
5
- attr_accessor :owner_klass
6
- end
7
-
8
- class PreferenceRescue
9
- def self.try
10
- OldPrefs.where(:key => nil).each do |old_pref|
11
- next unless owner = (old_pref.owner rescue nil)
12
- unless old_pref.owner_type == "Spree::Activator" || old_pref.owner_type == "Spree::Configuration"
13
- begin
14
- old_pref.key = [owner.class.name, old_pref.name, owner.id].join('::').underscore
15
- old_pref.value_type = owner.preference_type(old_pref.name)
16
- puts "Migrating Preference: #{old_pref.key}"
17
- old_pref.save
18
- rescue NoMethodError => ex
19
- puts ex.message
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
data/script/rails DELETED
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
- ENGINE_PATH = File.expand_path('../../lib/spree/frontend/engine', __FILE__)
6
-
7
- require 'rails/all'
8
- require 'rails/engine/commands'
9
-
@@ -1,30 +0,0 @@
1
- # encoding: UTF-8
2
- version = File.read(File.expand_path("../../SOLIDUS_VERSION", __FILE__)).strip
3
-
4
- Gem::Specification.new do |s|
5
- s.platform = Gem::Platform::RUBY
6
- s.name = 'solidus_frontend'
7
- s.version = version
8
- s.summary = 'Cart and storefront for the Solidus e-commerce project.'
9
- s.description = s.summary
10
-
11
- s.required_ruby_version = '>= 2.1.0'
12
- s.author = 'Solidus Team'
13
- s.email = 'contact@solidus.io'
14
- s.homepage = 'http://solidus.io/'
15
- s.rubyforge_project = 'solidus_frontend'
16
-
17
- s.files = `git ls-files`.split("\n")
18
- s.require_path = 'lib'
19
- s.requirements << 'none'
20
-
21
- s.add_dependency 'solidus_api', version
22
- s.add_dependency 'solidus_core', version
23
-
24
- s.add_dependency 'canonical-rails', '~> 0.0.4'
25
- s.add_dependency 'jquery-rails'
26
- s.add_dependency 'sass-rails'
27
- s.add_dependency 'coffee-rails'
28
-
29
- s.add_development_dependency 'capybara-accessible'
30
- end
@@ -1,126 +0,0 @@
1
- require 'spec_helper'
2
-
3
- # This test tests the functionality within
4
- # spree/core/controller_helpers/respond_with.rb
5
- # Rather than duck-punching the existing controllers, let's define a custom one:
6
- class Spree::CustomController < Spree::BaseController
7
- def index
8
- respond_with(Spree::Address.new) do |format|
9
- format.html { render :text => "neutral" }
10
- end
11
- end
12
-
13
- def create
14
- # Just need a model with validations
15
- # Address is good enough, so let's go with that
16
- address = Spree::Address.new(params[:address])
17
- respond_with(address)
18
- end
19
- end
20
-
21
- describe Spree::CustomController, :type => :controller do
22
- after do
23
- Spree::CustomController.clear_overrides!
24
- end
25
-
26
- before do
27
- @routes = ActionDispatch::Routing::RouteSet.new.tap do |r|
28
- r.draw {
29
- get 'index', to: 'spree/custom#index'
30
- post 'create', to: 'spree/custom#create'
31
- }
32
- end
33
- end
34
-
35
- context "extension testing" do
36
- context "index" do
37
- context "specify symbol for handler instead of Proc" do
38
- before do
39
- Spree::CustomController.class_eval do
40
- respond_override({:index => {:html => {:success => :success_method}}})
41
-
42
- private
43
-
44
- def success_method
45
- render :text => 'success!!!'
46
- end
47
- end
48
- end
49
-
50
- describe "GET" do
51
- it "has value success" do
52
- spree_get :index
53
- expect(response).to be_success
54
- assert (response.body =~ /success!!!/)
55
- end
56
- end
57
- end
58
-
59
- context "render" do
60
- before do
61
- Spree::CustomController.instance_eval do
62
- respond_override({:index => {:html => {:success => lambda { render(:text => 'success!!!') }}}})
63
- respond_override({:index => {:html => {:failure => lambda { render(:text => 'failure!!!') }}}})
64
- end
65
- end
66
-
67
- describe "GET" do
68
- it "has value success" do
69
- spree_get :index
70
- expect(response).to be_success
71
- assert (response.body =~ /success!!!/)
72
- end
73
- end
74
- end
75
-
76
- context "redirect" do
77
- before do
78
- Spree::CustomController.instance_eval do
79
- respond_override({:index => {:html => {:success => lambda { redirect_to('/cart') }}}})
80
- respond_override({:index => {:html => {:failure => lambda { render(:text => 'failure!!!') }}}})
81
- end
82
- end
83
-
84
- describe "GET" do
85
- it "has value success" do
86
- spree_get :index
87
- expect(response).to be_redirect
88
- end
89
- end
90
- end
91
-
92
- context "validation error" do
93
- before do
94
- Spree::CustomController.instance_eval do
95
- respond_to :html
96
- respond_override({:create => {:html => {:success => lambda { render(:text => 'success!!!') }}}})
97
- respond_override({:create => {:html => {:failure => lambda { render(:text => 'failure!!!') }}}})
98
- end
99
- end
100
-
101
- describe "POST" do
102
- it "has value success" do
103
- spree_post :create
104
- expect(response).to be_success
105
- assert (response.body =~ /success!/)
106
- end
107
- end
108
- end
109
-
110
- context 'A different controllers respond_override. Regression test for #1301' do
111
- before do
112
- Spree::CheckoutController.instance_eval do
113
- respond_override({:index => {:html => {:success => lambda { render(:text => 'success!!!') }}}})
114
- end
115
- end
116
-
117
- describe "POST" do
118
- it "should not effect the wrong controller" do
119
- spree_get :index
120
- assert (response.body =~ /neutral/)
121
- end
122
- end
123
- end
124
- end
125
- end
126
- end