workarea-package_products 3.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.editorconfig +20 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.gitignore +15 -0
- data/CHANGELOG.md +343 -0
- data/CODE_OF_CONDUCT.md +3 -0
- data/CONTRIBUTING.md +3 -0
- data/Gemfile +16 -0
- data/LICENSE +52 -0
- data/README.md +40 -0
- data/Rakefile +52 -0
- data/app/assets/javascripts/workarea/storefront/package_products/modules/family_product_add_to_cart.js +83 -0
- data/app/assets/javascripts/workarea/storefront/package_products/templates/family_add_to_cart_checkbox.jst.ejs +1 -0
- data/app/assets/stylesheets/workarea/admin/package_products/components/_product_cards.scss +7 -0
- data/app/assets/stylesheets/workarea/storefront/package_products/components/_product_detail_packaged_products.scss +11 -0
- data/app/controllers/workarea/admin/create_catalog_package_products_controller.rb +150 -0
- data/app/controllers/workarea/admin/create_catalog_products_controller.decorator +25 -0
- data/app/controllers/workarea/storefront/cart_items_controller.decorator +29 -0
- data/app/controllers/workarea/storefront/products_controller.decorator +8 -0
- data/app/models/workarea/catalog/product.decorator +44 -0
- data/app/models/workarea/search/admin/catalog_product.decorator +20 -0
- data/app/models/workarea/search/storefront/package_product.rb +40 -0
- data/app/queries/workarea/search/product_entries.decorator +8 -0
- data/app/seeds/workarea/package_product_seeds.rb +41 -0
- data/app/services/workarea/add_package_to_cart.rb +79 -0
- data/app/view_models/workarea/admin/product_view_model.decorator +35 -0
- data/app/view_models/workarea/storefront/product_templates/family_view_model.rb +6 -0
- data/app/view_models/workarea/storefront/product_templates/package_view_model.rb +33 -0
- data/app/view_models/workarea/storefront/product_view_model.decorator +13 -0
- data/app/views/workarea/admin/catalog_products/_create_package_button.html.haml +1 -0
- data/app/views/workarea/admin/catalog_products/_packaged_products_card.html.haml +26 -0
- data/app/views/workarea/admin/create_catalog_package_products/categorization.html.haml +64 -0
- data/app/views/workarea/admin/create_catalog_package_products/content.html.haml +54 -0
- data/app/views/workarea/admin/create_catalog_package_products/details.html.haml +87 -0
- data/app/views/workarea/admin/create_catalog_package_products/images.html.haml +57 -0
- data/app/views/workarea/admin/create_catalog_package_products/packaged_products.html.haml +79 -0
- data/app/views/workarea/admin/create_catalog_package_products/publish.html.haml +61 -0
- data/app/views/workarea/admin/create_catalog_package_products/setup.html.haml +68 -0
- data/app/views/workarea/admin/create_catalog_products/select.html.haml +34 -0
- data/app/views/workarea/storefront/cart_items/package.html.haml +59 -0
- data/app/views/workarea/storefront/products/package_show.html.haml +49 -0
- data/app/views/workarea/storefront/products/templates/_family.html.haml +42 -0
- data/app/views/workarea/storefront/products/templates/_package.html.haml +36 -0
- data/app/workers/workarea/update_package_products.rb +21 -0
- data/bin/rails +16 -0
- data/config/initializers/appends.rb +31 -0
- data/config/initializers/configuration.rb +6 -0
- data/config/initializers/seeds.rb +1 -0
- data/config/locales/en.yml +45 -0
- data/config/routes.rb +30 -0
- data/lib/tasks/sample_data.rake +16 -0
- data/lib/workarea/package_products.rb +10 -0
- data/lib/workarea/package_products/engine.rb +8 -0
- data/lib/workarea/package_products/version.rb +5 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +4 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +34 -0
- data/test/dummy/bin/update +29 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/config/application.rb +18 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +9 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +54 -0
- data/test/dummy/config/environments/production.rb +83 -0
- data/test/dummy/config/environments/test.rb +43 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/workarea.rb +5 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/puma.rb +47 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/seeds.rb +2 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/public/favicon.ico +1 -0
- data/test/integration/workarea/admin/create_catalog_package_products_integration_test.rb +139 -0
- data/test/integration/workarea/storefront/package_cart_items_integration_test.rb +47 -0
- data/test/integration/workarea/storefront/products_integration_test.decorator +19 -0
- data/test/models/workarea/catalog/package_product_test.rb +68 -0
- data/test/models/workarea/search/storefront/package_product_test.rb +44 -0
- data/test/queries/workarea/search/product_entries_test.decorator +15 -0
- data/test/services/workarea/add_package_to_cart_test.rb +46 -0
- data/test/system/workarea/admin/activity_system_test.decorator +53 -0
- data/test/system/workarea/admin/package_product_copy_system_test.rb +27 -0
- data/test/system/workarea/admin/package_products_system_test.rb +101 -0
- data/test/system/workarea/admin/product_copy_system_test.decorator +28 -0
- data/test/system/workarea/admin/products_system_test.decorator +69 -0
- data/test/system/workarea/storefront/categories_with_packages_system_test.rb +172 -0
- data/test/system/workarea/storefront/family_product_system_test.rb +58 -0
- data/test/system/workarea/storefront/package_product_system_test.rb +42 -0
- data/test/test_helper.rb +10 -0
- data/test/view_models/workarea/admin/package_product_view_model_test.rb +41 -0
- data/test/view_models/workarea/storefront/package_product_view_model_test.rb +27 -0
- data/test/view_models/workarea/storefront/package_templates/package_view_model_test.rb +34 -0
- data/test/workers/workarea/update_package_products_test.rb +27 -0
- data/workarea-package_products.gemspec +24 -0
- metadata +189 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.view
|
|
2
|
+
- if @items.blank?
|
|
3
|
+
= render_message 'error', data: { message_show_dismiss: 'false' } do
|
|
4
|
+
= t('workarea.storefront.flash_messages.cart_item_error')
|
|
5
|
+
|
|
6
|
+
- else
|
|
7
|
+
= render_message 'success', data: { message_show_dismiss: 'false' } do
|
|
8
|
+
= t('workarea.storefront.flash_messages.cart_item_added')
|
|
9
|
+
|
|
10
|
+
- @items.each do |item|
|
|
11
|
+
.product-list__item{ data: { cart_count: current_order.quantity } }
|
|
12
|
+
.product-list__item-cell
|
|
13
|
+
.product-list__summary
|
|
14
|
+
%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'
|
|
15
|
+
.product-list__info
|
|
16
|
+
%p.product-list__name= link_to item.product_name, product_path(item.product, sku: item.sku)
|
|
17
|
+
%p.product-list__id= item.sku_name
|
|
18
|
+
- if item.has_options?
|
|
19
|
+
.product-list__option-group
|
|
20
|
+
- item.details.each do |name, value|
|
|
21
|
+
%p.product-list__option #{name.titleize}: #{value}
|
|
22
|
+
- item.customizations.each do |name, value|
|
|
23
|
+
%p.customization #{name.titleize}: #{value}
|
|
24
|
+
.product-list__item-cell
|
|
25
|
+
%table.table
|
|
26
|
+
%thead
|
|
27
|
+
%tr
|
|
28
|
+
%th.table__prices= t('workarea.storefront.orders.price')
|
|
29
|
+
%th.table__quantity= t('workarea.storefront.orders.quantity')
|
|
30
|
+
%th.table__prices= t('workarea.storefront.orders.total')
|
|
31
|
+
%tbody
|
|
32
|
+
%tr
|
|
33
|
+
%td.table__prices
|
|
34
|
+
= render 'workarea/storefront/carts/pricing', item: item, css_block: 'table'
|
|
35
|
+
%td.table__quantity
|
|
36
|
+
= form_tag cart_item_path(item), method: :patch, class: 'inline-form', data: { analytics: update_cart_item_analytics_data(item).to_json } do
|
|
37
|
+
.inline-form__cell
|
|
38
|
+
.value= number_field_tag :quantity, item.quantity, min: 1, required: true, class: 'text-box text-box--x-small', data: { form_submitting_control: '' }, title: t('workarea.storefront.orders.quantity'), id: dom_id(item, 'package')
|
|
39
|
+
%p.inline-form__cell.hidden-if-js-enabled= button_tag t('workarea.storefront.carts.update'), value: 'change_quantity', class: 'button'
|
|
40
|
+
%td.table__prices
|
|
41
|
+
- item.total_adjustments.each do |adjustment|
|
|
42
|
+
%p.table__price
|
|
43
|
+
- if item.total_adjustments.many?
|
|
44
|
+
%span.table__price-label= adjustment.description.titleize
|
|
45
|
+
|
|
46
|
+
- if adjustment.discount?
|
|
47
|
+
%strong.table__price-discount= number_to_currency(adjustment.amount)
|
|
48
|
+
- else
|
|
49
|
+
%span= number_to_currency(adjustment.amount)
|
|
50
|
+
|
|
51
|
+
- if item.total_adjustments.many?
|
|
52
|
+
%p.table__price
|
|
53
|
+
%span.table__price-label= t('workarea.storefront.orders.item_total')
|
|
54
|
+
%span= number_to_currency(item.total_price)
|
|
55
|
+
|
|
56
|
+
.grid.grid--auto.grid--center
|
|
57
|
+
.grid__cell= link_to t('workarea.storefront.carts.continue_shopping'), root_path, class: 'button button--large', data: { dialog_close_button: true }
|
|
58
|
+
.grid__cell= link_to t('workarea.storefront.carts.view_cart'), cart_path, class: 'button button--large'
|
|
59
|
+
.grid__cell= link_to t('workarea.storefront.carts.checkout'), checkout_path, class: 'button button--large'
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
- @title = @product.browser_title
|
|
2
|
+
- @breadcrumbs = @product.breadcrumbs
|
|
3
|
+
- params[:sku] = nil # HACK: avoid issues with current_sku
|
|
4
|
+
|
|
5
|
+
- content_for :head do
|
|
6
|
+
- cache "#{@product.cache_key}/head", expires_in: 1.hour do
|
|
7
|
+
%meta{ property: 'recent-view', content: recent_view_content(product_id: @product.id) }
|
|
8
|
+
%meta{ property: 'global-id', content: @product.to_global_id.to_param }
|
|
9
|
+
= append_partials('storefront.product_head', product: @product)
|
|
10
|
+
|
|
11
|
+
%link{ href: product_path(@product), rel: 'canonical' }
|
|
12
|
+
|
|
13
|
+
- unless @product.meta_description.blank?
|
|
14
|
+
%meta{ name: :description, content: strip_tags(@product.meta_description) }
|
|
15
|
+
|
|
16
|
+
%meta{ property: 'og:url', content: url_for }
|
|
17
|
+
%meta{ property: 'og:title', content: @product.name }
|
|
18
|
+
%meta{ property: 'og:type', content: 'product' }
|
|
19
|
+
- @product.images.each do |image|
|
|
20
|
+
%meta{ property: 'og:image', content: product_image_url(image, :detail) }
|
|
21
|
+
- unless @product.meta_description.blank?
|
|
22
|
+
%meta{ property: 'og:description', content: strip_tags(@product.meta_description) }
|
|
23
|
+
|
|
24
|
+
- cache "#{@product.cache_key}/show", expires_in: 1.hour do
|
|
25
|
+
.view
|
|
26
|
+
.product-detail-container.product-detail-container--package{ itemscope: true, itemtype: 'http://schema.org/Product', data: { analytics: product_view_analytics_data(@product).to_json } }
|
|
27
|
+
|
|
28
|
+
.product-details{ class: "product-details--#{@product.template}" }
|
|
29
|
+
= render "workarea/storefront/products/templates/#{@product.template}", product: @product
|
|
30
|
+
|
|
31
|
+
.product-detail-packaged-products{ class: "product-detail-packaged-products--#{@product.template}" }
|
|
32
|
+
- @product.packaged_products.each do |product|
|
|
33
|
+
.product-detail-packaged-products__container{ data: { packaged_product_id: product.id } }
|
|
34
|
+
.product-details{ class: "product-details--#{product.template}", itemprop: 'isRelatedTo', itemscope: true, itemtype: 'http://schema.org/Product', data: { analytics: product_view_analytics_data(product).to_json } }
|
|
35
|
+
= render "workarea/storefront/products/templates/#{product.template}", product: product
|
|
36
|
+
|
|
37
|
+
- if @product.recommendations.any?
|
|
38
|
+
%h2.recommendations__heading= t('workarea.storefront.recommendations.heading')
|
|
39
|
+
|
|
40
|
+
.grid{ data: { analytics: product_list_analytics_data('Product Recommendations').to_json } }
|
|
41
|
+
- @product.recommendations.each do |product|
|
|
42
|
+
.grid__cell.grid__cell--50.grid__cell--33-at-medium.grid__cell--16-at-wide
|
|
43
|
+
.product-summary.product-summary--small{ itemprop: 'isRelatedTo', itemscope: true, itemtype: 'http://schema.org/Product' }
|
|
44
|
+
= render 'workarea/storefront/products/summary', product: product
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
%div{ data: { recommendations_placeholder: recent_views_path } }
|
|
48
|
+
|
|
49
|
+
= append_partials('storefront.product_show', product: @product)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.grid.grid--rev
|
|
2
|
+
.grid__cell.grid__cell--60-at-medium
|
|
3
|
+
|
|
4
|
+
.product-details__name
|
|
5
|
+
%h1.product-details__heading{ itemprop: 'name' }= product.name
|
|
6
|
+
|
|
7
|
+
%p.product-details__id
|
|
8
|
+
%span{ itemprop: 'productID' }= product.id
|
|
9
|
+
|
|
10
|
+
.product-prices.product-prices--details{ itemprop: 'offers', itemscope: true, itemtype: 'http://schema.org/Offer' }
|
|
11
|
+
= render 'workarea/storefront/products/pricing', product: product
|
|
12
|
+
|
|
13
|
+
- if product.description.present?
|
|
14
|
+
.product-details__description
|
|
15
|
+
%p= truncated_product_description(product, t('workarea.storefront.products.read_more'))
|
|
16
|
+
|
|
17
|
+
= form_tag package_cart_items_path, method: 'post', class: 'product-details__add-to-cart-form', data: { dialog: { dialogOptions: { closeAll: true, initModules: true } }, analytics: add_to_cart_analytics_data(product).to_json } do
|
|
18
|
+
= hidden_field_tag :product_id, product.id, id: dom_id(product, 'product_id')
|
|
19
|
+
= hidden_field_tag :via, params[:via], id: dom_id(product, 'via')
|
|
20
|
+
|
|
21
|
+
%p.product-details__add-to-cart-action= button_tag t('workarea.storefront.products.add_to_cart'), value: 'add_to_cart', class: 'button button--large'
|
|
22
|
+
|
|
23
|
+
= append_partials('storefront.product_details', product: product)
|
|
24
|
+
|
|
25
|
+
%p.product-details__full-details=link_to t('workarea.storefront.products.view_full_details'), product_path(product, color: params[:color]), class: 'text-button', itemprop: 'url'
|
|
26
|
+
|
|
27
|
+
.grid__cell.grid__cell--40-at-medium
|
|
28
|
+
|
|
29
|
+
.product-details__primary-image
|
|
30
|
+
= link_to(product_image_url(product.primary_image, :zoom), target: '_blank', class: 'product-details__primary-image-link', data: { dialog_button: '' }) do
|
|
31
|
+
= image_tag product_image_url(product.primary_image, :detail), alt: 'View Larger Image', itemprop: 'image', class: 'product-details__primary-image-link-image'
|
|
32
|
+
|
|
33
|
+
- if product.images.length > 1
|
|
34
|
+
.product-details__alt-images
|
|
35
|
+
.grid.grid--auto
|
|
36
|
+
- product.images.each_with_index do |image, index|
|
|
37
|
+
.grid__cell
|
|
38
|
+
.product-details__alt-image
|
|
39
|
+
- button_class = index == 0 ? 'product-details__alt-image-link product-details__alt-image-link--selected' : 'product-details__alt-image-link'
|
|
40
|
+
= link_to(image_tag(product_image_url(image, :small_thumb), alt: t('workarea.storefront.products.zoom')), product_image_url(image, :zoom), class: button_class, target: '_blank', data: { alternate_image_button: { src: product_image_url(image, :detail) }.to_json })
|
|
41
|
+
|
|
42
|
+
= append_partials('storefront.product_details_alt_images', product: product)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.grid.grid--rev
|
|
2
|
+
.grid__cell.grid__cell--60-at-medium
|
|
3
|
+
|
|
4
|
+
.product-details__name
|
|
5
|
+
%h1.product-details__heading{ itemprop: 'name' }= product.name
|
|
6
|
+
|
|
7
|
+
%p.product-details__id
|
|
8
|
+
%span{ itemprop: 'productID' }= product.id
|
|
9
|
+
|
|
10
|
+
.product-prices.product-prices--details{ itemprop: 'offers', itemscope: true, itemtype: 'http://schema.org/Offer' }
|
|
11
|
+
= render 'workarea/storefront/products/pricing', product: product
|
|
12
|
+
|
|
13
|
+
- if product.description.present?
|
|
14
|
+
.product-details__description
|
|
15
|
+
%p= truncated_product_description(product, t('workarea.storefront.products.read_more'))
|
|
16
|
+
|
|
17
|
+
= append_partials('storefront.product_details', product: product)
|
|
18
|
+
|
|
19
|
+
%p.product-details__full-details=link_to t('workarea.storefront.products.view_full_details'), product_path(product, color: params[:color]), class: 'text-button', itemprop: 'url'
|
|
20
|
+
|
|
21
|
+
.grid__cell.grid__cell--40-at-medium
|
|
22
|
+
|
|
23
|
+
.product-details__primary-image
|
|
24
|
+
= link_to(product_image_url(product.primary_image, :zoom), target: '_blank', class: 'product-details__primary-image-link', data: { dialog_button: '' }) do
|
|
25
|
+
= image_tag product_image_url(product.primary_image, :detail), alt: 'View Larger Image', itemprop: 'image', class: 'product-details__primary-image-link-image'
|
|
26
|
+
|
|
27
|
+
- if product.images.length > 1
|
|
28
|
+
.product-details__alt-images
|
|
29
|
+
.grid.grid--auto
|
|
30
|
+
- product.images.each_with_index do |image, index|
|
|
31
|
+
.grid__cell
|
|
32
|
+
.product-details__alt-image
|
|
33
|
+
- button_class = index == 0 ? 'product-details__alt-image-link product-details__alt-image-link--selected' : 'product-details__alt-image-link'
|
|
34
|
+
= link_to(image_tag(product_image_url(image, :small_thumb), alt: t('workarea.storefront.products.zoom')), product_image_url(image, :zoom), class: button_class, target: '_blank', data: { alternate_image_button: { src: product_image_url(image, :detail) }.to_json })
|
|
35
|
+
|
|
36
|
+
= append_partials('storefront.product_details_alt_images', product: product)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Workarea
|
|
2
|
+
class UpdatePackageProducts
|
|
3
|
+
include Sidekiq::Worker
|
|
4
|
+
include Sidekiq::CallbacksWorker
|
|
5
|
+
|
|
6
|
+
sidekiq_options(
|
|
7
|
+
enqueue_on: { Catalog::Product => :destroy },
|
|
8
|
+
unique: :until_executing
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
def perform(id)
|
|
12
|
+
Sidekiq::Callbacks.inline do
|
|
13
|
+
packages = Catalog::Product.where(product_ids: id)
|
|
14
|
+
packages.each do |package|
|
|
15
|
+
package.product_ids.delete(id)
|
|
16
|
+
package.save
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
data/bin/rails
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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/content_search/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_mailer/railtie'
|
|
14
|
+
require 'sprockets/railtie'
|
|
15
|
+
require 'rails/test_unit/railtie'
|
|
16
|
+
require 'rails/engine/commands'
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Javascript Appends
|
|
2
|
+
Workarea.append_javascripts(
|
|
3
|
+
'storefront.modules',
|
|
4
|
+
'workarea/storefront/package_products/modules/family_product_add_to_cart'
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
Workarea.append_javascripts(
|
|
8
|
+
'storefront.templates',
|
|
9
|
+
'workarea/storefront/package_products/templates/family_add_to_cart_checkbox'
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
Workarea.append_stylesheets(
|
|
13
|
+
'admin.components',
|
|
14
|
+
'workarea/admin/package_products/components/product_cards'
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
Workarea.append_stylesheets(
|
|
18
|
+
'storefront.components',
|
|
19
|
+
'workarea/storefront/package_products/components/product_detail_packaged_products'
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
# Partial Appends
|
|
23
|
+
Workarea.append_partials(
|
|
24
|
+
'admin.catalog_product_cards',
|
|
25
|
+
'workarea/admin/catalog_products/packaged_products_card'
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
Workarea.append_partials(
|
|
29
|
+
'admin.product_index_actions',
|
|
30
|
+
'workarea/admin/catalog_products/create_package_button'
|
|
31
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Workarea.config.seeds.insert_after('Workarea::ProductsSeeds', 'Workarea::PackageProductSeeds')
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
en:
|
|
2
|
+
workarea:
|
|
3
|
+
admin:
|
|
4
|
+
catalog_products:
|
|
5
|
+
cards:
|
|
6
|
+
packaged_products:
|
|
7
|
+
button: Manage Products
|
|
8
|
+
description: Package products appear on the product detail page.
|
|
9
|
+
empty: No packaged products.
|
|
10
|
+
empty_button: Add Products
|
|
11
|
+
title: Packaged Products
|
|
12
|
+
index:
|
|
13
|
+
add_new_package_product: Add New Package Product
|
|
14
|
+
create_catalog_package_products:
|
|
15
|
+
flash_messages:
|
|
16
|
+
packaged_products_saved: Packaged products have been saved
|
|
17
|
+
packaged_products:
|
|
18
|
+
continue_to_images: Continue to Images
|
|
19
|
+
instruction: Click on products to add them to the package.
|
|
20
|
+
no_matching_products: No matching products found
|
|
21
|
+
page_title: Products for %{product_name}
|
|
22
|
+
start_over: Start over
|
|
23
|
+
title: "%{product_name}: Add Products"
|
|
24
|
+
setup:
|
|
25
|
+
save_and_add_products: Save and Add Products
|
|
26
|
+
steps:
|
|
27
|
+
categorization: Categorization
|
|
28
|
+
content: Content
|
|
29
|
+
details: Details
|
|
30
|
+
images: Images
|
|
31
|
+
packaged_products: Packaged Products
|
|
32
|
+
publish: Publish
|
|
33
|
+
setup: Setup
|
|
34
|
+
workflow:
|
|
35
|
+
cancel_message: Are you sure? All work on this package will be lost.
|
|
36
|
+
skip_this: or skip this
|
|
37
|
+
create_catalog_products:
|
|
38
|
+
select:
|
|
39
|
+
button: Select and Continue
|
|
40
|
+
instruction: A product can contain either variants or other products. Pick the product type you wish you continue creating.
|
|
41
|
+
package: Package
|
|
42
|
+
package_description: A product that contains other products. Can be used to bundle similar or related products together on a single detail page.
|
|
43
|
+
standard: Standard
|
|
44
|
+
standard_description: A typical product that contains variants representing the options of a single product.
|
|
45
|
+
title: Select a type of product to create
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Workarea::Admin::Engine.routes.draw do
|
|
2
|
+
scope '(:locale)', constraints: Workarea::I18n.routes_constraint do
|
|
3
|
+
resources :create_catalog_package_products, except: :show do
|
|
4
|
+
member do
|
|
5
|
+
get :packaged_products
|
|
6
|
+
|
|
7
|
+
get :details
|
|
8
|
+
post :save_details
|
|
9
|
+
|
|
10
|
+
get :images
|
|
11
|
+
post :save_images
|
|
12
|
+
|
|
13
|
+
get :content
|
|
14
|
+
post :save_content
|
|
15
|
+
|
|
16
|
+
get :categorization
|
|
17
|
+
post :save_categorization
|
|
18
|
+
|
|
19
|
+
get :publish
|
|
20
|
+
post :save_publish
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
Workarea::Storefront::Engine.routes.draw do
|
|
27
|
+
scope '(:locale)', constraints: Workarea::I18n.routes_constraint do
|
|
28
|
+
post 'cart/items/package', to: 'cart_items#package', as: :package_cart_items
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
namespace :dummy do
|
|
2
|
+
desc 'Add sample data for the Dummy project.'
|
|
3
|
+
task sample_data: :environment do
|
|
4
|
+
require 'workarea/sample_data/task'
|
|
5
|
+
|
|
6
|
+
# add require statement for new generators
|
|
7
|
+
require 'workarea/sample_data/generators/package_product_generator'
|
|
8
|
+
|
|
9
|
+
# Inserts a discount generator from host generator before ShippingMethodsGenerator
|
|
10
|
+
Workarea::SampleData.generators.insert(
|
|
11
|
+
Workarea::SampleData::Generators::PackageProductGenerator,
|
|
12
|
+
Workarea::SampleData::Generators::ProductsGenerator
|
|
13
|
+
)
|
|
14
|
+
Workarea::SampleData::Task.run
|
|
15
|
+
end
|
|
16
|
+
end
|
data/test/dummy/Rakefile
ADDED
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require_tree .
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
|
11
|
+
* It is generally better to create a new file per style scope.
|
|
12
|
+
*
|
|
13
|
+
*= require_tree .
|
|
14
|
+
*= require_self
|
|
15
|
+
*/
|