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,20 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
module Admin
|
5
|
+
class RegistriesSystemTest < Workarea::SystemTest
|
6
|
+
include Admin::IntegrationTest
|
7
|
+
|
8
|
+
def test_index
|
9
|
+
user = create_user(first_name: 'Ben', last_name: 'Crouse')
|
10
|
+
|
11
|
+
registry = create_registry(
|
12
|
+
user_id: user.id
|
13
|
+
)
|
14
|
+
|
15
|
+
visit admin.registries_path
|
16
|
+
assert(page.has_content?('Ben Crouse'))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
class UpdateRegistryItemsTest < TestCase
|
5
|
+
setup :registry, :product, :registry_item
|
6
|
+
|
7
|
+
def registry
|
8
|
+
@registry ||= create_registry
|
9
|
+
end
|
10
|
+
|
11
|
+
def product
|
12
|
+
@product ||= create_product(
|
13
|
+
name: 'Integration Product',
|
14
|
+
variants: [
|
15
|
+
{ sku: 'SKU1', regular: 5.to_m },
|
16
|
+
{ sku: 'SKU2', regular: 6.to_m }
|
17
|
+
]
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def registry_item
|
22
|
+
@registry_item = create_registry_item({
|
23
|
+
registry: registry,
|
24
|
+
product_id: product.id,
|
25
|
+
sku: product.variants.first.sku
|
26
|
+
})
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_perform
|
30
|
+
user = create_user
|
31
|
+
order = create_order(email: user.email, user_id: user.id)
|
32
|
+
order.items.build(product_id: product.id, sku: product.variants.first.sku, quantity: 1, registry_id: registry.id)
|
33
|
+
order.save!
|
34
|
+
|
35
|
+
UpdateRegistryItems.new.perform(order.id)
|
36
|
+
|
37
|
+
registry.reload
|
38
|
+
|
39
|
+
assert_equal(2, registry.items.count)
|
40
|
+
assert_equal(1, registry.items.first.received)
|
41
|
+
assert(registry.items.first.received?)
|
42
|
+
assert(registry.items.last.purchased?)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require 'workarea/registries/version'
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'workarea-registries'
|
9
|
+
spec.version = Workarea::Registries::VERSION
|
10
|
+
spec.authors = ['Jurgen Hahn']
|
11
|
+
spec.email = ['jurgen@syatt.io']
|
12
|
+
spec.homepage = 'https://github.com/syatt-io/workarea-registries'
|
13
|
+
spec.summary = 'Workarea Commerce plugin for registries'
|
14
|
+
spec.description = 'A registry plugin into the Workarea Commerce system.'
|
15
|
+
spec.license = 'Nonstandard'
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split("\n")
|
18
|
+
|
19
|
+
spec.add_dependency 'workarea', '~> 3.x'
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: workarea-registries
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jurgen Hahn
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-02-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: workarea
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.x
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.x
|
27
|
+
description: A registry plugin into the Workarea Commerce system.
|
28
|
+
email:
|
29
|
+
- jurgen@syatt.io
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- Gemfile
|
36
|
+
- LICENSE
|
37
|
+
- README.md
|
38
|
+
- Rakefile
|
39
|
+
- app/assets/images/workarea/storefront/registries/icons/email.svg
|
40
|
+
- app/assets/images/workarea/storefront/registries/icons/link.svg
|
41
|
+
- app/assets/javascripts/workarea/storefront/registries/modules/add_to_registry_button.js
|
42
|
+
- app/assets/javascripts/workarea/storefront/registries/modules/copy_registry_url_button.js
|
43
|
+
- app/assets/javascripts/workarea/storefront/registries/modules/toggle_registry_address.js
|
44
|
+
- app/assets/javascripts/workarea/storefront/registries/templates/add_to_registry_button.jst.ejs
|
45
|
+
- app/controllers/workarea/admin/registries_controller.rb
|
46
|
+
- app/controllers/workarea/storefront/cart_items_controller.decorator
|
47
|
+
- app/controllers/workarea/storefront/registries_controller.rb
|
48
|
+
- app/controllers/workarea/storefront/users/registries_controller.rb
|
49
|
+
- app/controllers/workarea/storefront/users/registry_items_controller.rb
|
50
|
+
- app/controllers/workarea/storefront/users/registry_shares_controller.rb
|
51
|
+
- app/controllers/workarea/storefront/users/registry_thanks_controller.rb
|
52
|
+
- app/helpers/workarea/registries_helper.rb
|
53
|
+
- app/mailers/workarea/storefront/registries_mailer.rb
|
54
|
+
- app/models/workarea/checkout/steps/addresses.decorator
|
55
|
+
- app/models/workarea/order.decorator
|
56
|
+
- app/models/workarea/order/item.decorator
|
57
|
+
- app/models/workarea/registry.rb
|
58
|
+
- app/models/workarea/registry/item.rb
|
59
|
+
- app/models/workarea/registry/public_search.rb
|
60
|
+
- app/models/workarea/registry/share.rb
|
61
|
+
- app/models/workarea/registry/thank.rb
|
62
|
+
- app/models/workarea/search/admin/registry.rb
|
63
|
+
- app/queries/workarea/search/admin_orders.decorator
|
64
|
+
- app/queries/workarea/search/admin_registries.rb
|
65
|
+
- app/seeds/workarea/registry_content_seeds.rb
|
66
|
+
- app/services/workarea/inventory_adjustment.decorator
|
67
|
+
- app/view_models/workarea/admin/registry_view_model.rb
|
68
|
+
- app/view_models/workarea/storefront/checkout/addresses_view_model.decorator
|
69
|
+
- app/view_models/workarea/storefront/order_item_view_model.decorator
|
70
|
+
- app/view_models/workarea/storefront/order_view_model.decorator
|
71
|
+
- app/view_models/workarea/storefront/registry_email_view_model.rb
|
72
|
+
- app/view_models/workarea/storefront/registry_item_view_model.rb
|
73
|
+
- app/view_models/workarea/storefront/registry_share_view_model.rb
|
74
|
+
- app/view_models/workarea/storefront/registry_thank_view_model.rb
|
75
|
+
- app/view_models/workarea/storefront/registry_view_model.rb
|
76
|
+
- app/view_models/workarea/storefront/user_view_model.decorator
|
77
|
+
- app/views/workarea/admin/registries/_menu.html.haml
|
78
|
+
- app/views/workarea/admin/registries/index.html.haml
|
79
|
+
- app/views/workarea/storefront/carts/_registry_details.html.haml
|
80
|
+
- app/views/workarea/storefront/checkouts/_registry_address.html.haml
|
81
|
+
- app/views/workarea/storefront/checkouts/_registry_address_fields.html.haml
|
82
|
+
- app/views/workarea/storefront/checkouts/_registry_details.html.haml
|
83
|
+
- app/views/workarea/storefront/products/_add_to_registry_placeholder.html.haml
|
84
|
+
- app/views/workarea/storefront/registries/_registries_link.html.haml
|
85
|
+
- app/views/workarea/storefront/registries/index.html.haml
|
86
|
+
- app/views/workarea/storefront/registries/search.html.haml
|
87
|
+
- app/views/workarea/storefront/registries/show.html.haml
|
88
|
+
- app/views/workarea/storefront/registries_mailer/creation.html.haml
|
89
|
+
- app/views/workarea/storefront/registries_mailer/gift_receipt.html.haml
|
90
|
+
- app/views/workarea/storefront/registries_mailer/share.html.haml
|
91
|
+
- app/views/workarea/storefront/registries_mailer/thank.html.haml
|
92
|
+
- app/views/workarea/storefront/users/_registry_count.json.jbuilder
|
93
|
+
- app/views/workarea/storefront/users/accounts/_registries.html.haml
|
94
|
+
- app/views/workarea/storefront/users/registries/_form.html.haml
|
95
|
+
- app/views/workarea/storefront/users/registries/_radio_list.html.haml
|
96
|
+
- app/views/workarea/storefront/users/registries/_summary.html.haml
|
97
|
+
- app/views/workarea/storefront/users/registries/edit.html.haml
|
98
|
+
- app/views/workarea/storefront/users/registries/index.html.haml
|
99
|
+
- app/views/workarea/storefront/users/registries/new.html.haml
|
100
|
+
- app/views/workarea/storefront/users/registries/show.html.haml
|
101
|
+
- app/views/workarea/storefront/users/registry_items/new.html.haml
|
102
|
+
- app/views/workarea/storefront/users/registry_items/templates/_purchased.html.haml
|
103
|
+
- app/views/workarea/storefront/users/registry_items/templates/_unpurchased.html.haml
|
104
|
+
- app/views/workarea/storefront/users/registry_shares/_share_buttons.html.haml
|
105
|
+
- app/views/workarea/storefront/users/registry_shares/new.html.haml
|
106
|
+
- app/views/workarea/storefront/users/registry_thanks/new.html.haml
|
107
|
+
- app/workers/workarea/send_gift_receipt.rb
|
108
|
+
- app/workers/workarea/send_registry_creation_email.rb
|
109
|
+
- app/workers/workarea/update_registry_items.rb
|
110
|
+
- bin/rails
|
111
|
+
- config/initializers/appends.rb
|
112
|
+
- config/initializers/fields.rb
|
113
|
+
- config/locales/en.yml
|
114
|
+
- config/routes.rb
|
115
|
+
- lib/workarea/mailer_previews/storefront/registry_mailer_preview.rb
|
116
|
+
- lib/workarea/registries.rb
|
117
|
+
- lib/workarea/registries/engine.rb
|
118
|
+
- lib/workarea/registries/version.rb
|
119
|
+
- test/dummy/config/application.rb
|
120
|
+
- test/factories/workarea/registry.rb
|
121
|
+
- test/integration/workarea/storefront/cart_item_registry_integration_test.rb
|
122
|
+
- test/integration/workarea/storefront/checkout_registry_integration_test.rb
|
123
|
+
- test/integration/workarea/storefront/registry_privacy_integration_test.rb
|
124
|
+
- test/integration/workarea/storefront/user_registries_integration_test.rb
|
125
|
+
- test/integration/workarea/storefront/user_registry_items_integration_test.rb
|
126
|
+
- test/models/workarea/registry/item_test.rb
|
127
|
+
- test/models/workarea/registry/public_search_test.rb
|
128
|
+
- test/models/workarea/registry_test.rb
|
129
|
+
- test/system/workarea/admin/registry_system_test.rb
|
130
|
+
- test/workers/update_registry_items_test.rb
|
131
|
+
- workarea-registries.gemspec
|
132
|
+
homepage: https://github.com/syatt-io/workarea-registries
|
133
|
+
licenses:
|
134
|
+
- Nonstandard
|
135
|
+
metadata: {}
|
136
|
+
post_install_message:
|
137
|
+
rdoc_options: []
|
138
|
+
require_paths:
|
139
|
+
- lib
|
140
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
requirements: []
|
151
|
+
rubyforge_project:
|
152
|
+
rubygems_version: 2.6.14.1
|
153
|
+
signing_key:
|
154
|
+
specification_version: 4
|
155
|
+
summary: Workarea Commerce plugin for registries
|
156
|
+
test_files: []
|