solidus_frontend 2.3.1 → 2.4.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4d176efa0436e1940a95991523624736fb3d1e0
4
- data.tar.gz: af932af8026330bf6bff2f79d494a870ef9c8cb6
3
+ metadata.gz: 67186cb07ac12ada0005473b10b274aefd20d75f
4
+ data.tar.gz: 1ac41dd260ca844e9d30010c49d607d3966d78cf
5
5
  SHA512:
6
- metadata.gz: 12f0588f86bd39eac042c2b3c10cab6eb7f6e979592eab4dbcb75e0c4ebf54f833d9babdd0c6791d60fc18927bbdbdaf5ed3bbb52c76280f28e22f92562df1c0
7
- data.tar.gz: 337973a26fa1bdd7854235f3b7fe8d7d4f26e39f7b1bdb84b348d4ef0ad91552da8ea5490db89c582607d7048a837919e4000fca868ce23c3e5ec8303b8ef513
6
+ metadata.gz: e72385aba870300b90a8186d602e5f22ba8eb63028274f89fc65e76822540e41ea7e6038cc8e0039a193c86431a200198c89fc807e147afd803f7f5b19fe11e4
7
+ data.tar.gz: 4cb6950834f9f2e1b0c576f0d51552074aaa5a13799624091ed2a6fc9bd6bac72ce3c6859ea4487e61e46d18c3ed8d081dfbbe8fc11c6605474cebd788ba52a4
@@ -12,6 +12,7 @@ $link_text_color: #00ADEE !default;
12
12
  $product_background_color: #FFFFFF !default;
13
13
  $product_title_text_color: #404042 !default;
14
14
  $product_body_text_color: #404042 !default;
15
+ $product_price_text_color: #252525 !default;
15
16
  $product_link_text_color: #BBBBBB !default;
16
17
 
17
18
  /*--------------------------------------*/
@@ -452,7 +452,7 @@ nav#taxonomies {
452
452
 
453
453
  %price_text {
454
454
  font-weight: bold;
455
- color: $link_text_color;
455
+ color: $product_price_text_color;
456
456
  }
457
457
 
458
458
  span.price {
@@ -520,7 +520,7 @@ ul#products {
520
520
  }
521
521
 
522
522
  .price {
523
- color: $link_text_color;
523
+ color: $product_price_text_color;
524
524
  font-size: $product_list_price_font_size;
525
525
  padding-top: 5px;
526
526
  display: block;
@@ -752,7 +752,7 @@ ul#products {
752
752
  }
753
753
  }
754
754
 
755
- #billing {
755
+ #billing, #shipping {
756
756
  input[type="text"], input[type="email"],
757
757
  input[type="tel"], input[type="number"],
