workarea-storefront 3.4.45 → 3.5.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +52 -0
  3. data/app/assets/javascripts/workarea/storefront/application.js.erb +2 -12
  4. data/app/assets/javascripts/workarea/storefront/config.js.erb +0 -5
  5. data/app/assets/javascripts/workarea/storefront/modules/{analytics.js → analytics.js.erb} +17 -0
  6. data/app/assets/javascripts/workarea/storefront/modules/dialog_buttons.js +1 -1
  7. data/app/assets/javascripts/workarea/storefront/modules/workarea_analytics.js +4 -0
  8. data/app/assets/stylesheets/workarea/storefront/application.scss.erb +0 -2
  9. data/app/assets/stylesheets/workarea/storefront/email/_base.scss +9 -1
  10. data/app/assets/stylesheets/workarea/storefront/email/_components.scss +1 -1
  11. data/app/assets/stylesheets/workarea/storefront/email/_helpers.scss +16 -0
  12. data/app/assets/stylesheets/workarea/storefront/email/{_settings.scss → _settings.scss.erb} +1 -1
  13. data/app/controllers/workarea/storefront/analytics_controller.rb +36 -21
  14. data/app/controllers/workarea/storefront/application_controller.rb +2 -4
  15. data/app/controllers/workarea/storefront/cart_items_controller.rb +1 -2
  16. data/app/controllers/workarea/storefront/checkout/addresses_controller.rb +0 -2
  17. data/app/controllers/workarea/storefront/checkouts_controller.rb +6 -4
  18. data/app/controllers/workarea/storefront/content_areas_controller.rb +1 -0
  19. data/app/controllers/workarea/storefront/content_blocks_controller.rb +1 -0
  20. data/app/controllers/workarea/storefront/current_checkout.rb +20 -14
  21. data/app/controllers/workarea/storefront/downloads_controller.rb +18 -0
  22. data/app/controllers/workarea/storefront/email_signups_controller.rb +1 -0
  23. data/app/controllers/workarea/storefront/errors_controller.rb +6 -0
  24. data/app/controllers/workarea/storefront/recent_views_controller.rb +2 -35
  25. data/app/controllers/workarea/storefront/recommendations_controller.rb +2 -2
  26. data/app/controllers/workarea/storefront/searches_controller.rb +0 -11
  27. data/app/controllers/workarea/storefront/users/accounts_controller.rb +2 -7
  28. data/app/controllers/workarea/storefront/users/credit_cards_controller.rb +5 -2
  29. data/app/controllers/workarea/storefront/users/passwords_controller.rb +1 -5
  30. data/app/helpers/workarea/storefront/application_helper.rb +19 -3
  31. data/app/helpers/workarea/storefront/content_helper.rb +1 -1
  32. data/app/helpers/workarea/storefront/favicons_helper.rb +6 -7
  33. data/app/helpers/workarea/storefront/navigation_helper.rb +10 -0
  34. data/app/helpers/workarea/storefront/schema_org_helper.rb +156 -0
  35. data/app/mailers/workarea/storefront/application_mailer.rb +1 -0
  36. data/app/view_models/workarea/storefront/category_view_model.rb +2 -2
  37. data/app/view_models/workarea/storefront/content_block_view_model.rb +41 -10
  38. data/app/view_models/workarea/storefront/content_blocks/product_insights_view_model.rb +1 -1
  39. data/app/view_models/workarea/storefront/display_content.rb +3 -1
  40. data/app/view_models/workarea/storefront/inquiry_view_model.rb +1 -7
  41. data/app/view_models/workarea/storefront/inventory_status_view_model.rb +10 -6
  42. data/app/view_models/workarea/storefront/order_item_view_model.rb +14 -0
  43. data/app/view_models/workarea/storefront/product_view_model.rb +22 -4
  44. data/app/view_models/workarea/storefront/recommendations_view_model.rb +8 -4
  45. data/app/view_models/workarea/storefront/search_view_model.rb +1 -1
  46. data/app/view_models/workarea/storefront/user_activity_view_model.rb +6 -17
  47. data/app/views/layouts/workarea/storefront/application.html.haml +13 -17
  48. data/app/views/layouts/workarea/storefront/checkout.html.haml +1 -1
  49. data/app/views/layouts/workarea/storefront/content_preview.html.haml +1 -0
  50. data/app/views/layouts/workarea/storefront/email.html.haml +33 -26
  51. data/app/views/layouts/workarea/storefront/empty.html.haml +1 -0
  52. data/app/views/layouts/workarea/storefront/navigation.html.haml +1 -1
  53. data/app/views/workarea/storefront/account_mailer/creation.html.haml +2 -0
  54. data/app/views/workarea/storefront/account_mailer/password_reset.html.haml +2 -0
  55. data/app/views/workarea/storefront/cart_items/create.html.haml +1 -1
  56. data/app/views/workarea/storefront/carts/show.html.haml +1 -1
  57. data/app/views/workarea/storefront/categories/show.html.haml +3 -2
  58. data/app/views/workarea/storefront/checkouts/confirmation.html.haml +1 -1
  59. data/app/views/workarea/storefront/contacts/show.html.haml +4 -2
  60. data/app/views/workarea/storefront/content_areas/show.html.haml +1 -0
  61. data/app/views/workarea/storefront/content_blocks/_category_summary.html.haml +2 -1
  62. data/app/views/workarea/storefront/content_blocks/_product_insights.html.haml +2 -1
  63. data/app/views/workarea/storefront/content_blocks/_product_list.html.haml +2 -1
  64. data/app/views/workarea/storefront/errors/show.html.haml +1 -0
  65. data/app/views/workarea/storefront/fulfillment_mailer/shipped.html.haml +3 -1
  66. data/app/views/workarea/storefront/order_mailer/_summary.html.haml +6 -0
  67. data/app/views/workarea/storefront/order_mailer/confirmation.html.haml +3 -0
  68. data/app/views/workarea/storefront/order_mailer/reminder.html.haml +3 -0
  69. data/app/views/workarea/storefront/orders/_summary.html.haml +3 -1
  70. data/app/views/workarea/storefront/orders/show.html.haml +3 -3
  71. data/app/views/workarea/storefront/pages/home_page.html.haml +4 -0
  72. data/app/views/workarea/storefront/pages/robots.text.erb +0 -1
  73. data/app/views/workarea/storefront/pages/show.html.haml +1 -0
  74. data/app/views/workarea/storefront/products/_price.html.haml +1 -2
  75. data/app/views/workarea/storefront/products/_pricing.html.haml +12 -6
  76. data/app/views/workarea/storefront/products/_summary.html.haml +3 -3
  77. data/app/views/workarea/storefront/products/show.html.haml +6 -4
  78. data/app/views/workarea/storefront/products/templates/_generic.html.haml +5 -5
  79. data/app/views/workarea/storefront/products/templates/_option_selects.html.haml +5 -7
  80. data/app/views/workarea/storefront/products/templates/_option_thumbnails.html.haml +5 -7
  81. data/app/views/workarea/storefront/recent_views/aside.html.haml +3 -10
  82. data/app/views/workarea/storefront/recent_views/narrow.html.haml +3 -10
  83. data/app/views/workarea/storefront/recent_views/show.html.haml +3 -10
  84. data/app/views/workarea/storefront/recommendations/show.html.haml +1 -1
  85. data/app/views/workarea/storefront/searches/show.html.haml +4 -5
  86. data/app/views/workarea/storefront/users/accounts/edit.html.haml +3 -3
  87. data/app/views/workarea/storefront/users/accounts/show.html.haml +3 -3
  88. data/app/views/workarea/storefront/users/addresses/edit.html.haml +3 -3
  89. data/app/views/workarea/storefront/users/addresses/new.html.haml +3 -3
  90. data/app/views/workarea/storefront/users/credit_cards/edit.html.haml +3 -3
  91. data/app/views/workarea/storefront/users/credit_cards/new.html.haml +3 -3
  92. data/app/views/workarea/storefront/users/orders/index.html.haml +3 -3
  93. data/app/views/workarea/storefront/users/orders/show.html.haml +4 -4
  94. data/app/views/workarea/storefront/users/passwords/new.html.haml +3 -3
  95. data/config/locales/en.yml +16 -3
  96. data/config/routes.rb +4 -2
  97. data/test/dummy/config/initializers/session_store.rb +1 -1
  98. data/test/helpers/workarea/storefront/content_helper_test.rb +1 -0
  99. data/test/helpers/workarea/storefront/navigation_helper_test.rb +4 -0
  100. data/test/helpers/workarea/storefront/schema_org_helper_test.rb +27 -0
  101. data/test/integration/workarea/storefront/analytics_integration_test.rb +44 -4
  102. data/test/integration/workarea/storefront/cart_items_integration_test.rb +0 -12
  103. data/test/integration/workarea/storefront/categories_integration_test.rb +0 -10
  104. data/test/integration/workarea/storefront/checkout_side_effects_integration_test.rb +15 -1
  105. data/test/integration/workarea/storefront/checkouts_integration_test.rb +68 -11
  106. data/test/integration/workarea/storefront/contact_form_integration_test.rb +18 -20
  107. data/test/integration/workarea/storefront/content_blocks_integration_test.rb +1 -4
  108. data/test/integration/workarea/storefront/current_checkout_integration_test.rb +53 -2
  109. data/test/integration/workarea/storefront/downloads_integration_test.rb +38 -0
  110. data/test/integration/workarea/storefront/email_signups_integration_test.rb +2 -0
  111. data/test/integration/workarea/storefront/guest_browsing_integration_test.rb +2 -2
  112. data/test/integration/workarea/storefront/impersonations_integration_test.rb +2 -2
  113. data/test/integration/workarea/storefront/login_integration_test.rb +3 -9
  114. data/test/integration/workarea/storefront/order_data_integration_test.rb +1 -9
  115. data/test/integration/workarea/storefront/place_order_integration_test.rb +5 -7
  116. data/test/integration/workarea/storefront/placing_order_integration_test.rb +1 -1
  117. data/test/integration/workarea/storefront/recent_views_integration_test.rb +29 -0
  118. data/test/integration/workarea/storefront/releases_integration_test.rb +132 -0
  119. data/test/integration/workarea/storefront/search_integration_test.rb +0 -46
  120. data/test/integration/workarea/storefront/segment_overrides_integration_test.rb +48 -0
  121. data/test/integration/workarea/storefront/segments_integration_test.rb +250 -0
  122. data/test/integration/workarea/storefront/store_credit_integration_test.rb +1 -1
  123. data/test/integration/workarea/storefront/users/credit_cards_integration_test.rb +2 -2
  124. data/test/integration/workarea/storefront/users/passwords_integration_test.rb +0 -19
  125. data/test/javascripts/traffic_referrer_spec.js +1 -1
  126. data/test/mailers/workarea/storefront/transactional_mailer_test.rb +9 -13
  127. data/test/system/workarea/storefront/analytics_system_test.rb +54 -40
  128. data/test/system/workarea/storefront/content_system_test.rb +10 -1
  129. data/test/system/workarea/storefront/digital_products_system_test.rb +2 -0
  130. data/test/system/workarea/storefront/download_system_test.rb +145 -0
  131. data/test/system/workarea/storefront/guest_checkout_system_test.rb +20 -0
  132. data/test/system/workarea/storefront/logged_in_checkout_system_test.rb +31 -32
  133. data/test/system/workarea/storefront/passwords_system_test.rb +35 -37
  134. data/test/system/workarea/storefront/pricing_overrides_system_test.rb +13 -2
  135. data/test/system/workarea/storefront/segment_overrides_system_test.rb +69 -0
  136. data/test/view_models/workarea/storefront/category_view_model_test.rb +20 -0
  137. data/test/view_models/workarea/storefront/content_block_view_model_test.rb +135 -3
  138. data/test/view_models/workarea/storefront/display_content_test.rb +4 -0
  139. data/test/view_models/workarea/storefront/product_view_model/option_set_test.rb +7 -8
  140. data/test/view_models/workarea/storefront/product_view_model_test.rb +17 -10
  141. data/test/view_models/workarea/storefront/search_view_model_test.rb +0 -6
  142. data/test/view_models/workarea/storefront/user_activity_view_model_test.rb +18 -20
  143. metadata +20 -22
  144. data/app/assets/javascripts/workarea/storefront/modules/recent_views.js +0 -25
  145. data/app/assets/javascripts/workarea/storefront/modules/search_fields.js +0 -59
  146. data/app/assets/javascripts/workarea/storefront/templates/ui_menu_heading.jst.ejs +0 -1
  147. data/app/assets/javascripts/workarea/storefront/templates/ui_menu_item.jst.ejs +0 -8
  148. data/app/assets/stylesheets/jquery_ui/storefront/_ui_autocomplete.scss +0 -17
  149. data/app/assets/stylesheets/jquery_ui/storefront/_ui_menu.scss +0 -40
  150. data/app/controllers/workarea/storefront/http_caching.rb +0 -33
  151. data/app/controllers/workarea/storefront/user_activity.rb +0 -19
  152. data/app/view_models/workarea/storefront/search_suggestion_view_model.rb +0 -87
  153. data/app/views/workarea/storefront/searches/index.json.jbuilder +0 -1
  154. data/app/views/workarea/storefront/style_guides/components/_ui_autocomplete.html.haml +0 -11
  155. data/test/dummy/tmp/screenshots/.keep +0 -0
  156. data/test/view_models/workarea/storefront/search_suggestion_view_model_test.rb +0 -42
