spree_frontend 3.0.0.rc1 → 3.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/spree/orders_controller.rb +0 -1
  3. data/app/helpers/spree/frontend_helper.rb +1 -1
  4. data/app/views/kaminari/twitter-bootstrap-3/_first_page.html.erb +4 -4
  5. data/app/views/kaminari/twitter-bootstrap-3/_last_page.html.erb +3 -3
  6. data/app/views/kaminari/twitter-bootstrap-3/_next_page.html.erb +3 -3
  7. data/app/views/kaminari/twitter-bootstrap-3/_paginator.html.erb +17 -16
  8. data/app/views/kaminari/twitter-bootstrap-3/_prev_page.html.erb +3 -3
  9. data/app/views/spree/address/_form.html.erb +2 -1
  10. data/app/views/spree/checkout/_confirm.html.erb +1 -1
  11. data/app/views/spree/checkout/_delivery.html.erb +0 -3
  12. data/app/views/spree/checkout/_payment.html.erb +6 -7
  13. data/app/views/spree/checkout/edit.html.erb +1 -0
  14. data/app/views/spree/checkout/payment/_gateway.html.erb +0 -1
  15. data/app/views/spree/layouts/spree_application.html.erb +0 -2
  16. data/app/views/spree/orders/_line_item.html.erb +4 -3
  17. data/app/views/spree/orders/edit.html.erb +0 -3
  18. data/app/views/spree/orders/show.html.erb +1 -0
  19. data/app/views/spree/payments/_payment.html.erb +1 -0
  20. data/app/views/spree/products/_cart_form.html.erb +4 -6
  21. data/app/views/spree/products/_promotions.html.erb +6 -5
  22. data/app/views/spree/products/_taxons.html.erb +3 -5
  23. data/app/views/spree/products/index.html.erb +0 -4
  24. data/app/views/spree/products/show.html.erb +1 -8
  25. data/app/views/spree/shared/_error_messages.html.erb +3 -3
  26. data/app/views/spree/shared/_filters.html.erb +1 -0
  27. data/app/views/spree/shared/_google_checkout.js.erb +1 -1
  28. data/app/views/spree/shared/_header.html.erb +1 -3
  29. data/app/views/spree/shared/_nav_bar.html.erb +0 -1
  30. data/app/views/spree/shared/_order_details.html.erb +0 -3
  31. data/app/views/spree/shared/_products.html.erb +21 -21
  32. data/app/views/spree/shared/_search.html.erb +13 -12
  33. data/app/views/spree/shared/_shipment_tracking.html.erb +1 -0
  34. data/app/views/spree/shared/_taxonomies.html.erb +1 -0
  35. data/config/routes.rb +0 -1
  36. data/spec/controllers/controller_extension_spec.rb +13 -2
  37. data/spec/controllers/spree/checkout_controller_spec.rb +5 -4
  38. data/spec/controllers/spree/orders_controller_ability_spec.rb +22 -30
  39. data/spec/spec_helper.rb +1 -1
  40. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27ddec8bb47e07dad6aef735b0b2f8490a8abd56
4
- data.tar.gz: c488a041981c0b4624925feffeeb75d84b7b1c99
3
+ metadata.gz: 21c4d3d6e5618eab61604b1b12a95fd8cdde9891
4
+ data.tar.gz: 148499f4d495b915912a7ce7cd5d41ef409a92ee
5
5
  SHA512:
6
- metadata.gz: 39ab773f3d7bffa2287c021567583de9c020eff79449d7d9e2ba69dc0af774543c05dec32198e4200bdc87b5820e7f7b46a79942698dc465062d3fec397ddc8d
7
- data.tar.gz: 27fbeb3df1cf2972dede8537ba8ec37f5811a45a9c6f01e833b770433d8c535dfd3cc41371276fadb13ac4cb898d07fa8be46a19214cf6a5dfb3747f190a1efb
6
+ metadata.gz: 65bcce2469d7125984737b17d7a5367df1bb15eb1bedac13856f42492429923d94377510a5475a1fcc457681badbf2dd5d65c03bd5743daaa1e193deaa5a9227
7
+ data.tar.gz: ea10c019574ae8d23cc7e5c58b42f87899cb8a64f311d00a84e20c40fecf3efac36d682a34aa7fd30a31657ec1268a32a17a25996c7ee1448600c7c150205fe0
@@ -81,7 +81,6 @@ module Spree
81
81
  end
82
82
 
83
83
  def check_authorization
84
- cookies.permanent.signed[:guest_token] = params[:token] if params[:token]
85
84
  order = Spree::Order.find_by_number(params[:id]) || current_order
86
85
 
87
86
  if order
@@ -10,7 +10,7 @@ module Spree
10
10
  separator = raw(separator)
11
11
  crumbs = [content_tag(:li, content_tag(:span, link_to(Spree.t(:home), spree.root_path, itemprop: "url") + separator, itemprop: "title"), itemscope: "itemscope", itemtype: "http://data-vocabulary.org/Breadcrumb")]
