workarea-wish_lists 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +20 -0
  3. data/.eslintignore +2 -0
  4. data/.eslintrc +24 -0
  5. data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
  6. data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
  7. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  8. data/.gitignore +15 -0
  9. data/.scss-lint.yml +188 -0
  10. data/.yardopts +1 -0
  11. data/CHANGELOG.md +610 -0
  12. data/CODE_OF_CONDUCT.md +3 -0
  13. data/CONTRIBUTING.md +3 -0
  14. data/Gemfile +6 -0
  15. data/LICENSE +52 -0
  16. data/README.md +58 -0
  17. data/Rakefile +53 -0
  18. data/app/assets/javascripts/workarea/storefront/wish_lists/modules/wish_list_button.js +35 -0
  19. data/app/assets/javascripts/workarea/storefront/wish_lists/modules/wish_list_public_quantity_fields.js +42 -0
  20. data/app/assets/javascripts/workarea/storefront/wish_lists/templates/hidden_input.jst.ejs +1 -0
  21. data/app/assets/stylesheets/workarea/storefront/wish_lists/components/_wish_list_button.scss +6 -0
  22. data/app/assets/stylesheets/workarea/storefront/wish_lists/components/_wish_lists.scss +24 -0
  23. data/app/controllers/workarea/admin/users_controller.decorator +20 -0
  24. data/app/controllers/workarea/storefront/users/wish_lists_controller.rb +128 -0
  25. data/app/controllers/workarea/storefront/wish_lists_controller.rb +22 -0
  26. data/app/models/workarea/wish_list.rb +212 -0
  27. data/app/models/workarea/wish_list/item.rb +76 -0
  28. data/app/models/workarea/wish_list/pricing.rb +14 -0
  29. data/app/models/workarea/wish_list/pricing/calculators/totals_calculator.rb +26 -0
  30. data/app/models/workarea/wish_list/public_search.rb +34 -0
  31. data/app/models/workarea/wish_list/request.rb +36 -0
  32. data/app/seeds/workarea/wish_list_seeds.rb +24 -0
  33. data/app/services/workarea/set_wish_list_details.rb +49 -0
  34. data/app/services/workarea/wish_list_session.rb +53 -0
  35. data/app/view_models/workarea/admin/user_view_model.decorator +12 -0
  36. data/app/view_models/workarea/storefront/user_view_model.decorator +31 -0
  37. data/app/view_models/workarea/storefront/wish_list_item_view_model.rb +35 -0
  38. data/app/view_models/workarea/storefront/wish_list_view_model.rb +75 -0
  39. data/app/views/layouts/workarea/storefront/_wish_lists_link.html.haml +6 -0
  40. data/app/views/workarea/admin/users/_wish_list_card.html.haml +24 -0
  41. data/app/views/workarea/admin/users/_wish_list_item_summary.html.haml +8 -0
  42. data/app/views/workarea/admin/users/wish_list.html.haml +26 -0
  43. data/app/views/workarea/storefront/carts/_move_to_wish_list.html.haml +4 -0
  44. data/app/views/workarea/storefront/products/_add_to_wish_list.html.haml +4 -0
  45. data/app/views/workarea/storefront/style_guides/_wish_lists_product_list_docs.html.haml +158 -0
  46. data/app/views/workarea/storefront/users/accounts/_wish_list_summary.html.haml +15 -0
  47. data/app/views/workarea/storefront/users/wish_lists/show.html.haml +125 -0
  48. data/app/views/workarea/storefront/wish_lists/_wish_lists_link.html.haml +4 -0
  49. data/app/views/workarea/storefront/wish_lists/index.html.haml +32 -0
  50. data/app/views/workarea/storefront/wish_lists/show.html.haml +97 -0
  51. data/app/workers/workarea/mark_wish_list_items_purchased.rb +18 -0
  52. data/app/workers/workarea/update_wish_list_details.rb +19 -0
  53. data/bin/rails +18 -0
  54. data/config/initializers/append_points.rb +46 -0
  55. data/config/initializers/configuration.rb +10 -0
  56. data/config/locales/en.yml +60 -0
  57. data/config/routes.rb +23 -0
  58. data/lib/workarea/testing/factories/wish_lists.rb +22 -0
  59. data/lib/workarea/wish_lists.rb +13 -0
  60. data/lib/workarea/wish_lists/engine.rb +15 -0
  61. data/lib/workarea/wish_lists/version.rb +5 -0
  62. data/test/dummy/Rakefile +6 -0
  63. data/test/dummy/app/assets/config/manifest.js +4 -0
  64. data/test/dummy/app/assets/images/.keep +0 -0
  65. data/test/dummy/app/assets/javascripts/application.js +13 -0
  66. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  67. data/test/dummy/app/controllers/application_controller.rb +3 -0
  68. data/test/dummy/app/controllers/concerns/.keep +0 -0
  69. data/test/dummy/app/helpers/application_helper.rb +2 -0
  70. data/test/dummy/app/jobs/application_job.rb +2 -0
  71. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  72. data/test/dummy/app/models/concerns/.keep +0 -0
  73. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  74. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  75. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  76. data/test/dummy/bin/bundle +3 -0
  77. data/test/dummy/bin/rails +4 -0
  78. data/test/dummy/bin/rake +4 -0
  79. data/test/dummy/bin/setup +34 -0
  80. data/test/dummy/bin/update +29 -0
  81. data/test/dummy/config.ru +5 -0
  82. data/test/dummy/config/application.rb +24 -0
  83. data/test/dummy/config/boot.rb +5 -0
  84. data/test/dummy/config/cable.yml +9 -0
  85. data/test/dummy/config/environment.rb +5 -0
  86. data/test/dummy/config/environments/development.rb +54 -0
  87. data/test/dummy/config/environments/production.rb +86 -0
  88. data/test/dummy/config/environments/test.rb +43 -0
  89. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  90. data/test/dummy/config/initializers/assets.rb +11 -0
  91. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  92. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  93. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  94. data/test/dummy/config/initializers/inflections.rb +16 -0
  95. data/test/dummy/config/initializers/mime_types.rb +4 -0
  96. data/test/dummy/config/initializers/new_framework_defaults.rb +21 -0
  97. data/test/dummy/config/initializers/session_store.rb +3 -0
  98. data/test/dummy/config/initializers/workarea.rb +5 -0
  99. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  100. data/test/dummy/config/locales/en.yml +23 -0
  101. data/test/dummy/config/puma.rb +47 -0
  102. data/test/dummy/config/routes.rb +5 -0
  103. data/test/dummy/config/secrets.yml +22 -0
  104. data/test/dummy/config/spring.rb +6 -0
  105. data/test/dummy/db/seeds.rb +3 -0
  106. data/test/dummy/lib/assets/.keep +0 -0
  107. data/test/dummy/log/.keep +0 -0
  108. data/test/dummy/public/404.html +67 -0
  109. data/test/dummy/public/422.html +67 -0
  110. data/test/dummy/public/500.html +66 -0
  111. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  112. data/test/dummy/public/apple-touch-icon.png +0 -0
  113. data/test/dummy/public/favicon.ico +0 -0
  114. data/test/integration/workarea/storefront/wish_lists_integration_test.rb +211 -0
  115. data/test/models/workarea/wish_list/public_search_test.rb +82 -0
  116. data/test/models/workarea/wish_list_test.rb +158 -0
  117. data/test/services/workarea/set_wish_list_details_test.rb +62 -0
  118. data/test/services/workarea/wish_list_session_test.rb +47 -0
  119. data/test/system/workarea/admin/wish_lists_system_test.rb +46 -0
  120. data/test/system/workarea/storefront/wish_lists_system_test.rb +287 -0
  121. data/test/test_helper.rb +10 -0
  122. data/test/view_models/workarea/storefront/user_view_model_test.rb +46 -0
  123. data/test/view_models/workarea/storefront/wish_list_item_view_model_test.rb +47 -0
  124. data/test/view_models/workarea/storefront/wish_list_view_model_test.rb +74 -0
  125. data/test/workers/workarea/mark_wish_list_items_purchased_test.rb +21 -0
  126. data/workarea-wish_lists.gemspec +21 -0
  127. metadata +188 -0
