workarea-registries 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/Gemfile +9 -0
  4. data/LICENSE +21 -0
  5. data/README.md +1 -0
  6. data/Rakefile +58 -0
  7. data/app/assets/images/workarea/storefront/registries/icons/email.svg +4 -0
  8. data/app/assets/images/workarea/storefront/registries/icons/link.svg +1 -0
  9. data/app/assets/javascripts/workarea/storefront/registries/modules/add_to_registry_button.js +49 -0
  10. data/app/assets/javascripts/workarea/storefront/registries/modules/copy_registry_url_button.js +51 -0
  11. data/app/assets/javascripts/workarea/storefront/registries/modules/toggle_registry_address.js +58 -0
  12. data/app/assets/javascripts/workarea/storefront/registries/templates/add_to_registry_button.jst.ejs +3 -0
  13. data/app/controllers/workarea/admin/registries_controller.rb +28 -0
  14. data/app/controllers/workarea/storefront/cart_items_controller.decorator +14 -0
  15. data/app/controllers/workarea/storefront/registries_controller.rb +47 -0
  16. data/app/controllers/workarea/storefront/users/registries_controller.rb +94 -0
  17. data/app/controllers/workarea/storefront/users/registry_items_controller.rb +67 -0
  18. data/app/controllers/workarea/storefront/users/registry_shares_controller.rb +43 -0
  19. data/app/controllers/workarea/storefront/users/registry_thanks_controller.rb +41 -0
  20. data/app/helpers/workarea/registries_helper.rb +41 -0
  21. data/app/mailers/workarea/storefront/registries_mailer.rb +52 -0
  22. data/app/models/workarea/checkout/steps/addresses.decorator +28 -0
  23. data/app/models/workarea/order.decorator +7 -0
  24. data/app/models/workarea/order/item.decorator +11 -0
  25. data/app/models/workarea/registry.rb +129 -0
  26. data/app/models/workarea/registry/item.rb +39 -0
  27. data/app/models/workarea/registry/public_search.rb +23 -0
  28. data/app/models/workarea/registry/share.rb +46 -0
  29. data/app/models/workarea/registry/thank.rb +26 -0
  30. data/app/models/workarea/search/admin/registry.rb +29 -0
  31. data/app/queries/workarea/search/admin_orders.decorator +7 -0
  32. data/app/queries/workarea/search/admin_registries.rb +16 -0
  33. data/app/seeds/workarea/registry_content_seeds.rb +50 -0
  34. data/app/services/workarea/inventory_adjustment.decorator +43 -0
  35. data/app/view_models/workarea/admin/registry_view_model.rb +19 -0
  36. data/app/view_models/workarea/storefront/checkout/addresses_view_model.decorator +17 -0
  37. data/app/view_models/workarea/storefront/order_item_view_model.decorator +9 -0
  38. data/app/view_models/workarea/storefront/order_view_model.decorator +8 -0
  39. data/app/view_models/workarea/storefront/registry_email_view_model.rb +37 -0
  40. data/app/view_models/workarea/storefront/registry_item_view_model.rb +72 -0
  41. data/app/view_models/workarea/storefront/registry_share_view_model.rb +6 -0
  42. data/app/view_models/workarea/storefront/registry_thank_view_model.rb +6 -0
  43. data/app/view_models/workarea/storefront/registry_view_model.rb +74 -0
  44. data/app/view_models/workarea/storefront/user_view_model.decorator +12 -0
  45. data/app/views/workarea/admin/registries/_menu.html.haml +1 -0
  46. data/app/views/workarea/admin/registries/index.html.haml +70 -0
  47. data/app/views/workarea/storefront/carts/_registry_details.html.haml +3 -0
  48. data/app/views/workarea/storefront/checkouts/_registry_address.html.haml +13 -0
  49. data/app/views/workarea/storefront/checkouts/_registry_address_fields.html.haml +28 -0
  50. data/app/views/workarea/storefront/checkouts/_registry_details.html.haml +3 -0
  51. data/app/views/workarea/storefront/products/_add_to_registry_placeholder.html.haml +1 -0
  52. data/app/views/workarea/storefront/registries/_registries_link.html.haml +4 -0
  53. data/app/views/workarea/storefront/registries/index.html.haml +39 -0
  54. data/app/views/workarea/storefront/registries/search.html.haml +35 -0
  55. data/app/views/workarea/storefront/registries/show.html.haml +63 -0
  56. data/app/views/workarea/storefront/registries_mailer/creation.html.haml +13 -0
  57. data/app/views/workarea/storefront/registries_mailer/gift_receipt.html.haml +51 -0
  58. data/app/views/workarea/storefront/registries_mailer/share.html.haml +21 -0
  59. data/app/views/workarea/storefront/registries_mailer/thank.html.haml +19 -0
  60. data/app/views/workarea/storefront/users/_registry_count.json.jbuilder +3 -0
  61. data/app/views/workarea/storefront/users/accounts/_registries.html.haml +14 -0
  62. data/app/views/workarea/storefront/users/registries/_form.html.haml +56 -0
  63. data/app/views/workarea/storefront/users/registries/_radio_list.html.haml +8 -0
  64. data/app/views/workarea/storefront/users/registries/_summary.html.haml +12 -0
  65. data/app/views/workarea/storefront/users/registries/edit.html.haml +4 -0
  66. data/app/views/workarea/storefront/users/registries/index.html.haml +24 -0
  67. data/app/views/workarea/storefront/users/registries/new.html.haml +4 -0
  68. data/app/views/workarea/storefront/users/registries/show.html.haml +75 -0
  69. data/app/views/workarea/storefront/users/registry_items/new.html.haml +10 -0
  70. data/app/views/workarea/storefront/users/registry_items/templates/_purchased.html.haml +29 -0
  71. data/app/views/workarea/storefront/users/registry_items/templates/_unpurchased.html.haml +35 -0
  72. data/app/views/workarea/storefront/users/registry_shares/_share_buttons.html.haml +18 -0
  73. data/app/views/workarea/storefront/users/registry_shares/new.html.haml +49 -0
  74. data/app/views/workarea/storefront/users/registry_thanks/new.html.haml +47 -0
  75. data/app/workers/workarea/send_gift_receipt.rb +15 -0
  76. data/app/workers/workarea/send_registry_creation_email.rb +12 -0
  77. data/app/workers/workarea/update_registry_items.rb +24 -0
  78. data/bin/rails +20 -0
  79. data/config/initializers/appends.rb +54 -0
  80. data/config/initializers/fields.rb +19 -0
  81. data/config/locales/en.yml +133 -0
  82. data/config/routes.rb +26 -0
  83. data/lib/workarea/mailer_previews/storefront/registry_mailer_preview.rb +25 -0
  84. data/lib/workarea/registries.rb +11 -0
  85. data/lib/workarea/registries/engine.rb +17 -0
  86. data/lib/workarea/registries/version.rb +5 -0
  87. data/test/dummy/config/application.rb +27 -0
  88. data/test/factories/workarea/registry.rb +67 -0
  89. data/test/integration/workarea/storefront/cart_item_registry_integration_test.rb +104 -0
  90. data/test/integration/workarea/storefront/checkout_registry_integration_test.rb +156 -0
  91. data/test/integration/workarea/storefront/registry_privacy_integration_test.rb +48 -0
  92. data/test/integration/workarea/storefront/user_registries_integration_test.rb +50 -0
  93. data/test/integration/workarea/storefront/user_registry_items_integration_test.rb +106 -0
  94. data/test/models/workarea/registry/item_test.rb +22 -0
  95. data/test/models/workarea/registry/public_search_test.rb +48 -0
  96. data/test/models/workarea/registry_test.rb +113 -0
  97. data/test/system/workarea/admin/registry_system_test.rb +20 -0
  98. data/test/workers/update_registry_items_test.rb +45 -0
  99. data/workarea-registries.gemspec +20 -0
  100. metadata +156 -0