12
12
  if taxon
13
- crumbs << content_tag(:li, content_tag(:span, link_to(Spree.t(:products), products_path, itemprop: "url") + separator, itemprop: "title"), itemscope: "itemscope", itemtype: "http://data-vocabulary.org/Breadcrumb")
13
+ crumbs << content_tag(:li, content_tag(:span, link_to(Spree.t(:products), spree.products_path, itemprop: "url") + separator, itemprop: "title"), itemscope: "itemscope", itemtype: "http://data-vocabulary.org/Breadcrumb")
14
14
  crumbs << taxon.ancestors.collect { |ancestor| content_tag(:li, content_tag(:span, link_to(ancestor.name , seo_url(ancestor), itemprop: "url") + separator, itemprop: "title"), itemscope: "itemscope", itemtype: "http://data-vocabulary.org/Breadcrumb") } unless taxon.ancestors.empty?
15
15
  crumbs << content_tag(:li, content_tag(:span, link_to(taxon.name , seo_url(taxon), itemprop: "url"), itemprop: "title"), class: 'active', itemscope: "itemscope", itemtype: "http://data-vocabulary.org/Breadcrumb")
16
16
  else
@@ -7,7 +7,7 @@
7
7
  remote: data-remote
8
8
  -%>
9
9
  <% unless current_page.first? %>
10
- <li class="first">
11
- <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %>
12
- </li>
13
- <% end %>
10
+ <li class="first">
11
+ <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %>
12
+ </li>
13
+ <% end %>
@@ -7,7 +7,7 @@
7
7
  remote: data-remote
8
8
  -%>
9
9
  <% unless current_page.last? %>
10
- <li class="last next"><%# "next" class present for border styling in twitter bootstrap %>
11
- <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %>
12
- </li>
10
+ <li class="last next"><%# "next" class present for border styling in twitter bootstrap %>
11
+ <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %>
12
+ </li>
13
13
  <% end %>
@@ -7,7 +7,7 @@
7
7
  remote: data-remote
8
8
  -%>
9
9
  <% unless current_page.last? %>
10
- <li class="next_page">
11
- <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %>
12
- </li>
10
+ <li class="next_page">
11
+ <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %>
12
+ </li>
13
13
  <% end %>
@@ -6,19 +6,20 @@
6
6
  remote: data-remote
7
7
  paginator: the paginator that renders the pagination tags inside
8
8
  -%>
9
- <%- pagination_class ||= '' %>
10
- <%= paginator.render do -%>
11
- <ul class="pagination <%= pagination_class %>">
12
- <%= first_page_tag unless current_page.first? %>
13
- <%= prev_page_tag unless current_page.first? %>
14
- <% each_page do |page| -%>
15
- <% if page.left_outer? || page.right_outer? || page.inside_window? -%>
16
- <%= page_tag page %>
17
- <% elsif !page.was_truncated? -%>
18
- <%= gap_tag %>
19
- <% end -%>
20
- <% end -%>
21
- <%= next_page_tag unless current_page.last? %>
22
- <%= last_page_tag unless current_page.last? %>
23
- </ul>
24
- <% end -%>
9
+ <% pagination_class ||= '' %>
10
+
11
+ <%= paginator.render do %>
12
+ <ul class="pagination <%= pagination_class %>">
13
+ <%= first_page_tag unless current_page.first? %>
14
+ <%= prev_page_tag unless current_page.first? %>
15
+ <% each_page do |page| %>
16
+ <% if page.left_outer? || page.right_outer? || page.inside_window? %>
17
+ <%= page_tag page %>
18
+ <% elsif !page.was_truncated? %>
19
+ <%= gap_tag %>
20
+ <% end %>
21
+ <% end %>
22
+ <%= next_page_tag unless current_page.last? %>
23
+ <%= last_page_tag unless current_page.last? %>
24
+ </ul>
25
+ <% end %>
@@ -7,7 +7,7 @@
7
7
  remote: data-remote
8
8
  -%>
9
9
  <% unless current_page.first? %>
10
- <li class="prev">
11
- <%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %>
12
- </li>
10
+ <li class="prev">
11
+ <%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %>
12
+ </li>
13
13
  <% end %>
@@ -1,4 +1,5 @@
1
1
  <% address_id = address_type.chars.first %>
2
+
2
3
  <div class="inner" data-hook=<%="#{address_type}_inner" %>>
3
4
  <p class="form-group" id=<%="#{address_id}firstname" %>>
4
5
  <%= form.label :firstname, Spree.t(:first_name) %><span class="required">*</span><br />
@@ -49,7 +50,7 @@
49
50
  :disabled => have_states)
50
51
  ].join.gsub('"', "'").gsub("\n", "")
51
52
  %>
52
- <%= javascript_tag do -%>
53
+ <%= javascript_tag do %>
53
54
  $('#<%="#{address_id}state" %>').append("<%== state_elements %>");
54
55
  <% end %>