@@ -0,0 +1,15 @@
1
+ .grid
2
+ .grid__cell
3
+ .box
4
+ .box__header
5
+ %span.box__action= link_to t('workarea.storefront.wish_lists.manage'), users_wish_list_path, class: 'button'
6
+ %h2.box__heading= t('workarea.storefront.wish_lists.wish_list')
7
+ .box__body
8
+ - if user.wish_list_items.any?
9
+ .grid
10
+ - user.wish_list_items.each do |item|
11
+ .grid__cell.grid__cell--50.grid__cell--25-at-medium.grid__cell--20-at-wide
12
+ .product-summary.product-summary--small{ itemscope: true, itemtype: 'http://schema.org/Product' }
13
+ = render 'workarea/storefront/products/summary', product: item.product
14
+ - else
15
+ %p= t('workarea.storefront.wish_lists.empty.message', state: t('workarea.storefront.wish_lists.empty.states.unpurchased'))
@@ -0,0 +1,125 @@
1
+ - @title = t('workarea.storefront.wish_lists.wish_list_title')
2
+
3
+ - content_for :breadcrumbs do
4
+ %p.breadcrumbs__node-group
5
+ %span.breadcrumbs__node{ itemprop: 'breadcrumb' }
6
+ = link_to t('workarea.storefront.layouts.home'), root_path, rel: 'home'
7
+ %span.breadcrumbs__node{ itemprop: 'breadcrumb' }
8
+ = link_to t('workarea.storefront.users.account'), users_account_path
9
+ %span.breadcrumbs__node{ itemprop: 'breadcrumb' }= t('workarea.storefront.wish_lists.wish_list_title')
10
+
11
+ .wish-lists.view
12
+
13
+ %h1= t('workarea.storefront.wish_lists.wish_list_title')
14
+
15
+ .wish-lists__section.wish-lists__section--settings
16
+ %h2= t('workarea.storefront.wish_lists.privacy')
17
+
18
+ - if @wish_list.shared? || @wish_list.public?
19
+ .wish-lists__public-url
20
+ %p.wish-lists__public-url-name= t('workarea.storefront.wish_lists.wish_list_link')
21
+ %p.wish-lists__public-url-link= link_to wish_list_path(@wish_list.token), wish_list_path(@wish_list.token)
22
+
23
+ = form_tag update_users_wish_list_path, method: 'patch' do
24
+ .button-property-group
25
+ .button-property
26
+ .value= radio_button_tag :privacy, 'public', @wish_list.public?, data: { form_submitting_control: '' }
27
+ = label_tag 'privacy[public]', nil, class: 'button-property__name' do
28
+ %span.button-property__text= t('workarea.storefront.wish_lists.public_privacy')
29
+ .button-property
30
+ .value= radio_button_tag :privacy, 'shared', @wish_list.shared?, data: { form_submitting_control: '' }
31
+ = label_tag 'privacy[shared]', nil, class: 'button-property__name' do
32
+ %span.button-property__text= t('workarea.storefront.wish_lists.shared_privacy')
33
+ .button-property
34
+ .value= radio_button_tag :privacy, 'private', @wish_list.private?, data: { form_submitting_control: '' }
35
+ = label_tag 'privacy[private]', nil, class: 'button-property__name' do
36
+ %span.button-property__text= t('workarea.storefront.wish_lists.private_privacy')
37
+ %p.hidden-if-js-enabled= button_tag t('workarea.storefront.forms.save'), value: 'save_privacy', class: 'button'
38
+
39
+ .wish-lists__section.wish-lists__section--items
40
+
41
+ %h2= t('workarea.storefront.wish_lists.items')
42
+
43
+ .browsing-controls
44
+ = form_tag users_wish_list_path, method: 'get', class: 'browsing-controls__form' do
45
+ %p.browsing-controls__form-item.property
46
+ = label_tag :state, nil, class: 'property__name' do
47
+ %span.property__text= t('workarea.storefront.wish_lists.show')
48
+ %span.value= select_tag :state, options_for_select(@wish_list.state_options, params[:state]), data: { form_submitting_control: '' }
49
+ %p.browsing-controls__form-item.hidden-if-js-enabled= button_tag t('workarea.storefront.forms.go'), class: 'button'
50
+
51
+ - if @wish_list.items.empty?
52
+ %p= @wish_list.empty_text
53
+
54
+ - else
55
+
56
+ %ul.product-list
57
+ - @wish_list.items.each do |item|
58
+ %li.product-list__item
59
+ .product-list__item-cell
60
+ .product-list__summary
61
+ %p.product-list__media= link_to image_tag(product_image_url(item.primary_image, :small_thumb), alt: item.name, class: 'product-list__media-image'), product_url(item.product, sku: item.sku), class: 'product-list__media-link'
62
+ .product-list__info
63
+ %p.product-list__name= link_to item.name, product_path(item.product, sku: item.sku)
64
+ %p.product-list__id= item.sku_name
65
+ %p= item.inventory_status
66
+ .product-list__option-group
67
+ - item.details.each do |name, value|
68
+ %p.product-list__option #{name.titleize}: #{value}
69
+ - item.customizations.each do |name, value|
70
+ %p.product-list__option #{name.titleize}: #{value}
71
+ .product-list__item-cell
72
+ %table.table
73
+ %thead
74
+ %tr
75
+ %th.table__prices= t('workarea.storefront.orders.price')
76
+ %th.table__quantity= t('workarea.storefront.orders.quantity')
77
+ %th.table__prices= t('workarea.storefront.orders.total')
78
+ %tbody
79
+ %tr
80
+ %td.table__prices
81
+ - if item.on_sale?
82
+ %p.table__price
83
+ %span.table__price-label= t('workarea.storefront.orders.price_now')
84
+ %strong.table__price-discount= number_to_currency(item.unit_price, exchange: false)
85
+ %p.table__price
86
+ %span.table__price-label= t('workarea.storefront.orders.price_was')
87
+ %s= number_to_currency(item.original_price, exchange: false)
88
+ - else
89
+ %p.table__price
90
+ %span= number_to_currency(item.unit_price, exchange: false)
91
+ - if item.customized?
92
+ %p.table__price
93
+ %span.table__price-label= t('workarea.storefront.orders.customizations')
94
+ %span= number_to_currency item.customizations_unit_price
95
+ %td.table__quantity
96
+ = form_tag update_item_users_wish_list_path(item), method: 'patch', class: 'inline-form' do
97
+ .inline-form__cell
98
+ .value= number_field_tag :quantity, item.quantity, class: 'text-box text-box--x-small', min: 1, data: { form_submitting_control: '' }, id: nil
99
+ %p.inline-form__cell.hidden-if-js-enabled= button_tag t('workarea.storefront.forms.update'), value: 'change_quantity', class: 'button'
100
+ %td.table__prices
101
+ - if item.total_adjustments.many?
102
+ %p.table__price
103
+ %span.table__price-label= t('workarea.storefront.orders.subtotal')
104
+ %span= number_to_currency item.prediscount_price
105
+ - item.total_adjustments.each do |adjustment|
106
+ %p.table__price
107
+ %span= adjustment.description.titleize
108
+ %span= number_to_currency(adjustment.amount)
109
+ %p.table__price
110
+ %span= number_to_currency(item.total_price, exchange: false)
111
+ .grid.grid--auto.grid--middle
112
+ .grid__cell
113
+ - if item.purchasable?
114
+ = form_tag cart_items_path, data: { dialog_form: { dialogOptions: { closeAll: true, initModules: true } }, analytics: add_to_cart_analytics_data(item.product).to_json } do
115
+ = hidden_field_tag :sku, item.sku, id: nil
116
+ = hidden_field_tag :quantity, item.quantity, id: nil
117
+ - item.customizations.each do |param, value|
118
+ = hidden_field_tag param, value, id: nil
119
+ %p= button_tag t('workarea.storefront.products.add_to_cart'), value: 'add_to_cart', class: 'button'
120
+ - else
121
+ %p.unavailable= t('workarea.storefront.products.unavailable')
122
+ .grid__cell
123
+ = form_tag remove_from_users_wish_list_path, method: 'delete' do
124
+ = hidden_field_tag :sku, item.sku, id: nil
125
+ %p= button_tag t('workarea.storefront.carts.remove'), value: 'remove_item', class: 'text-button'
@@ -0,0 +1,4 @@
1
+ .grid__cell
2
+ .wish-lists__link
3
+ = link_to users_wish_list_path do
4
+ %span= t('layouts.workarea.storefront.wish_lists_link.your_wish_list')
@@ -0,0 +1,32 @@
1
+ - @title = t('workarea.storefront.wish_lists.find_title')
2
+
3
+ .view
4
+
5
+ %h1= t('workarea.storefront.wish_lists.find_title')
6
+ %p= t('workarea.storefront.wish_lists.find_instructions')
7
+
8
+ - if params[:wish_list_query]
9
+ %h2= t('workarea.storefront.wish_lists.results')
10
+
11
+ - unless @wish_lists.present?
12
+ %p= t('workarea.storefront.searches.no_results', terms: params[:wish_list_query])
13
+
14
+ - else
15
+ %ol
16
+ - @wish_lists.each do |wish_list|
17
+ %li= link_to wish_list.name, wish_list_path(wish_list.token)
18
+
19
+ %h2= t('workarea.storefront.searches.search_again')
20
+
21
+ = form_tag wish_lists_path, method: 'get', id: 'find_wish_list_form' do
22
+ .property
23
+ = label_tag 'name_or_email', nil, class: 'property__name' do
24
+ %span.property__text= t('workarea.storefront.wish_lists.name_or_email')
25
+ .value= text_field_tag :wish_list_query, params[:wish_list_query], id: 'name_or_email', class: 'text-box', required: true
26
+ .property
27
+ = label_tag :location, nil, class: 'property__name' do
28
+ %span.property__text= t('workarea.storefront.wish_lists.location')
29
+ %span.property__requirement.property__requirement--optional= t('workarea.storefront.forms.optional')
30
+ .value= text_field_tag :location, params[:location], class: 'text-box'
31
+
32
+ %p= button_tag t('workarea.storefront.searches.search'), value: 'search', class: 'button'
@@ -0,0 +1,97 @@
1
+ - @title = t('workarea.storefront.wish_lists.show_title', name: @wish_list.name)
2
+
3
+ - content_for :breadcrumbs do
4
+ %p.breadcrumbs__node-group
5
+ %span.breadcrumbs__node{ itemprop: 'breadcrumb' }
6
+ = link_to t('workarea.storefront.layouts.home'), root_path, rel: 'home'
7
+ %span.breadcrumbs__node{ itemprop: 'breadcrumb' }
8
+ = link_to t('workarea.storefront.wish_lists.find_title'), wish_lists_path
9
+ %span.breadcrumbs__node{ itemprop: 'breadcrumb' }= t('workarea.storefront.wish_lists.show_title', name: @wish_list.name)
10
+
11
+ .wish-lists.view
12
+
13
+ %h1= t('workarea.storefront.wish_lists.show_title', name: @wish_list.name)
14
+
15
+ .wish-lists__section
16
+
17
+ .browsing-controls
18
+ = form_tag wish_list_path(params[:id]), method: :get, class: 'browsing-controls__form' do
19
+ %p.browsing-controls__form-item.property
20
+ = label_tag :state, nil, class: 'property__name' do
21
+ %span.property__text= t('workarea.storefront.wish_lists.show')
22
+ %span.value= select_tag :state, options_for_select(@wish_list.state_options, params[:state]), data: { form_submitting_control: '' }
23
+ %p.browsing-controls__form-item.hidden-if-js-enabled= button_tag t('workarea.storefront.forms.go'), class: 'button'
24
+
25
+ - if @wish_list.items.empty?
26
+
27
+ %p= @wish_list.empty_text
28
+
29
+ - else
30
+
31
+ %ul.product-list
32
+ - @wish_list.items.each do |item|
33
+ %li.product-list__item
34
+ .product-list__item-cell
35
+ .product-list__summary
36
+ %p.product-list__media= link_to image_tag(product_image_url(item.primary_image, :small_thumb), alt: item.name, class: 'product-list__media-image'), product_url(item.product, sku: item.sku), class: 'product-list__media-link'
37
+ .product-list__info
38
+ %p.product-list__name= link_to item.name, product_path(item.product, sku: item.sku)
39
+ %p.product-list__id= item.sku_name
40
+ %p= item.inventory_status
41
+ - if item.has_options?
42
+ .product-list__option-group
43
+ - item.details.each do |name, value|
44
+ %p.product-list__option #{name.titleize}: #{value}
45
+ - item.customizations.each do |name, value|
46
+ %p.product-list__option #{name.titleize}: #{value}
47
+ = form_tag cart_items_path, class: 'product-list__item-cell', data: { dialog_form: { dialogOptions: { closeAll: true, initModules: true } }, analytics: add_to_cart_analytics_data(item.product).to_json } do
48
+ = hidden_field_tag :product_id, item.product_id, id: nil
49
+ = hidden_field_tag :sku, item.sku, id: nil
50
+ - item.customizations.each do |param, value|
51
+ = hidden_field_tag param, value, id: nil
52
+ %table.table
53
+ %thead
54
+ %tr
55
+ %th.table__prices= t('workarea.storefront.orders.price')
56
+ %th.table__quantity= t('workarea.storefront.wish_lists.requested')
57
+ %th.table__quantity= t('workarea.storefront.wish_lists.received')
58
+ %th.table__quantity= t('workarea.storefront.orders.quantity')
59
+ %th.table__prices= t('workarea.storefront.orders.total')
60
+ %tbody
61
+ %tr
62
+ %td.table__prices
63
+ - if item.on_sale?
64
+ %p.table__price
65
+ %span.table__price-label= t('workarea.storefront.orders.price_now')
66
+ %strong.table__price-discount.wish-lists__public-item-price= number_to_currency(item.unit_price, exchange: false)
67
+ %p.table__price
68
+ %span.table__price-label= t('workarea.storefront.orders.price_was')
69
+ %s= number_to_currency(item.original_price, exchange: false)
70
+ - else
71
+ %p.table__price
72
+ %span.wish-lists__public-item-price= number_to_currency(item.unit_price, exchange: false)
73
+ - if item.customized?
74
+ %p.table__price
75
+ %span.table__price-label= t('workarea.storefront.orders.customizations')
76
+ %span= number_to_currency item.customizations_unit_price
77
+ %td.table__quantity= item.quantity
78
+ %td.table__quantity= item.received
79
+ %td.table__quantity
80
+ .value= number_field_tag :quantity, item.quantity, class: 'text-box text-box--x-small wish-lists__public-quantity-field', min: 1, id: nil
81
+ %td.table__prices
82
+ - if item.total_adjustments.many?
83
+ %p.table__price
84
+ %span.table__price-label= t('workarea.storefront.orders.subtotal')
85
+ %span= number_to_currency item.prediscount_price
86
+ - item.total_adjustments.each do |adjustment|
87
+ %p.table__price
88
+ %span= adjustment.description.titleize
89
+ %span= number_to_currency(adjustment.amount)
90
+ %p.table__price
91
+ %span.wish-lists__public-total-price= number_to_currency(item.total_price, exchange: false)
92
+ .grid.grid--auto.grid--middle
93
+ .grid__cell
94
+ - if item.purchasable?
95
+ %p= button_tag t('workarea.storefront.products.add_to_cart'), class: 'button'
96
+ - else
97
+ %p.unavailable= t('workarea.storefront.products.unavailable')
@@ -0,0 +1,18 @@
1
+ module Workarea
2
+ class MarkWishListItemsPurchased
3
+ include Sidekiq::Worker
4
+ include Sidekiq::CallbacksWorker
5
+
6
+ sidekiq_options enqueue_on: { Order => :place }, queue: 'high'
7
+
8
+ def perform(order_id)
9
+ order = Order.find(order_id)
10
+ return if order.user_id.blank?
11
+
12
+ wish_list = Workarea::WishList.for_user(order.user_id)
13
+ order.items.each do |item|
14
+ wish_list.mark_item_purchased(item.sku, item.quantity)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ module Workarea
2
+ class UpdateWishListDetails
3
+ include Sidekiq::Worker
4
+ include Sidekiq::CallbacksWorker
5
+
6
+ sidekiq_options(
7
+ enqueue_on: { User => :save },
8
+ unique: :until_executing
9
+ )
10
+
11
+ def perform(user_id)
12
+ wish_list = Workarea::WishList.for_user(user_id)
13
+ SetWishListDetails.new(wish_list).perform!
14
+ rescue Mongo::Error::OperationFailure => error
15
+ raise error unless error.message =~ /E11000 duplicate key error collection/
16
+ logger.warn "Duplicate key error, WishList with user_id=#{user_id} already exists."
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
6
+ ENGINE_PATH = File.expand_path('../../lib/workarea/wish_lists/engine', __FILE__)
7
+
8
+ # Set up gems listed in the Gemfile.
9
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
10
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
11
+
12
+ require 'action_controller/railtie'
13
+ require 'action_view/railtie'
14
+ require 'action_mailer/railtie'
15
+ require 'rails/test_unit/railtie'
16
+ require 'sprockets/railtie'
17
+
18
+ require 'rails/engine/commands'
@@ -0,0 +1,46 @@
1
+ Workarea.append_stylesheets(
2
+ 'storefront.components',
3
+ 'workarea/storefront/wish_lists/components/wish_list_button',
4
+ 'workarea/storefront/wish_lists/components/wish_lists'
5
+ )
6
+
7
+ Workarea.append_javascripts(
8
+ 'storefront.templates',
9
+ 'workarea/storefront/wish_lists/templates/hidden_input'
10
+ )
11
+
12
+ Workarea.append_javascripts(
13
+ 'storefront.modules',
14
+ 'workarea/storefront/wish_lists/modules/wish_list_button',
15
+ 'workarea/storefront/wish_lists/modules/wish_list_public_quantity_fields'
16
+ )
17
+
18
+ Workarea.append_partials(
19
+ 'storefront.cart_item_actions',
20
+ 'workarea/storefront/carts/move_to_wish_list'
21
+ )
22
+
23
+ Workarea.append_partials(
24
+ 'storefront.style_guide_product_list',
25
+ 'workarea/storefront/style_guides/wish_lists_product_list_docs'
26
+ )
27
+
28
+ Workarea.append_partials(
29
+ 'storefront.product_details',
30
+ 'workarea/storefront/products/add_to_wish_list'
31
+ )
32
+
33
+ Workarea.append_partials(
34
+ 'storefront.account_section',
35
+ 'workarea/storefront/users/accounts/wish_list_summary'
36
+ )
37
+
38
+ Workarea.append_partials(
39
+ 'storefront.utility_nav',
40
+ 'workarea/storefront/wish_lists/wish_lists_link'
41
+ )
42
+
43
+ Workarea.append_partials(
44
+ 'admin.user_cards',
45
+ 'workarea/admin/users/wish_list_card'
46
+ )
@@ -0,0 +1,10 @@
1
+ Workarea.configure do |config|
2
+ config.seeds << 'Workarea::WishListSeeds'
3
+ config.wish_list_pricing_calculators = Workarea::SwappableList.new(
4
+ %w(
5
+ Workarea::Pricing::Calculators::ItemCalculator
6
+ Workarea::Pricing::Calculators::CustomizationsCalculator
7
+ Workarea::WishList::Pricing::Calculators::TotalsCalculator
8
+ )
9
+ )
10
+ end
@@ -0,0 +1,60 @@
1
+ ---
2
+ en:
3
+ layouts:
4
+ workarea:
5
+ storefront:
6
+ wish_lists_link:
7
+ your_wish_list: Your Wish List
8
+ workarea:
9
+ admin:
10
+ users:
11
+ cards:
12
+ wish_list:
13
+ button: View Full Wish List
14
+ empty: There are currently no unpurchased items on this user's wish list.
15
+ title: Wish List
16
+ wish_list:
17
+ item: Item
18
+ quantity: Quantity
19
+ state: State
20
+ title: Wish list for %{user}
21
+ title_html: Wish list for %{user}
22
+ storefront:
23
+ flash_messages:
24
+ item_moved_to_wish_list: This item has been moved to your wish list
25
+ wish_list_item_added: This item has been added to your wish list
26
+ wish_list_item_not_added: 'This item could not be added to your wish list. %{errors}'
27
+ wish_list_item_removed: This item has been removed from your wish list
28
+ wish_list_item_updated: This item has been updated on your wish list
29
+ wish_list_updated: Your wish list has been updated
30
+ wish_lists:
31
+ add_to_wish_list: Add to Wish List
32
+ empty:
33
+ message: Your wish list has no %{state} items.
34
+ states:
35
+ purchased: purchased
36
+ unpurchased: unpurchased
37
+ find_instructions: 'Find a friend or family member''s wish list:'
38
+ find_title: Find a Wish List
39
+ items: Items
40
+ location: City, State, or Postal Code
41
+ manage: Manage Your Wish List
42
+ move_to_wish_list: Move to Wish List
43
+ name_or_email: Name or Email
44
+ no_results: No wish lists found
45
+ privacy: Privacy
46
+ private_privacy: 'Private: Only you can see this wish list'
47
+ public_privacy: 'Public: Anyone can find this wish list'
48
+ purchased_items: Purchased Items
49
+ received: Received
50
+ requested: Requested
51
+ results: Results
52
+ share: Share
53
+ share_message: My Wish List from %{site}
54
+ shared_privacy: 'Shared: Only people with the link can see this wish list'
55
+ show: Show
56
+ show_title: "%{name}'s Wish List"
57
+ unpurchased_items: Unpurchased Items
58
+ wish_list: Wish List
59
+ wish_list_link: Wish List Link
60
+ wish_list_title: Your Wish List