spree_frontend 3.7.13 → 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.js +4 -1
  4. data/app/assets/javascripts/spree/frontend/checkout/address.js +42 -14
  5. data/app/assets/javascripts/spree/frontend/checkout/address_book.js +56 -0
  6. data/app/assets/javascripts/spree/frontend/product.js +54 -39
  7. data/app/assets/stylesheets/spree/frontend.css +1 -0
  8. data/app/assets/stylesheets/spree/frontend/_variables.scss +1 -1
  9. data/app/assets/stylesheets/spree/frontend/address_book.scss +8 -0
  10. data/app/assets/stylesheets/spree/frontend/frontend_bootstrap.css.scss +13 -35
  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.rb +3 -3
  60. data/lib/spree/frontend/engine.rb +4 -0
  61. data/spree_frontend.gemspec +4 -3
  62. metadata +48 -25
@@ -0,0 +1,53 @@
1
+ # https://github.com/spree-contrib/spree_address_book/blob/master/app/controllers/spree/checkout_controller_decorator.rb
2
+ module Spree
3
+ module Checkout
4
+ module AddressBook
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ after_action :normalize_addresses, only: :update
9
+ before_action :set_addresses, only: :update
10
+ end
11
+
12
+ protected
13
+
14
+ def set_addresses
15
+ return unless params[:order] && params[:state] == 'address'
16
+
17
+ if params[:order][:ship_address_id].to_i > 0
18
+ params[:order].delete(:ship_address_attributes)
19
+
20
+ Spree::Address.find(params[:order][:ship_address_id]).user_id != try_spree_current_user&.id && raise('Frontend address forging')
21
+ else
22
+ params[:order].delete(:ship_address_id)
23
+ end
24
+
25
+ if params[:order][:bill_address_id].to_i > 0
26
+ params[:order].delete(:bill_address_attributes)
27
+
28
+ Spree::Address.find(params[:order][:bill_address_id]).user_id != try_spree_current_user&.id && raise('Frontend address forging')
29
+ else
30
+ params[:order].delete(:bill_address_id)
31
+ end
32
+ end
33
+
34
+ def normalize_addresses
35
+ return unless params[:state] == 'address' && @order.bill_address_id && @order.ship_address_id
36
+
37
+ # ensure that there is no validation errors and addresses were saved
38
+ return unless @order.bill_address && @order.ship_address
39
+
40
+ bill_address = @order.bill_address
41
+ ship_address = @order.ship_address
42
+ if @order.bill_address_id != @order.ship_address_id && bill_address == ship_address
43
+ @order.update_column(:bill_address_id, ship_address.id)
44
+ bill_address.destroy
45
+ else
46
+ bill_address.update_attribute(:user_id, try_spree_current_user&.id)
47
+ end
48
+
49
+ ship_address.update_attribute(:user_id, try_spree_current_user&.id)
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,72 @@
1
+ # https://github.com/spree-contrib/spree_address_book/blob/master/app/controllers/spree/addresses_controller.rb
2
+ module Spree
3
+ class AddressesController < Spree::StoreController
4
+ helper Spree::AddressesHelper
5
+ load_and_authorize_resource class: Spree::Address
6
+
7
+ def index
8
+ @addresses = spree_current_user.addresses
9
+ end
10
+
11
+ def create
12
+ @address = spree_current_user.addresses.build(address_params)
13
+ if @address.save
14
+ flash[:notice] = Spree.t(:successfully_created, scope: :address_book)
15
+ redirect_to :index
16
+ else
17
+ render :new
18
+ end
19
+ end
20
+
21
+ def edit
22
+ session['spree_user_return_to'] = request.env['HTTP_REFERER']
23
+ end
24
+
25
+ def new
26
+ @address = Spree::Address.default
27
+ end
28
+
29
+ def update
30
+ if @address.editable?
31
+ if @address.update_attributes(address_params)
32
+ flash[:notice] = Spree.t(:successfully_updated, scope: :address_book)
33
+ redirect_back_or_default(addresses_path)
34
+ else
35
+ render :edit
36
+ end
37
+ else
38
+ new_address = @address.clone
39
+ new_address.attributes = address_params
40
+ @address.update_attribute(:deleted_at, Time.current)
41
+ if new_address.save
42
+ flash[:notice] = Spree.t(:successfully_updated, scope: :address_book)
43
+ redirect_back_or_default(addresses_path)
44
+ else
45
+ render :edit
46
+ end
47
+ end
48
+ end
49
+
50
+ def destroy
51
+ @address.destroy
52
+
53
+ flash[:notice] = Spree.t(:successfully_removed, scope: :address_book)
54
+ redirect_to(request.env['HTTP_REFERER'] || addresses_path) unless request.xhr?
55
+ end
56
+
57
+ private
58
+
59
+ def address_params
60
+ params[:address].permit(:address,
61
+ :firstname,
62
+ :lastname,
63
+ :address1,
64
+ :address2,
65
+ :city,
66
+ :state_id,
67
+ :zipcode,
68
+ :country_id,
69
+ :phone)
70
+ end
71
+ end
72
+ end
@@ -4,6 +4,8 @@ module Spree
4
4
  # checkout which has nothing to do with updating an order that this approach