55
56
  </p>
@@ -3,7 +3,7 @@
3
3
  <h3 class="panel-title"><%= Spree.t(:confirm) %></h3>
4
4
  </div>
5
5
  <div class="panel-body">
6
- <%= render :partial => 'spree/shared/order_details', :locals => { :order => @order } %>
6
+ <%= render :partial => 'spree/shared/order_details', :locals => { :order => @order } %>
7
7
  </div>
8
8
  </div>
9
9
 
@@ -5,7 +5,6 @@
5
5
  <div class="panel-body" data-hook="shipping_method_inner">
6
6
  <div id="methods">
7
7
  <%= form.fields_for :shipments do |ship_form| %>
8
-
9
8
  <div class="shipment">
10
9
  <h4 class="stock-location" data-hook="stock-location">
11
10
  <%= Spree.t(:package_from) %>
@@ -52,7 +51,6 @@
52
51
  <% end %>
53
52
  </ul>
54
53
  </div>
55
-
56
54
  <% end %>
57
55
 
58
56
  <% if @differentiator.try(:missing?) %>
@@ -86,7 +84,6 @@
86
84
  </table>
87
85
  </div>
88
86
  <% end %>
89
-
90
87
  </div>
91
88
  <% if Spree::Config[:shipping_instructions] %>
92
89
  <p id="minstrs" data-hook>
@@ -3,7 +3,6 @@
3
3
  <h3 class="panel-title"><%= Spree.t(:payment_information) %></h3>
4
4
  </div>
5
5
  <div class="panel-body" data-hook="checkout_payment_step">
6
-
7
6
  <% if @payment_sources.present? %>
8
7
  <div class="card_options">
9
8
  <%= radio_button_tag 'use_existing_card', 'yes', true %>
@@ -39,12 +38,12 @@
39
38
 
40
39
  <ul class="list-group" id="payment-method-fields" data-hook>
41
40
  <% @order.available_payment_methods.each do |method| %>
42
- <li class="list-group-item">
43
- <label>
44
- <%= radio_button_tag "order[payments_attributes][][payment_method_id]", method.id, method == @order.available_payment_methods.first %>
45
- <%= Spree.t(method.name, :scope => :payment_methods, :default => method.name) %>
46
- </label>
47
- </li>
41
+ <li class="list-group-item">
42
+ <label>
43
+ <%= radio_button_tag "order[payments_attributes][][payment_method_id]", method.id, method == @order.available_payment_methods.first %>
44
+ <%= Spree.t(method.name, :scope => :payment_methods, :default => method.name) %>
45
+ </label>
46
+ </li>
48
47
  <% end %>
49
48
  </ul>
50
49
 
@@ -1,6 +1,7 @@
1
1
  <% content_for :google_analytics do %>
2
2
  <%= render partial: 'spree/shared/google_checkout.js', locals: { order: @order, step_number: (@order.checkout_steps.index(@order.state) + 1) } %>
3
3
  <% end %>
4
+
4
5
  <div id="checkout" data-hook>
5
6
  <%= render partial: 'spree/shared/error_messages', locals: { target: @order } %>
6
7
 
@@ -31,5 +31,4 @@
31
31
  </div>
32
32
 
33
33
  <%= hidden_field_tag "#{param_prefix}[cc_type]", '', :id => "cc_type", :class => 'ccType' %>
34
-
35
34
  </div>
@@ -12,9 +12,7 @@
12
12
  <%= render partial: 'spree/shared/header' %>
13
13
 
14
14
  <div class="container">
15
-
16
15
  <div class="row" data-hook>
17
-
18
16
  <%= breadcrumbs(@taxon) %>
19
17
 
20
18
  <%= render partial: 'spree/shared/sidebar' if content_for? :sidebar %>
@@ -1,5 +1,6 @@
1
- <% variant = line_item.variant -%>
2
- <%= order_form.fields_for :line_items, line_item do |item_form| -%>
1
+ <% variant = line_item.variant %>
2
+
3
+ <%= order_form.fields_for :line_items, line_item do |item_form| %>
3
4
  <tr class="line-item">
4
5
  <td class="cart-item-image" data-hook="cart_item_image">
5
6
  <% if variant.images.length == 0 %>
@@ -33,4 +34,4 @@
33
34
  <%= link_to content_tag(:span, '', class: 'glyphicon glyphicon-minus-sign'), '#', class: 'delete', id: "delete_#{dom_id(line_item)}" %>
34
35
  </td>
35
36
  </tr>
36
- <% end -%>
37
+ <% end %>
@@ -3,14 +3,11 @@
3
3
  <h1><%= Spree.t(:shopping_cart) %></h1>
4
4
 
5
5
  <% if @order.line_items.empty? %>
6
-
7
6
  <div data-hook="empty_cart">
8
7
  <div class="alert alert-info"><%= Spree.t(:your_cart_is_empty) %></div>
9
8
  <p><%= link_to Spree.t(:continue_shopping), products_path, class: 'btn btn-default' %></p>
