spree_frontend 3.7.14.1 → 4.0.0.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/app/assets/javascripts/spree/frontend/checkout/address.js +42 -14
  4. data/app/assets/javascripts/spree/frontend/checkout/address_book.js +56 -0
  5. data/app/assets/javascripts/spree/frontend/product.js +54 -39
  6. data/app/assets/javascripts/spree/frontend.js +4 -1
  7. data/app/assets/stylesheets/spree/frontend/_variables.scss +1 -1
  8. data/app/assets/stylesheets/spree/frontend/address_book.scss +8 -0
  9. data/app/assets/stylesheets/spree/frontend/frontend_bootstrap.css.scss +13 -35
  10. data/app/assets/stylesheets/spree/frontend.css +1 -0
  11. data/app/controllers/concerns/spree/checkout/address_book.rb +53 -0
  12. data/app/controllers/spree/addresses_controller.rb +72 -0
  13. data/app/controllers/spree/checkout_controller.rb +2 -0
  14. data/app/controllers/spree/orders_controller.rb +0 -55
  15. data/app/controllers/spree/products_controller.rb +5 -1
  16. data/app/controllers/spree/store_controller.rb +1 -1
  17. data/app/helpers/spree/addresses_helper.rb +36 -0
  18. data/app/helpers/spree/frontend_helper.rb +16 -15
  19. data/app/views/kaminari/{twitter-bootstrap-3 → twitter-bootstrap-4}/_first_page.html.erb +2 -2
  20. data/app/views/kaminari/{twitter-bootstrap-3 → twitter-bootstrap-4}/_gap.html.erb +5 -1
  21. data/app/views/kaminari/{twitter-bootstrap-3 → twitter-bootstrap-4}/_last_page.html.erb +2 -2
  22. data/app/views/kaminari/{twitter-bootstrap-3 → twitter-bootstrap-4}/_next_page.html.erb +2 -2
  23. data/app/views/kaminari/{twitter-bootstrap-3 → twitter-bootstrap-4}/_page.html.erb +8 -2
  24. data/app/views/kaminari/{twitter-bootstrap-3 → twitter-bootstrap-4}/_paginator.html.erb +1 -1
  25. data/app/views/kaminari/{twitter-bootstrap-3 → twitter-bootstrap-4}/_prev_page.html.erb +2 -2
  26. data/app/views/spree/address/_form.html.erb +27 -24
  27. data/app/views/spree/addresses/_form.html.erb +18 -0
  28. data/app/views/spree/addresses/destroy.js.erb +2 -0
  29. data/app/views/spree/addresses/edit.html.erb +23 -0
  30. data/app/views/spree/addresses/new.html.erb +23 -0
  31. data/app/views/spree/checkout/_address.html.erb +61 -37
  32. data/app/views/spree/checkout/_confirm.html.erb +12 -10
  33. data/app/views/spree/checkout/_delivery.html.erb +27 -15
  34. data/app/views/spree/checkout/_payment.html.erb +14 -9
  35. data/app/views/spree/checkout/_summary.html.erb +59 -57
  36. data/app/views/spree/checkout/edit.html.erb +6 -6
  37. data/app/views/spree/checkout/payment/_gateway.html.erb +43 -35
  38. data/app/views/spree/layouts/spree_application.html.erb +5 -2
  39. data/app/views/spree/orders/_form.html.erb +38 -25
  40. data/app/views/spree/orders/edit.html.erb +28 -22
  41. data/app/views/spree/orders/show.html.erb +2 -1
  42. data/app/views/spree/products/_cart_form.html.erb +28 -26
  43. data/app/views/spree/products/_product.html.erb +7 -8
  44. data/app/views/spree/products/_promotions.html.erb +13 -11
  45. data/app/views/spree/products/_properties.html.erb +10 -3
  46. data/app/views/spree/products/_thumbnails.html.erb +5 -7
  47. data/app/views/spree/products/show.html.erb +8 -8
  48. data/app/views/spree/shared/_filters.html.erb +29 -9
  49. data/app/views/spree/shared/_header.html.erb +2 -2
  50. data/app/views/spree/shared/_login_bar.html.erb +9 -3
  51. data/app/views/spree/shared/_main_nav_bar.html.erb +15 -15
  52. data/app/views/spree/shared/_nav_bar.html.erb +2 -2
  53. data/app/views/spree/shared/_order_details.html.erb +143 -89
  54. data/app/views/spree/shared/_products.html.erb +2 -2
  55. data/app/views/spree/shared/_search.html.erb +19 -12
  56. data/app/views/spree/shared/_sidebar.html.erb +1 -1
  57. data/app/views/spree/shared/_taxonomies.html.erb +7 -3
  58. data/config/routes.rb +2 -0
  59. data/lib/spree/frontend/engine.rb +4 -0
  60. data/lib/spree/frontend.rb +3 -3
  61. data/spree_frontend.gemspec +4 -3
  62. metadata +48 -25