758
758
  select, textarea {
@@ -9,8 +9,8 @@ module Spree
9
9
  respond_to :html
10
10
 
11
11
  def index
12
- @searcher = build_searcher(params.merge(include_images: true))
13
- @products = @searcher.retrieve_products
12
+ @searcher = build_searcher(params.merge(include_images: true).reject { |k, _| ["per_page", "page"].include?(k) } )
13
+ @products = @searcher.retrieve_products.page(params[:page] || 1).per(params[:per_page].presence || Spree::Config[:products_per_page])
14
14
  @taxonomies = Spree::Taxonomy.includes(root: :children)
15
15
  end
16
16
 
@@ -3,8 +3,6 @@ module Spree
3
3
  include Spree::Core::ControllerHelpers::Pricing
4
4
  include Spree::Core::ControllerHelpers::Order
5
5
 
6
- skip_before_action :set_current_order, only: :cart_link
7
-
8
6
  def unauthorized
9
7
  render 'spree/shared/unauthorized', layout: Spree::Config[:layout], status: 401
10
8
  end
@@ -9,8 +9,8 @@ module Spree
9
9
  @taxon = Spree::Taxon.find_by!(permalink: params[:id])
10
10
  return unless @taxon
11
11
 
12
- @searcher = build_searcher(params.merge(taxon: @taxon.id, include_images: true))
13
- @products = @searcher.retrieve_products
12
+ @searcher = build_searcher(params.merge(taxon: @taxon.id, include_images: true).reject { |k, _| ["per_page", "page"].include?(k) } )
13
+ @products = @searcher.retrieve_products.page(params[:page] || 1).per(params[:per_page].presence || Spree::Config[:products_per_page])
14
14
  @taxonomies = Spree::Taxonomy.includes(root: :children)
15
15
  end
16
16
 
@@ -0,0 +1,16 @@
1
+ require 'truncate_html'
2
+ require 'app/helpers/truncate_html_helper'
3
+
4
+ module Spree
5
+ module OrdersHelper
6
+ include TruncateHtmlHelper
7
+
8
+ def truncated_product_description(product)
9
+ truncate_html(raw(product.description))
10
+ end
11
+
12
+ def order_just_completed?(order)
13
+ flash[:order_completed] && order.present?
14
+ end
15
+ end
16
+ end
@@ -12,7 +12,7 @@
12
12
  <% if @order.state == 'address' || !@order.email? %>
13
13
  <p class="field" style='clear: both'>
14
14
  <%= form.label :email %><br />
15
- <%= form.text_field :email %>
15
+ <%= form.email_field :email %>
16
16
  </p>
17
17
  <% end %>
18
18
  <%= render @order.state, form: form %>
@@ -13,7 +13,7 @@
13
13
  <tr>
14
14
  <td colspan="4" align='right'><h5><%= Spree.t(:shipping) %>: <%= shipment.shipping_method.name %></h5></td>
15
15
  <td colspan='2'>
16
- <h5><%= shipment.display_discounted_cost %></h5>
16
+ <h5><%= shipment.display_total_before_tax %></h5>
17
17
  </td>
18
18
  </tr>
19
19
  <% end %>
@@ -110,7 +110,7 @@
110
110
  <% order.shipments.group_by { |s| s.selected_shipping_rate.name }.each do |name, shipments| %>
111
111
  <tr class="total" data-hook='shipment-row'>
112
112
  <td colspan="4"><%= Spree.t(:shipping) %>: <strong><%= name %></strong></td>
113
- <td class="total"><span><%= Spree::Money.new(shipments.sum(&:discounted_cost), currency: order.currency).to_html %></span></td>
113
+ <td class="total"><span><%= Spree::Money.new(shipments.sum(&:total_before_tax), currency: order.currency).to_html %></span></td>
114
114
  </tr>
115
115
  <% end %>
116
116
  </tfoot>
@@ -7,6 +7,5 @@ require 'font-awesome-rails'
7
7
 
8
8
  require 'spree/core'
9
9
 
10
- require 'spree/responder'
11
10
  require 'spree/frontend/middleware/seo_assist'
12
11
  require 'spree/frontend/engine'
@@ -8,7 +8,6 @@ Gem::Specification.new do |s|
8
8
  s.summary = 'Cart and storefront for the Solidus e-commerce project.'
9
9
  s.description = s.summary
10
10
 
11
- s.required_ruby_version = '>= 2.1.0'
12
11
  s.author = 'Solidus Team'
13
12
  s.email = 'contact@solidus.io'
14
13
  s.homepage = 'http://solidus.io/'
@@ -29,6 +28,8 @@ Gem::Specification.new do |s|
29
28
  s.add_dependency 'sass-rails'
30
29
  s.add_dependency 'coffee-rails'
31
30
  s.add_dependency 'font-awesome-rails', '~> 4.0'
31
+ s.add_dependency 'truncate_html', '~> 0.9', '>= 0.9.2'
32
+ s.add_dependency 'kaminari', '>= 0.17', '< 2.0'
32
33
 
33
34
  s.add_development_dependency 'capybara-accessible'
34
35
  end
@@ -81,9 +81,9 @@ describe Spree::CheckoutController, type: :controller do
81
81
  }
82
82
  end
83
83
 
84
- let!(:payment_method) { create(:payment_method) }
85
84
  before do
86
85
  # Must have *a* shipping method and a payment method so updating from address works
86
+ allow(order).to receive_messages available_payment_methods: [stub_model(Spree::PaymentMethod)]
87
87
  allow(order).to receive_messages ensure_available_shipping_rates: true
88
88
  order.line_items << FactoryGirl.create(:line_item)
89
89
  end
@@ -225,53 +225,6 @@ describe Spree::CheckoutController, type: :controller do
225
225
  end
226
226
  end
227
227
 
