spree_frontend 4.2.5 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/app/assets/config/spree_frontend_manifest.js +4 -0
  4. data/app/assets/images/arrow-right-circle-fill.svg +3 -0
  5. data/app/assets/images/card-image.svg +4 -0
  6. data/app/assets/images/file-image.svg +4 -0
  7. data/app/assets/images/image.svg +4 -0
  8. data/app/assets/images/noimage/large.png +0 -0
  9. data/app/assets/images/noimage/mini.png +0 -0
  10. data/app/assets/images/noimage/plp.svg +23 -0
  11. data/app/assets/images/noimage/product.png +0 -0
  12. data/app/assets/images/noimage/small.png +0 -0
  13. data/app/assets/javascripts/spree/api/main.js +36 -0
  14. data/app/assets/javascripts/spree/api/storefront/cart.js +49 -0
  15. data/app/assets/javascripts/spree/frontend/checkout/payment.js +18 -5
  16. data/app/assets/javascripts/spree/frontend/checkout.js +16 -0
  17. data/app/assets/javascripts/spree/frontend/locale.es6 +13 -0
  18. data/app/assets/javascripts/spree/frontend/views/spree/home/product_carousels.js +3 -3
  19. data/app/assets/javascripts/spree/frontend/views/spree/products/index.js +0 -9
  20. data/app/assets/javascripts/spree/frontend/views/spree/products/price_filters.es6 +46 -0
  21. data/app/assets/javascripts/spree/frontend.js +3 -0
  22. data/app/assets/javascripts/spree.js +78 -0
  23. data/app/assets/stylesheets/spree/frontend/application.scss +1 -0
  24. data/app/assets/stylesheets/spree/frontend/components-bootstrap/button.scss +8 -0
  25. data/app/assets/stylesheets/spree/frontend/helpers/spree/frontend_helper.scss +41 -0
  26. data/app/assets/stylesheets/spree/frontend/variables/variables.scss +2 -2
  27. data/app/assets/stylesheets/spree/frontend/views/spree/checkout/edit.scss +17 -5
  28. data/app/assets/stylesheets/spree/frontend/views/spree/cms_sections/_index.scss +1 -0
  29. data/app/assets/stylesheets/spree/frontend/views/spree/cms_sections/product_buy_bar.scss +20 -0
  30. data/app/assets/stylesheets/spree/frontend/views/spree/home/index.scss +54 -67
  31. data/app/assets/stylesheets/spree/frontend/views/spree/shared/category_nav_bar.scss +3 -3
  32. data/app/assets/stylesheets/spree/frontend/views/spree/shared/footer.scss +4 -0
  33. data/app/assets/stylesheets/spree/frontend/views/spree/shared/main_nav_bar.scss +12 -1
  34. data/app/controllers/spree/addresses_controller.rb +14 -23
  35. data/app/controllers/spree/checkout_controller.rb +5 -3
  36. data/app/controllers/spree/cms_pages_controller.rb +29 -0
  37. data/app/controllers/spree/content_controller.rb +0 -2
  38. data/app/controllers/spree/errors_controller.rb +11 -0
  39. data/app/controllers/spree/home_controller.rb +34 -1
  40. data/app/controllers/spree/locale_controller.rb +7 -1
  41. data/app/controllers/spree/orders_controller.rb +9 -7
  42. data/app/controllers/spree/products_controller.rb +14 -13
  43. data/app/controllers/spree/store_controller.rb +25 -1
  44. data/app/controllers/spree/taxons_controller.rb +12 -5
  45. data/app/helpers/spree/addresses_helper.rb +9 -4
  46. data/app/helpers/spree/cms_pages_helper.rb +23 -0
  47. data/app/helpers/spree/frontend_helper.rb +109 -10
  48. data/app/helpers/spree/navigation_helper.rb +73 -4
  49. data/app/helpers/spree/products_filters_helper.rb +168 -0
  50. data/app/helpers/spree/store_helper.rb +3 -1
  51. data/app/views/spree/checkout/_address.html.erb +1 -1
  52. data/app/views/spree/checkout/_credit_card.html.erb +1 -0
  53. data/app/views/spree/cms_pages/show.html.erb +16 -0
  54. data/app/views/spree/errors/forbidden.html.erb +0 -0
  55. data/app/views/spree/errors/unauthorized.html.erb +0 -0
  56. data/app/views/spree/home/index.html.erb +19 -118
  57. data/app/views/spree/layouts/spree_application.html.erb +3 -2
  58. data/app/views/spree/products/_description.html.erb +16 -19
  59. data/app/views/spree/products/_filters_desktop.html.erb +50 -15
  60. data/app/views/spree/products/_filters_mobile.html.erb +38 -10
  61. data/app/views/spree/products/_sort_desktop.html.erb +17 -11
  62. data/app/views/spree/products/_sort_mobile.html.erb +16 -0
  63. data/app/views/spree/products/index.html.erb +1 -1
  64. data/app/views/spree/shared/_carousel_4_products.html.erb +8 -8
  65. data/app/views/spree/shared/_checkout_header.html.erb +22 -21
  66. data/app/views/spree/shared/_copyright.html.erb +1 -10
  67. data/app/views/spree/shared/_footer.html.erb +18 -12
  68. data/app/views/spree/shared/_get_started.html.erb +32 -0
  69. data/app/views/spree/shared/_head.html.erb +1 -1
  70. data/app/views/spree/shared/_header.html.erb +3 -3
  71. data/app/views/spree/shared/_main_nav_bar.html.erb +61 -43
  72. data/app/views/spree/shared/_mobile_navigation.html.erb +30 -19
  73. data/app/views/spree/shared/_nav_bar.html.erb +1 -1
  74. data/app/views/spree/shared/_option_values.html.erb +2 -21
  75. data/app/views/spree/shared/_order_details.html.erb +1 -1
  76. data/app/views/spree/shared/_paths.html.erb +8 -0
  77. data/app/views/spree/shared/_properties.html.erb +4 -0
  78. data/app/views/spree/shared/_translations.html.erb +2 -1
  79. data/app/views/spree/shared/carousel/_single.html.erb +1 -1
  80. data/app/views/spree/shared/carousel/_thumbnails.html.erb +1 -1
  81. data/app/views/spree/shared/cms/pages/_edit_mode.html.erb +13 -0
  82. data/app/views/spree/shared/cms/sections/_featured_article.html.erb +27 -0
  83. data/app/views/spree/shared/cms/sections/_hero_image.html.erb +60 -0
  84. data/app/views/spree/shared/cms/sections/_image_gallery.html.erb +171 -0
  85. data/app/views/spree/shared/cms/sections/_product_carousel.html.erb +5 -0
  86. data/app/views/spree/shared/cms/sections/_rich_text_content.html.erb +3 -0
  87. data/app/views/spree/shared/cms/sections/_side_by_side_images.html.erb +118 -0
  88. data/app/views/spree/taxons/_header.html.erb +6 -1
  89. data/app/views/spree/users/show.html.erb +4 -1
  90. data/config/initializers/assets.rb +4 -13
  91. data/config/routes.rb +10 -4
  92. data/lib/generators/spree/frontend/install/install_generator.rb +5 -5
  93. data/lib/generators/spree/frontend/install/templates/app/assets/config/manifest.js +2 -0
  94. data/lib/generators/spree/frontend/install/templates/vendor/assets/javascripts/spree/frontend/all.js +8 -0
  95. data/lib/generators/spree/frontend/install/templates/vendor/assets/stylesheets/spree/frontend/all.css +9 -0
  96. data/lib/spree/frontend/engine.rb +6 -0
  97. data/lib/spree/frontend.rb +6 -3
  98. data/spec/fixtures/files/store_favicon.ico +0 -0
  99. data/spree_frontend.gemspec +8 -4
  100. data/vendor/assets/javascripts/cleave.js +8 -0
  101. data/vendor/assets/javascripts/fetch.umd.js +531 -0
  102. data/vendor/assets/javascripts/jquery.payment.js +652 -0
  103. data/vendor/assets/javascripts/jsuri.js +458 -0
  104. data/vendor/assets/javascripts/polyfill.min.js +1 -0
  105. metadata +117 -70
  106. data/app/assets/images/homepage/big_category_banner.jpg +0 -0
  107. data/app/assets/images/homepage/big_category_banner_mobile.jpg +0 -0
  108. data/app/assets/images/homepage/big_category_banner_tablet_landscape.jpg +0 -0
  109. data/app/assets/images/homepage/big_category_banner_tablet_portrait.jpg +0 -0
  110. data/app/assets/images/homepage/category_banner_lower.jpg +0 -0
  111. data/app/assets/images/homepage/category_banner_lower_mobile.jpg +0 -0
  112. data/app/assets/images/homepage/category_banner_lower_tablet_landscape.jpg +0 -0
  113. data/app/assets/images/homepage/category_banner_lower_tablet_portrait.jpg +0 -0
  114. data/app/assets/images/homepage/category_banner_upper.jpg +0 -0
  115. data/app/assets/images/homepage/category_banner_upper_mobile.jpg +0 -0
  116. data/app/assets/images/homepage/category_banner_upper_tablet_landscape.jpg +0 -0
  117. data/app/assets/images/homepage/category_banner_upper_tablet_portrait.jpg +0 -0
  118. data/app/assets/images/homepage/main_banner.jpg +0 -0
  119. data/app/assets/images/homepage/main_banner_mobile.jpg +0 -0
  120. data/app/assets/images/homepage/main_banner_tablet_landscape.jpg +0 -0
  121. data/app/assets/images/homepage/main_banner_tablet_portrait.jpg +0 -0
  122. data/app/assets/images/homepage/promo_banner_left.jpg +0 -0
  123. data/app/assets/images/homepage/promo_banner_left_mobile.jpg +0 -0
  124. data/app/assets/images/homepage/promo_banner_left_tablet_landscape.jpg +0 -0
  125. data/app/assets/images/homepage/promo_banner_left_tablet_portrait.jpg +0 -0
  126. data/app/assets/images/homepage/promo_banner_right.jpg +0 -0
  127. data/app/assets/images/homepage/promo_banner_right_mobile.jpg +0 -0
  128. data/app/assets/images/homepage/promo_banner_right_tablet_landscape.jpg +0 -0
  129. data/app/assets/images/homepage/promo_banner_right_tablet_portrait.jpg +0 -0
  130. data/app/assets/images/meganav/promo_banner_left-first-category.jpg +0 -0
  131. data/app/assets/images/meganav/promo_banner_left-second-category.jpg +0 -0
  132. data/app/assets/images/meganav/promo_banner_left-third-category.jpg +0 -0
  133. data/app/assets/images/meganav/promo_banner_right-first-category.jpg +0 -0
  134. data/app/assets/images/meganav/promo_banner_right-second-category.jpg +0 -0
  135. data/app/assets/images/meganav/promo_banner_right-third-category.jpg +0 -0
  136. data/app/assets/images/noimage/big_category_banner.jpg +0 -0
  137. data/app/assets/images/noimage/big_category_banner_mobile.jpg +0 -0
  138. data/app/assets/images/noimage/big_category_banner_tablet_landscape.jpg +0 -0
  139. data/app/assets/images/noimage/big_category_banner_tablet_portrait.jpg +0 -0
  140. data/app/assets/images/noimage/category_banner.jpg +0 -0
  141. data/app/assets/images/noimage/category_banner_mobile.jpg +0 -0
  142. data/app/assets/images/noimage/category_banner_plp.jpg +0 -0
  143. data/app/assets/images/noimage/category_banner_tablet_landscape.jpg +0 -0
  144. data/app/assets/images/noimage/category_banner_tablet_portrait.jpg +0 -0
  145. data/app/assets/images/noimage/main_banner.jpg +0 -0
  146. data/app/assets/images/noimage/main_banner_mobile.jpg +0 -0
  147. data/app/assets/images/noimage/main_banner_tablet_landscape.jpg +0 -0
  148. data/app/assets/images/noimage/main_banner_tablet_portrait.jpg +0 -0
  149. data/app/assets/images/noimage/product_photo.jpg +0 -0
  150. data/app/assets/images/noimage/promo_banner.jpg +0 -0
  151. data/app/assets/images/noimage/promo_banner_megamenu.jpg +0 -0
  152. data/app/assets/images/noimage/promo_banner_mobile.jpg +0 -0
  153. data/app/assets/images/noimage/promo_banner_tablet_landscape.jpg +0 -0
  154. data/app/assets/images/noimage/promo_banner_tablet_portrait.jpg +0 -0
  155. data/app/assets/images/spark-logo@3x.png +0 -0
  156. data/app/assets/javascripts/spree/frontend/locale.js +0 -13
  157. data/app/assets/javascripts/spree/frontend/multi_currency.js +0 -13
  158. data/lib/generators/spree/frontend/install/templates/config/initializers/spree_storefront.rb +0 -1
  159. data/lib/generators/spree/frontend/install/templates/config/spree_storefront.yml +0 -99