@@ -1,27 +1,30 @@
1
1
  <%= form_for :order, html: { id: 'add-to-cart-form' } do |f| %>
2
2
  <div class="row" id="inside-product-cart-form" data-hook="inside_product_cart_form" itemprop="offers" itemscope itemtype="https://schema.org/Offer">
3
3
  <% if @product.variants_and_option_values(current_currency).any? %>
4
- <div id="product-variants" class="col-md-6">
4
+ <div id="product-variants" class="col-lg-6 mt-4">
5
5
  <h3 class="product-section-title"><%= Spree.t(:variants) %></h3>
6
6
  <ul class="list-group">
7
7
  <% @product.variants_and_option_values(current_currency).each_with_index do |variant, index| %>
8
- <li>
9
- <%= radio_button_tag "variant_id", variant.id, index == 0,
10
- 'data-price' => variant.price_in(current_currency).money,
11
- 'data-in-stock' => variant.can_supply?,
12
- 'data-backordered' => variant.backordered?
13
- %>
14
- <%= label_tag "variant_id_#{ variant.id }" do %>
15
- <span class="variant-description">
16
- <%= variant.options_text %>
17
- </span>
18
- <% if variant_price variant %>
19
- <span class="price diff"><%= variant_price variant %></span>
8
+ <li class="list-group-item <%= "active" if index == 0 %>">
9
+ <div class="form-check">
10
+ <%= radio_button_tag "variant_id", variant.id, index == 0,
11
+ 'data-price' => variant.price_in(current_currency).money,
12
+ 'data-in-stock' => variant.can_supply?,
13
+ 'data-backordered' => variant.backordered?,
14
+ class: 'form-check-input'
15
+ %>
16
+ <%= label_tag "variant_id_#{ variant.id }", class: "form-check-label" do %>
17
+ <span class="variant-description">
18
+ <%= variant.options_text %>
19
+ </span>
20
+ <% if variant_price variant %>
21
+ <span class="price diff"><%= variant_price variant %></span>
22
+ <% end %>
23
+ <% unless variant.can_supply? %>
24
+ <span class="out-of-stock"><%= Spree.t(:out_of_stock) %></span>
25
+ <% end %>
20
26
  <% end %>
21
- <% unless variant.can_supply? %>
22
- <span class="out-of-stock"><%= Spree.t(:out_of_stock) %></span>
23
- <% end %>
24
- <% end %>
27
+ </div>
25
28
  </li>
26
29
  <% end%>
27
30
  </ul>
@@ -31,9 +34,9 @@
31
34
  <% end %>
32
35
 
33
36
  <% if @product.price_in(current_currency) && !@product.price.nil? %>
34
- <div data-hook="product_price" class="col-md-5">
37
+ <div data-hook="product_price" class="col-lg-5 mt-4">
35
38
  <div id="product-price">