10
9
  </div>
11
-
12
10
  <% else %>
13
-
14
11
  <div data-hook="outside_cart_form">
15
12
  <%= form_for @order, url: update_cart_path, html: { id: 'update-cart' } do |order_form| %>
16
13
  <div data-hook="inside_cart_form">
@@ -3,6 +3,7 @@
3
3
  <%= render partial: 'spree/shared/google_purchase.js', locals: { order: @order } %>
4
4
  <% end %>
5
5
  <% end %>
6
+
6
7
  <fieldset id="order_summary" data-hook>
7
8
  <legend><%= Spree.t(:order_number, number: @order.number) %></legend>
8
9
  <h1><%= accurate_title %></h1>
@@ -1,4 +1,5 @@
1
1
  <% source = payment.source %>
2
+
2
3
  <% if source.is_a?(Spree::CreditCard) %>
3
4
  <span class="cc-type">
4
5
  <% unless (cc_type = source.cc_type).blank? %>
@@ -1,6 +1,5 @@
1
1
  <%= form_for :order, :url => populate_orders_path do |f| %>
2
2
  <div class="row" id="inside-product-cart-form" data-hook="inside_product_cart_form" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
3
-
4
3
  <% if @product.variants_and_option_values(current_currency).any? %>
5
4
  <div id="product-variants" class="col-md-6">
6
5
  <h3 class="product-section-title"><%= Spree.t(:variants) %></h3>
@@ -29,7 +28,6 @@
29
28
 
30
29
  <% if @product.price_in(current_currency) and !@product.price.nil? %>
31
30
  <div data-hook="product_price" class="col-md-5">
32
-
33
31
  <div id="product-price">
34
32
  <h6 class="product-section-title"><%= Spree.t(:price) %></h6>
35
33
  <div>
@@ -60,10 +58,10 @@
60
58
  </div>
61
59
  </div>
62
60
  <% else %>
63
- <div id="product-price">
64
- <br>
65
- <div><span class="price selling" itemprop="price"><%= Spree.t('product_not_available_in_this_currency') %></span></div>
66
- </div>
61
+ <div id="product-price">
62
+ <br>
63
+ <div><span class="price selling" itemprop="price"><%= Spree.t('product_not_available_in_this_currency') %></span></div>
64
+ </div>
67
65
  <% end %>
68
66
  </div>
69
67
  <% end %>
@@ -1,4 +1,5 @@
1
1
  <% promotions = @product.possible_promotions %>
2
+
2
3
  <% if promotions.any? %>
3
4
  <div id="promotions">
4
5
  <h3><%= Spree.t(:promotions) %></h3>
@@ -7,11 +8,11 @@
7
8
  <h4><%= promotion.name %></h4>
8
9
  <p><%= promotion.description %></p>
9
10
  <% if promotion.products.any? %>
10
- <ul>
11
- <% promotion.products.each do |product| %>
12
- <li><%= link_to product.name, product_path(product) %></li>
13
- <% end %>
14
- </ul>
11
+ <ul>
12
+ <% promotion.products.each do |product| %>
13
+ <li><%= link_to product.name, product_path(product) %></li>
14
+ <% end %>
15
+ </ul>
15
16
  <% end %>
16
17
  </div>
17
18
  <% end %>
@@ -1,14 +1,12 @@
1
1
  <% if !@product.taxons.blank? %>
2
2
  <div id="taxon-crumbs" data-hook class=" five ">
3
3
  <h3 class="product-section-title"><%= Spree.t(:look_for_similar_items) %></h3>
4
-
5
4
  <div data-hook="product_taxons">
6
5
  <ul class="list-group" id="similar_items_by_taxon" data-hook>
7
- <% @product.taxons.each do |taxon| %>
8
- <li class="list-group-item"><%= link_to taxon.name, seo_url(taxon) %></li>
9
- <% end %>
6
+ <% @product.taxons.each do |taxon| %>
7
+ <li class="list-group-item"><%= link_to taxon.name, seo_url(taxon) %></li>
8
+ <% end %>
10
9
  </ul>
11
10
  </div>
12
-
13
11
  </div>
14
12
  <% end %>
@@ -10,9 +10,7 @@
10
10
  <% end %>
11
11
  <% end %>
12
12
 
13
-
14
13
  <% if params[:keywords] %>
15
-
16
14
  <div data-hook="search_results">
17
15
  <% if @products.empty? %>
18
16
  <h6 class="search-results-title"><%= Spree.t(:no_products_found) %></h6>
@@ -20,9 +18,7 @@
20
18
  <%= render :partial => 'spree/shared/products', :locals => { :products => @products, :taxon => @taxon } %>
21
19
  <% end %>
22
20
  </div>
23
-
24
21
  <% else %>
25
-
26
22
  <div data-hook="homepage_products">
27
23
  <% cache(cache_key_for_products) do %>
28
24
  <%= render :partial => 'spree/shared/products', :locals => { :products => @products, :taxon => @taxon } %>