@@ -3,22 +3,46 @@ require 'digest'
3
3
  module Spree
4
4
  module NavigationHelper
5
5
  def spree_navigation_data
6
- @spree_navigation_data ||= SpreeStorefrontConfig.dig(I18n.locale, :navigation) || SpreeStorefrontConfig.dig(current_store.code, :navigation) || SpreeStorefrontConfig.dig(:default, :navigation) || []
6
+ ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
7
+ NavigationHelper#spree_navigation_data is deprecated and will be removed in Spree 5.0.
8
+ Please migrate to the new navigation cms system.
9
+ DEPRECATION
10
+
11
+ @spree_navigation_data ||= SpreeStorefrontConfig.dig(I18n.locale,
12
+ :navigation) || SpreeStorefrontConfig.dig(current_store.code,
13
+ :navigation) || SpreeStorefrontConfig.dig(
14
+ :default, :navigation
15
+ ) || []
7
16
  # safeguard for older Spree installs that don't have spree_navigation initializer
8
17
  # or spree.yml file present
9
- rescue
18
+ rescue StandardError
10
19
  []
11
20
  end
12
21
 
13
22
  def spree_nav_cache_key(section = 'header')
23
+ ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
24
+ NavigationHelper#spree_nav_cache_key is deprecated and will be removed in Spree 5.0.
25
+ Please migrate to the new navigation cms system.
26
+ DEPRECATION
27
+
14
28
  @spree_nav_cache_key = begin