36
- <h6 class="product-section-title"><%= Spree.t(:price) %></h6>
39
+ <h3 class="product-section-title"><%= Spree.t(:price) %></h3>
37
40
  <div>
38
41
  <span class="lead price selling" itemprop="price" content="<%= @product.price_in(current_currency).amount.to_d %>">
39
42
  <%= display_price(@product) %>
@@ -44,8 +47,9 @@
44
47
  <% if @product.master.can_supply? %>
45
48
  <link itemprop="availability" href="https://schema.org/InStock" />
46
49
  <% elsif @product.variants.empty? %>
47
- <br />
48
- <span class="out-of-stock"><%= Spree.t(:out_of_stock) %></span>
50
+ <span class="out-of-stock d-block mt-2">
51
+ <%= Spree.t(:out_of_stock) %>
52
+ </span>
49
53
  <% end %>
50
54
  <% if @product.backordered? %>
51
55
  <div class="alert alert-warning" id="cart-backordered-info">
@@ -55,22 +59,20 @@
55
59
  </div>
56
60
 
57
61
  <% if @product.can_supply? %>
58
- <div class="add-to-cart">
59
- <br />
62
+ <div class="add-to-cart mt-2">
60
63
  <div class="input-group">
61
64
  <%= number_field_tag :quantity, 1, class: 'title form-control', min: 1 %>
62
- <span class="input-group-btn">
65
+ <div class="input-group-append">
63
66
  <%= button_tag class: 'btn btn-success', id: 'add-to-cart-button', type: :submit, disabled: true do %>
64
67
  <%= Spree.t(:add_to_cart) %>
65
68
  <% end %>
66
- </span>
69
+ </div>
67
70
  </div>
68
71
  </div>
69
72
  <% end %>
70
73
  </div>
71
74
  <% else %>
72
75
  <div id="product-price">
73
- <br />
74
76
  <div>
75
77
  <span class="price selling" itemprop="price">
76
78
  <%= Spree.t('product_not_available_in_this_currency') %>
@@ -1,15 +1,14 @@
1
1
  <% url = spree.product_path(product, taxon_id: taxon.try(:id)) %>
2
- <div id="product_<%= product.id %>" class="col-md-3 col-sm-6 col-xs-6 product-list-item" data-hook="products_list_item" itemscope itemtype="https://schema.org/Product">
3
- <div class="panel panel-default">
2
+ <div id="product_<%= product.id %>" class="d-flex w-100 col-12 col-sm-6 col-lg-4 col-xl-3 product-list-item mb-4" data-hook="products_list_item" itemscope itemtype="https://schema.org/Product">
3
+ <div class="card w-100">
4
4
  <% cache(taxon.present? ? [I18n.locale, current_currency, taxon, product] : cache_key_for_product(product)) do %>
5
- <div class="panel-body text-center product-body">
6
- <%= link_to url, itemprop: "url" do %>
7
- <%= small_image(product, itemprop: "image") %><br/>
8
- <%= content_tag(:span, truncate(product.name, length: 50), class: 'info', itemprop: "name", title: product.name) %>
5
+ <div class="card-body text-center product-body">
6
+ <%= link_to url, itemprop: "url", class: 'd-block text-center' do %>
7
+ <%= small_image(product, itemprop: "image", class: "d-block mx-auto") %>
8
+ <%= content_tag(:span, truncate(product.name, length: 50), class: 'info mt-3 d-block', itemprop: "name", title: product.name) %>
9
9
  <% end %>
10
- <br/>
11
10
  </div>
12
- <div class="panel-footer text-center">
11
+ <div class="card-footer text-center">
13
12
  <span itemprop="offers" itemscope itemtype="https://schema.org/Offer">
14
13
  <span class="price selling lead" itemprop="price" content="<%= (product.price_in(current_currency).amount.nil?)? 0 : product.price_in(current_currency).amount.to_d %>">
15
14
  <%= display_price(product) %>