@@ -7,6 +7,7 @@ module Workarea
7
7
 
8
8
  add_template_helper ActionView::Helpers::AssetUrlHelper
9
9
  add_template_helper Workarea::DetailsHelper
10
+ add_template_helper Workarea::Storefront::SchemaOrgHelper
10
11
 
11
12
  def path_to_url(path)
12
13
  protocol = Rails.application.config.force_ssl ? 'https' : 'http'
@@ -27,9 +27,9 @@ module Workarea
27
27
 
28
28
  def search_query
29
29
  @search_query ||= Search::CategoryBrowse.new(
30
- options.except(:per_page).merge(
30
+ options.merge(
31
31
  category_ids: [model.id],
32
- rules: model.product_rules,
32
+ rules: model.product_rules.usable,
33
33
  terms_facets: terms_facets - %w(category),
34
34
  range_facets: range_facets,
35
35
  sort: current_sorts
@@ -13,19 +13,50 @@ module Workarea
13
13
  end
14
14
 
15
15
  def locals
16
- @locals ||= model.data.merge(
17
- hidden_breakpoints: model.hidden_breakpoints,
18
- view_model: self
19
- )
16
+ @locals ||= model
17
+ .data
18
+ .merge(hidden_breakpoints: model.hidden_breakpoints, view_model: self)
19
+ .merge(asset_alt_text) do |_, block_alt, asset_alt|
20
+ block_alt.presence || asset_alt
21
+ end
20
22
  end
21
23
 
22
- # This ensures memoization happens
23
24
  def find_asset(id)
24
- @assets ||= {}
25
- return @assets[id.to_s] if @assets[id.to_s].present?
25
+ return Content::Asset.image_placeholder if id.blank?
26
+ return assets[id.to_s] if assets[id.to_s].present?
27
+
28
+ assets[id.to_s] = Content::Asset.find(id)
29
+ rescue Mongoid::Errors::DocumentNotFound
30
+ assets[id.to_s] = Content::Asset.image_placeholder
31
+ end
32
+
33
+ def assets
34
+ @assets ||= begin
35
+ asset_ids = model
36
+ .type
37
+ .fields
38
+ .select { |field, _memo| field.type == :asset }
39
+ .map { |field| model.data[field.slug] }
40
+ .reject(&:blank?)
41
+ .map(&:to_s)
42
+
43
+ assets = Content::Asset.in(id: asset_ids)
26
44
 
27
- @assets[id.to_s] = Content::Asset.find(id) rescue
28
- Content::Asset.image_placeholder
45
+ asset_ids.each_with_object({}) do |id, memo|
46
+ memo[id] = assets.detect { |a| a.id.to_s == id } ||
47
+ Content::Asset.image_placeholder
48
+ end
49
+ end
50
+ end
51
+
52
+ def asset_alt_text
53
+ @asset_alt_texts ||= model.type
54
+ .fields
55
+ .select { |f| f.options[:alt_field].present? }
56
+ .each_with_object({}) do |field, memo|
57
+ key = field.options[:alt_field].systemize.to_sym
58
+ memo[key] = find_asset(model.data[field.slug])&.alt_text
59
+ end
29
60
  end
30
61
 
31
62
  def series
@@ -40,7 +71,7 @@ module Workarea
40
71
  data = model.data.slice(*fields)
41
72
 
42
73
  if data.present? && data.values.any?(&:present?)
43
- duplicate = Content::Block.new(model.attributes)
74
+ duplicate = Content::Block.instantiate(model.as_document)
44
75
  duplicate.data = data
45
76
  .map { |k, v| [k.gsub(/_\d+/, ''), v] }
46
77
  .to_h
@@ -34,7 +34,7 @@ module Workarea
34
34
  end
35
35
 
36
36
  def newest_products
37
- @newest_products ||= Catalog::Product.active.recent(results_count)
37
+ @newest_products ||= Catalog::Product.recent(results_count * 2).select(&:active?)
38
38
  end
39
39
 
40
40
  def results_count
@@ -1,7 +1,7 @@
1
1
  module Workarea
2
2
  module Storefront
3
3
  module DisplayContent
4
- delegate :css, :javascript,
4
+ delegate :css, :javascript, :head_content,
5
5
  to: :content, allow_nil: true
6
6
 
7
7
  def browser_title
@@ -25,6 +25,8 @@ module Workarea
25
25
  @open_graph_asset ||=
26
26
  if content.open_graph_asset_id.present?
27
27
  Content::Asset.find(content.open_graph_asset_id)
28
+ elsif (og_default = Content::Asset.open_graph_default).present?
29
+ og_default
28
30
  else
29
31
  Content::Asset.open_graph_placeholder
30
32
  end
@@ -9,13 +9,7 @@ module Workarea
9
9
  end
10
10
 
11
11
  def subjects
12
- Workarea.config.inquiry_subjects.map do |key, default_value|
13
- [
14
- I18n.t('workarea.inquiry.subjects')[key.optionize.to_sym].presence ||
15
- default_value,
16
- key
17
- ]
18
- end
12
+ Workarea.config.inquiry_subjects.map { |k, v| [v, k] }
19
13
  end
20
14
 
21
15
  private
@@ -3,25 +3,29 @@ module Workarea
3
3
  class InventoryStatusViewModel < ApplicationViewModel
4
4
  def message
5
5
  return '' if model.nil?
6
- if purchasable?(Workarea.config.low_inventory_threshold) &&
7
- !backordered?
6
+
7
+ if inventory.available?
8
8
  ::I18n.t('workarea.storefront.products.in_stock')
9
- elsif purchasable? && !backordered?
9
+ elsif inventory.low_inventory?
10
10
  ::I18n.t(
11
11
  'workarea.storefront.products.few_left',
12
12
  quantity: available_to_sell
13
13
  )
14
- elsif backordered? && backordered_until.present?
14
+ elsif inventory.backordered? && backordered_until.present?
15
15
  ::I18n.t(
16
16
  'workarea.storefront.products.ships_on',
17
17
  date: backordered_until.to_date.to_s(:short)
18
18
  )
19
- elsif backordered?
19
+ elsif inventory.backordered?
20
20
  ::I18n.t('workarea.storefront.products.backordered')
21
- else
21
+ elsif inventory.out_of_stock?
22
22
  ::I18n.t('workarea.storefront.products.out_of_stock')
23
23
  end
24
24
  end
25
+
26
+ def inventory
27
+ @inventory ||= Inventory::Collection.new(model.id, [model])
28
+ end
25
29
  end
26
30
  end
27
31
  end
@@ -68,6 +68,20 @@ module Workarea
68
68
  @total_adjustments ||= price_adjustments.reduce_by_description('item')
69
69
  end
70
70
 
71
+ #
72
+ # Fulfillment
73
+ #
74
+ #
75
+ def fulfillment_sku
76
+ @fulfillment_sku ||=
77
+ Fulfillment::Sku.find_or_initialize_by(id: model.sku)
78
+ end
79
+
80
+ def token
81
+ return unless fulfillment_sku.download?
82
+ @token ||= Fulfillment::Token.for_order_item(model.order.id, model.id)
83
+ end
84
+
71
85
  def default_category_name
72
86
  @default_category_name =
73
87
  Categorization.new(catalog_product).default_model.try(:name)
@@ -10,8 +10,6 @@ module Workarea
10
10
  else
11
11
  new(model, options)
12
12
  end
13
- rescue NameError
14
- new(model, options)
15
13
  end
16
14
 
17
15
  def breadcrumbs
@@ -19,12 +17,12 @@ module Workarea
19
17
  if options[:via].present?
20
18
  Navigation::Breadcrumbs.from_global_id(
21
19
  options[:via],
22
- last: model.name
20
+ last: model
23
21
  )
24
22
  else
25
23
  Navigation::Breadcrumbs.new(
26
24
  default_category,
27
- last: model.name
25
+ last: model
28
26
  )
29
27
  end
30
28
  end
@@ -179,6 +177,26 @@ module Workarea
179
177
  model.description
180
178
  end
181
179
  end
180
+
181
+ #
182
+ # Fulfillment
183
+ #
184
+ #
185
+
186
+ def fulfillment_skus
187
+ @fulfillment_skus ||=
188
+ Fulfillment::Sku.find_or_initialize_all(variants.map(&:sku))
189
+ end
190
+
191
+ def requires_shipping?
192
+ if current_variant.present?
193
+ fulfillment_skus
194
+ .detect { |sku| sku.id == current_variant.sku }
195
+ .requires_shipping?
196
+ else
197
+ fulfillment_skus.any?(&:requires_shipping?)
198
+ end
199
+ end
182
200
  end
183
201
  end
184
202
  end
@@ -7,12 +7,10 @@ module Workarea
7
7
  def products
8
8
  @products ||=
9
9
  begin
10
- results = Catalog::Product.active.purchasable.find_ordered(product_ids)
10
+ results = find_displayable_products(product_ids)
11
11
 
12
12
  if results.size < result_count
13
- results.push(
14
- *Catalog::Product.active.purchasable.find_ordered(popular_product_ids)
15
- )
13
+ results.push(*find_displayable_products(popular_product_ids))
16
14
  end
17
15
 
18
16
  ProductViewModel.wrap(results.uniq).take(result_count)
@@ -34,6 +32,12 @@ module Workarea
34
32
  def result_count
35
33
  raise NotImplementedError
36
34
  end
35
+
36
+ private
37
+
38
+ def find_displayable_products(ids)
39
+ Catalog::Product.find_ordered(ids).select(&:active?).select(&:purchasable?)
40
+ end
37
41
  end
38
42
  end
39
43
  end
@@ -34,7 +34,7 @@ module Workarea
34
34
  all = Recommendation::Searches.find(options[:q]) +
35
35
  model.query_suggestions
36
36
 
37
- all.uniq.take(3)
37
+ all.take(3)
38
38
  end
39
39
  end
40
40
 
@@ -4,33 +4,22 @@ module Workarea
4
4
  def products
5
5
  @products ||=
6
6
  begin
7
- product_ids = model.product_ids.uniq.first(display_count)
8
- models = Catalog::Product.any_in(_id: product_ids).to_a
9
- models = models.select(&:active?)
7
+ product_ids = model.viewed.recent_product_ids(max: display_count, unique: true)
10
8
 
11
- product_ids.map do |id|
12
- product = models.detect { |p| p.id == id }
13
- ProductViewModel.wrap(product) if product
14
- end.compact
9
+ Catalog::Product.find_ordered(product_ids).select(&:active?).map do |product|
10
+ ProductViewModel.wrap(product, options)
11
+ end
15
12
  end
16
13
  end
17
14
 
18
15
  def categories
19
16
  @categories ||=
20
17
  begin
21
- category_ids = model.category_ids.uniq.first(display_count)
22
- models = Catalog::Category.any_in(_id: category_ids).to_a
23
-
24
- category_ids.map do |id|
25
- models.detect { |c| c.id.to_s == id.to_s }
26
- end.compact
18
+ category_ids = model.viewed.recent_category_ids(max: display_count, unique: true)
19
+ Catalog::Category.find_ordered(category_ids).select(&:active?)
27
20
  end
28
21
  end
29
22
 
30
- def searches
31
- model.searches.uniq.first(display_count)
32
- end
33
-
34
23
  private
35
24
 
36
25
  def display_count
@@ -1,5 +1,6 @@
1
1
  - add_css(layout_content.css)
2
2
  - add_javascript(layout_content.javascript)
3
+ - add_head_content(layout_content.head_content)
3
4
 
4
5
  !!!
5
6
  /
@@ -31,21 +32,13 @@
31
32
  = append_partials('storefront.document_head')
32
33
  = javascript_include_tag Workarea.config.asset_manifests.storefront_javascript_head
33
34
 
34
- %script{ type: 'application/ld+json' }
35
- :plain
36
- {
37
- "@context": "http://schema.org",
38
- "@type": "WebSite",
39
- "url": "#{root_url}",
40
- "potentialAction": {
41
- "@type": "SearchAction",
42
- "target": "#{search_url}?q={search_term_string}",
43
- "query-input": "required name=search_term_string"
44
- }
45
- }
46
-
47
-
48
- %body{ itemscope: true, itemtype: 'http://schema.org/WebPage' }
35
+ = render_schema_org(web_site_schema)
36
+ = render_schema_org(web_page_schema)
37
+
38
+ = yield :head_content
39
+ = yield :javascript_head
40
+
41
+ %body
49
42
  = append_partials('storefront.body_top')
50
43
 
51
44
  %nav.accessibility-nav.visually-hidden
@@ -90,7 +83,8 @@
90
83
  .page-header__search
91
84
  = form_tag search_path, method: 'get', class: 'page-header__search-form', role: 'search' do
92
85
  .page-header__search-value
93
- .value= search_field_tag :q, params[:q], id: 'storefront_search', class: 'text-box', title: t('workarea.storefront.searches.search'), aria: { label: t('workarea.storefront.searches.search') }, placeholder: t('workarea.storefront.searches.search'), data: { search_field: '' }
86
+ .value= search_field_tag :q, params[:q], id: 'storefront_search', class: 'text-box', title: t('workarea.storefront.searches.search'), aria: { label: t('workarea.storefront.searches.search') }, placeholder: t('workarea.storefront.searches.search')
87
+ = append_partials('storefront.page_header_search_value')
94
88
  .page-header__search-button= button_tag t('workarea.storefront.forms.go'), value: 'search', class: 'button'
95
89
 
96
90
  %nav#navigation.primary-nav
@@ -112,10 +106,12 @@
112
106
  .breadcrumbs{ role: 'navigation' }
113
107
  = yield :breadcrumbs
114
108
  - elsif @breadcrumbs.present?
109
+ = render_schema_org(breadcrumb_list_schema(@breadcrumbs.map { |t| [t.name, storefront_url_for(t)] }))
110
+
115
111
  .breadcrumbs{ role: 'navigation' }
116
112
  %p.breadcrumbs__node-group
117
113
  - @breadcrumbs.each do |taxon|
118
- %span.breadcrumbs__node{ itemprop: 'breadcrumb' }
114
+ %span.breadcrumbs__node
119
115
  - if taxon.navigable.present?
120
116
  - if @breadcrumbs.last == taxon
121
117
  %span.breadcrumbs__text= taxon.name
@@ -27,7 +27,7 @@
27
27
  = append_partials('storefront.document_head')
28
28
  = javascript_include_tag Workarea.config.asset_manifests.storefront_javascript_head
29
29
 
30
- %body{ itemscope: true, itemtype: 'http://schema.org/WebPage' }
30
+ %body
31
31
  = append_partials('storefront.body_top')
32
32
 
33
33
  %nav.accessibility-nav.visually-hidden
@@ -5,6 +5,7 @@
5
5
 
6
6
  - add_css(@content.css)
7
7
  - add_javascript(@content.javascript)
8
+ - add_head_content(@content.head_content)
8
9
 
9
10
  !!!
10
11
  /
@@ -14,7 +14,6 @@
14
14
  -# The title tag shows in email notifications, like Android 4.4.
15
15
  %title= t('workarea.storefront.email.title', host: Workarea.config.host)
16
16
 
17
-
18
17
  -# BEGIN: web font / @font-face
19
18
  -# You're able to load the webfont from your build here, if you so desire.
20
19
  -# This is commented out, by default, since it's something you'll have to
@@ -73,7 +72,7 @@
73
72
  mso-table-rspace: 0pt !important;
74
73
  }
75
74
 
76
- /* Fixes webkit padding issue. Fix for Yahoo mail table alignment bug. Applies table-layout to the first 2 tables then removes for anything nested deeper. */
75
+ /* Fixes webkit padding issue. */
77
76
  table {
78
77
  border-spacing: 0 !important;
79
78
  border-collapse: collapse !important;
@@ -82,19 +81,20 @@
82
81
  margin-right: auto !important;
83
82
  margin-left: auto !important;
84
83
  }
85
- table table table {
86
- table-layout: auto;
87
- }
88
84
 
89
85
  /* Uses a better rendering method when resizing images in IE. */
90
86
  img {
91
87
  -ms-interpolation-mode:bicubic;
92
88
  }
93
89
 
90
+ /* What it does: Prevents Windows 10 Mail from underlining links despite inline CSS. Styles for underlined links should be inline. */
91
+ a {
92
+ text-decoration: none;
93
+ }
94
+
94
95
  /* A work-around for email clients meddling in triggered links. */
95
- *[x-apple-data-detectors], /* iOS */
96
- .x-gmail-data-detectors, /* Gmail */
97
- .x-gmail-data-detectors *,
96
+ a[x-apple-data-detectors], /* iOS */
97
+ .unstyle-auto-detected-links a,
98
98
  .aBn {
99
99
  border-bottom: 0 !important;
100
100
  cursor: default !important;
@@ -106,7 +106,12 @@
106
106
  line-height: inherit !important;
107
107
  }
108
108
 
109
- /* Prevents Gmail from displaying an download button on large, non-linked images. */
109
+ /* What it does: Prevents Gmail from changing the text color in conversation threads. */
110
+ .im {
111
+ color: inherit !important;
112
+ }
113
+
114
+ /* Prevents Gmail from displaying a download button on large, non-linked images. */
110
115
  .a6S {
111
116
  display: none !important;
112
117
  opacity: 0.01 !important;
@@ -116,37 +121,27 @@
116
121
  display: none !important;
117
122
  }
118
123
 
119
- /* Prevents underlining the button text in Windows 10 */
120
- .button-link {
121
- text-decoration: none !important;
122
- }
123
-
124
124
  /* Removes right gutter in Gmail iOS app: https://github.com/TedGoas/Cerberus/issues/89 */
125
125
  /* Create one of these media queries for each additional viewport size you'd like to fix */
126
126
 
127
127
  /* iPhone 4, 4S, 5, 5S, 5C, and 5SE */
128
128
  @media only screen and (min-device-width: 320px) and (max-device-width: 374px) {
129
- .email-container {
129
+ u ~ div .email-container {
130
130
  min-width: 320px !important;
131
131
  }
132
132
  }
133
133
  /* iPhone 6, 6S, 7, 8, and X */
134
134
  @media only screen and (min-device-width: 375px) and (max-device-width: 413px) {
135
- .email-container {
135
+ u ~ div .email-container {
136
136
  min-width: 375px !important;
137
137
  }
138
138
  }
139
139
  /* iPhone 6+, 7+, and 8+ */
140
140
  @media only screen and (min-device-width: 414px) {
141
- .email-container {
141
+ u ~ div .email-container {
142
142
  min-width: 414px !important;
143
143
  }
144
144
  }
145
- -# END: CSS Reset
146
-
147
- -# The rest of the styles are loaded from the email manifest and will be
148
- -# applied to each element via premailer.
149
- = stylesheet_link_tag Workarea.config.asset_manifests.storefront_email_stylesheet
150
145
 
151
146
  -# Makes background images in 72ppi Outlook render at correct size.
152
147
  /[if gte mso 9]
@@ -158,10 +153,16 @@
158
153
  </o:OfficeDocumentSettings>
159
154
  </xml>
160
155
 
156
+ -# END: CSS Reset
157
+
158
+ -# The rest of the styles are loaded from the email manifest and will be
159
+ -# applied to each element via premailer.
160
+ = stylesheet_link_tag Workarea.config.asset_manifests.storefront_email_stylesheet
161
+
161
162
  %body{ style: 'mso-line-height-rule: exactly;', width: '100%' }
162
163
  %center
163
164
  /[if mso | IE]
164
- <table role="presentation" width="100%"><tr><td>
165
+ <table class='mso-wrapper' role="presentation" width="100%" align="center"><tr><td>
165
166
 
166
167
  -# Preheader Text
167
168
  -# A preheader (otherwise known as a ‘Johnson Box’) is the short summary
@@ -169,16 +170,22 @@
169
170
  - if content_for?(:preheader_text)
170
171
  .preheader-text= yield :preheader_text
171
172
 
172
- %table.email-container{ role: 'presentation', width: 600 }
173
+ -# Preview Text Spacing Hack
174
+ -# Create white space after the desired preview text so email clients
175
+ -# don’t pull other distracting text into the inbox preview. Extend as
176
+ -# necessary.
177
+ .hidden!= '&zwnj;&nbsp;' * 18
178
+
179
+ %table.email-container{ role: 'presentation', width: Workarea.config.storefront_email_width }
173
180
  %tr
174
181
  %td.email-header
175
182
  = link_to "http://#{Workarea.config.host}/", class: 'logo' do
176
183
  = image_tag url_to_image('workarea/storefront/email/banner.png'), alt: t('workarea.storefront.layouts.logo'), class: 'logo__image', border: 0, size: '200x50'
177
184
 
178
- %table.email-container.email-container--main{ role: 'presentation', width: 600 }
185
+ %table.email-container.email-container--main{ role: 'presentation', width: Workarea.config.storefront_email_width }
179
186
  = yield
180
187
 
181
- %table.email-container{ role: 'presentation', width: 600 }
188
+ %table.email-container{ role: 'presentation', width: Workarea.config.storefront_email_width }
182
189
  %tr
183
190
  %td.email-footer
184
191
  = Workarea.config.site_name