15
- keys = base_cache_key + [current_store, spree_navigation_data_cache_key, Spree::Config[:logo], stores&.cache_key, section]
29
+ keys = base_cache_key + [current_store, spree_navigation_data_cache_key, Spree::Config[:logo], stores&.cache_key_with_version, section]
16
30
  Digest::MD5.hexdigest(keys.join('-'))
17
31
  end
18
32
  end
19
33
 
34
+ def spree_menu_cache_key(section = 'header')
35
+ keys = base_cache_key + [
36
+ current_store.cache_key_with_version,
37
+ spree_menu(section)&.cache_key_with_version,
38
+ stores&.maximum(:updated_at),
39
+ section
40
+ ]
41
+ Digest::MD5.hexdigest(keys.join('-'))
42
+ end
43
+
20
44
  def main_nav_image(image_path, title = '')
21
- image_url = asset_path(asset_exists?(image_path) ? image_path : 'noimage/plp.png')
45
+ image_url = asset_path(asset_exists?(image_path) ? image_path : 'noimage/plp.svg')
22
46
 
23
47
  lazy_image(
24
48
  src: image_url,
@@ -28,11 +52,56 @@ module Spree
28
52
  )
29
53
  end
30
54
 
55
+ def spree_menu(location = 'header')
56
+ method_name = "for_#{location}"
57
+
58
+ if available_menus.respond_to?(method_name) && Spree::Menu::MENU_LOCATIONS_PARAMETERIZED.include?(location)
59
+ available_menus.send(method_name, I18n.locale) || current_store.default_menu(location)
60
+ end
61
+ end
62
+
63
+ def spree_localized_link(item)
64
+ return if item.link.nil?
65
+
66
+ output_locale = if locale_param
67
+ "/#{I18n.locale}"
68
+ end
69
+
70
+ if Spree::MenuItem::DYNAMIC_RESOURCE_TYPE.include? item.linked_resource_type
71
+ output_locale.to_s + item.link
72
+ elsif item.linked_resource_type == 'Home Page'
73
+ "/#{locale_param}"
74
+ else
75
+ item.link
76
+ end
77
+ end
78
+
31
79
  def should_render_internationalization_dropdown?