@@ -1,10 +1,9 @@
1
1
  <% @body_id = 'product-details' %>
2
+
2
3
  <% cache [I18n.locale, current_currency, @product] do %>
3
4
  <div data-hook="product_show" itemscope itemtype="http://schema.org/Product">
4
-
5
5
  <div class="col-md-4" data-hook="product_left_part">
6
6
  <div data-hook="product_left_part_wrap">
7
-
8
7
  <div id="product-images" data-hook="product_images">
9
8
  <div id="main-image" class="panel panel-default" data-hook>
10
9
  <div class="panel-body text-center">
@@ -23,15 +22,12 @@
23
22
  <div data-hook="promotions">
24
23
  <%= render :partial => 'promotions' %>
25
24
  </div>
26
-
27
25
  </div>
28
26
  </div>
29
27
 
30
28
  <div class="col-md-8" data-hook="product_right_part">
31
29
  <div data-hook="product_right_part_wrap">
32
-
33
30
  <div id="product-description" data-hook="product_description">
34
-
35
31
  <h1 class="product-title" itemprop="name"><%= @product.name %></h1>
36
32
 
37
33
  <div class="well" itemprop="description" data-hook="description">
@@ -41,13 +37,10 @@
41
37
  <div id="cart-form" data-hook="cart_form">
42
38
  <%= render :partial => 'cart_form' %>
43
39
  </div>
44
-
45
40
  </div>
46
41
 
47
42
  <%= render :partial => 'taxons' %>
48
-
49
43
  </div>
50
44
  </div>
51
-
52
45
  </div>
53
46
  <% end %>
@@ -3,9 +3,9 @@
3
3
  <h3><%= Spree.t(:errors_prohibited_this_record_from_being_saved, :count => target.errors.count) %>:</h3>
4
4
  <p><%= Spree.t(:there_were_problems_with_the_following_fields) %>:</p>
5
5
  <ul>
6
- <% target.errors.full_messages.each do |msg| %>
7
- <li><%= msg %></li>
8
- <% end %>
6
+ <% target.errors.full_messages.each do |msg| %>
7
+ <li><%= msg %></li>
8
+ <% end %>
9
9
  </ul>
10
10
  <br/>
11
11
  </div>
@@ -1,4 +1,5 @@
1
1
  <% filters = @taxon ? @taxon.applicable_filters : [Spree::Core::ProductFilters.all_taxons] %>
2
+
2
3
  <% unless filters.empty? %>
3
4
  <%= form_tag '', :method => :get, :id => 'sidebar_products_search' do %>
4
5
  <%= hidden_field_tag 'per_page', params[:per_page] %>
@@ -6,5 +6,5 @@ ga('set', '&cu', '<%= current_currency %>');
6
6
 
7
7
  // Add the step number and additional info about the checkout to the action.
8
8
  ga('ec:setAction','checkout', {
9
- 'step': <%= step_number %>
9
+ 'step': <%= step_number %>
10
10
  });
@@ -1,5 +1,4 @@
1
1
  <div id="spree-header">
2
-
3
2
  <header id="header" data-hook>
4
3
  <div class="container">
5
4
  <div class="row">
@@ -13,5 +12,4 @@
13
12
  <div class="container">
14
13
  <%= render :partial => 'spree/shared/main_nav_bar' if store_menu? %>
15
14
  </div>
16
-
17
- </div>
15
+ </div>
@@ -4,5 +4,4 @@
4
4
  <%= render :partial => 'spree/shared/search' %>
5
5
  </li>
6
6
  </ul>
7
-
8
7
  </nav>
@@ -1,7 +1,5 @@
1
1
  <div class="row steps-data">
2
-
3
2
  <% if order.has_step?("address") %>
4
-
5
3
  <div class="col-md-3" data-hook="order-bill-address">
6
4
  <h4><%= Spree.t(:billing_address) %> <%= link_to "(#{Spree.t(:edit)})", checkout_state_path(:address) unless order.completed? %></h4>
7
5
  <%= render partial: 'spree/shared/address', locals: { address: order.bill_address } %>
@@ -36,7 +34,6 @@
36
34
  <% end %>
37
35
  </div>
38
36
  </div>
39
-
40
37
  </div>
41
38
 
42
39
  <hr />
@@ -16,33 +16,33 @@
16
16
  </div>
17
17
  <% elsif params.key?(:keywords) %>
18
18
  <div data-hook="products_search_results_heading_results_found">
19
- <h6 class="search-results-title"><%= Spree.t(:search_results, :keywords => h(params[:keywords])) %></h6>
19
+ <h6 class="search-results-title"><%= Spree.t(:search_results, keywords: h(params[:keywords])) %></h6>
20
20
  </div>
21
21
  <% end %>
22
22
  </div>
23
23
 
24
24
  <% if products.any? %>