@@ -0,0 +1,12 @@
1
+ module Workarea
2
+ decorate Storefront::UserViewModel, with: :registries do
3
+ def registries
4
+ @registries ||= Storefront::RegistryViewModel.wrap(
5
+ Registry.for_user(model.id).by_activity,
6
+ options.merge(
7
+ user: self
8
+ )
9
+ )
10
+ end
11
+ end
12
+ end
@@ -0,0 +1 @@
1
+ %li{ class: "primary-nav__item" }= link_to t('workarea.admin.shared.primary_nav.registries'), registries_path, class: navigation_link_classes(registries_path)
@@ -0,0 +1,70 @@
1
+ - @page_title = t('workarea.admin.registries.index.page_title')
2
+
3
+ .view
4
+ .view__header
5
+ .grid.grid--middle.grid--center
6
+ .grid__cell.grid__cell--50
7
+ .view__heading
8
+ = link_to "↑ #{t('workarea.admin.registries.index.dashboard_link')}", orders_dashboards_path, class: 'view__dashboard-button'
9
+ %h1.heading--no-margin= t('workarea.admin.registries.index.title')
10
+
11
+ .view__container
12
+ .browsing-controls.browsing-controls--with-divider.browsing-controls--center{ class: ('browsing-controls--filters-displayed' unless @search.toggle_facets?) }
13
+ = form_tag registries_path, method: 'get', id: 'page_search_form', class: 'browsing-controls__form' do
14
+ = facet_hidden_inputs(@search.facets)
15
+ .browsing-controls__sort
16
+ .property.property--inline
17
+ = label_tag 'sort', t('workarea.admin.search.sort_by'), class: 'property__name'
18
+ = select_tag :sort, options_for_select(@search.sorts, selected: @search.sort), data: { form_submitting_control: '' }
19
+
20
+ .browsing-controls__search
21
+ .search-form
22
+ = text_field_tag :q, params[:q], class: 'search-form__input', id: 'search_products', title: t('workarea.admin.search.keywords'), placeholder: t('workarea.admin.search.keywords')
23
+ = submit_tag 'search_pages', class: 'search-form__button'
24
+
25
+ - if @search.facets.present?
26
+ - @search.facets.each do |facet|
27
+ = render "workarea/admin/facets/#{facet.type}", facet: facet
28
+
29
+ - if @search.toggle_facets?
30
+ .browsing-controls__toggle-filters
31
+ %button.text-button{ type: 'button', data: { toggle_filters: '' } }= t('workarea.admin.search.show_filters')
32
+
33
+ = render 'workarea/admin/facets/applied', search: @search, reset_path: registries_path
34
+
35
+ %p.browsing-controls__count{ data: { browsing_controls_count: @search.total } }
36
+ = t('workarea.admin.registries.pluralize', count: @search.total)
37
+
38
+ - if @search.results.any?
39
+ %table.index-table
40
+ %thead
41
+ %tr
42
+ %th.index-table__control-cell
43
+ .checkbox
44
+ = check_box_tag 'select_all', nil, false, id: 'select_all', class: 'checkbox__input', data: { bulk_action_select_all: '' }
45
+ = label_tag 'select_all', t('workarea.admin.bulk_actions.select_all'), class: 'checkbox__label'
46
+ %th= t('workarea.admin.fields.name')
47
+ %th= t('workarea.admin.fields.user_id')
48
+ %th= t('workarea.admin.fields.items')
49
+ %tbody
50
+ - @search.results.each do |result|
51
+ %tr.index-table__row
52
+ %td.index-table__control-cell
53
+ .checkbox
54
+ = check_box_tag 'global_id', result.to_gid_param, false, class: 'checkbox__input', id: dom_id(result), data: { bulk_action_item: '' }
55
+ = label_tag dom_id(result), '', class: 'checkbox__label', title: t('workarea.admin.bulk_actions.add_summary_button')
56
+ %td= result.name
57
+ %td
58
+ - if result.user.nil?
59
+ = result.user_id
60
+ - else
61
+ = link_to result.user.name, user_path(result.user)
62
+ %td= result.items.size
63
+
64
+ - if @search.results.total_pages > 1
65
+ = render 'workarea/admin/shared/pagination', collection: @search.results
66
+
67
+ .workflow-bar
68
+ .grid
69
+ .grid__cell.grid__cell--50
70
+ = render 'workarea/admin/shared/bulk_actions', klass: Workarea::Registry, search: @search, bulk_delete: false
@@ -0,0 +1,3 @@
1
+ - if item.registry_item?
2
+ .product-list__registry-item
3
+ .product-list__registry-item-heading= item.registry_label
@@ -0,0 +1,13 @@
1
+ - if step.registry_address?
2
+ .checkout-addresses__section.checkout-addresses__fields--registry
3
+ %ul.list-reset.checkout-addresses__registry-address-radio-list{ data: { registry_address_radio_list: '' } }
4
+ %li.checkout-addresses__registry-radio-button{ data: { registry_address_option: { option: 'ship_to_another_address' }.to_json } }
5
+ = radio_button_tag 'ship_to_registrant', false, true, id: 'ship_to_another_address'
6
+ = label_tag 'ship_to_another_address', nil, class: 'button-property__name' do
7
+ %span.button-property__text= t('workarea.storefront.checkouts.ship_to_another_address')
8
+ %li.checkout-addresses__registry-radio-button{ data: { registry_address_option: { option: 'ship_to_registrant' }.to_json } }
9
+ = radio_button_tag 'ship_to_registrant', true, false, id: 'ship_to_registrant'
10
+ = label_tag 'ship_to_registrant', nil, class: 'button-property__name' do
11
+ %span.button-property__text= t('workarea.storefront.checkouts.ship_to_registrant')
12
+
13
+ = render 'workarea/storefront/checkouts/registry_address_fields', address: step.registry_address
@@ -0,0 +1,28 @@
1
+ .checkout-addresses__fields--registry.hidden{ data: { registry_checkout_addresses_fields: '' } }
2
+ = address.first_name
3
+ = address.last_name
4
+ - if address.company.present?
5
+ %br
6
+ = address.company
7
+ %br
8
+ = address.street
9
+ - if address.street_2.present?
10
+ %br
11
+ = address.street_2
12
+ %br
13
+ = address.city
14
+ = address.region
15
+ = address.postal_code
16
+ %br
17
+ = address.country
18
+
19
+ = hidden_field_tag 'registry_shipping_address[first_name]', address.first_name, id: nil
20
+ = hidden_field_tag 'registry_shipping_address[last_name]', address.last_name, id: nil
21
+ = hidden_field_tag 'registry_shipping_address[company]', address.company, id: nil
22
+ = hidden_field_tag 'registry_shipping_address[street]', address.street, id: nil
23
+ = hidden_field_tag 'registry_shipping_address[street_2]', address.street_2, id: nil
24
+ = hidden_field_tag 'registry_shipping_address[city]', address.city, id: nil
25
+ = hidden_field_tag 'registry_shipping_address[country]', address.country, id: nil
26
+ = hidden_field_tag 'registry_shipping_address[region]', address.region, id: nil
27
+ = hidden_field_tag 'registry_shipping_address[postal_code]', address.postal_code, id: nil
28
+ = hidden_field_tag 'registry_shipping_address[phone_number]', address.phone_number, id: nil
@@ -0,0 +1,3 @@
1
+ - if item.registry_item?
2
+ %p.product-list__registry
3
+ = t('workarea.storefront.carts.registry_item')
@@ -0,0 +1 @@
1
+ %div{ data: { add_to_registry_button: '' } }
@@ -0,0 +1,4 @@
1
+ .grid__cell
2
+ .registries__link
3
+ = link_to registries_path do
4
+ %span= t('workarea.storefront.registries.registries_link')
@@ -0,0 +1,39 @@
1
+ - @title = @page.browser_title
2
+
3
+ - add_css(@page.css)
4
+ - add_javascript(@page.javascript)
5
+
6
+ - content_for :head do
7
+ %meta{ property: 'global-id', content: @page.to_global_id.to_param }
8
+
9
+ %link{ href: "http://#{Workarea.config.host}", rel: 'canonical' }
10
+ - unless @page.meta_description.blank?
11
+ %meta{ name: :description, content: @page.meta_description }
12
+
13
+ %meta{ property: 'og:url', content: url_for(only_path: false) }
14
+ %meta{ property: 'og:title', content: page_title }
15
+ %meta{ property: 'og:type', content: 'website' }
16
+ %meta{ property: 'og:image', content: image_path('workarea/storefront/logo.png') }
17
+
18
+ .view
19
+ = render_content_blocks(@page.content_blocks) if @page.content_blocks.present?
20
+
21
+ .grid
22
+ .grid__cell.grid__cell--33-at-medium
23
+ .data-card.data-card--row
24
+ .data-card__cell
25
+ = link_to registry_search_path do
26
+ %h5.heading.heading--1= t('workarea.storefront.registries.index.find_link')
27
+ %p= t('workarea.storefront.registries.index.find')
28
+ .grid__cell.grid__cell--33-at-medium
29
+ .data-card.data-card--row
30
+ .data-card__cell
31
+ = link_to new_users_registry_path do
32
+ %h5.heading.heading--1= t('workarea.storefront.registries.index.create_link')
33
+ %p= t('workarea.storefront.registries.index.create')
34
+ .grid__cell.grid__cell--33-at-medium
35
+ .data-card.data-card--row
36
+ .data-card__cell
37
+ = link_to users_registries_path do
38
+ %h5.heading.heading--1= t('workarea.storefront.registries.index.manage_link')
39
+ %p= t('workarea.storefront.registries.index.manage')
@@ -0,0 +1,35 @@
1
+ - @title = t('workarea.storefront.registries.search_title')
2
+
3
+ - content_for :breadcrumbs do
4
+ %p.breadcrumbs__node-group
5
+ %span.breadcrumbs__node
6
+ = link_to t('workarea.storefront.layouts.home'), root_path, rel: 'home'
7
+ %span.breadcrumbs__node
8
+ = link_to t('workarea.storefront.registries.registry_home'), registries_path
9
+ %span.breadcrumbs__node= t('workarea.storefront.registries.registry_search')
10
+
11
+ .view
12
+
13
+ %h1= t('workarea.storefront.registries.search.heading')
14
+ %p= t('workarea.storefront.registries.search_instructions')
15
+
16
+ - if params[:registry_query]
17
+ %h2= t('workarea.storefront.registries.results')
18
+
19
+ - unless @registries.present?
20
+ %p= t('workarea.storefront.searches.no_results', terms: params[:registry_query])
21
+
22
+ - else
23
+ %ol
24
+ - @registries.each do |registry|
25
+ %li= link_to registry.name, registry_path(registry)
26
+
27
+ %h2= t('workarea.storefront.searches.search_again')
28
+
29
+ = form_tag registry_search_path, method: 'get', id: 'find_registry_form' do
30
+ .property
31
+ = label_tag 'name_or_email', nil, class: 'property__name' do
32
+ %span.property__text= t('workarea.storefront.registries.name_or_email')
33
+ .value= text_field_tag :registry_query, params[:registry], id: 'name_or_email', class: 'text-box', required: true
34
+
35
+ %p= button_tag t('workarea.storefront.searches.search'), value: 'search', class: 'button'
@@ -0,0 +1,63 @@
1
+ - @title = t('workarea.storefront.registries.show_title', name: @registry.owner)
2
+
3
+ = render_schema_org(breadcrumb_list_schema([[t('workarea.storefront.layouts.home'), root_path], [t('workarea.storefront.registries.find_title'), registry_search_path], [@registry.name, registry_path(@registry)]]))
4
+
5
+ - content_for :breadcrumbs do
6
+ %p.breadcrumbs__node-group
7
+ %span.breadcrumbs__node
8
+ = link_to t('workarea.storefront.layouts.home'), root_path, rel: 'home'
9
+ %span.breadcrumbs__node
10
+ = link_to t('workarea.storefront.registries.registry_search'), registry_search_path
11
+ %span.breadcrumbs__node= t('workarea.storefront.registries.show_title', name: @registry.owner)
12
+
13
+ .view
14
+
15
+ %h2= @registry.name
16
+
17
+ .registries__section
18
+ - if @registry.items.empty?
19
+
20
+ %p= t('workarea.storefront.registries.issues.nothing_to_purchase')
21
+
22
+ - else
23
+
24
+ %ul.product-list
25
+ - @registry.items.each do |item|
26
+ = render_schema_org(product_schema(item.product))
27
+
28
+ %li.product-list__item
29
+ .product-list__item-cell
30
+ .product-list__summary
31
+ %p.product-list__media= link_to image_tag(product_image_url(item.image, :small_thumb), alt: item.product_name, class: 'product-list__media-image'), product_url(item.product, sku: item.sku), class: 'product-list__media-link'
32
+ .product-list__info
33
+ %p.product-list__name= link_to item.product_name, product_path(item.product, sku: item.sku)
34
+ %p.product-list__id= item.sku_name
35
+ %p.product-list__inventory-status= item.inventory_status
36
+ - if item.has_options?
37
+ .product-list__option-group
38
+ - item.details.each do |name, value|
39
+ %p.product-list__option #{name.titleize}: #{value}
40
+ = 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
41
+ = hidden_field_tag :product_id, item.product_id, id: nil
42
+ = hidden_field_tag :sku, item.sku, id: nil
43
+ = hidden_field_tag :registry_id, @registry.id, id: nil
44
+ %table.table
45
+ %thead
46
+ %tr
47
+ %th.table__prices= t('workarea.storefront.orders.price')
48
+ %th.table__quantity= t('workarea.storefront.orders.quantity')
49
+ %th.table__prices= t('workarea.storefront.orders.total')
50
+ %th.table__purchase
51
+ %tbody
52
+ %tr
53
+ %td.table__prices
54
+ %p.table__price
55
+ = render 'workarea/storefront/carts/pricing', item: item, css_block: 'table'
56
+ %td.table__quantity
57
+ .value= number_field_tag :quantity, 1, class: 'text-box text-box--x-small', min: 1, id: nil
58
+ %p= t('workarea.storefront.registries.requested', quantity: item.quantity - item.received)
59
+ %td.table__prices
60
+ %p.table__price
61
+ %span= number_to_currency(item.total_price)
62
+ %td.table__purchase
63
+ %p= button_tag t('workarea.storefront.products.add_to_cart'), class: 'button'
@@ -0,0 +1,13 @@
1
+ = append_partials('storefront.registry_creation_mailer.top')
2
+
3
+ - content_for :preheader_text do
4
+ = @content
5
+
6
+ %tr
7
+ %td
8
+ %p= t('workarea.storefront.email.registries.creation.heading', registry_name: @registry.name)
9
+ = @content
10
+ %p
11
+ = link_to users_registry_url(@registry), users_registry_url(@registry)
12
+
13
+ = append_partials('storefront.registry_creation_mailer.bottom')
@@ -0,0 +1,51 @@
1
+ = append_partials('storefront.registry_gift_receipt_mailer.top')
2
+
3
+ - content_for :preheader_text do
4
+ = @content
5
+
6
+ %tr
7
+ %td
8
+ %p= t('workarea.storefront.email.registries.gift_receipt.heading', order_id: @order.id)
9
+ = @content
10
+
11
+ %tr
12
+ %td
13
+ %table.product-grid
14
+ - @order.items.each_slice(4) do |item_row|
15
+ %tr
16
+ - item_row.each do |item|
17
+ %td.stack-column-center
18
+ %table.product-grid__product{ role: 'presentation', width: '100%' }
19
+ %tr
20
+ %td.product-grid__image
21
+ = link_to product_url(item.product, sku: item.sku), class: 'product-grid__link' do
22
+ = image_tag(product_image_url(item.product.primary_image, :medium_thumb), alt: item.product_name)
23
+ %tr
24
+ %td.product-grid__info
25
+ = link_to product_url(item.product, sku: item.sku), class: 'product-grid__link' do
26
+ .product-grid__name= item.product_name
27
+ = item.sku
28
+
29
+ %tr
30
+ %td
31
+ %table
32
+ - item.details.each do |name, value|
33
+ %tr
34
+ %td.align-left
35
+ %strong= "#{name.titleize}:"
36
+ %td.align-right= value
37
+
38
+ - item.customizations.each do |name, value|
39
+ %tr
40
+ %td.align-left
41
+ %strong= "#{name.titleize}:"
42
+ %td.align-right= value
43
+
44
+ %tr
45
+ %td.align-left
46
+ %strong= t('workarea.storefront.orders.quantity')
47
+ %td.align-right= item.quantity
48
+
49
+ = append_partials('storefront.order_mailer_summary_order_details', item: item)
50
+
51
+ = append_partials('storefront.registry_gift_receipt_mailer.bottom')
@@ -0,0 +1,21 @@
1
+ = append_partials('storefront.registry_share_mailer.top')
2
+
3
+ - content_for :preheader_text do
4
+ = @content
5
+
6
+ %tr
7
+ %td
8
+ %h1= @content
9
+ %p
10
+ %strong= @share.from
11
+ %p= t('workarea.storefront.email.registries.share.from_info')
12
+
13
+ %p= link_to @share.registry_name, path_to_url(@share.url)
14
+
15
+ - if @share.message.present?
16
+ %p
17
+ %strong #{@share.from} #{t('workarea.storefront.email.share.from_message_html')}
18
+ %p= @share.message
19
+
20
+
21
+ = append_partials('storefront.registry_share_mailer.bottom')
@@ -0,0 +1,19 @@
1
+ = append_partials('storefront.registry_thank_mailer.top')
2
+
3
+ - content_for :preheader_text do
4
+ = @content
5
+
6
+ %tr
7
+ %td
8
+ %h1= @content
9
+ %p
10
+ %strong= @thank.from
11
+ %p= t('workarea.storefront.email.thank.thank_you')
12
+
13
+ - if @thank.message.present?
14
+ %p
15
+ %strong #{@thank.from} #{t('workarea.storefront.email.thank.from_message_html')}
16
+ %p= @thank.message
17
+
18
+
19
+ = append_partials('storefront.registry_thank_mailer.bottom')
@@ -0,0 +1,3 @@
1
+ if logged_in?
2
+ json.registry_count Workarea::Registry.for_user(current_user.id).count
3
+ end
@@ -0,0 +1,14 @@
1
+ #registries-summary.box
2
+ .box__header
3
+ .box__action= link_to t('workarea.storefront.registries.create'), new_users_registry_path, data: { dialog_button: '' }, class: 'button'
4
+ %h2.box__heading= t('workarea.storefront.registries.title')
5
+ .box__body
6
+ - unless @user.registries.any?
7
+ %p
8
+ = t('workarea.storefront.registries.none')
9
+ - else
10
+ - @user.registries.take(3).each do |registry|
11
+ = render 'workarea/storefront/users/registries/summary', registry: registry
12
+ - if @user.registries.size > 3
13
+ %p
14
+ = link_to t('workarea.storefront.registries.view_all'), users_registries_path, class: 'button'
@@ -0,0 +1,56 @@
1
+ - if registry.errors.any?
2
+ - registry.errors.full_messages.each do |message|
3
+ = render_message 'error', message, data: { analytics: validation_error_analytics_data('registries').to_json }
4
+
5
+ = form_tag send(action, registry), method: method, id: 'registry_form' do
6
+ = hidden_field_tag :return_to, users_account_path, id: nil
7
+ = hidden_field_tag 'registry[user_id]', current_user.id, id: nil
8
+
9
+ .property
10
+ = label_tag 'registry[name]', nil, class: 'property__name' do
11
+ %span.property__text= t('workarea.storefront.registries.name')
12
+ %span.property__requirement.property__requirement--required= t('workarea.storefront.forms.required')
13
+ .value= text_field_tag 'registry[name]', @registry.name, required: true, class: 'text-box'
14
+
15
+ .property
16
+ = label_tag 'registry[email]', nil, class: 'property__name' do
17
+ %span.property__text= t('workarea.storefront.registries.email')
18
+ %span.property__requirement.property__requirement--required= t('workarea.storefront.forms.required')
19
+ .value= email_field_tag 'registry[email]', @registry.email, required: true, class: 'text-box', autocomplete: 'off'
20
+
21
+ .property
22
+ = label_tag 'registry[description]', nil, class: 'property__name' do
23
+ %span.property__text= t('workarea.storefront.registries.description')
24
+ .value= text_field_tag 'registry[description]', @registry.description, class: 'text-box', autocomplete: 'off', maxlength: 80
25
+
26
+ %fieldset
27
+ %legend
28
+ %span.heading.heading--2= t('workarea.storefront.registries.privacy_settings')
29
+ .property-group
30
+ .grid
31
+ .grid__cell.grid__cell--33-at-medium
32
+ .property
33
+ = label_tag 'registry[privacy]', nil, class: 'property__name' do
34
+ %span.button-property__text= t('workarea.storefront.registries.public_privacy')
35
+ .value= radio_button_tag 'registry[privacy]', 'public', @registry.default_privacy?
36
+ .grid__cell.grid__cell--33-at-medium
37
+ .property
38
+ = label_tag 'registry[privacy]', nil, class: 'property__name' do
39
+ %span.button-property__text= t('workarea.storefront.registries.shared_privacy')
40
+ .value= radio_button_tag 'registry[privacy]', 'shared', @registry.shared?
41
+ .grid__cell.grid__cell--33-at-medium
42
+ .property
43
+ = label_tag 'registry[privacy]', nil, class: 'property__name' do
44
+ %span.button-property__text= t('workarea.storefront.registries.private_privacy')
45
+ .value= radio_button_tag 'registry[privacy]', 'private', @registry.private?
46
+
47
+ .checkout-addresses__fields= render 'workarea/storefront/shared/address_fields', label: 'registry_address', address: @registry.address
48
+
49
+ .property
50
+ = label_tag 'registry[event_date]', nil, class: 'property__name' do
51
+ %span.property__text= t('workarea.storefront.registries.event_date')
52
+ .value= date_field_tag 'registry[event_date]', @registry.event_date, min: (Time.current + 1.day).to_date, pattern: '\d{4}-\d{2}-\d{2}', placeholder: 'yyyy-mm-dd', class: 'text-box'
53
+
54
+ .grid.grid--auto.grid--middle
55
+ .grid__cell= button_tag t('workarea.storefront.forms.save'), value: 'save_registry', class: 'button'
56
+ .grid__cell= link_to t('workarea.storefront.forms.cancel'), users_account_path, class: 'text-button', data: { dialog_close_button: '' }