workarea-registries 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +9 -0
- data/LICENSE +21 -0
- data/README.md +1 -0
- data/Rakefile +58 -0
- data/app/assets/images/workarea/storefront/registries/icons/email.svg +4 -0
- data/app/assets/images/workarea/storefront/registries/icons/link.svg +1 -0
- data/app/assets/javascripts/workarea/storefront/registries/modules/add_to_registry_button.js +49 -0
- data/app/assets/javascripts/workarea/storefront/registries/modules/copy_registry_url_button.js +51 -0
- data/app/assets/javascripts/workarea/storefront/registries/modules/toggle_registry_address.js +58 -0
- data/app/assets/javascripts/workarea/storefront/registries/templates/add_to_registry_button.jst.ejs +3 -0
- data/app/controllers/workarea/admin/registries_controller.rb +28 -0
- data/app/controllers/workarea/storefront/cart_items_controller.decorator +14 -0
- data/app/controllers/workarea/storefront/registries_controller.rb +47 -0
- data/app/controllers/workarea/storefront/users/registries_controller.rb +94 -0
- data/app/controllers/workarea/storefront/users/registry_items_controller.rb +67 -0
- data/app/controllers/workarea/storefront/users/registry_shares_controller.rb +43 -0
- data/app/controllers/workarea/storefront/users/registry_thanks_controller.rb +41 -0
- data/app/helpers/workarea/registries_helper.rb +41 -0
- data/app/mailers/workarea/storefront/registries_mailer.rb +52 -0
- data/app/models/workarea/checkout/steps/addresses.decorator +28 -0
- data/app/models/workarea/order.decorator +7 -0
- data/app/models/workarea/order/item.decorator +11 -0
- data/app/models/workarea/registry.rb +129 -0
- data/app/models/workarea/registry/item.rb +39 -0
- data/app/models/workarea/registry/public_search.rb +23 -0
- data/app/models/workarea/registry/share.rb +46 -0
- data/app/models/workarea/registry/thank.rb +26 -0
- data/app/models/workarea/search/admin/registry.rb +29 -0
- data/app/queries/workarea/search/admin_orders.decorator +7 -0
- data/app/queries/workarea/search/admin_registries.rb +16 -0
- data/app/seeds/workarea/registry_content_seeds.rb +50 -0
- data/app/services/workarea/inventory_adjustment.decorator +43 -0
- data/app/view_models/workarea/admin/registry_view_model.rb +19 -0
- data/app/view_models/workarea/storefront/checkout/addresses_view_model.decorator +17 -0
- data/app/view_models/workarea/storefront/order_item_view_model.decorator +9 -0
- data/app/view_models/workarea/storefront/order_view_model.decorator +8 -0
- data/app/view_models/workarea/storefront/registry_email_view_model.rb +37 -0
- data/app/view_models/workarea/storefront/registry_item_view_model.rb +72 -0
- data/app/view_models/workarea/storefront/registry_share_view_model.rb +6 -0
- data/app/view_models/workarea/storefront/registry_thank_view_model.rb +6 -0
- data/app/view_models/workarea/storefront/registry_view_model.rb +74 -0
- data/app/view_models/workarea/storefront/user_view_model.decorator +12 -0
- data/app/views/workarea/admin/registries/_menu.html.haml +1 -0
- data/app/views/workarea/admin/registries/index.html.haml +70 -0
- data/app/views/workarea/storefront/carts/_registry_details.html.haml +3 -0
- data/app/views/workarea/storefront/checkouts/_registry_address.html.haml +13 -0
- data/app/views/workarea/storefront/checkouts/_registry_address_fields.html.haml +28 -0
- data/app/views/workarea/storefront/checkouts/_registry_details.html.haml +3 -0
- data/app/views/workarea/storefront/products/_add_to_registry_placeholder.html.haml +1 -0
- data/app/views/workarea/storefront/registries/_registries_link.html.haml +4 -0
- data/app/views/workarea/storefront/registries/index.html.haml +39 -0
- data/app/views/workarea/storefront/registries/search.html.haml +35 -0
- data/app/views/workarea/storefront/registries/show.html.haml +63 -0
- data/app/views/workarea/storefront/registries_mailer/creation.html.haml +13 -0
- data/app/views/workarea/storefront/registries_mailer/gift_receipt.html.haml +51 -0
- data/app/views/workarea/storefront/registries_mailer/share.html.haml +21 -0
- data/app/views/workarea/storefront/registries_mailer/thank.html.haml +19 -0
- data/app/views/workarea/storefront/users/_registry_count.json.jbuilder +3 -0
- data/app/views/workarea/storefront/users/accounts/_registries.html.haml +14 -0
- data/app/views/workarea/storefront/users/registries/_form.html.haml +56 -0
- data/app/views/workarea/storefront/users/registries/_radio_list.html.haml +8 -0
- data/app/views/workarea/storefront/users/registries/_summary.html.haml +12 -0
- data/app/views/workarea/storefront/users/registries/edit.html.haml +4 -0
- data/app/views/workarea/storefront/users/registries/index.html.haml +24 -0
- data/app/views/workarea/storefront/users/registries/new.html.haml +4 -0
- data/app/views/workarea/storefront/users/registries/show.html.haml +75 -0
- data/app/views/workarea/storefront/users/registry_items/new.html.haml +10 -0
- data/app/views/workarea/storefront/users/registry_items/templates/_purchased.html.haml +29 -0
- data/app/views/workarea/storefront/users/registry_items/templates/_unpurchased.html.haml +35 -0
- data/app/views/workarea/storefront/users/registry_shares/_share_buttons.html.haml +18 -0
- data/app/views/workarea/storefront/users/registry_shares/new.html.haml +49 -0
- data/app/views/workarea/storefront/users/registry_thanks/new.html.haml +47 -0
- data/app/workers/workarea/send_gift_receipt.rb +15 -0
- data/app/workers/workarea/send_registry_creation_email.rb +12 -0
- data/app/workers/workarea/update_registry_items.rb +24 -0
- data/bin/rails +20 -0
- data/config/initializers/appends.rb +54 -0
- data/config/initializers/fields.rb +19 -0
- data/config/locales/en.yml +133 -0
- data/config/routes.rb +26 -0
- data/lib/workarea/mailer_previews/storefront/registry_mailer_preview.rb +25 -0
- data/lib/workarea/registries.rb +11 -0
- data/lib/workarea/registries/engine.rb +17 -0
- data/lib/workarea/registries/version.rb +5 -0
- data/test/dummy/config/application.rb +27 -0
- data/test/factories/workarea/registry.rb +67 -0
- data/test/integration/workarea/storefront/cart_item_registry_integration_test.rb +104 -0
- data/test/integration/workarea/storefront/checkout_registry_integration_test.rb +156 -0
- data/test/integration/workarea/storefront/registry_privacy_integration_test.rb +48 -0
- data/test/integration/workarea/storefront/user_registries_integration_test.rb +50 -0
- data/test/integration/workarea/storefront/user_registry_items_integration_test.rb +106 -0
- data/test/models/workarea/registry/item_test.rb +22 -0
- data/test/models/workarea/registry/public_search_test.rb +48 -0
- data/test/models/workarea/registry_test.rb +113 -0
- data/test/system/workarea/admin/registry_system_test.rb +20 -0
- data/test/workers/update_registry_items_test.rb +45 -0
- data/workarea-registries.gemspec +20 -0
- metadata +156 -0
@@ -0,0 +1,8 @@
|
|
1
|
+
- registries.each_with_index do |registry, index|
|
2
|
+
= label_tag "registry_id_#{registry.id}" do
|
3
|
+
.box
|
4
|
+
.box__body.grid.grid--auto.grid--middle
|
5
|
+
.grid__cell
|
6
|
+
.value= radio_button_tag 'registry_id', registry.id, index == 0, title: registry.name
|
7
|
+
.grid__cell
|
8
|
+
%strong.text.text--large= registry.name
|
@@ -0,0 +1,12 @@
|
|
1
|
+
.data-card.data-card--row
|
2
|
+
.data-card__cell
|
3
|
+
%p.data-card__line
|
4
|
+
%strong= registry.id
|
5
|
+
%p.data-card__line
|
6
|
+
%strong= registry.name
|
7
|
+
- if registry.description.present?
|
8
|
+
%p.data-card__line
|
9
|
+
= registry.description
|
10
|
+
.data-card__cell
|
11
|
+
.grid.grid--auto
|
12
|
+
%p.grid__cell= link_to t('workarea.storefront.registries.view'), users_registry_path(registry), class: 'button button--small'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
- @title = t('workarea.storefront.registries.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.registries.title')
|
10
|
+
|
11
|
+
.view
|
12
|
+
.grid.grid--auto.grid--middle
|
13
|
+
.grid__cell
|
14
|
+
%h1= t('workarea.storefront.registries.your_registries')
|
15
|
+
.grid__cell
|
16
|
+
= link_to t('workarea.storefront.registries.create'), new_users_registry_path, class: 'button button--small'
|
17
|
+
|
18
|
+
- if @registries.blank?
|
19
|
+
%span.heading.heading--5= t('workarea.storefront.registries.none')
|
20
|
+
- else
|
21
|
+
.grid
|
22
|
+
- @registries.each do |registry|
|
23
|
+
.grid__cell.grid__cell--50-at-medium
|
24
|
+
= render 'workarea/storefront/users/registries/summary', registry: registry
|
@@ -0,0 +1,75 @@
|
|
1
|
+
- @title = @registry.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.users.account'), users_account_path
|
9
|
+
%span.breadcrumbs__node{ itemprop: 'breadcrumb' }
|
10
|
+
= link_to t('workarea.storefront.registries.title'), users_registries_path
|
11
|
+
%span.breadcrumbs__node{ itemprop: 'breadcrumb' }= @registry.name
|
12
|
+
|
13
|
+
.view
|
14
|
+
.grid.grid--auto.grid--middle
|
15
|
+
.grid__cell
|
16
|
+
%h1.heading.heading--1= @registry.name
|
17
|
+
.grid__cell
|
18
|
+
%p= link_to t('workarea.storefront.registries.edit'), edit_users_registry_path(@registry), data: { dialog_button: '' }, class: 'text-button'
|
19
|
+
|
20
|
+
.box
|
21
|
+
.box__body
|
22
|
+
.grid
|
23
|
+
.grid__cell.grid__cell--33-at-medium
|
24
|
+
%h3= t('workarea.storefront.registries.share')
|
25
|
+
|
26
|
+
= render 'workarea/storefront/users/registry_shares/share_buttons', registry_id: @registry.id, share_url: share_registry_url(@registry), registry_name: @registry.name
|
27
|
+
|
28
|
+
.grid__cell.grid__cell--33-at-medium
|
29
|
+
%h3= t('workarea.storefront.registries.event_date')
|
30
|
+
- if @registry.event_date?
|
31
|
+
= local_time(@registry.event_date, '%B %e, %Y')
|
32
|
+
- else
|
33
|
+
= t('workarea.storefront.registries.no_event_date')
|
34
|
+
|
35
|
+
.grid__cell.grid__cell--33-at-medium
|
36
|
+
%h3= t('workarea.storefront.registries.shipping_address')
|
37
|
+
|
38
|
+
= @registry.address.first_name
|
39
|
+
= @registry.address.last_name
|
40
|
+
- if @registry.address.company.present?
|
41
|
+
%br
|
42
|
+
= @registry.address.company
|
43
|
+
%br
|
44
|
+
= @registry.address.street
|
45
|
+
- if @registry.address.street_2.present?
|
46
|
+
%br
|
47
|
+
= @registry.address.street_2
|
48
|
+
%br
|
49
|
+
= @registry.address.city
|
50
|
+
= @registry.address.region
|
51
|
+
= @registry.address.postal_code
|
52
|
+
%br
|
53
|
+
= @registry.address.country
|
54
|
+
%br
|
55
|
+
= number_to_phone @registry.address.phone_number, extension: @registry.address.phone_extension
|
56
|
+
|
57
|
+
%h2= t('workarea.storefront.registries.items')
|
58
|
+
|
59
|
+
.browsing-controls
|
60
|
+
= form_tag users_registry_path, method: 'get', class: 'browsing-controls__form' do
|
61
|
+
%p.browsing-controls__form-item.property
|
62
|
+
= label_tag :state, nil, class: 'property__name' do
|
63
|
+
%span.property__text= t('workarea.storefront.registries.filter')
|
64
|
+
%span.value= select_tag :state, options_for_select(@registry.state_options, params[:state]), data: { form_submitting_control: '' }
|
65
|
+
%p.browsing-controls__form-item.hidden-if-js-enabled= button_tag t('workarea.storefront.forms.go'), class: 'button'
|
66
|
+
|
67
|
+
.grid
|
68
|
+
.grid__cell
|
69
|
+
.section
|
70
|
+
- if @registry.items.any?
|
71
|
+
%ul.product-list
|
72
|
+
- @registry.items.each_with_index do |item, index|
|
73
|
+
= render "workarea/storefront/users/registry_items/templates/#{item.template}", item: item, index: index
|
74
|
+
- else
|
75
|
+
%h3= t('workarea.storefront.registries.issues.no_items')
|
@@ -0,0 +1,10 @@
|
|
1
|
+
= form_tag users_registry_items_path, method: :post, id: 'add_to_registry_form' do
|
2
|
+
= hidden_field_tag 'product_id', @product.id, id: nil
|
3
|
+
= hidden_field_tag 'sku', @product.current_sku, id: nil
|
4
|
+
= hidden_field_tag 'quantity', params[:quantity], id: nil
|
5
|
+
|
6
|
+
%h2= t('workarea.storefront.registry_items.add_to')
|
7
|
+
|
8
|
+
= render 'workarea/storefront/users/registries/radio_list', registries: @registries
|
9
|
+
|
10
|
+
= button_tag t('workarea.storefront.registry_items.add'), class: 'button'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
%li.product-list__item
|
2
|
+
.product-list__item-cell
|
3
|
+
.product-list__summary
|
4
|
+
%p.product-list__media= link_to image_tag(product_image_url(item.primary_image, :small_thumb), alt: item.product_name, class: 'product-list__media-image'), product_url(item.product, sku: item.sku), class: 'product-list__media-link'
|
5
|
+
.product-list__info
|
6
|
+
%p.product-list__name= link_to item.product_name, product_path(item.product, sku: item.sku)
|
7
|
+
%p.product-list__id= item.sku_name
|
8
|
+
%p.product-list__inventory-status= item.inventory_status
|
9
|
+
- if item.has_options?
|
10
|
+
.product-list__option-group
|
11
|
+
- item.details.each do |name, value|
|
12
|
+
%p.product-list__option #{name.titleize}: #{value}
|
13
|
+
|
14
|
+
.product-list__item-cell
|
15
|
+
%table.table
|
16
|
+
%thead
|
17
|
+
%tr
|
18
|
+
%th.table__quantity= t('workarea.storefront.registry.item.quantity')
|
19
|
+
%th.table__purchased_by= t('workarea.storefront.registry.item.purchased_by')
|
20
|
+
%th.table__thank_you= t('workarea.storefront.registry.item.thank_you')
|
21
|
+
%tbody
|
22
|
+
%tr
|
23
|
+
%td.table__quantity
|
24
|
+
= item.quantity
|
25
|
+
%td.table__purchased_by
|
26
|
+
= item.purchased_by
|
27
|
+
%td.table__thank_you
|
28
|
+
= link_to new_users_registry_thank_path(registry_id: item.registry.id, to_email: item.purchased_by), class: 'thank-you__button', rel: 'nofollow', title: t('workarea.storefront.registry.item.thank_you'), data: { dialog_button: '' } do
|
29
|
+
= inline_svg('workarea/storefront/registries/icons/email.svg', class: 'svg-icon svg-icon--blue')
|
@@ -0,0 +1,35 @@
|
|
1
|
+
%li.product-list__item
|
2
|
+
.product-list__item-cell
|
3
|
+
.product-list__summary
|
4
|
+
%p.product-list__media= link_to image_tag(product_image_url(item.primary_image, :small_thumb), alt: item.product_name, class: 'product-list__media-image'), product_url(item.product, sku: item.sku), class: 'product-list__media-link'
|
5
|
+
.product-list__info
|
6
|
+
%p.product-list__name= link_to item.product_name, product_path(item.product, sku: item.sku)
|
7
|
+
%p.product-list__id= item.sku_name
|
8
|
+
%p.product-list__inventory-status= item.inventory_status
|
9
|
+
- if item.has_options?
|
10
|
+
.product-list__option-group
|
11
|
+
- item.details.each do |name, value|
|
12
|
+
%p.product-list__option #{name.titleize}: #{value}
|
13
|
+
|
14
|
+
.grid.grid--auto
|
15
|
+
.grid__cell
|
16
|
+
- unless item.received?
|
17
|
+
= form_tag users_registry_item_path(@registry, item), method: 'delete', class: 'action-group__item', data: { deletion_form: { message: t('workarea.storefront.registry.item.deletion_confirm') }.to_json } do
|
18
|
+
%p= button_tag t('workarea.storefront.carts.remove'), value: 'remove_item', class: 'text-button', id: "remove_item_#{index}"
|
19
|
+
|
20
|
+
.product-list__item-cell
|
21
|
+
%table.table
|
22
|
+
%thead
|
23
|
+
%tr
|
24
|
+
%th.table__prices= t('workarea.storefront.orders.price')
|
25
|
+
%th.table__quantity= t('workarea.storefront.orders.quantity')
|
26
|
+
%tbody
|
27
|
+
%tr
|
28
|
+
%td.table__prices
|
29
|
+
= render 'workarea/storefront/carts/pricing', item: item, css_block: 'table'
|
30
|
+
%td.table__quantity
|
31
|
+
= form_tag users_registry_item_path(@registry, item), method: :patch, class: 'inline-form' do
|
32
|
+
.inline-form__cell
|
33
|
+
.value= number_field_tag :quantity, item.quantity, min: minimum_quantity(item.received), required: true, class: 'text-box text-box--x-small', data: { form_submitting_control: '' }, title: t('workarea.storefront.orders.quantity'), id: "quantity_#{index}", aria: { label: t('workarea.storefront.orders.quantity') }
|
34
|
+
%p= t('workarea.storefront.registries.quantity_purchased', quantity: item.received)
|
35
|
+
%p.inline-form__cell.hidden-if-js-enabled= button_tag t('workarea.storefront.carts.update'), value: 'change_quantity', class: 'button'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
- if share_url.present?
|
2
|
+
%ul.share-buttons
|
3
|
+
%li.share-buttons__item
|
4
|
+
= link_to "https://www.facebook.com/sharer/sharer.php?#{facebook_query_string(share_url)}", class: 'share-buttons__button', title: t('workarea.storefront.shares.share_on_facebook'), target: '_blank', data: { popup_button: '', analytics: share_analytics_data('facebook', share_url).to_json } do
|
5
|
+
= inline_svg('workarea/storefront/icons/facebook.svg', class: 'svg-icon svg-icon--blue')
|
6
|
+
%li.share-buttons__item
|
7
|
+
= link_to "https://twitter.com/intent/tweet?#{twitter_query_string(share_url, registry_name)}", class: 'share-buttons__button', title: t('workarea.storefront.shares.share_on_twitter'), target: '_blank', data: { popup_button: '', analytics: share_analytics_data('twitter', share_url).to_json } do
|
8
|
+
= inline_svg('workarea/storefront/icons/twitter.svg', class: 'svg-icon svg-icon--blue')
|
9
|
+
%li.share-buttons__item
|
10
|
+
= link_to "https://pinterest.com/pin/create/button/?#{share_query_string(share_url, registry_name, local_assigns[:image])}", class: 'share-buttons__button', title: t('workarea.storefront.shares.share_on_pinterest'), target: '_blank', data: { popup_button: '', analytics: share_analytics_data('pinterest', share_url).to_json } do
|
11
|
+
= inline_svg('workarea/storefront/icons/pinterest.svg', class: 'svg-icon svg-icon--blue')
|
12
|
+
- if registry_name.present?
|
13
|
+
%li.share-buttons__item
|
14
|
+
= link_to new_users_registry_share_path(registry_id: registry_id, url: share_url, registry_name: registry_name), class: 'share-buttons__button', rel: 'nofollow', title: t('workarea.storefront.registry.share.share_title'), data: { dialog_button: '', analytics: share_analytics_data('email', share_url).to_json } do
|
15
|
+
= inline_svg('workarea/storefront/registries/icons/email.svg', class: 'svg-icon svg-icon--blue')
|
16
|
+
%li.share-buttons__item
|
17
|
+
= link_to '#', class: 'share-buttons__button', title: t('workarea.storefront.registry.share.copy_link'), target: '_blank', data: { copy_registry_url_button: '', registry_url: "#{share_url}", analytics: share_analytics_data('url_copy', share_url).to_json } do
|
18
|
+
= inline_svg('workarea/storefront/registries/icons/link.svg', class: 'svg-icon svg-icon--blue')
|
@@ -0,0 +1,49 @@
|
|
1
|
+
- @title = t('workarea.storefront.registry.share.share_title')
|
2
|
+
|
3
|
+
.view
|
4
|
+
%h1= t('workarea.storefront.registry.share.share_title')
|
5
|
+
- if @registry_share.errors.any?
|
6
|
+
- @registry_share.errors.full_messages.each do |message|
|
7
|
+
= render_message 'error', message, data: { analytics: validation_error_analytics_data('registry_share').to_json }
|
8
|
+
|
9
|
+
= form_tag users_registry_shares_path, method: 'post', id: 'registry_email_friend_form' do
|
10
|
+
= hidden_field_tag 'registry_name', @registry_share.registry_name
|
11
|
+
= hidden_field_tag 'url', @registry_share.url
|
12
|
+
= hidden_field_tag 'registry_id', @registry_share.registry_id
|
13
|
+
|
14
|
+
%fieldset
|
15
|
+
%legend
|
16
|
+
%span.heading.heading--2= t('workarea.storefront.registry.share.from')
|
17
|
+
.property-group
|
18
|
+
.property
|
19
|
+
= label_tag 'from_name', nil, class: 'property__name' do
|
20
|
+
%span.property__text= t('workarea.storefront.registry.share.name')
|
21
|
+
%span.property__requirement.property__requirement--optional= t('workarea.storefront.forms.optional')
|
22
|
+
.value= text_field_tag 'from_name', @registry_share.from_name, class: 'text-box', placeholder: t('workarea.storefront.registry.share.from_name_placeholder')
|
23
|
+
.property
|
24
|
+
= label_tag 'from_email', nil, class: 'property__name' do
|
25
|
+
%span.property__text= t('workarea.storefront.registry.share.email')
|
26
|
+
.value= email_field_tag 'from_email', @registry_share.from_email, class: 'text-box', required: true, autocapitalize: 'off', autocorrect: 'off', placeholder: t('workarea.storefront.registry.share.from_email_placeholder')
|
27
|
+
|
28
|
+
%fieldset
|
29
|
+
%legend
|
30
|
+
%span.heading.heading--2= t('workarea.storefront.registry.share.to')
|
31
|
+
.property-group
|
32
|
+
.property
|
33
|
+
= label_tag 'to_name', nil, class: 'property__name' do
|
34
|
+
%span.property__text= t('workarea.storefront.registry.share.name')
|
35
|
+
%span.property__requirement.property__requirement--optional= t('workarea.storefront.forms.optional')
|
36
|
+
.value= text_field_tag 'to_name', @registry_share.to_name, class: 'text-box', placeholder: t('workarea.storefront.registry.share.to_name_placeholder')
|
37
|
+
.property
|
38
|
+
= label_tag 'to_email', nil, class: 'property__name' do
|
39
|
+
%span.property__text= t('workarea.storefront.registry.share.email')
|
40
|
+
.value= email_field_tag 'to_email', @registry_share.to_email, class: 'text-box', required: true, autocapitalize: 'off', autocorrect: 'off', placeholder: t('workarea.storefront.registry.share.to_email_placeholder')
|
41
|
+
.property
|
42
|
+
= label_tag 'message', nil, class: 'property__name' do
|
43
|
+
%span.property__text= t('workarea.storefront.registry.share.message')
|
44
|
+
%span.property__requirement.property__requirement--optional= t('workarea.storefront.forms.optional')
|
45
|
+
.value= text_area_tag 'message', @registry_share.message, class: 'text-box text-box--multi-line text-box--wide', placeholder: t('workarea.storefront.registry.share.message_placeholder'), maxlength: Workarea.config.max_email_registry_share_message_length
|
46
|
+
|
47
|
+
.grid.grid--auto
|
48
|
+
%p.grid__cell= button_tag t('workarea.storefront.forms.send'), value: 'email_friend', class: 'button'
|
49
|
+
%p.grid__cell= link_to t('workarea.storefront.forms.cancel'), @registry_share.url, class: 'text-button', data: { dialog_close_button: '' }
|
@@ -0,0 +1,47 @@
|
|
1
|
+
- @title = t('workarea.storefront.registry.thank.thank_you_email')
|
2
|
+
|
3
|
+
.view
|
4
|
+
%h1= t('workarea.storefront.registry.thank.thank_you_email')
|
5
|
+
- if @registry_thank.errors.any?
|
6
|
+
- @registry_thank.errors.full_messages.each do |message|
|
7
|
+
= render_message 'error', message, data: { analytics: validation_error_analytics_data('registry_thank').to_json }
|
8
|
+
|
9
|
+
= form_tag users_registry_thanks_path, method: 'post', id: 'registry_thank_you_form' do
|
10
|
+
= hidden_field_tag 'registry_id', @registry_thank.registry_id
|
11
|
+
|
12
|
+
%fieldset
|
13
|
+
%legend
|
14
|
+
%span.heading.heading--2= t('workarea.storefront.registry.thank.from')
|
15
|
+
.property-group
|
16
|
+
.property
|
17
|
+
= label_tag 'from_name', nil, class: 'property__name' do
|
18
|
+
%span.property__text= t('workarea.storefront.registry.thank.name')
|
19
|
+
%span.property__requirement.property__requirement--optional= t('workarea.storefront.forms.optional')
|
20
|
+
.value= text_field_tag 'from_name', @registry_thank.from_name, class: 'text-box', placeholder: t('workarea.storefront.registry.thank.from_name_placeholder')
|
21
|
+
.property
|
22
|
+
= label_tag 'from_email', nil, class: 'property__name' do
|
23
|
+
%span.property__text= t('workarea.storefront.registry.thank.email')
|
24
|
+
.value= email_field_tag 'from_email', @registry_thank.from_email, class: 'text-box', required: true, autocapitalize: 'off', autocorrect: 'off', placeholder: t('workarea.storefront.registry.thank.from_email_placeholder')
|
25
|
+
|
26
|
+
%fieldset
|
27
|
+
%legend
|
28
|
+
%span.heading.heading--2= t('workarea.storefront.registry.thank.to')
|
29
|
+
.property-group
|
30
|
+
.property
|
31
|
+
= label_tag 'to_name', nil, class: 'property__name' do
|
32
|
+
%span.property__text= t('workarea.storefront.registry.thank.name')
|
33
|
+
%span.property__requirement.property__requirement--optional= t('workarea.storefront.forms.optional')
|
34
|
+
.value= text_field_tag 'to_name', @registry_thank.to_name, class: 'text-box', placeholder: t('workarea.storefront.registry.thank.to_name_placeholder')
|
35
|
+
.property
|
36
|
+
= label_tag 'to_email', nil, class: 'property__name' do
|
37
|
+
%span.property__text= t('workarea.storefront.registry.thank.email')
|
38
|
+
.value= email_field_tag 'to_email', @registry_thank.to_email, class: 'text-box', required: true, autocapitalize: 'off', autocorrect: 'off', placeholder: t('workarea.storefront.registry.thank.to_email_placeholder')
|
39
|
+
.property
|
40
|
+
= label_tag 'message', nil, class: 'property__name' do
|
41
|
+
%span.property__text= t('workarea.storefront.registry.thank.message')
|
42
|
+
%span.property__requirement.property__requirement--optional= t('workarea.storefront.forms.optional')
|
43
|
+
.value= text_area_tag 'message', @registry_thank.message, class: 'text-box text-box--multi-line text-box--wide', placeholder: t('workarea.storefront.registry.thank.message_placeholder'), maxlength: Workarea.config.max_email_registry_thanks_message_length
|
44
|
+
|
45
|
+
.grid.grid--auto
|
46
|
+
%p.grid__cell= button_tag t('workarea.storefront.forms.send'), value: 'email_friend', class: 'button'
|
47
|
+
%p.grid__cell= link_to t('workarea.storefront.forms.cancel'), users_registry_path(@registry_thank.registry_id), class: 'text-button', data: { dialog_close_button: '' }
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Workarea
|
2
|
+
class SendGiftReceipt
|
3
|
+
include Sidekiq::Worker
|
4
|
+
include Sidekiq::CallbacksWorker
|
5
|
+
|
6
|
+
sidekiq_options queue: 'high', enqueue_on: { Order => :place }
|
7
|
+
|
8
|
+
def perform(order_id)
|
9
|
+
order = Order.find(order_id)
|
10
|
+
if order.ship_to_registrant?
|
11
|
+
Storefront::RegistriesMailer.gift_receipt(order_id).deliver_later
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Workarea
|
2
|
+
class SendRegistryCreationEmail
|
3
|
+
include Sidekiq::Worker
|
4
|
+
include Sidekiq::CallbacksWorker
|
5
|
+
|
6
|
+
sidekiq_options queue: 'high', enqueue_on: { Registry => :create }
|
7
|
+
|
8
|
+
def perform(registry_id)
|
9
|
+
Storefront::RegistriesMailer.creation(registry_id).deliver_later
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Workarea
|
2
|
+
class UpdateRegistryItems
|
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
|
+
|
11
|
+
order.items.each do |item|
|
12
|
+
next unless item.registry_id.present?
|
13
|
+
registry = Workarea::Registry.find(item.registry_id)
|
14
|
+
registry.mark_item_received(item)
|
15
|
+
registry.add_purchased_item({
|
16
|
+
sku: item.sku,
|
17
|
+
product_id: item.product_id,
|
18
|
+
quantity: item.quantity,
|
19
|
+
purchased_by: order.email
|
20
|
+
})
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/bin/rails
ADDED
@@ -0,0 +1,20 @@
|
|
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/registries/engine', __FILE__)
|
7
|
+
APP_PATH = File.expand_path('../../test/dummy/config/application', __FILE__)
|
8
|
+
|
9
|
+
# Set up gems listed in the Gemfile.
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
11
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
12
|
+
|
13
|
+
require 'action_controller/railtie'
|
14
|
+
require 'action_view/railtie'
|
15
|
+
require 'action_mailer/railtie'
|
16
|
+
require 'rails/test_unit/railtie'
|
17
|
+
require 'sprockets/railtie'
|
18
|
+
require 'teaspoon-mocha'
|
19
|
+
|
20
|
+
require 'rails/engine/commands'
|
@@ -0,0 +1,54 @@
|
|
1
|
+
Workarea.append_partials(
|
2
|
+
'admin.orders_menu',
|
3
|
+
'workarea/admin/registries/menu'
|
4
|
+
)
|
5
|
+
|
6
|
+
Workarea.append_partials(
|
7
|
+
'storefront.utility_nav',
|
8
|
+
'workarea/storefront/registries/registries_link'
|
9
|
+
)
|
10
|
+
|
11
|
+
Workarea.append_partials(
|
12
|
+
'storefront.cart_item_details',
|
13
|
+
'workarea/storefront/carts/registry_details'
|
14
|
+
)
|
15
|
+
|
16
|
+
Workarea.append_partials(
|
17
|
+
'storefront.checkout_cart_summary_item_details',
|
18
|
+
'workarea/storefront/checkouts/registry_details'
|
19
|
+
)
|
20
|
+
|
21
|
+
Workarea.append_partials(
|
22
|
+
'storefront.account_section_left',
|
23
|
+
'workarea/storefront/users/accounts/registries'
|
24
|
+
)
|
25
|
+
|
26
|
+
Workarea.append_partials(
|
27
|
+
'storefront.product_details',
|
28
|
+
'workarea/storefront/products/add_to_registry_placeholder'
|
29
|
+
)
|
30
|
+
|
31
|
+
Workarea.append_partials(
|
32
|
+
'storefront.checkout_shipping_address_top',
|
33
|
+
'workarea/storefront/checkouts/registry_address'
|
34
|
+
)
|
35
|
+
|
36
|
+
Workarea.append_javascripts(
|
37
|
+
'storefront.modules',
|
38
|
+
'workarea/storefront/registries/modules/copy_registry_url_button'
|
39
|
+
)
|
40
|
+
|
41
|
+
Workarea.append_javascripts(
|
42
|
+
'storefront.modules',
|
43
|
+
'workarea/storefront/registries/modules/add_to_registry_button'
|
44
|
+
)
|
45
|
+
|
46
|
+
Workarea.append_javascripts(
|
47
|
+
'storefront.modules',
|
48
|
+
'workarea/storefront/registries/modules/toggle_registry_address'
|
49
|
+
)
|
50
|
+
|
51
|
+
Workarea.append_javascripts(
|
52
|
+
'storefront.templates',
|
53
|
+
'workarea/storefront/registries/templates/add_to_registry_button'
|
54
|
+
)
|