32
80
  (defined?(should_render_locale_dropdown?) && should_render_locale_dropdown?) ||
33
81
  (defined?(should_render_currency_dropdown?) && should_render_currency_dropdown?)
34
82
  end
35
83
 
84
+ def spree_nav_link_tag(item, opts = {}, &block)
85
+ if item.new_window
86
+ target = opts[:target] || '_blank'
87
+ rel = opts[:rel] || 'noopener noreferrer'
88
+ end
89
+
90
+ active_class = if request && current_page?(spree_localized_link(item))
91
+ "active #{opts[:class]}"
92
+ else
93
+ opts[:class]
94
+ end
95
+
96
+ link_opts = { target: target, rel: rel, class: active_class, id: opts[:id], data: opts[:data], aria: opts[:aria] }
97
+
98
+ if block_given?
99
+ link_to spree_localized_link(item), link_opts, &block
100
+ else
101
+ link_to item.name, spree_localized_link(item), link_opts
102
+ end
103
+ end
104
+
36
105
  private
37
106
 
38
107
  def spree_navigation_data_cache_key
@@ -0,0 +1,168 @@
1
+ module Spree
2
+ module ProductsFiltersHelper
3
+ PRICE_FILTER_NAME = 'price'.freeze
4
+
5
+ FILTER_LINK_CSS_CLASSES = 'd-inline-block text-uppercase py-1 px-2 m-1 plp-overlay-card-item'.freeze
6
+ ACTIVE_FILTER_LINK_CSS_CLASSES = 'plp-overlay-card-item--selected'.freeze
7
+
8
+ CLEAR_ALL_FILTERS_LINK_CSS_CLASSES = 'btn spree-btn btn-outline-primary w-100 mb-4'.freeze
9
+
10
+ def price_filters
11
+ @price_filters ||= [
12
+ filters_less_than_price_range(50),
13
+ filters_price_range(50, 100),
14
+ filters_price_range(101, 150),
15
+ filters_price_range(151, 200),
16
+ filters_price_range(201, 300),
17
+ filters_more_than_price_range(300)
18
+ ]
19
+ end
20
+
21
+ def min_price_filter_input(**html_options)
22
+ price_filter_input(
23
+ name: :min_price,
24
+ value: filters_price_range_from_param.min_price.to_i,
25
+ placeholder: "#{currency_symbol(current_currency)} #{Spree.t(:min)}",
26
+ **html_options
27
+ )
28
+ end
29
+
30
+ def max_price_filter_input(**html_options)
31
+ price_filter_input(
32
+ name: :max_price,
33
+ value: filters_price_range_from_param.max_price.to_i,
34
+ placeholder: "#{currency_symbol(current_currency)} #{Spree.t(:max)}",
35
+ **html_options
36
+ )
37
+ end
38
+
39
+ def price_filter_input(name:, value:, placeholder:, **html_options)
40
+ price_value = value&.zero? ? '' : value
41
+ style_class = "spree-flat-input #{html_options[:class]}"
42
+
43
+ number_field_tag(
44
+ name, price_value,
45
+ id: name,
46
+ class: style_class,
47
+ min: 0, step: 1, placeholder: placeholder,
48
+ **html_options.except(:class)
49
+ )
50
+ end
51
+
52
+ def option_value_filter_link(option_value, permitted_params, opts = {})
53
+ id = option_value.id
54
+ ot_downcase_name = option_value.option_type.filter_param
55
+ selected_option_values = params[ot_downcase_name]&.split(',')&.map(&:to_i) || []
56
+ is_selected = selected_option_values.include?(id)
57
+ option_value_param = (is_selected ? selected_option_values - [id] : selected_option_values + [id]).join(',')
58
+ new_params = permitted_params.merge(ot_downcase_name => option_value_param, menu_open: 1)
59
+
60
+ link_to new_params, data: { params: new_params, id: id, filter_name: ot_downcase_name, multiselect: true } do
61
+ # TODO: refactor this
62
+ if color_option_type_name.present? && color_option_type_name.downcase == ot_downcase_name
63
+ content_tag :span, class: 'd-inline-block mb-1' do
64
+ render partial: 'spree/shared/color_select', locals: {
65
+ color: option_value.presentation,
66
+ selected: is_selected
67
+ }
68
+ end
69
+ else
70
+ filter_content_tag(option_value.name, opts.merge(is_selected: is_selected))
71
+ end
72
+ end
73
+ end
74
+
75
+ def property_value_filter_link(property, value, permitted_params, opts = {})
76
+ id = value.first
77
+ name = value.last
78
+
79
+ selected_properties = params.dig(:properties, property.filter_param)&.split(',') || []
80
+ is_selected = selected_properties.include?(id)
81
+ property_values = (is_selected ? selected_properties - [id] : selected_properties + [id])
82
+ url = permitted_params.merge(properties: { property.filter_param => property_values }, menu_open: 1)
83
+ filter_name = "properties[#{property.filter_param}]"
84
+ new_params = permitted_params.merge(filter_name => property_values, menu_open: 1)
85
+
86
+ base_filter_link(url, name, opts.merge(params: new_params, is_selected: is_selected, filter_name: filter_name, id: id, multiselect: true))
87
+ end
88
+
89
+ def price_filter_link(price_range, permitted_params, opts = {})
90
+ is_selected = params[:price] == price_range.to_param
91
+ price_param = is_selected ? '' : price_range.to_param
92
+ url = permitted_params.merge(price: price_param, menu_open: 1)
93
+
94
+ opts[:is_selected] ||= is_selected
95
+
96
+ content_tag :div do
97
+ base_filter_link(url, price_range, opts.merge(is_selected: is_selected, filter_name: PRICE_FILTER_NAME, id: price_param))
98
+ end
99
+ end
100
+
101
+ def product_filters_present?(permitted_params)
102
+ properties = permitted_params.fetch(:properties, {}).to_unsafe_h
103
+ flatten_params = permitted_params.to_h.merge(properties)
104
+
105
+ flatten_params.any? { |name, value| product_filter_present?(name, value) }
106
+ end
107
+
108
+ def clear_all_filters_link(permitted_params, opts = {})
109
+ opts[:css_class] ||= CLEAR_ALL_FILTERS_LINK_CSS_CLASSES
110
+ sort_by_param = permitted_params.slice(:sort_by)
111
+
112
+ link_to Spree.t('plp.clear_all'), sort_by_param, class: opts[:css_class], data: { params: sort_by_param }
113
+ end
114
+
115
+ private
116
+
117
+ def product_filter_present?(filter_param, filter_value)
118
+ filter_param.in?(product_filters_params) && filter_value.present?
119
+ end
120
+
121
+ def product_filters_params
122
+ options_filter_params = OptionType.filterable.map(&:filter_param)
123
+ properties_filter_params = Property.filterable.pluck(:filter_param)
124
+
125
+ options_filter_params + properties_filter_params + [PRICE_FILTER_NAME]
126
+ end
127
+
128
+ def base_filter_link(url, label, opts = {})
129
+ opts[:params] ||= url
130
+
131
+ link_to url, data: { filter_name: opts[:filter_name], id: opts[:id], params: opts[:params], multiselect: opts[:multiselect] } do
132
+ filter_content_tag(label, opts)
133
+ end
134
+ end
135
+
136
+ def filter_content_tag(label, opts = {})
137
+ opts[:css_class] ||= FILTER_LINK_CSS_CLASSES
138
+ opts[:css_active_class] ||= ACTIVE_FILTER_LINK_CSS_CLASSES
139
+
140
+ content_tag :div, class: "#{opts[:css_class]} #{opts[:css_active_class] if opts[:is_selected]}" do
141
+ label.to_s
142
+ end
143
+ end
144
+
145
+ def filters_price_range_from_param
146
+ Filters::PriceRangePresenter.from_param(params[:price].to_s, currency: current_currency)
147
+ end
148
+
149
+ def filters_price_range(min_amount, max_amount)
150
+ Filters::PriceRangePresenter.new(
151
+ min_price: filters_price(min_amount),
152
+ max_price: filters_price(max_amount)
153
+ )
154
+ end
155
+
156
+ def filters_less_than_price_range(amount)
157
+ Filters::QuantifiedPriceRangePresenter.new(price: filters_price(amount), quantifier: :less_than)
158
+ end
159
+
160
+ def filters_more_than_price_range(amount)
161
+ Filters::QuantifiedPriceRangePresenter.new(price: filters_price(amount), quantifier: :more_than)
162
+ end
163
+
164
+ def filters_price(amount)
165
+ Filters::PricePresenter.new(amount: amount, currency: current_currency)
166
+ end
167
+ end
168
+ end
@@ -1,5 +1,7 @@
1
1
  module Spree