@@ -4,17 +4,19 @@
4
4
  <div id="promotions">
5
5
  <h3><%= Spree.t(:promotions) %></h3>
6
6
  <% promotions.each do |promotion| %>
7
- <div class="well well-sm">
8
- <h4><%= promotion.name %></h4>
9
- <p><%= promotion.description %></p>
10
- <% if promotion.products.any? %>
11
- <ul>
12
- <% promotion.products.each do |product| %>
13
- <li><%= link_to product.name, product_path(product) %></li>
14
- <% end %>
15
- </ul>
16
- <% end %>
17
- </div>
7
+ <div class="card mb-3 bg-light">
8
+ <div class="card-body p-1">
9
+ <h4><%= promotion.name %></h4>
10
+ <p><%= promotion.description %></p>
11
+ <% if promotion.products.any? %>
12
+ <ul>
13
+ <% promotion.products.each do |product| %>
14
+ <li><%= link_to product.name, product_path(product) %></li>
15
+ <% end %>
16
+ </ul>
17
+ <% end %>
18
+ </div>
19
+ </div>
18
20
  <% end %>
19
21
  </div>
20
22
  <% end %>
@@ -1,11 +1,18 @@
1
- <% unless @product_properties.blank? %>
2
- <h3 class="product-section-title"><%= Spree.t('properties')%></h3>
1
+ <% unless @product_properties.blank? %>
2
+ <h3 class="product-section-title h4 mt-4">
3
+ <%= Spree.t('properties')%>
4
+ </h3>
5
+
3
6
  <table id="product-properties" class="table table-striped" data-hook>
4
7
  <tbody>
5
8
  <% @product_properties.each do |product_property| %>
6
9
  <% css_class = cycle('even', 'odd', name: "properties") %>
7
10
  <tr class="<%= css_class %>">
8
- <td><strong><%= product_property.property.presentation %></strong></td>
11
+ <td>
12
+ <strong>
13
+ <%= product_property.property.presentation %>
14
+ </strong>
15
+ </td>
9
16
  <td><%= product_property.value %></td>
10
17
  </tr>
11
18
  <% end %>
@@ -1,19 +1,17 @@
1
1
  <%# no need for thumbnails unless there is more than one image %>
2
2
  <% if (@product.images + @product.variant_images).uniq.size > 1 %>
3
- <ul id="product-thumbnails" class="thumbnails list-inline" data-hook>
3
+ <ul id="product-thumbnails" class="thumbnails d-flex w-100 pl-0 my-4" data-hook>
4
4
  <% @product.images.each do |i| %>
5
- <li class='tmb-all tmb-<%= i.viewable.id %>'>
6
- <% img_tag = image_tag(main_app.url_for(i.url(:mini)), class: "thumbnail", alt: set_image_alt(i, :mini)) %>
7
- <%= link_to(img_tag, main_app.url_for(i.url(:product))) %>
5
+ <li class='tmb-all mr-2 tmb-<%= i.viewable.id %>'>
6
+ <%= link_to(image_tag(main_app.url_for(i.url(:mini)), class: "img-thumbnail d-inline-block"), main_app.url_for(i.url(:product))) %>
8
7
  </li>
9
8
  <% end %>
10
9
 
11
10
  <% if @product.has_variants? %>
12
11
  <% @product.variant_images.each do |i| %>
13
12
  <% next if @product.images.include?(i) %>
14
- <li class='vtmb tmb-<%= i.viewable.id %>'>
15
- <% img_tag = image_tag(main_app.url_for(i.url(:mini)), class: "thumbnail", alt: set_image_alt(i, :mini)) %>
16
- <%= link_to(img_tag, main_app.url_for(i.url(:product))) %>
13
+ <li class='vtmb mr-2 tmb-<%= i.viewable.id %>'>
14
+ <%= link_to(image_tag(main_app.url_for(i.url(:mini)), class: "img-thumbnail"), main_app.url_for(i.url(:product))) %>
17
15
  </li>
