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.
- checksums.yaml +4 -4
- data/LICENSE.txt +52 -0
- data/app/assets/javascripts/workarea/storefront/application.js.erb +2 -12
- data/app/assets/javascripts/workarea/storefront/config.js.erb +0 -5
- data/app/assets/javascripts/workarea/storefront/modules/{analytics.js → analytics.js.erb} +17 -0
- data/app/assets/javascripts/workarea/storefront/modules/dialog_buttons.js +1 -1
- data/app/assets/javascripts/workarea/storefront/modules/workarea_analytics.js +4 -0
- data/app/assets/stylesheets/workarea/storefront/application.scss.erb +0 -2
- data/app/assets/stylesheets/workarea/storefront/email/_base.scss +9 -1
- data/app/assets/stylesheets/workarea/storefront/email/_components.scss +1 -1
- data/app/assets/stylesheets/workarea/storefront/email/_helpers.scss +16 -0
- data/app/assets/stylesheets/workarea/storefront/email/{_settings.scss → _settings.scss.erb} +1 -1
- data/app/controllers/workarea/storefront/analytics_controller.rb +36 -21
- data/app/controllers/workarea/storefront/application_controller.rb +2 -4
- data/app/controllers/workarea/storefront/cart_items_controller.rb +1 -2
- data/app/controllers/workarea/storefront/checkout/addresses_controller.rb +0 -2
- data/app/controllers/workarea/storefront/checkouts_controller.rb +6 -4
- data/app/controllers/workarea/storefront/content_areas_controller.rb +1 -0
- data/app/controllers/workarea/storefront/content_blocks_controller.rb +1 -0
- data/app/controllers/workarea/storefront/current_checkout.rb +20 -14
- data/app/controllers/workarea/storefront/downloads_controller.rb +18 -0
- data/app/controllers/workarea/storefront/email_signups_controller.rb +1 -0
- data/app/controllers/workarea/storefront/errors_controller.rb +6 -0
- data/app/controllers/workarea/storefront/recent_views_controller.rb +2 -35
- data/app/controllers/workarea/storefront/recommendations_controller.rb +2 -2
- data/app/controllers/workarea/storefront/searches_controller.rb +0 -11
- data/app/controllers/workarea/storefront/users/accounts_controller.rb +2 -7
- data/app/controllers/workarea/storefront/users/credit_cards_controller.rb +5 -2
- data/app/controllers/workarea/storefront/users/passwords_controller.rb +1 -5
- data/app/helpers/workarea/storefront/application_helper.rb +19 -3
- data/app/helpers/workarea/storefront/content_helper.rb +1 -1
- data/app/helpers/workarea/storefront/favicons_helper.rb +6 -7
- data/app/helpers/workarea/storefront/navigation_helper.rb +10 -0
- data/app/helpers/workarea/storefront/schema_org_helper.rb +156 -0
- data/app/mailers/workarea/storefront/application_mailer.rb +1 -0
- data/app/view_models/workarea/storefront/category_view_model.rb +2 -2
- data/app/view_models/workarea/storefront/content_block_view_model.rb +41 -10
- data/app/view_models/workarea/storefront/content_blocks/product_insights_view_model.rb +1 -1
- data/app/view_models/workarea/storefront/display_content.rb +3 -1
- data/app/view_models/workarea/storefront/inquiry_view_model.rb +1 -7
- data/app/view_models/workarea/storefront/inventory_status_view_model.rb +10 -6
- data/app/view_models/workarea/storefront/order_item_view_model.rb +14 -0
- data/app/view_models/workarea/storefront/product_view_model.rb +22 -4
- data/app/view_models/workarea/storefront/recommendations_view_model.rb +8 -4
- data/app/view_models/workarea/storefront/search_view_model.rb +1 -1
- data/app/view_models/workarea/storefront/user_activity_view_model.rb +6 -17
- data/app/views/layouts/workarea/storefront/application.html.haml +13 -17
- data/app/views/layouts/workarea/storefront/checkout.html.haml +1 -1
- data/app/views/layouts/workarea/storefront/content_preview.html.haml +1 -0
- data/app/views/layouts/workarea/storefront/email.html.haml +33 -26
- data/app/views/layouts/workarea/storefront/empty.html.haml +1 -0
- data/app/views/layouts/workarea/storefront/navigation.html.haml +1 -1
- data/app/views/workarea/storefront/account_mailer/creation.html.haml +2 -0
- data/app/views/workarea/storefront/account_mailer/password_reset.html.haml +2 -0
- data/app/views/workarea/storefront/cart_items/create.html.haml +1 -1
- data/app/views/workarea/storefront/carts/show.html.haml +1 -1
- data/app/views/workarea/storefront/categories/show.html.haml +3 -2
- data/app/views/workarea/storefront/checkouts/confirmation.html.haml +1 -1
- data/app/views/workarea/storefront/contacts/show.html.haml +4 -2
- data/app/views/workarea/storefront/content_areas/show.html.haml +1 -0
- data/app/views/workarea/storefront/content_blocks/_category_summary.html.haml +2 -1
- data/app/views/workarea/storefront/content_blocks/_product_insights.html.haml +2 -1
- data/app/views/workarea/storefront/content_blocks/_product_list.html.haml +2 -1
- data/app/views/workarea/storefront/errors/show.html.haml +1 -0
- data/app/views/workarea/storefront/fulfillment_mailer/shipped.html.haml +3 -1
- data/app/views/workarea/storefront/order_mailer/_summary.html.haml +6 -0
- data/app/views/workarea/storefront/order_mailer/confirmation.html.haml +3 -0
- data/app/views/workarea/storefront/order_mailer/reminder.html.haml +3 -0
- data/app/views/workarea/storefront/orders/_summary.html.haml +3 -1
- data/app/views/workarea/storefront/orders/show.html.haml +3 -3
- data/app/views/workarea/storefront/pages/home_page.html.haml +4 -0
- data/app/views/workarea/storefront/pages/robots.text.erb +0 -1
- data/app/views/workarea/storefront/pages/show.html.haml +1 -0
- data/app/views/workarea/storefront/products/_price.html.haml +1 -2
- data/app/views/workarea/storefront/products/_pricing.html.haml +12 -6
- data/app/views/workarea/storefront/products/_summary.html.haml +3 -3
- data/app/views/workarea/storefront/products/show.html.haml +6 -4
- data/app/views/workarea/storefront/products/templates/_generic.html.haml +5 -5
- data/app/views/workarea/storefront/products/templates/_option_selects.html.haml +5 -7
- data/app/views/workarea/storefront/products/templates/_option_thumbnails.html.haml +5 -7
- data/app/views/workarea/storefront/recent_views/aside.html.haml +3 -10
- data/app/views/workarea/storefront/recent_views/narrow.html.haml +3 -10
- data/app/views/workarea/storefront/recent_views/show.html.haml +3 -10
- data/app/views/workarea/storefront/recommendations/show.html.haml +1 -1
- data/app/views/workarea/storefront/searches/show.html.haml +4 -5
- data/app/views/workarea/storefront/users/accounts/edit.html.haml +3 -3
- data/app/views/workarea/storefront/users/accounts/show.html.haml +3 -3
- data/app/views/workarea/storefront/users/addresses/edit.html.haml +3 -3
- data/app/views/workarea/storefront/users/addresses/new.html.haml +3 -3
- data/app/views/workarea/storefront/users/credit_cards/edit.html.haml +3 -3
- data/app/views/workarea/storefront/users/credit_cards/new.html.haml +3 -3
- data/app/views/workarea/storefront/users/orders/index.html.haml +3 -3
- data/app/views/workarea/storefront/users/orders/show.html.haml +4 -4
- data/app/views/workarea/storefront/users/passwords/new.html.haml +3 -3
- data/config/locales/en.yml +16 -3
- data/config/routes.rb +4 -2
- data/test/dummy/config/initializers/session_store.rb +1 -1
- data/test/helpers/workarea/storefront/content_helper_test.rb +1 -0
- data/test/helpers/workarea/storefront/navigation_helper_test.rb +4 -0
- data/test/helpers/workarea/storefront/schema_org_helper_test.rb +27 -0
- data/test/integration/workarea/storefront/analytics_integration_test.rb +44 -4
- data/test/integration/workarea/storefront/cart_items_integration_test.rb +0 -12
- data/test/integration/workarea/storefront/categories_integration_test.rb +0 -10
- data/test/integration/workarea/storefront/checkout_side_effects_integration_test.rb +15 -1
- data/test/integration/workarea/storefront/checkouts_integration_test.rb +68 -11
- data/test/integration/workarea/storefront/contact_form_integration_test.rb +18 -20
- data/test/integration/workarea/storefront/content_blocks_integration_test.rb +1 -4
- data/test/integration/workarea/storefront/current_checkout_integration_test.rb +53 -2
- data/test/integration/workarea/storefront/downloads_integration_test.rb +38 -0
- data/test/integration/workarea/storefront/email_signups_integration_test.rb +2 -0
- data/test/integration/workarea/storefront/guest_browsing_integration_test.rb +2 -2
- data/test/integration/workarea/storefront/impersonations_integration_test.rb +2 -2
- data/test/integration/workarea/storefront/login_integration_test.rb +3 -9
- data/test/integration/workarea/storefront/order_data_integration_test.rb +1 -9
- data/test/integration/workarea/storefront/place_order_integration_test.rb +5 -7
- data/test/integration/workarea/storefront/placing_order_integration_test.rb +1 -1
- data/test/integration/workarea/storefront/recent_views_integration_test.rb +29 -0
- data/test/integration/workarea/storefront/releases_integration_test.rb +132 -0
- data/test/integration/workarea/storefront/search_integration_test.rb +0 -46
- data/test/integration/workarea/storefront/segment_overrides_integration_test.rb +48 -0
- data/test/integration/workarea/storefront/segments_integration_test.rb +250 -0
- data/test/integration/workarea/storefront/store_credit_integration_test.rb +1 -1
- data/test/integration/workarea/storefront/users/credit_cards_integration_test.rb +2 -2
- data/test/integration/workarea/storefront/users/passwords_integration_test.rb +0 -19
- data/test/javascripts/traffic_referrer_spec.js +1 -1
- data/test/mailers/workarea/storefront/transactional_mailer_test.rb +9 -13
- data/test/system/workarea/storefront/analytics_system_test.rb +54 -40
- data/test/system/workarea/storefront/content_system_test.rb +10 -1
- data/test/system/workarea/storefront/digital_products_system_test.rb +2 -0
- data/test/system/workarea/storefront/download_system_test.rb +145 -0
- data/test/system/workarea/storefront/guest_checkout_system_test.rb +20 -0
- data/test/system/workarea/storefront/logged_in_checkout_system_test.rb +31 -32
- data/test/system/workarea/storefront/passwords_system_test.rb +35 -37
- data/test/system/workarea/storefront/pricing_overrides_system_test.rb +13 -2
- data/test/system/workarea/storefront/segment_overrides_system_test.rb +69 -0
- data/test/view_models/workarea/storefront/category_view_model_test.rb +20 -0
- data/test/view_models/workarea/storefront/content_block_view_model_test.rb +135 -3
- data/test/view_models/workarea/storefront/display_content_test.rb +4 -0
- data/test/view_models/workarea/storefront/product_view_model/option_set_test.rb +7 -8
- data/test/view_models/workarea/storefront/product_view_model_test.rb +17 -10
- data/test/view_models/workarea/storefront/search_view_model_test.rb +0 -6
- data/test/view_models/workarea/storefront/user_activity_view_model_test.rb +18 -20
- metadata +20 -22
- data/app/assets/javascripts/workarea/storefront/modules/recent_views.js +0 -25
- data/app/assets/javascripts/workarea/storefront/modules/search_fields.js +0 -59
- data/app/assets/javascripts/workarea/storefront/templates/ui_menu_heading.jst.ejs +0 -1
- data/app/assets/javascripts/workarea/storefront/templates/ui_menu_item.jst.ejs +0 -8
- data/app/assets/stylesheets/jquery_ui/storefront/_ui_autocomplete.scss +0 -17
- data/app/assets/stylesheets/jquery_ui/storefront/_ui_menu.scss +0 -40
- data/app/controllers/workarea/storefront/http_caching.rb +0 -33
- data/app/controllers/workarea/storefront/user_activity.rb +0 -19
- data/app/view_models/workarea/storefront/search_suggestion_view_model.rb +0 -87
- data/app/views/workarea/storefront/searches/index.json.jbuilder +0 -1
- data/app/views/workarea/storefront/style_guides/components/_ui_autocomplete.html.haml +0 -11
- data/test/dummy/tmp/screenshots/.keep +0 -0
- data/test/view_models/workarea/storefront/search_suggestion_view_model_test.rb +0 -42
@@ -1 +0,0 @@
|
|
1
|
-
<li class="ui-menu-heading"><%= categoryName %></li>
|
@@ -1,17 +0,0 @@
|
|
1
|
-
/*------------------------------------*\
|
2
|
-
#UI-AUTOCOMPLETE
|
3
|
-
\*------------------------------------*/
|
4
|
-
|
5
|
-
$ui-autocomplete-bg-color: $white !default;
|
6
|
-
|
7
|
-
$ui-autocomplete-width: 190px !default;
|
8
|
-
|
9
|
-
|
10
|
-
.ui-autocomplete {
|
11
|
-
@extend %list-reset;
|
12
|
-
position: absolute;
|
13
|
-
z-index: index($components, ui-autocomplete);
|
14
|
-
padding: $spacing-unit;
|
15
|
-
width: $ui-autocomplete-width;
|
16
|
-
background: $ui-autocomplete-bg-color;
|
17
|
-
}
|
@@ -1,40 +0,0 @@
|
|
1
|
-
/*------------------------------------*\
|
2
|
-
#UI-MENU
|
3
|
-
\*------------------------------------*/
|
4
|
-
|
5
|
-
$ui-menu-item-selected-color: $highlight-color !default;
|
6
|
-
|
7
|
-
|
8
|
-
/**
|
9
|
-
* 1. default menu item state
|
10
|
-
* 2. hovered menu item state
|
11
|
-
* 3. the displayed result image
|
12
|
-
* 4. menu headings
|
13
|
-
*/
|
14
|
-
|
15
|
-
.ui-menu {
|
16
|
-
.ui-menu-item { /* [1] */
|
17
|
-
@extend %clearfix;
|
18
|
-
padding: ($spacing-unit / 2) 0;
|
19
|
-
cursor: pointer;
|
20
|
-
|
21
|
-
&:hover { /* [2] */
|
22
|
-
background: $ui-menu-item-selected-color;
|
23
|
-
}
|
24
|
-
|
25
|
-
img { /* [3] */
|
26
|
-
margin: 0 ($spacing-unit / 2) 0 0;
|
27
|
-
float: left;
|
28
|
-
}
|
29
|
-
}
|
30
|
-
|
31
|
-
.ui-menu-heading { /* [4] */
|
32
|
-
margin: ($spacing-unit / 2) 0;
|
33
|
-
padding: ($spacing-unit / 2) 0;
|
34
|
-
font-weight: bold;
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
.ui-menu-item-wrapper {
|
39
|
-
display: block;
|
40
|
-
}
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module Workarea
|
2
|
-
module Storefront
|
3
|
-
module HttpCaching
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
included do
|
7
|
-
after_action :set_vary_headers
|
8
|
-
helper_method :http_caching?
|
9
|
-
end
|
10
|
-
|
11
|
-
def cache_page
|
12
|
-
unless current_user.try(:admin?)
|
13
|
-
expires_in Workarea.config.cache_expirations.http_cache, public: true if flash.blank?
|
14
|
-
request.session_options[:skip] = true
|
15
|
-
@http_caching = true
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def http_caching?
|
20
|
-
!!@http_caching
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def set_vary_headers
|
26
|
-
response.headers['X-Requested-With'] = request.headers['X-Requested-With'] || ''
|
27
|
-
response.headers['X-Flash-Messages'] ||= ''
|
28
|
-
|
29
|
-
response.headers['Vary'] = 'X-Requested-With, X-Flash-Messages'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Workarea
|
2
|
-
module Storefront
|
3
|
-
module UserActivity
|
4
|
-
def user_activity
|
5
|
-
return Recommendation::UserActivity.new if current_user_activity_id.blank?
|
6
|
-
|
7
|
-
@user_activity ||= Recommendation::UserActivity.find_or_initialize_by(
|
8
|
-
id: current_user_activity_id
|
9
|
-
)
|
10
|
-
end
|
11
|
-
|
12
|
-
def current_user_activity_id
|
13
|
-
current_user.try(:id).presence ||
|
14
|
-
session.id.try(:cookie_value).presence ||
|
15
|
-
session.id
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,87 +0,0 @@
|
|
1
|
-
module Workarea
|
2
|
-
module Storefront
|
3
|
-
class SearchSuggestionViewModel < ApplicationViewModel
|
4
|
-
include I18n::DefaultUrlOptions
|
5
|
-
include Storefront::Engine.routes.url_helpers
|
6
|
-
include Search::LoadProductResults
|
7
|
-
include AnalyticsHelper
|
8
|
-
|
9
|
-
def to_h
|
10
|
-
{
|
11
|
-
value: name,
|
12
|
-
type: type,
|
13
|
-
image: image,
|
14
|
-
url: url,
|
15
|
-
analytics: analytics
|
16
|
-
}
|
17
|
-
end
|
18
|
-
|
19
|
-
def source
|
20
|
-
model['_source']
|
21
|
-
end
|
22
|
-
|
23
|
-
def name
|
24
|
-
source['content']['name']
|
25
|
-
end
|
26
|
-
|
27
|
-
def type
|
28
|
-
t("workarea.storefront.searches.#{suggestion_type.pluralize}")
|
29
|
-
end
|
30
|
-
|
31
|
-
# TODO this can be simplified in v4, when we can be confident the index
|
32
|
-
# will always have relative paths stored for image cache.
|
33
|
-
def image
|
34
|
-
return if source['cache']['image'].blank?
|
35
|
-
|
36
|
-
image_url = URI.parse(source['cache']['image'])
|
37
|
-
|
38
|
-
if asset_host.present?
|
39
|
-
image_url.scheme = asset_host.scheme
|
40
|
-
image_url.host = asset_host.host
|
41
|
-
end
|
42
|
-
|
43
|
-
image_url.to_s
|
44
|
-
end
|
45
|
-
|
46
|
-
def asset_host
|
47
|
-
URI.parse(Rails.application.config.action_controller.asset_host)
|
48
|
-
rescue URI::InvalidURIError
|
49
|
-
nil
|
50
|
-
end
|
51
|
-
|
52
|
-
def suggestion_type
|
53
|
-
source['type']
|
54
|
-
end
|
55
|
-
|
56
|
-
def analytics
|
57
|
-
return unless suggestion_type == 'product'
|
58
|
-
|
59
|
-
product_analytics_data(product)
|
60
|
-
end
|
61
|
-
|
62
|
-
def product
|
63
|
-
@product ||=
|
64
|
-
begin
|
65
|
-
loaded = load_model_from(model)
|
66
|
-
|
67
|
-
Storefront::ProductViewModel.wrap(
|
68
|
-
loaded[:model],
|
69
|
-
loaded.slice(:inventory, :pricing)
|
70
|
-
)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def url
|
75
|
-
if suggestion_type == 'product'
|
76
|
-
product_path(product)
|
77
|
-
elsif suggestion_type == 'search'
|
78
|
-
search_path(q: name)
|
79
|
-
elsif suggestion_type == 'category'
|
80
|
-
category_path(source['slug'])
|
81
|
-
elsif suggestion_type == 'page'
|
82
|
-
page_path(source['slug'])
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
json.results @results
|
@@ -1,11 +0,0 @@
|
|
1
|
-
#ui-autocomplete.style-guide__subsection
|
2
|
-
|
3
|
-
%h3= link_to_style_guide('components', 'ui_autocomplete')
|
4
|
-
|
5
|
-
%p An example of the default jQuery UI autocomplete widget instance.
|
6
|
-
|
7
|
-
%p Enter the string "sweater" in the field below to see an example.
|
8
|
-
|
9
|
-
.style-guide__example-block
|
10
|
-
= text_field_tag 'ui_autocomplete_field', nil, class: 'text-box', data: { style_guide_autocomplete_field: '' }
|
11
|
-
|
File without changes
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Workarea
|
4
|
-
module Storefront
|
5
|
-
class SearchSuggestionViewModelTest < TestCase
|
6
|
-
setup :set_asset_host_config
|
7
|
-
teardown :restore_asset_host_config
|
8
|
-
|
9
|
-
def set_asset_host_config
|
10
|
-
@current_asset_host = Rails.application.config.action_controller.asset_host
|
11
|
-
Rails.application.config.action_controller.asset_host = 'http://cdn.client.com'
|
12
|
-
end
|
13
|
-
|
14
|
-
def restore_asset_host_config
|
15
|
-
Rails.application.config.action_controller.asset_host = @current_asset_host
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_image_handles_blank
|
19
|
-
search_suggestion = { '_source' => { 'cache' => { 'image' => '' } } }
|
20
|
-
view_model = SearchSuggestionViewModel.new(search_suggestion)
|
21
|
-
assert(view_model.image.nil?)
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_image_handles_different_urls_from_index
|
25
|
-
possible_index_urls = %w(
|
26
|
-
/image.jpg
|
27
|
-
https://staging.client.com/image.jpg
|
28
|
-
http://cdn.client.com/image.jpg
|
29
|
-
)
|
30
|
-
|
31
|
-
possible_index_urls.each do |url_from_index|
|
32
|
-
search_suggestion = {
|
33
|
-
'_source' => { 'cache' => { 'image' => url_from_index } }
|
34
|
-
}
|
35
|
-
|
36
|
-
view_model = SearchSuggestionViewModel.new(search_suggestion)
|
37
|
-
assert_equal('http://cdn.client.com/image.jpg', view_model.image)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|