2
2
  module StoreHelper
3
+ include LocaleHelper
4
+
3
5
  def store_country_iso(store = nil)
4
6
  store ||= current_store if defined?(current_store)
5
7
 
@@ -22,7 +24,7 @@ module Spree
22
24
  return unless store
23
25
  return store.name if store.default_locale.blank?
24
26
 
25
- Spree.t('i18n.this_file_language', locale: store.default_locale)
27
+ locale_full_name(store.default_locale)
26
28
  end
27
29
 
28
30
  def should_render_store_chooser?
@@ -54,7 +54,7 @@
54
54
  address_name: address_name,
55
55
  address_form: address_form,
56
56
  address_type: address_type,
57
- address: Spree::Address.default,
57
+ address: Spree::Address.new(country: current_store.default_country),
58
58
  form: form
59
59
  } %>
60
60
  </div>
@@ -5,5 +5,6 @@
5
5
  <%= credit_card_icon(card.cc_type) %>
6
6
  <span>****<%= card.last_digits %>,&nbsp</span>
7
7
  <span><%= card.name %></span>
8
+ <%= button_tag Spree.t(:remove), type: 'button', class: 'btn text-left d-block p-0 js-remove-credit-card', data: { id: card.id } %>
8
9
  </label>
9
10
  </div>