18
16
  <% end %>
19
17
  <% end %>
@@ -2,11 +2,11 @@
2
2
 
3
3
  <% cache cache_key_for_product do %>
4
4
  <div data-hook="product_show" class="row" itemscope itemtype="https://schema.org/Product">
5
- <div class="col-md-4 col-sm-5" data-hook="product_left_part">
5
+ <div class="col-lg-4 col-md-5" data-hook="product_left_part">
6
6
  <div data-hook="product_left_part_wrap">
7
7
  <div id="product-images" data-hook="product_images">
8
- <div id="main-image" class="panel panel-default" data-hook>
9
- <div class="panel-body text-center">
8
+ <div id="main-image" class="card " data-hook>
9
+ <div class="card-body text-center">
10
10
  <%= product_image(@product, itemprop: "image") %>
11
11
  </div>
12
12
  </div>
@@ -25,13 +25,13 @@
25
25
  </div>
26
26
  </div>
27
27
 
28
- <div class="col-md-8 col-sm-7" data-hook="product_right_part">
28
+ <div class="col-lg-8 col-md-7" data-hook="product_right_part">
29
29
  <div data-hook="product_right_part_wrap">
30
30
  <div id="product-description" data-hook="product_description">
31
- <h1 class="product-title" itemprop="name"><%= @product.name %></h1>
31
+ <h1 class="product-title mt-2" itemprop="name"><%= @product.name %></h1>
32
32
 
33
- <div class="well" itemprop="description" data-hook="description">
34
- <%= product_description(@product) %>
33
+ <div itemprop="description" data-hook="description">
34
+ <%= sanitize product_description(@product) %>
35
35
  </div>
36
36
 
37
37
  <div id="cart-form" data-hook="cart_form">
@@ -39,7 +39,7 @@
39
39
  </div>
40
40
  </div>
41
41
 
42
- <div id="taxon-crumbs" class=" five " data-hook="product_taxons">
42
+ <div id="taxon-crumbs" class="mt-4" data-hook="product_taxons">
43
43
  <%= render partial: 'taxons' %>
44
44
  </div>
45
45
  </div>
@@ -6,23 +6,43 @@
6
6
  <% filters.each do |filter| %>
7
7
  <% labels = filter[:labels] || filter[:conds].map {|m,c| [m,m]} %>
8
8
  <% next if labels.empty? %>
9
- <div class="navigation" data-hook="navigation">
10
- <h4 class="filter-title"> <%= filter[:name] %> </h4>
9
+ <div
10
+ class="navigation mt-4"
11
+ data-hook="navigation"
12
+ aria-labelledby="products_search_wrapper"
13
+ role="group">
14
+
15
+ <h4 class="filter-title mt-0 h5" id="products_search_wrapper">
16
+ <%= filter[:name] %>
17
+ </h4>
18
+
11
19
  <ul class="list-group">
12
20
  <% labels.each do |nm,val| %>
13
21
  <% label = "#{filter[:name]}_#{nm}".gsub(/\s+/,'_') %>
14
22
  <li class="list-group-item">
15
- <input type="checkbox"
16
- id="<%= label %>"
17
- name="search[<%= filter[:scope].to_s %>][]"
18
- value="<%= val %>"
19
- <%= params[:search].present? && params[:search][filter[:scope]] && params[:search][filter[:scope]].include?(val.to_s) ? "checked" : "" %> />
20
- <label class="nowrap" for="<%= label %>"> <%= nm %> </label>
23
+ <div class="form-check">
24
+ <input
25
+ aria-labelledby="products_search_wrapper"
26
+ type="checkbox"
27
+ class="form-check-input"
28
+ id="<%= label %>"
29
+ name="search[<%= filter[:scope].to_s %>][]"
30
+ value="<%= val %>"
31
+ <%= params[:search].present? &&
32
+ params[:search][filter[:scope]] &&
33
+ params[:search][filter[:scope]].include?(val.to_s) ?
34
+ "checked" :
35
+ "" %> />
36
+ <label class="nowrap form-check-label" for="<%= label %>">
37
+ <%= nm %>
38
+ </label>
39
+ </div>
21
40
  </li>