228
- context "when in the payment state" do
229
- let(:order) { create(:order_with_line_items) }
230
- let(:payment_method) { create(:credit_card_payment_method) }
231
-
232
- let(:params) do
233
- {
234
- state: 'payment',
235
- order: {
236
- payments_attributes: [
237
- {
238
- payment_method_id: payment_method.id.to_s,
239
- source_attributes: attributes_for(:credit_card)
240
- }
241
- ]
242
- }
243
- }
244
- end
245
-
246
- before do
247
- order.update_attributes! user: user
248
- 3.times { order.next! } # should put us in the payment state
249
- end
250
-
251
- context 'with a permitted payment method' do
252
- it 'sets the payment amount' do
253
- post :update, params: params
254
- order.reload
255
- expect(order.state).to eq('confirm')
256
- expect(order.payments.size).to eq(1)
257
- expect(order.payments.first.amount).to eq(order.total)
258
- end
259
- end
260
-
261
- context 'with an unpermitted payment method' do
262
- before { payment_method.update!(available_to_users: false) }
263
-
264
- it 'sets the payment amount' do
265
- expect {
266
- post :update, params: params
267
- }.to raise_error(ActiveRecord::RecordNotFound)
268
-
269
- expect(order.state).to eq('payment')
270
- expect(order.payments).to be_empty
271
- end
272
- end
273
- end
274
-
275
228
  context "when in the confirm state" do
276
229
  before do
277
230
  order.update_attributes! user: user
@@ -93,7 +93,7 @@ describe "Checkout", type: :feature, inaccessible: true do
93
93
 
94
94
  order.reload
95
95
  order.user = user
96
- order.update!
96
+ order.recalculate
97
97
  order
98
98
  end
99
99
 
@@ -211,13 +211,13 @@ describe "Checkout", type: :feature, inaccessible: true do
211
211
 
212
212
  # Regression test for https://github.com/spree/spree/issues/2694 and https://github.com/spree/spree/issues/4117
213
213
  context "doesn't allow bad credit card numbers" do
214
- let!(:payment_method) { create(:credit_card_payment_method) }
215
214
  before(:each) do
216
215
  order = OrderWalkthrough.up_to(:delivery)
216
+ allow(order).to receive_messages(available_payment_methods: [create(:credit_card_payment_method)])
217
217
 
218
218
  user = create(:user)
219
219
  order.user = user
220
- order.update!
220
+ order.recalculate
221
221
 
222
222
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
223
223
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
@@ -245,7 +245,7 @@ describe "Checkout", type: :feature, inaccessible: true do
245
245
 
246
246
  order.reload
247
247
  order.user = user
248
- order.update!
248
+ order.recalculate
249
249
  order
250
250
  end
251
251
 
@@ -292,7 +292,7 @@ describe "Checkout", type: :feature, inaccessible: true do
292
292
  order = OrderWalkthrough.up_to(:delivery)
293
293
  allow(order).to receive_messages(available_payment_methods: [check_payment, credit_cart_payment])
294
294
  order.user = create(:user)
295
- order.update!
295
+ order.recalculate
296
296
 
297
297
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
298
298
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: order.user)
@@ -314,8 +314,7 @@ describe "Checkout", type: :feature, inaccessible: true do
314
314
  end
315
315
 
316
316
  context "user has payment sources", js: true do
317
- before { Spree::PaymentMethod.all.each(&:really_destroy!) }
318
- let!(:bogus) { create(:credit_card_payment_method) }
317
+ let(:bogus) { create(:credit_card_payment_method) }
319
318
  let(:user) { create(:user) }
320
319
 
321
320
  let!(:credit_card) do
@@ -325,6 +324,7 @@ describe "Checkout", type: :feature, inaccessible: true do
325
324
  before do
326
325
  user.wallet.add(credit_card)
327
326
  order = OrderWalkthrough.up_to(:delivery)
327
+ allow(order).to receive_messages(available_payment_methods: [bogus])
328
328
 
329
329
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
330
330
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
@@ -15,7 +15,7 @@ describe "checkout with unshippable items", type: :feature, inaccessible: true d
15
15
 
16
16
  user = create(:user)
17
17
  order.user = user
18
- order.update!
18
+ order.recalculate
19
19
 
20
20
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
21
21
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ module Spree
4
+ describe Spree::OrdersHelper, type: :helper do
5
+ # Regression test for https://github.com/spree/spree/issues/2518 and https://github.com/spree/spree/issues/2323
6
+ it "truncates HTML correctly in product description" do
7
+ product = double(description: "<strong>" + ("a" * 95) + "</strong> This content is invisible.")
8
+ expected = "<strong>" + ("a" * 95) + "</strong>..."
9
+ expect(truncated_product_description(product)).to eq(expected)
10
+ end
11
+ end
12
+ end
data/spec/spec_helper.rb CHANGED
@@ -45,8 +45,6 @@ require 'spree/testing_support/url_helpers'
45
45
  require 'spree/testing_support/order_walkthrough'
46
46
  require 'spree/testing_support/caching'
47
47
 