@@ -0,0 +1,16 @@
1
+ <% if @cms_page %>
2
+ <% if simple_page?(@cms_page) %>
3
+ <div class="container">
4
+ <div class="row my-5">
5
+ <div class="col-12">
6
+ <%= @cms_page.content.html_safe %>
7
+ </div>
8
+ </div>
9
+ </div>
10
+ <% else %>
11
+ <% @cms_page.cms_sections.each do |section| %>
12
+ <%= build_section(section) %>
13
+ <% end %>
14
+ <% end %>
15
+ <% end %>
16
+ <%= render "spree/shared/cms/pages/edit_mode", edit_mode: @edit_mode %>
File without changes
File without changes
@@ -1,121 +1,22 @@
1
- <% @body_id = 'home' %>
2
-
3
- <div class="homepage-hero-image mb-3 position-relative">
4
- <img class="lazyload hero-image position-absolute"
5
- data-src="<%= asset_path('homepage/main_banner.jpg') %>"
6
- data-srcset="<%= image_source_set('homepage/main_banner') %>"
7
- alt="Summer Collection">
8
-
9
- <div class="hero-content">
10
- <div class="homepage-hero-image-text mb-2 mx-auto pb-3 pb-md-4">
11
- Summer Collection
12
- </div>
13
- <div>
14
- <%= link_to 'SHOP NOW', spree.products_path, class: 'btn btn-primary spree-btn px-5' %>
1
+ <% if @homepage %>
2
+ <% @homepage.cms_sections.each do |section| %>
3
+ <%= build_section(section) %>
4
+ <% end %>
5
+ <% else %>
6
+ <div id="missingHomepage" class="container my-5">
7
+ <div class="row my-5">
8
+ <div class="col-12">
9
+ <figure class="logo mx-auto missing-homepage-logo-container">
10
+ <%= logo %>
11
+ </figure>
12
+ </div>
13
+ <div class="col-12 mb-5 text-center">
14
+ <h1 class="mb-3"><%= Spree.t('we_will_be_back') %></h1>
15
+ <h4 class="text-dark"><%= Spree.t('we_are_busy_updating', store_name: current_store.name) %></h4>
16
+ <h4 class="text-dark"><%= Spree.t('please_check_back_soon') %></h4>
17
+ </div>
15
18
  </div>