25
- <div id="products" class="row" data-hook>
26
- <% products.each do |product| %>
27
- <% url = product_url(product, taxon_id: @taxon.try(:id)) %>
28
- <div id="product_<%= product.id %>" class="col-md-3 col-sm-6 product-list-item" data-hook="products_list_item" itemscope itemtype="http://schema.org/Product">
29
- <div class="panel panel-default">
30
- <% cache(@taxon.present? ? [I18n.locale, current_currency, @taxon, product] : [I18n.locale, current_currency, product]) do %>
31
- <div class="panel-body text-center product-body">
32
- <%= link_to small_image(product, itemprop: "image"), url, itemprop: 'url' %><br/>
33
- <%= link_to truncate(product.name, length: 50), url, class: 'info', itemprop: "name", title: product.name %>
34
- </div>
35
- <div class="panel-footer text-center">
36
- <span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
37
- <span class="price selling lead" itemprop="price"><%= display_price(product) %></span>
38
- </span>
39
- </div>
40
- <% end %>
25
+ <div id="products" class="row" data-hook>
26
+ <% products.each do |product| %>
27
+ <% url = spree.product_url(product, taxon_id: @taxon.try(:id)) %>
28
+ <div id="product_<%= product.id %>" class="col-md-3 col-sm-6 product-list-item" data-hook="products_list_item" itemscope itemtype="http://schema.org/Product">
29
+ <div class="panel panel-default">
30
+ <% cache(@taxon.present? ? [I18n.locale, current_currency, @taxon, product] : [I18n.locale, current_currency, product]) do %>
31
+ <div class="panel-body text-center product-body">
32
+ <%= link_to small_image(product, itemprop: "image"), url, itemprop: 'url' %><br/>
33
+ <%= link_to truncate(product.name, length: 50), url, class: 'info', itemprop: "name", title: product.name %>
34
+ </div>
35
+ <div class="panel-footer text-center">
36
+ <span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
37
+ <span class="price selling lead" itemprop="price"><%= display_price(product) %></span>
38
+ </span>
39
+ </div>
40
+ <% end %>
41
+ </div>
41
42
  </div>
42
- </div>
43
- <% end %>
44
- <% reset_cycle("classes") %>
45
- </div>
43
+ <% end %>
44
+ <% reset_cycle("classes") %>
45
+ </div>
46
46
  <% end %>
47
47
 
48
48
  <% if paginated_products.respond_to?(:num_pages) %>
@@ -1,15 +1,16 @@
1
1
  <% @taxons = @taxon && @taxon.parent ? @taxon.parent.children : Spree::Taxon.roots %>
2
+
2
3
  <%= form_tag spree.products_path, :method => :get, class: "navbar-form" do %>
3
- <div class="form-group">
4
- <% cache(cache_key_for_taxons) do %>
5
- <%= select_tag :taxon,
6
- options_for_select([[Spree.t(:all_departments), '']] +
7
- @taxons.map {|t| [t.name, t.id]},
8
- @taxon ? @taxon.id : params[:taxon]), 'aria-label' => 'Taxon', class: "form-control" %>
9
- <% end %>
10
- </div>
11
- <div class="form-group">
12
- <%= search_field_tag :keywords, params[:keywords], :placeholder => Spree.t(:search), class: "form-control" %>
13
- </div>
14
- <%= submit_tag Spree.t(:search), :name => nil, class: "btn btn-success" %>
4
+ <div class="form-group">
5
+ <% cache(cache_key_for_taxons) do %>
6
+ <%= select_tag :taxon,
7
+ options_for_select([[Spree.t(:all_departments), '']] +
8
+ @taxons.map {|t| [t.name, t.id]},
9
+ @taxon ? @taxon.id : params[:taxon]), 'aria-label' => 'Taxon', class: "form-control" %>
10
+ <% end %>
11
+ </div>
12
+ <div class="form-group">
13
+ <%= search_field_tag :keywords, params[:keywords], :placeholder => Spree.t(:search), class: "form-control" %>
14
+ </div>
15
+ <%= submit_tag Spree.t(:search), :name => nil, class: "btn btn-success" %>
15
16
  <% end %>
@@ -1,4 +1,5 @@
1
1
  <% shipments = order.shipments.trackable %>
2
+
2
3
  <% if shipments.any? %>
3
4
  <h6><%= Spree.t(:tracking) %></h6>
4
5
  <div class="tracking">
@@ -1,4 +1,5 @@
1
1
  <% max_level = Spree::Config[:max_level_in_taxons_menu] || 1 %>
2
+
2
3
  <nav id="taxonomies" class="sidebar-item" data-hook>
3
4
  <% @taxonomies.each do |taxonomy| %>
4
5
  <% cache [I18n.locale, taxonomy, max_level] do %>
data/config/routes.rb CHANGED
@@ -17,7 +17,6 @@ Spree::Core::Engine.add_routes do
17
17
  end
18
18
 
19
19
  get '/orders/populate', :to => populate_redirect
20
- get '/orders/:id/token/:token' => 'orders#show', :as => :token_order
21
20
 