22
41
  <% end %>
23
42
  </ul>
24
43
  </div>
25
44
  <% end %>
26
- <%= submit_tag Spree.t(:search), name: nil, class: 'btn btn-primary' %>
45
+
46
+ <%= submit_tag Spree.t(:search), name: nil, class: 'mt-4 btn btn-primary' %>
27
47
  <% end %>
28
48
  <% end %>
@@ -1,8 +1,8 @@
1
1
  <div id="spree-header">
2
- <header id="header" data-hook>
2
+ <header id="header" data-hook class="py-3">
3
3
  <div class="container">
4
4
  <div class="row">
5
- <figure id="logo" class="col-md-4 col-sm-3" data-hook>
5
+ <figure id="logo" class="col-3 col-md-4" data-hook>
6
6
  <%= logo %>
7
7
  </figure>
8
8
  <%= render partial: 'spree/shared/nav_bar' %>
@@ -1,6 +1,12 @@
1
1
  <% if spree_current_user %>
2
- <li><%= link_to Spree.t(:my_account), spree.account_path %></li>
3
- <li><%= link_to Spree.t(:logout), spree.logout_path %></li>
2
+ <li>
3
+ <%= link_to Spree.t(:my_account), spree.account_path %>
4
+ </li>
5
+ <li>
6
+ <%= link_to Spree.t(:logout), spree.logout_path %>
7
+ </li>
4
8
  <% else %>
5
- <li id="link-to-login"><%= link_to Spree.t(:login), spree.login_path %></li>
9
+ <li id="link-to-login">
10
+ <%= link_to Spree.t(:login), spree.login_path %>
11
+ </li>
6
12
  <% end %>
@@ -1,16 +1,16 @@
1
- <nav class="col-md-12">
2
- <div id="main-nav-bar" class="navbar">
3
- <ul class="nav navbar-nav" data-hook>
4
- <li id="home-link" data-hook><%= link_to Spree.t(:home), spree.root_path %></li>
5
- </ul>
6
- <ul class="nav navbar-nav navbar-right" data-hook>
7
- <li id="link-to-cart" data-hook>
8
- <noscript>
9
- <%= link_to_cart %>
10
- </noscript>
11
- &nbsp;
12
- </li>
13
- <script>Spree.fetch_cart()</script>
14
- </ul>
15
- </div>
1
+ <nav id="main-nav-bar" class="navbar">
2
+ <ul class="nav" data-hook>
3
+ <li id="home-link" class="nav-item" data-hook>
4
+ <%= link_to Spree.t(:home), spree.root_path, class: 'nav-link' %>
5
+ </li>
6
+ </ul>
7
+ <ul class="nav navbar-right" data-hook>
8
+ <li id="link-to-cart" class="nav-item" data-hook>
9
+ <noscript>
10
+ <%= link_to_cart %>
11
+ </noscript>
12
+ &nbsp;
13
+ </li>
14
+ <script>Spree.fetch_cart()</script>
15
+ </ul>
16
16
  </nav>
@@ -1,5 +1,5 @@
1
- <nav class="navbar col-md-8 col-sm-9" id="top-nav-bar">
2
- <ul id="nav-bar" class="nav navbar-nav navbar-right" data-hook>
1
+ <nav class="navbar navbar-dark col-md-8 col-sm-9" id="top-nav-bar">
2
+ <ul id="nav-bar" class="nav align-items-center d-flex flex-column flex-sm-row navbar-right w-100 justify-content-start justify-content-md-end" data-hook>
3
3
  <li id="search-bar" data-hook>
4
4
  <%= render partial: 'spree/shared/search' %>
5
5
  </li>