16
19
  </div>
17
- </div>
18
-
19
- <div class="container">
20
- <div class="row">
21
- <div class="col-6">
22
-
23
- <%= link_to spree.nested_taxons_path('men'), class: "homepage-taxon-box mb-3" do %>
24
- <img class="w-100 lazyload"
25
- data-src="<%= asset_path('homepage/category_banner_upper.jpg') %>"
26
- data-srcset="<%= image_source_set('homepage/category_banner_upper') %>"
27
- alt="Men">
28
-
29
- <div class="homepage-taxon-box-text">
30
- <h3>Men</h3>
31
- </div>
32
- <% end %>
33
-
34
- <%= link_to spree.nested_taxons_path('sportswear'), class: "homepage-taxon-box" do %>
35
- <img class="w-100 lazyload"
36
- data-src="<%= asset_path('homepage/category_banner_lower.jpg') %>"
37
- data-srcset="<%= image_source_set('homepage/category_banner_lower') %>"
38
- alt="Sportswear">
20
+ <% end %>
39
21
 
40
- <div class="homepage-taxon-box-text" role="img" aria-label="Sportswear">
41
- <h3>Sportswear</h3>
42
- </div>
43
- <% end %>
44
-
45
- </div>
46
-
47
- <div class="col-6 d-flex flex-column">
48
-
49
- <%= link_to spree.nested_taxons_path('women'), class: "homepage-taxon-box flex-grow-1" do %>
50
- <img class="w-100 lazyload"
51
- data-src="<%= asset_path('homepage/big_category_banner.jpg') %>"
52
- data-srcset="<%= image_source_set('homepage/big_category_banner') %>"
53
- alt="Women">
54
-
55
- <div class="homepage-taxon-box-text">
56
- <h3>Women</h3>
57
- </div>
58
- <% end %>
59
-
60
- </div>
61
- </div>
62
- </div>
63
-
64
- <div data-product-carousel data-product-carousel-taxon-id='bestsellers' class="my-3"></div>
65
-
66
- <div class="homepage-fashion-trends-box mb-3">
67
- <div class="text-center">
68
- <div class="homepage-fashion-trends-box-summer-text mb-1">Summer 2021</div>
69
- <div class="homepage-fashion-trends-box-fashion-trends-text mb-2">FASHION TRENDS</div>
70
- <div class="homepage-fashion-trends-box-description-text text-center mb-3">
71
- Want to rock this season’s hottest trend in style? These are the top fashion from Summer 2020 Fashion Weeks that are coming our way this season.
72
- </div>
73
- <%= link_to 'READ MORE', spree.nested_taxons_path('trending'), class: 'btn px-5 spree-btn btn-outline-primary' %>
74
- </div>
75
- </div>
76
-
77
- <div data-product-carousel data-product-carousel-taxon-id='trending' class="mb-3"></div>
78
-
79
- <div class="container">
80
- <div class="row">
81
- <div class="col-12 col-lg-6">
82
- <%= link_to spree.nested_taxons_path('streetstyle') do %>
83
- <div class="homepage-bottom-box text-center mb-3">
84
- <img class="w-100 lazyload"
85
- data-src="<%= asset_path('homepage/promo_banner_left.jpg') %>"
86
- data-srcset="<%= image_source_set('homepage/promo_banner_left') %>"
87
- alt="NEW COLLECTION">
88
-
89
- <div class="homepage-bottom-box-inner" role="img" aria-label="New Collection">
90
- <div class="homepage-bottom-box-inner-small-text">
91
- New Collection
92
- </div>
93
- <div class="homepage-bottom-box-inner-big-text">
94
- Streetstyle
95
- </div>
96
- </div>
97
- </div>
98
- <% end %>
99
- </div>
100
-
101
- <div class="col-12 col-lg-6">
102
- <%= link_to spree.nested_taxons_path('summer-sale') do %>
103
- <div class="homepage-bottom-box text-center mb-3">
104
- <img class="w-100 lazyload"
105
- data-src="<%= asset_path('homepage/promo_banner_right.jpg') %>"
106
- data-srcset="<%= image_source_set('homepage/promo_banner_right') %>"
107
- alt="Summer Sale">
108
-
109
- <div class="homepage-bottom-box-inner">
110
- <div class="homepage-bottom-box-inner-small-text">
111
- Summer Sale
112
- </div>
113
- <div class="homepage-bottom-box-inner-big-text">
114
- Up To 60%
115
- </div>
116
- </div>
117
- </div>
118
- <% end %>
119
- </div>
120
- </div>
121
- </div>
22
+ <%= render "spree/shared/cms/pages/edit_mode", edit_mode: @edit_mode %>