22
21
  resources :orders, :except => [:index, :new, :create, :destroy] do
23
22
  post :populate, :on => :collection
@@ -23,6 +23,15 @@ describe Spree::CustomController, :type => :controller do
23
23
  Spree::CustomController.clear_overrides!
24
24
  end
25
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
+
26
35
  context "extension testing" do
27
36
  context "index" do
28
37
  context "specify symbol for handler instead of Proc" do
@@ -37,6 +46,7 @@ describe Spree::CustomController, :type => :controller do
37
46
  end
38
47
  end
39
48
  end
49
+
40
50
  describe "GET" do
41
51
  it "has value success" do
42
52
  spree_get :index
@@ -53,6 +63,7 @@ describe Spree::CustomController, :type => :controller do
53
63
  respond_override({:index => {:html => {:failure => lambda { render(:text => 'failure!!!') }}}})
54
64
  end
55
65
  end
66
+
56
67
  describe "GET" do
57
68
  it "has value success" do
58
69
  spree_get :index
@@ -69,6 +80,7 @@ describe Spree::CustomController, :type => :controller do
69
80
  respond_override({:index => {:html => {:failure => lambda { render(:text => 'failure!!!') }}}})
70
81
  end
71
82
  end
83
+
72
84
  describe "GET" do
73
85
  it "has value success" do
74
86
  spree_get :index
@@ -101,6 +113,7 @@ describe Spree::CustomController, :type => :controller do
101
113
  respond_override({:index => {:html => {:success => lambda { render(:text => 'success!!!') }}}})
102
114
  end
103
115
  end
116
+
104
117
  describe "POST" do
105
118
  it "should not effect the wrong controller" do
106
119
  spree_get :index
@@ -108,8 +121,6 @@ describe Spree::CustomController, :type => :controller do
108
121
  end
109
122
  end
110
123
  end
111
-
112
124
  end
113
125
  end
114
-
115
126
  end
@@ -318,7 +318,8 @@ describe Spree::CheckoutController, :type => :controller do
318
318
  it "due to no available shipping rates for any of the shipments" do
319
319
  expect(order.shipments.count).to eq(1)
320
320
  order.shipments.first.shipping_rates.delete_all
321
- spree_put :update, :order => {}
321
+
322
+ spree_put :update, state: order.state, :order => {}
322
323
  expect(flash[:error]).to eq(Spree.t(:items_cannot_be_shipped))
323
324
  expect(response).to redirect_to(spree.checkout_state_path('address'))
324
325
  end
@@ -332,7 +333,7 @@ describe Spree::CheckoutController, :type => :controller do
332
333
  end
333
334
 
334
335
  it "due to the order having errors" do
335
- spree_put :update, :order => {}
336
+ spree_put :update, state: order.state, :order => {}
336
337
  expect(flash[:error]).to eq("Base error\nAdjustments error")
337
338
  expect(response).to redirect_to(spree.checkout_state_path('address'))
338
339
  end
@@ -359,7 +360,7 @@ describe Spree::CheckoutController, :type => :controller do
359
360
 
360
361
  it "when GatewayError is raised" do
361
362
  allow_any_instance_of(Spree::Payment).to receive(:process!).and_raise(Spree::Core::GatewayError.new(Spree.t(:payment_processing_failed)))
362
- spree_put :update, :order => {}
363
+ spree_put :update, state: order.state, :order => {}
363
364
  expect(flash[:error]).to eq(Spree.t(:payment_processing_failed))
364
365
  end
365
366
  end
@@ -403,7 +404,7 @@ describe Spree::CheckoutController, :type => :controller do
403
404
 
404
405
  it "doesn't set shipping address on the order" do
405
406
  expect(order).to_not receive(:ship_address=)
406
- spree_post :update
407
+ spree_post :update, state: order.state
407
408
  end
408
409
 
409
410
  it "doesn't remove unshippable items before payment" do
@@ -1,45 +1,40 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Spree
4
- describe OrdersController, :type => :controller do
5
- ORDER_TOKEN = 'ORDER_TOKEN'
6
-
4
+ describe OrdersController, type: :controller do
7
5
  let(:user) { create(:user) }
8
6
  let(:guest_user) { create(:user) }
9
7
  let(:order) { Spree::Order.create }
10
8
 
11
- it 'should understand order routes with token' do
12
- expect(spree.token_order_path('R123456', 'ABCDEF')).to eq('/orders/R123456/token/ABCDEF')
13
- end
14
-
15
9
  context 'when an order exists in the cookies.signed' do
16
10
  let(:token) { 'some_token' }
17
11
  let(:specified_order) { create(:order) }
18
12
 
19
13
  before do
20
- allow(controller).to receive_messages :current_order => order
21
- allow(controller).to receive_messages :spree_current_user => user
14
+ cookies.signed[:guest_token] = token
15
+ allow(controller).to receive_messages current_order: order
16
+ allow(controller).to receive_messages spree_current_user: user
22
17
  end
23
18
 
24
19
  context '#populate' do
