spree_frontend 3.7.14.1 → 4.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/app/assets/javascripts/spree/frontend/checkout/address.js +42 -14
- data/app/assets/javascripts/spree/frontend/checkout/address_book.js +56 -0
- data/app/assets/javascripts/spree/frontend/product.js +54 -39
- data/app/assets/javascripts/spree/frontend.js +4 -1
- data/app/assets/stylesheets/spree/frontend/_variables.scss +1 -1
- data/app/assets/stylesheets/spree/frontend/address_book.scss +8 -0
- data/app/assets/stylesheets/spree/frontend/frontend_bootstrap.css.scss +13 -35
- data/app/assets/stylesheets/spree/frontend.css +1 -0
- data/app/controllers/concerns/spree/checkout/address_book.rb +53 -0
- data/app/controllers/spree/addresses_controller.rb +72 -0
- data/app/controllers/spree/checkout_controller.rb +2 -0
- data/app/controllers/spree/orders_controller.rb +0 -55
- data/app/controllers/spree/products_controller.rb +5 -1
- data/app/controllers/spree/store_controller.rb +1 -1
- data/app/helpers/spree/addresses_helper.rb +36 -0
- data/app/helpers/spree/frontend_helper.rb +16 -15
- data/app/views/kaminari/{twitter-bootstrap-3 → twitter-bootstrap-4}/_first_page.html.erb +2 -2
- data/app/views/kaminari/{twitter-bootstrap-3 → twitter-bootstrap-4}/_gap.html.erb +5 -1
- data/app/views/kaminari/{twitter-bootstrap-3 → twitter-bootstrap-4}/_last_page.html.erb +2 -2
- data/app/views/kaminari/{twitter-bootstrap-3 → twitter-bootstrap-4}/_next_page.html.erb +2 -2
- data/app/views/kaminari/{twitter-bootstrap-3 → twitter-bootstrap-4}/_page.html.erb +8 -2
- data/app/views/kaminari/{twitter-bootstrap-3 → twitter-bootstrap-4}/_paginator.html.erb +1 -1
- data/app/views/kaminari/{twitter-bootstrap-3 → twitter-bootstrap-4}/_prev_page.html.erb +2 -2
- data/app/views/spree/address/_form.html.erb +27 -24
- data/app/views/spree/addresses/_form.html.erb +18 -0
- data/app/views/spree/addresses/destroy.js.erb +2 -0
- data/app/views/spree/addresses/edit.html.erb +23 -0
- data/app/views/spree/addresses/new.html.erb +23 -0
- data/app/views/spree/checkout/_address.html.erb +61 -37
- data/app/views/spree/checkout/_confirm.html.erb +12 -10
- data/app/views/spree/checkout/_delivery.html.erb +27 -15
- data/app/views/spree/checkout/_payment.html.erb +14 -9
- data/app/views/spree/checkout/_summary.html.erb +59 -57
- data/app/views/spree/checkout/edit.html.erb +6 -6
- data/app/views/spree/checkout/payment/_gateway.html.erb +43 -35
- data/app/views/spree/layouts/spree_application.html.erb +5 -2
- data/app/views/spree/orders/_form.html.erb +38 -25
- data/app/views/spree/orders/edit.html.erb +28 -22
- data/app/views/spree/orders/show.html.erb +2 -1
- data/app/views/spree/products/_cart_form.html.erb +28 -26
- data/app/views/spree/products/_product.html.erb +7 -8
- data/app/views/spree/products/_promotions.html.erb +13 -11
- data/app/views/spree/products/_properties.html.erb +10 -3
- data/app/views/spree/products/_thumbnails.html.erb +5 -7
- data/app/views/spree/products/show.html.erb +8 -8
- data/app/views/spree/shared/_filters.html.erb +29 -9
- data/app/views/spree/shared/_header.html.erb +2 -2
- data/app/views/spree/shared/_login_bar.html.erb +9 -3
- data/app/views/spree/shared/_main_nav_bar.html.erb +15 -15
- data/app/views/spree/shared/_nav_bar.html.erb +2 -2
- data/app/views/spree/shared/_order_details.html.erb +143 -89
- data/app/views/spree/shared/_products.html.erb +2 -2
- data/app/views/spree/shared/_search.html.erb +19 -12
- data/app/views/spree/shared/_sidebar.html.erb +1 -1
- data/app/views/spree/shared/_taxonomies.html.erb +7 -3
- data/config/routes.rb +2 -0
- data/lib/spree/frontend/engine.rb +4 -0
- data/lib/spree/frontend.rb +3 -3
- data/spree_frontend.gemspec +4 -3
- metadata +48 -25
@@ -11,7 +11,7 @@ module Spree
|
|
11
11
|
@searcher = build_searcher(params.merge(include_images: true))
|
12
12
|
@products = @searcher.retrieve_products
|
13
13
|
@products = @products.includes(:possible_promotions) if @products.respond_to?(:includes)
|
14
|
-
@taxonomies =
|
14
|
+
@taxonomies = load_taxonomies
|
15
15
|
end
|
16
16
|
|
17
17
|
def show
|
@@ -58,5 +58,9 @@ module Spree
|
|
58
58
|
redirect_to url_for(params), status: :moved_permanently
|
59
59
|
end
|
60
60
|
end
|
61
|
+
|
62
|
+
def load_taxonomies
|
63
|
+
Spree::Taxonomy.includes(root: :children)
|
64
|
+
end
|
61
65
|
end
|
62
66
|
end
|
@@ -3,7 +3,7 @@ module Spree
|
|
3
3
|
include Spree::Core::ControllerHelpers::Order
|
4
4
|
|
5
5
|
skip_before_action :set_current_order, only: :cart_link
|
6
|
-
skip_before_action :verify_authenticity_token, only: :ensure_cart
|
6
|
+
skip_before_action :verify_authenticity_token, only: :ensure_cart
|
7
7
|
|
8
8
|
def forbidden
|
9
9
|
render 'spree/shared/forbidden', layout: Spree::Config[:layout], status: 403
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# https://github.com/spree-contrib/spree_address_book/blob/master/app/helpers/spree/addresses_helper.rb
|
2
|
+
module Spree
|
3
|
+
module AddressesHelper
|
4
|
+
def address_field(form, method, address_id = 'b', &handler)
|
5
|
+
content_tag :div, id: [address_id, method].join, class: 'form-group' do
|
6
|
+
if handler
|
7
|
+
yield
|
8
|
+
else
|
9
|
+
is_required = Spree::Address.required_fields.include?(method)
|
10
|
+
separator = is_required ? '<span class="required">*</span><br />' : '<br />'
|
11
|
+
form.label(method) + separator.html_safe +
|
12
|
+
form.text_field(method, class: [is_required ? 'required' : nil, 'form-control'].compact, required: is_required)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def address_state(form, country, _address_id = 'b')
|
18
|
+
country ||= Spree::Country.find(Spree::Config[:default_country_id])
|
19
|
+
have_states = country.states.any?
|
20
|
+
state_elements = [
|
21
|
+
form.collection_select(:state_id, country.states.order(:name),
|
22
|
+
:id, :name,
|
23
|
+
{ include_blank: true },
|
24
|
+
class: have_states ? 'form-control' : 'hidden',
|
25
|
+
disabled: !have_states) +
|
26
|
+
form.text_field(:state_name,
|
27
|
+
class: !have_states ? 'form-control' : 'hidden',
|
28
|
+
disabled: have_states)
|
29
|
+
].join.tr('"', "'").delete("\n")
|
30
|
+
|
31
|
+
form.label(:state, Spree.t(:state)) + '<span class="req">*</span><br />'.html_safe +
|
32
|
+
content_tag(:noscript, form.text_field(:state_name, class: 'required form-control')) +
|
33
|
+
javascript_tag("document.write(\"#{state_elements.html_safe}\");")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -5,20 +5,20 @@ module Spree
|
|
5
5
|
@body_class
|
6
6
|
end
|
7
7
|
|
8
|
-
def spree_breadcrumbs(taxon, separator = '
|
8
|
+
def spree_breadcrumbs(taxon, separator = '')
|
9
9
|
return '' if current_page?('/') || taxon.nil?
|
10
10
|
|
11
11
|
separator = raw(separator)
|
12
|
-
crumbs = [content_tag(:li, content_tag(:span, link_to(content_tag(:span, Spree.t(:home), itemprop: 'name'), spree.root_path, itemprop: 'url') + separator, itemprop: 'item'), itemscope: 'itemscope', itemtype: 'https://schema.org/ListItem', itemprop: 'itemListElement')]
|
12
|
+
crumbs = [content_tag(:li, content_tag(:span, link_to(content_tag(:span, Spree.t(:home), itemprop: 'name'), spree.root_path, itemprop: 'url') + separator, itemprop: 'item'), itemscope: 'itemscope', itemtype: 'https://schema.org/ListItem', itemprop: 'itemListElement', class: 'breadcrumb-item')]
|
13
13
|
if taxon
|
14
|
-
crumbs << content_tag(:li, content_tag(:span, link_to(content_tag(:span, Spree.t(:products), itemprop: 'name'), spree.products_path, itemprop: 'url') + separator, itemprop: 'item'), itemscope: 'itemscope', itemtype: 'https://schema.org/ListItem', itemprop: 'itemListElement')
|
15
|
-
crumbs << taxon.ancestors.collect { |ancestor| content_tag(:li, content_tag(:span, link_to(content_tag(:span, ancestor.name, itemprop: 'name'), seo_url(ancestor), itemprop: 'url') + separator, itemprop: 'item'), itemscope: 'itemscope', itemtype: 'https://schema.org/ListItem', itemprop: 'itemListElement') } unless taxon.ancestors.empty?
|
16
|
-
crumbs << content_tag(:li, content_tag(:span, link_to(content_tag(:span, taxon.name, itemprop: 'name'), seo_url(taxon), itemprop: 'url'), itemprop: 'item'), class: 'active', itemscope: 'itemscope', itemtype: 'https://schema.org/ListItem', itemprop: 'itemListElement')
|
14
|
+
crumbs << content_tag(:li, content_tag(:span, link_to(content_tag(:span, Spree.t(:products), itemprop: 'name'), spree.products_path, itemprop: 'url') + separator, itemprop: 'item'), itemscope: 'itemscope', itemtype: 'https://schema.org/ListItem', itemprop: 'itemListElement', class: 'breadcrumb-item')
|
15
|
+
crumbs << taxon.ancestors.collect { |ancestor| content_tag(:li, content_tag(:span, link_to(content_tag(:span, ancestor.name, itemprop: 'name'), seo_url(ancestor), itemprop: 'url') + separator, itemprop: 'item'), itemscope: 'itemscope', itemtype: 'https://schema.org/ListItem', itemprop: 'itemListElement', class: 'breadcrumb-item') } unless taxon.ancestors.empty?
|
16
|
+
crumbs << content_tag(:li, content_tag(:span, link_to(content_tag(:span, taxon.name, itemprop: 'name'), seo_url(taxon), itemprop: 'url'), itemprop: 'item'), class: 'active breadcrumb-item', itemscope: 'itemscope', itemtype: 'https://schema.org/ListItem', itemprop: 'itemListElement')
|
17
17
|
else
|
18
18
|
crumbs << content_tag(:li, content_tag(:span, Spree.t(:products), itemprop: 'item'), class: 'active', itemscope: 'itemscope', itemtype: 'https://schema.org/ListItem', itemprop: 'itemListElement')
|
19
19
|
end
|
20
20
|
crumb_list = content_tag(:ol, raw(crumbs.flatten.map(&:mb_chars).join), class: 'breadcrumb', itemscope: 'itemscope', itemtype: 'https://schema.org/BreadcrumbList')
|
21
|
-
content_tag(:nav, crumb_list, id: 'breadcrumbs', class: 'col-
|
21
|
+
content_tag(:nav, crumb_list, id: 'breadcrumbs', class: 'col-12 mt-4', aria: { label: 'breadcrumb' })
|
22
22
|
end
|
23
23
|
|
24
24
|
def checkout_progress(numbers: false)
|
@@ -27,13 +27,13 @@ module Spree
|
|
27
27
|
text = Spree.t("order_state.#{state}").titleize
|
28
28
|
text.prepend("#{i.succ}. ") if numbers
|
29
29
|
|
30
|
-
css_classes = []
|
30
|
+
css_classes = ['nav-item']
|
31
31
|
current_index = states.index(@order.state)
|
32
32
|
state_index = states.index(state)
|
33
33
|
|
34
34
|
if state_index < current_index
|
35
35
|
css_classes << 'completed'
|
36
|
-
text = link_to text, checkout_state_path(state)
|
36
|
+
text = link_to text, checkout_state_path(state), class: 'nav-link'
|
37
37
|
end
|
38
38
|
|
39
39
|
css_classes << 'next' if state_index == current_index + 1
|
@@ -45,10 +45,10 @@ module Spree
|
|
45
45
|
if state_index < current_index
|
46
46
|
content_tag('li', text, class: css_classes.join(' '))
|
47
47
|
else
|
48
|
-
content_tag('li', content_tag('a', text), class: css_classes.join(' '))
|
48
|
+
content_tag('li', content_tag('a', text, class: "nav-link #{'active text-white' if state == @order.state}"), class: css_classes.join(' '))
|
49
49
|
end
|
50
50
|
end
|
51
|
-
content_tag('ul', raw(items.join("\n")), class: 'progress-steps nav nav-pills nav-justified', id: "checkout-step-#{@order.state}")
|
51
|
+
content_tag('ul', raw(items.join("\n")), class: 'progress-steps nav nav-pills nav-justified flex-column flex-md-row', id: "checkout-step-#{@order.state}")
|
52
52
|
end
|
53
53
|
|
54
54
|
def flash_messages(opts = {})
|
@@ -68,11 +68,12 @@ module Spree
|
|
68
68
|
text = "<span class='glyphicon glyphicon-shopping-cart'></span> #{text}: (#{Spree.t('empty')})"
|
69
69
|
css_class = 'empty'
|
70
70
|
else
|
71
|
-
text = "<span class='glyphicon glyphicon-shopping-cart'></span> #{text}: (#{simple_current_order.item_count})
|
71
|
+
text = "<span class='glyphicon glyphicon-shopping-cart'></span> #{text}: (#{simple_current_order.item_count})
|
72
|
+
<span class='amount'>#{simple_current_order.display_total.to_html}</span>"
|
72
73
|
css_class = 'full'
|
73
74
|
end
|
74
75
|
|
75
|
-
link_to text.html_safe, spree.cart_path, class: "cart-info #{css_class}"
|
76
|
+
link_to text.html_safe, spree.cart_path, class: "cart-info nav-link #{css_class}"
|
76
77
|
end
|
77
78
|
|
78
79
|
def taxons_tree(root_taxon, current_taxon, max_level = 1)
|
@@ -80,15 +81,15 @@ module Spree
|
|
80
81
|
|
81
82
|
content_tag :div, class: 'list-group' do
|
82
83
|
taxons = root_taxon.children.map do |taxon|
|
83
|
-
css_class = current_taxon&.self_and_ancestors&.include?(taxon) ? 'list-group-item active' : 'list-group-item'
|
84
|
+
css_class = current_taxon&.self_and_ancestors&.include?(taxon) ? 'list-group-item list-group-item-action active' : 'list-group-item list-group-item-action'
|
84
85
|
link_to(taxon.name, seo_url(taxon), class: css_class) + taxons_tree(taxon, current_taxon, max_level - 1)
|
85
86
|
end
|
86
87
|
safe_join(taxons, "\n")
|
87
88
|
end
|
88
89
|
end
|
89
90
|
|
90
|
-
def set_image_alt(image
|
91
|
-
image.alt
|
91
|
+
def set_image_alt(image)
|
92
|
+
return image.alt if image.alt.present?
|
92
93
|
end
|
93
94
|
end
|
94
95
|
end
|
@@ -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 %>
|
10
|
+
<li class="first page-item">
|
11
|
+
<%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, remote: remote, class: 'page-link' %>
|
12
12
|
</li>
|
13
13
|
<% end %>
|
@@ -5,4 +5,8 @@
|
|
5
5
|
per_page: number of items to fetch per page
|
6
6
|
remote: data-remote
|
7
7
|
-%>
|
8
|
-
<li class="page gap disabled
|
8
|
+
<li class="page gap disabled page-item">
|
9
|
+
<a href="#" onclick="return false;" class="page-link">
|
10
|
+
<%= raw(t 'views.pagination.truncate') %>
|
11
|
+
</a>
|
12
|
+
</li>
|
@@ -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,
|
10
|
+
<li class="last next page-item"><%# "next" class present for border styling in twitter bootstrap %>
|
11
|
+
<%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, remote: remote, class: 'page-link' %>
|
12
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 %>
|
10
|
+
<li class="next_page page-item">
|
11
|
+
<%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote, class: 'page-link' %>
|
12
12
|
</li>
|
13
13
|
<% end %>
|
@@ -7,6 +7,12 @@
|
|
7
7
|
per_page: number of items to fetch per page
|
8
8
|
remote: data-remote
|
9
9
|
-%>
|
10
|
-
<li class="page<%= ' active' if page.current? %>">
|
11
|
-
<%= link_to page,
|
10
|
+
<li class="page<%= ' active' if page.current? %> page-item">
|
11
|
+
<%= link_to page,
|
12
|
+
url,
|
13
|
+
opts = {
|
14
|
+
remote: remote,
|
15
|
+
rel: page.next? ? 'next' : page.prev? ? 'prev' : nil,
|
16
|
+
class: 'page-link'
|
17
|
+
} %>
|
12
18
|
</li>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<% pagination_class ||= '' %>
|
10
10
|
|
11
11
|
<%= paginator.render do %>
|
12
|
-
<ul class="pagination <%= pagination_class %>">
|
12
|
+
<ul class="pagination mt-4 <%= pagination_class %>">
|
13
13
|
<%= first_page_tag unless current_page.first? %>
|
14
14
|
<%= prev_page_tag unless current_page.first? %>
|
15
15
|
<% each_page do |page| %>
|
@@ -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 %>
|
10
|
+
<li class="prev page-item">
|
11
|
+
<%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote, class: 'page-link' %>
|
12
12
|
</li>
|
13
13
|
<% end %>
|
@@ -1,51 +1,52 @@
|
|
1
1
|
<% address_id = address_type.chars.first %>
|
2
2
|
|
3
3
|
<div class="inner" data-hook=<%="#{address_type}_inner" %>>
|
4
|
-
<
|
4
|
+
<div class="form-group" id=<%="#{address_id}firstname" %>>
|
5
5
|
<%= form.label :firstname do %>
|
6
6
|
<%= Spree.t(:first_name) %><abbr class="required" title="required">*</abbr>
|
7
7
|
<% end %>
|
8
8
|
<%= form.text_field :firstname, class: 'form-control', required: true %>
|
9
|
-
</
|
10
|
-
<
|
9
|
+
</div>
|
10
|
+
<div class="form-group" id=<%="#{address_id}lastname" %>>
|
11
11
|
<%= form.label :lastname do %>
|
12
12
|
<%= Spree.t(:last_name) %><abbr class="required" title="required">*</abbr>
|
13
13
|
<% end %>
|
14
14
|
<%= form.text_field :lastname, class: 'form-control', required: true %>
|
15
|
-
</
|
15
|
+
</div>
|
16
16
|
<% if Spree::Config[:company] %>
|
17
|
-
<
|
17
|
+
<div class="form-group" id=<%="#{address_id}company" %>>
|
18
18
|
<%= form.label :company, Spree.t(:company) %>
|
19
19
|
<%= form.text_field :company, class: 'form-control' %>
|
20
|
-
</
|
20
|
+
</div>
|
21
21
|
<% end %>
|
22
|
-
<
|
22
|
+
<div class="form-group" id=<%="#{address_id}address1" %>>
|
23
23
|
<%= form.label :address1 do %>
|
24
24
|
<%= Spree.t(:street_address) %><abbr class="required" title="required">*</abbr>
|
25
25
|
<% end %>
|
26
26
|
<%= form.text_field :address1, class: 'form-control required' %>
|
27
|
-
</
|
28
|
-
<
|
27
|
+
</div>
|
28
|
+
<div class="form-group" id=<%="#{address_id}address2" %>>
|
29
29
|
<%= form.label :address2, Spree.t(:street_address_2) %>
|
30
30
|
<%= form.text_field :address2, class: 'form-control' %>
|
31
|
-
</
|
32
|
-
<
|
31
|
+
</div>
|
32
|
+
<div class="form-group" id=<%="#{address_id}city" %>>
|
33
33
|
<%= form.label :city do %>
|
34
34
|
<%= Spree.t(:city) %><abbr class="required" title="required">*</abbr>
|
35
35
|
<% end %>
|
36
36
|
<%= form.text_field :city, class: 'form-control', required: true %>
|
37
|
-
</
|
38
|
-
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div class="form-group" id=<%="#{address_id}country" %>>
|
39
40
|
<%= form.label :country_id do %>
|
40
41
|
<%= Spree.t(:country) %><abbr class="required" title="required">*</abbr>
|
41
42
|
<% end %>
|
42
43
|
<span id=<%="#{address_id}country-selection" %>>
|
43
44
|
<%= form.collection_select :country_id, available_countries, :id, :name, {}, { class: 'form-control', required: true } %>
|
44
45
|
</span>
|
45
|
-
</
|
46
|
+
</div>
|
46
47
|
|
47
48
|
<% if Spree::Config[:address_requires_state] %>
|
48
|
-
<
|
49
|
+
<div class="form-group" id=<%="#{address_id}state" %>>
|
49
50
|
<% have_states = !address.country.states.empty? %>
|
50
51
|
<%= form.label :state do %>
|
51
52
|
<%= Spree.t(:state) %><abbr class='required' title="required" id=<%="#{address_id}state-required"%>>*</abbr>
|
@@ -55,37 +56,39 @@
|
|
55
56
|
form.collection_select(:state_id, address.country.states,
|
56
57
|
:id, :name,
|
57
58
|
{include_blank: true},
|
58
|
-
{class: have_states ? 'form-control' : '
|
59
|
+
{class: have_states ? 'form-control' : 'hidden',
|
59
60
|
required: have_states,
|
60
61
|
disabled: !have_states}) +
|
61
62
|
form.text_field(:state_name,
|
62
|
-
class: !have_states ? 'form-control' : '
|
63
|
+
class: !have_states ? 'form-control' : 'hidden',
|
63
64
|
required: !have_states,
|
64
65
|
disabled: have_states)
|
65
66
|
].join.gsub('"', "'").gsub("\n", "")
|
66
67
|
%>
|
67
|
-
</
|
68
|
+
</div>
|
68
69
|
<noscript>
|
69
70
|
<%= form.text_field :state_name, class: 'form-control', required: true %>
|
70
71
|
</noscript>
|
71
72
|
<% end %>
|
72
73
|
|
73
|
-
<
|
74
|
+
<div class="form-group" id=<%="#{address_id}zipcode" %>>
|
74
75
|
<%= form.label :zipcode do %>
|
75
76
|
<%= Spree.t(:zip) %><% if address.require_zipcode? %><abbr class="required" title="required">*</abbr><% end %>
|
76
77
|
<% end %>
|
77
78
|
<%= form.text_field :zipcode, class: 'form-control', required: address.require_zipcode? %>
|
78
|
-
</
|
79
|
-
|
79
|
+
</div>
|
80
|
+
|
81
|
+
|
82
|
+
<div class="form-group" id=<%="#{address_id}phone" %>>
|
80
83
|
<%= form.label :phone do %>
|
81
84
|
<%= Spree.t(:phone) %><% if address.require_phone? %><abbr class="required" title="required">*</abbr><% end %>
|
82
85
|
<% end %>
|
83
86
|
<%= form.phone_field :phone, class: 'form-control', required: address.require_phone? %>
|
84
|
-
</
|
87
|
+
</div>
|
85
88
|
<% if Spree::Config[:alternative_shipping_phone] %>
|
86
|
-
<
|
89
|
+
<div class="form-group" id=<%="#{address_id}altphone" %>>
|
87
90
|
<%= form.label :alternative_phone, Spree.t(:alternative_phone) %>
|
88
91
|
<%= form.phone_field :alternative_phone, class: 'form-control' %>
|
89
|
-
</
|
92
|
+
</div>
|
90
93
|
<% end %>
|
91
94
|
</div>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% address_id = address_type.chars.first %>
|
2
|
+
|
3
|
+
<% Spree::Address::ADDRESS_FIELDS.each do |field| %>
|
4
|
+
<% if field == "country" %>
|
5
|
+
<div class="form-group" id="<%= "#{address_id}country" %>">
|
6
|
+
<%= address_form.label :country_id, Spree.t(:country) %><span class="required">*</span><br />
|
7
|
+
<span id="<%= "#{address_id}country-selection" %>">
|
8
|
+
<%= address_form.collection_select :country_id, available_countries, :id, :name, {}, {:class => 'required form-control'} %>
|
9
|
+
</span>
|
10
|
+
</div>
|
11
|
+
<% elsif field == "state" %>
|
12
|
+
<%= address_field(address_form, :state, address_id) { address_state(address_form, address.country, address_id)} if Spree::Config[:address_requires_state] %>
|
13
|
+
<% else %>
|
14
|
+
<% next if field == "company" && !Spree::Config[:company] %>
|
15
|
+
<% next if field == "alternative_#{address_id}_phone" && !Spree::Config["alternative_#{address_id}_phone"] %>
|
16
|
+
<%= address_field(address_form, field.to_sym, address_id) %>
|
17
|
+
<% end %>
|
18
|
+
<% end %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<div class="col-lg-6 offset-lg-3">
|
2
|
+
<div class="card mb-3">
|
3
|
+
<div class="card-header">
|
4
|
+
<h3 class="card-title mb-0 h5"><%= t(:edit_shipping_address, scope: :address_book) %></h3>
|
5
|
+
</div>
|
6
|
+
<div class="card-body">
|
7
|
+
<%= render 'spree/shared/error_messages', target: @address %>
|
8
|
+
<%= form_for @address, html: { id: 'checkout_form_address' } do |f| %>
|
9
|
+
<fieldset>
|
10
|
+
<div class="inner">
|
11
|
+
<%= render 'spree/addresses/form',
|
12
|
+
address_name: 'address',
|
13
|
+
address_form: f,
|
14
|
+
address_type: 'shipping',
|
15
|
+
address: @address
|
16
|
+
%>
|
17
|
+
</div>
|
18
|
+
<%= f.submit Spree.t(:update), class: 'btn btn-primary' %>
|
19
|
+
</fieldset>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<div class="col-lg-6 offset-lg-3">
|
2
|
+
<div class="card mb-3">
|
3
|
+
<div class="card-header">
|
4
|
+
<h3 class="card-title h5 mb-0"><%= t(:new_shipping_address, scope: :address_book) %></h3>
|
5
|
+
</div>
|
6
|
+
<div class="card-body">
|
7
|
+
<%= render 'spree/shared/error_messages', target: @address %>
|
8
|
+
<%= form_for @address, html: { id: 'checkout_form_address' } do |f| %>
|
9
|
+
<fieldset>
|
10
|
+
<div class="inner">
|
11
|
+
<%= render 'spree/addresses/form',
|
12
|
+
address_name: 'address',
|
13
|
+
address_form: f,
|
14
|
+
address_type: 'shipping',
|
15
|
+
address: @address
|
16
|
+
%>
|
17
|
+
</div>
|
18
|
+
<%= f.submit t(:save, scope: :address_book), class: 'btn btn-primary' %>
|
19
|
+
</fieldset>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
</div>
|
@@ -1,44 +1,68 @@
|
|
1
|
-
|
2
|
-
<div class="col-sm-6" data-hook="billing_fieldset_wrapper">
|
3
|
-
<div class="panel panel-default" id="billing" data-hook>
|
4
|
-
<%= form.fields_for :bill_address do |bill_form| %>
|
5
|
-
<div class="panel-heading">
|
6
|
-
<h3 class="panel-title"><%= Spree.t(:billing_address) %></h3>
|
7
|
-
</div>
|
8
|
-
<div class="panel-body">
|
9
|
-
<%= render partial: 'spree/address/form', locals: { form: bill_form, address_type: 'billing', address: @order.bill_address } %>
|
10
|
-
</div>
|
11
|
-
<% end %>
|
12
|
-
</div>
|
13
|
-
</div>
|
1
|
+
<% @addresses = try_spree_current_user ? try_spree_current_user.addresses : [] %>
|
14
2
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
3
|
+
<div class="row">
|
4
|
+
<% ['billing', 'shipping'].each do |address_type|
|
5
|
+
address_name = "#{address_type[0...4]}_address" %>
|
6
|
+
<div class="col-12 col-md-6 mb-4" data-hook="<%= address_type %>_fieldset_wrapper">
|
7
|
+
<div class="card card-default" id="<%= address_type %>" data-hook>
|
8
|
+
<div class="card-header">
|
9
|
+
<h5 class="mb-0">
|
10
|
+
<%= Spree.t(address_type + '_address') %>
|
11
|
+
</h5>
|
20
12
|
</div>
|
21
|
-
<div class="
|
22
|
-
|
23
|
-
|
24
|
-
<%=
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
13
|
+
<div class="card-body">
|
14
|
+
<% if address_type == 'shipping' %>
|
15
|
+
<div class="mb-0 form-check" data-hook="use_billing">
|
16
|
+
<%= label_tag :order_use_billing, id: 'use_billing' do %>
|
17
|
+
<%= check_box_tag 'order[use_billing]', '1', @order.shipping_eq_billing_address?, { class: 'form-check-input'} %>
|
18
|
+
<%= Spree.t(:use_billing_address) %>
|
19
|
+
<% end %>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
22
|
+
<% if @addresses.present? %>
|
23
|
+
<div class="select_address">
|
24
|
+
<div class="form-group">
|
25
|
+
<% @addresses.each_with_index do |address, idx| %>
|
26
|
+
<span class="d-block mb-2" id="<%= [address_type, dom_id(address)].join('_') %>">
|
27
|
+
<label class="form-check-label">
|
28
|
+
<%= form.radio_button "#{address_name}_id", address.id, checked: (address.id == try_spree_current_user["#{address_name}_id"] || idx == 0) %> <%= address.to_s.html_safe %>
|
29
|
+
</label>
|
30
|
+
<a class="mb-3" href="<%= edit_address_path(address) %>" data-hook="edit_address"><%= Spree.t(:edit) %></a>
|
31
|
+
</span>
|
32
|
+
<% end %>
|
33
|
+
<div class="form-check">
|
34
|
+
<label class="form-check-label">
|
35
|
+
<%= form.radio_button "#{address_name}_id", 0, class: 'form-check-input' %> <%= Spree.t('address_book.other_address') %>
|
36
|
+
</label>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
<% end %>
|
41
|
+
<%= form.fields_for address_name do |address_form| %>
|
42
|
+
<div class="inner" data-hook=<%="#{address_type}_inner" %>>
|
43
|
+
<%= render partial: 'spree/addresses/form', locals: {
|
44
|
+
address_name: address_name,
|
45
|
+
address_form: address_form,
|
46
|
+
address_type: address_type,
|
47
|
+
address: Spree::Address.default
|
48
|
+
} %>
|
49
|
+
</div>
|
50
|
+
<% end %>
|
29
51
|
</div>
|
30
|
-
|
52
|
+
</div>
|
31
53
|
</div>
|
32
|
-
|
54
|
+
<% end %>
|
33
55
|
</div>
|
34
56
|
|
35
|
-
<div class="
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
57
|
+
<div class="card text-right form-buttons my-4" data-hook="buttons">
|
58
|
+
<div class="card-body">
|
59
|
+
<%= submit_tag Spree.t(:save_and_continue), class: 'btn btn-lg btn-success' %>
|
60
|
+
<% if try_spree_current_user %>
|
61
|
+
<span data-hook="save_user_address" class='save-user-address-wrapper'>
|
62
|
+
|
63
|
+
<%= check_box_tag 'save_user_address', '1', try_spree_current_user.respond_to?(:persist_order_address) %>
|
64
|
+
<%= label_tag :save_user_address, Spree.t(:save_my_address) %>
|
65
|
+
</span>
|
66
|
+
<% end %>
|
67
|
+
</div>
|
44
68
|
</div>
|
@@ -1,16 +1,18 @@
|
|
1
|
-
<div class="
|
2
|
-
<div class="
|
3
|
-
<h3 class="
|
1
|
+
<div class="card" id="order_details" data-hook>
|
2
|
+
<div class="card-header">
|
3
|
+
<h3 class="card-title mb-0 h5"><%= Spree.t(:confirm) %></h3>
|
4
4
|
</div>
|
5
|
-
<div class="
|
5
|
+
<div class="card-body">
|
6
6
|
<%= render partial: 'spree/shared/order_details', locals: { order: @order } %>
|
7
7
|
</div>
|
8
8
|
</div>
|
9
9
|
|
10
|
-
<div class="
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
<div class="card text-right form-buttons mt-4" data-hook="buttons">
|
11
|
+
<div class="card-body">
|
12
|
+
<% if @order.using_store_credit? %>
|
13
|
+
<%= button_tag Spree.t('store_credit.remove'), name: 'remove_store_credit', class: 'continue btn' %>
|
14
|
+
<% end %>
|
15
|
+
<%= submit_tag Spree.t(:place_order), class: 'btn btn-lg btn-success' %>
|
16
|
+
<script>Spree.disableSaveOnClick();</script>
|
17
|
+
</div>
|
16
18
|
</div>
|