48
- require 'paperclip/matchers'
49
-
50
48
  require 'capybara-screenshot/rspec'
51
49
  Capybara.save_path = ENV['CIRCLE_ARTIFACTS'] if ENV['CIRCLE_ARTIFACTS']
52
50
 
@@ -118,8 +116,6 @@ RSpec.configure do |config|
118
116
  config.include Spree::TestingSupport::ControllerRequests, type: :controller
119
117
  config.include Spree::TestingSupport::Flash
120
118
 
121
- config.include Paperclip::Shoulda::Matchers
122
-
123
119
  config.fail_fast = ENV['FAIL_FAST'] || false
124
120
 
125
121
  config.example_status_persistence_file_path = "./spec/examples.txt"
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: 2.3.1
4
+ version: 2.4.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: 2017-10-03 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: 2.3.1
19
+ version: 2.4.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: 2.3.1
26
+ version: 2.4.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: 2.3.1
33
+ version: 2.4.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: 2.3.1
40
+ version: 2.4.0.beta1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: canonical-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,46 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '4.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: truncate_html
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.9'
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: 0.9.2
121
+ type: :runtime
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - "~>"
126
+ - !ruby/object:Gem::Version
127
+ version: '0.9'
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: 0.9.2
131
+ - !ruby/object:Gem::Dependency
132
+ name: kaminari
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0.17'
138
+ - - "<"
139
+ - !ruby/object:Gem::Version
140
+ version: '2.0'
141
+ type: :runtime
142
+ prerelease: false
143
+ version_requirements: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0.17'
148
+ - - "<"
149
+ - !ruby/object:Gem::Version
150
+ version: '2.0'
111
151
  - !ruby/object:Gem::Dependency
112
152
  name: capybara-accessible
113
153
  requirement: !ruby/object:Gem::Requirement
@@ -181,6 +221,7 @@ files:
181
221
  - app/controllers/spree/products_controller.rb
182
222
  - app/controllers/spree/store_controller.rb
183
223
  - app/controllers/spree/taxons_controller.rb
224
+ - app/helpers/spree/orders_helper.rb
184
225
  - app/models/spree/frontend_configuration.rb
185
226
  - app/views/spree/address/_form.html.erb
186
227
  - app/views/spree/address/_form_hidden.html.erb
@@ -243,7 +284,6 @@ files:
243
284
  - lib/tasks/taxon.rake
244
285
  - script/rails
245
286
  - solidus_frontend.gemspec
246
- - spec/controllers/controller_extension_spec.rb
247
287
  - spec/controllers/controller_helpers_spec.rb
248
288
  - spec/controllers/spree/checkout_controller_spec.rb
249
289
  - spec/controllers/spree/checkout_controller_with_views_spec.rb
@@ -275,6 +315,7 @@ files:
275
315
  - spec/fixtures/thinking-cat.jpg
276
316
  - spec/generators/solidus/views/override_generator_spec.rb
277
317
  - spec/helpers/base_helper_spec.rb
318
+ - spec/helpers/order_helper_spec.rb
278
319
  - spec/spec_helper.rb
279
320
  - spec/support/shared_contexts/checkout_setup.rb
280
321
  - spec/support/shared_contexts/custom_products.rb
@@ -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 plain: "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 plain: 'success!!!'
46
- end
47
- end
48
- end
49
-
50
- describe "GET" do
51
- it "has value success" do
52
- get :index
53
- expect(response).to be_success
54
- expect(response.body).to match(/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(plain: 'success!!!') } } } })
63
- respond_override({ index: { html: { failure: lambda { render(plain: 'failure!!!') } } } })
64
- end
65
- end
66
-
67
- describe "GET" do
68
- it "has value success" do
69
- get :index
70
- expect(response).to be_success
71
- expect(response.body).to match(/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(plain: 'failure!!!') } } } })
81
- end
82
- end
83
-
84
- describe "GET" do
85
- it "has value success" do
86
- 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(plain: 'success!!!') } } } })
97
- respond_override({ create: { html: { failure: lambda { render(plain: 'failure!!!') } } } })
98
- end
99
- end
100
-
101
- describe "POST" do
102
- it "has value success" do
103
- post :create
104
- expect(response).to be_success
105
- expect(response.body).to match(/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(plain: 'success!!!') } } } })
114
- end
115
- end
116
-
117
- describe "POST" do
118
- it "should not effect the wrong controller" do
119
- get :index
120
- expect(response.body).to match(/neutral/)
121
- end
122
- end
123
- end
124
- end
125
- end
126
- end