25
20
  it 'should check if user is authorized for :edit' do
26
21
  expect(controller).to receive(:authorize!).with(:edit, order, token)
27
- spree_post :populate, :token => token
22
+ spree_post :populate
28
23
  end
29
24
  it "should check against the specified order" do
30
25
  expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
31
- spree_post :populate, :id => specified_order.number, :token => token
26
+ spree_post :populate, id: specified_order.number
32
27
  end
33
28
  end
34
29
 
35
30
  context '#edit' do
36
31
  it 'should check if user is authorized for :edit' do
37
32
  expect(controller).to receive(:authorize!).with(:edit, order, token)
38
- spree_get :edit, :token => token
33
+ spree_get :edit
39
34
  end
40
35
  it "should check against the specified order" do
41
36
  expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
42
- spree_get :edit, :id => specified_order.number, :token => token
37
+ spree_get :edit, id: specified_order.number
43
38
  end
44
39
  end
45
40
 
@@ -47,54 +42,51 @@ module Spree
47
42
  it 'should check if user is authorized for :edit' do
48
43
  allow(order).to receive :update_attributes
49
44
  expect(controller).to receive(:authorize!).with(:edit, order, token)
50
- spree_post :update, :order => { :email => "foo@bar.com" }, :token => token
45
+ spree_post :update, order: { email: "foo@bar.com" }
51
46
  end
52
47
  it "should check against the specified order" do
53
48
  allow(order).to receive :update_attributes
54
49
  expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
55
- spree_post :update, :order => { :email => "foo@bar.com" }, :id => specified_order.number, :token => token
50
+ spree_post :update, order: { email: "foo@bar.com" }, id: specified_order.number
56
51
  end
57
52
  end
58
53
 
59
54
  context '#empty' do
60
55
  it 'should check if user is authorized for :edit' do
61
56
  expect(controller).to receive(:authorize!).with(:edit, order, token)
62
- spree_post :empty, :token => token
57
+ spree_post :empty
63
58
  end
64
59
  it "should check against the specified order" do
65
60
  expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
66
- spree_post :empty, :id => specified_order.number, :token => token
61
+ spree_post :empty, id: specified_order.number
67
62
  end
68
63
  end
69
64
 
70
65
  context "#show" do
71
66
  it "should check against the specified order" do
72
67
  expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
73
- spree_get :show, :id => specified_order.number, :token => token
68
+ spree_get :show, id: specified_order.number
74
69
  end
75
70
  end
76
71
  end
77
72
 
78
73
  context 'when no authenticated user' do
79
- let(:order) { create(:order, :number => 'R123') }
74
+ let(:order) { create(:order, number: 'R123') }
80
75
 
81
76
  context '#show' do
82
- context 'when token parameter present' do
83
- it 'always ooverride existing token when passing a new one' do
84
- cookies.signed[:guest_token] = "soo wrong"
85
- spree_get :show, { :id => 'R123', :token => order.guest_token }
86
- expect(cookies.signed[:guest_token]).to eq(order.guest_token)
87
- end
77
+ context 'when guest_token correct' do
78
+ before { cookies.signed[:guest_token] = order.guest_token }
88
79
 
89
- it 'should store as guest_token in session' do
90
- spree_get :show, {:id => 'R123', :token => order.guest_token }
91
- expect(cookies.signed[:guest_token]).to eq(order.guest_token)
80
+ it 'displays the page' do
81
+ expect(controller).to receive(:authorize!).with(:edit, order, order.guest_token)
82
+ spree_get :show, { id: 'R123' }
83
+ expect(response.code).to eq('200')
92
84
  end
93
85
  end
94
86
 
95
- context 'when no token present' do
87
+ context 'when guest_token not present' do
96
88
  it 'should respond with 404' do
97
- spree_get :show, {:id => 'R123'}
89
+ spree_get :show, { id: 'R123'}
98
90
  expect(response.code).to eq('404')
99
91
  end
100
92
  end
data/spec/spec_helper.rb CHANGED
@@ -108,7 +108,7 @@ RSpec.configure do |config|
108
108
 
109
109
  config.include Spree::TestingSupport::Preferences
110
110
  config.include Spree::TestingSupport::UrlHelpers
111
- config.include Spree::TestingSupport::ControllerRequests
111
+ config.include Spree::TestingSupport::ControllerRequests, type: :controller
112
112
  config.include Spree::TestingSupport::Flash
113
113
 
114
114
  config.include Paperclip::Shoulda::Matchers
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.rc1
4
+ version: 3.0.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-04 00:00:00.000000000 Z
11
+ date: 2015-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.0.rc1
19
+ version: 3.0.0.rc3
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: 3.0.0.rc1
26
+ version: 3.0.0.rc3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spree_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.0.rc1
33
+ version: 3.0.0.rc3
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: 3.0.0.rc1
40
+ version: 3.0.0.rc3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bootstrap-sass
43
43
  requirement: !ruby/object:Gem::Requirement