5
5
  # is waranted.
6
6
  class CheckoutController < Spree::StoreController
7
+ include Spree::Checkout::AddressBook
8
+
7
9
  before_action :set_cache_header, only: [:edit]
8
10
  before_action :load_order_with_lock
9
11
  before_action :ensure_valid_state_lock_version, only: [:update]
@@ -6,7 +6,6 @@ module Spree
6
6
  respond_to :html
7
7
 
8
8
  before_action :assign_order_with_lock, only: :update
9
- skip_before_action :verify_authenticity_token, only: [:populate]
10
9
 
11
10
  def show
12
11
  @order = Order.includes(line_items: [variant: [:option_values, :images, :product]], bill_address: :state, ship_address: :state).find_by!(number: params[:id])
@@ -38,60 +37,6 @@ module Spree
38
37
  associate_user
39
38
  end
40
39
 
41
- # Adds a new item to the order (creating a new order if none already exists)
42
- def populate
43
- ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
44
- OrdersController#populate is deprecated and will be removed in Spree 4.0.
45
- Please use `/api/v2/storefront/cart/add_item` endpoint instead.
46
- See documentation: https://github.com/spree/spree/blob/master/api/docs/v2/storefront/index.yaml#L42
47
- DEPRECATION
48
-
49
- order = current_order(create_order_if_necessary: true)
50
- variant = Spree::Variant.find(params[:variant_id])
51
- quantity = params[:quantity].to_i
52
- options = params[:options] || {}
53
-
54
- # 2,147,483,647 is crazy. See issue #2695.
55
- if quantity.between?(1, 2_147_483_647)
56
- begin
57
- result = cart_add_item_service.call(order: order,
58
- variant: variant,
59
- quantity: quantity,
60
- options: options)
61
- if result.failure?
62
- error = result.value.errors.full_messages.join(', ')
63
- else
64
- order.update_line_item_prices!
65
- order.create_tax_charge!
66
- order.update_with_updater!
67
- end
68
- rescue ActiveRecord::RecordInvalid => e
69
- error = e.record.errors.full_messages.join(', ')
70
- end
71
- else
72
- error = Spree.t(:please_enter_reasonable_quantity)
73
- end
74
-
75
- if error
76
- flash[:error] = error
77
- redirect_back_or_default(spree.root_path)
78
- else
79
- respond_with(order) do |format|
80
- format.html { redirect_to(cart_path(variant_id: variant.id)) }
81
- end
82
- end
83
- end
84
-
85
- def populate_redirect
86
- ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
87
- OrdersController#populate is deprecated and will be removed in Spree 4.0.
88
- Please use `/api/v2/storefront/cart/add_item` endpoint instead.
89
- See documentation: https://github.com/spree/spree/blob/master/api/docs/v2/storefront/index.yaml#L42
90
- DEPRECATION
91
- flash[:error] = Spree.t(:populate_get_error)
92
- redirect_to cart_path
93
- end
94
-
95
40
  def empty
96
41
  current_order.try(:empty!)
97
42
 
@@ -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 = Spree::Taxonomy.includes(root: :children)
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, raise: false
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 = '&nbsp;')
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-md-12')
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}) <span class='amount'>#{simple_current_order.display_total.to_html}</span>"
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, size)
91
- image.alt.present? ? image.alt : image_alt(main_app.url_for(image.url(size)))
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"><a href="#" onclick="return false;"><%= raw(t 'views.pagination.truncate') %></a></li>
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, {remote: remote} %>
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, url, opts = {remote: remote, rel: page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
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
- <p class="form-group" id=<%="#{address_id}firstname" %>>
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
- </p>
10
- <p class="form-group" id=<%="#{address_id}lastname" %>>
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
- </p>
15
+ </div>
16
16
  <% if Spree::Config[:company] %>
17
- <p class="form-group" id=<%="#{address_id}company" %>>
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
- </p>
20
+ </div>
21
21
  <% end %>
22
- <p class="form-group" id=<%="#{address_id}address1" %>>
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
- </p>
28
- <p class="form-group" id=<%="#{address_id}address2" %>>
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
- </p>
32
- <p class="form-group" id=<%="#{address_id}city" %>>
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
- </p>
38
- <p class="form-group" id=<%="#{address_id}country" %>>
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
- </p>
46
+ </div>
46
47
 
47
48
  <% if Spree::Config[:address_requires_state] %>
48
- <p class="form-group" id=<%="#{address_id}state" %>>
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' : 'form-control hidden',
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' : 'form-control hidden',
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
- </p>
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
- <p class="form-group" id=<%="#{address_id}zipcode" %>>
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
- </p>
79
- <p class="form-group" id=<%="#{address_id}phone" %>>
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
- </p>
87
+ </div>
85
88
  <% if Spree::Config[:alternative_shipping_phone] %>
86
- <p class="form-group" id=<%="#{address_id}altphone" %>>
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
- </p>
92
+ </div>
90
93
  <% end %>
91
94
  </div>