workarea 3.4.16 → 3.4.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +81 -0
- metadata +10 -579
- data/docs/Gemfile +0 -8
- data/docs/Gemfile.lock +0 -130
- data/docs/bin/middleman +0 -29
- data/docs/config.rb +0 -87
- data/docs/config.ru +0 -7
- data/docs/data/articles.yml +0 -157
- data/docs/package.json +0 -15
- data/docs/source/404.html.erb +0 -13
- data/docs/source/articles/access-routes-in-javascript.html.md +0 -33
- data/docs/source/articles/add-a-content-area.html.md +0 -169
- data/docs/source/articles/add-a-content-block-type.html.md +0 -334
- data/docs/source/articles/add-a-report.html.md +0 -202
- data/docs/source/articles/add-css-through-the-admin-ui.html.md +0 -30
- data/docs/source/articles/add-javascript-through-a-manifest.html.md +0 -367
- data/docs/source/articles/add-javascript-through-a-view.html.md +0 -80
- data/docs/source/articles/add-javascript-through-the-admin-ui.html.md +0 -30
- data/docs/source/articles/add-metrics.html.md +0 -58
- data/docs/source/articles/add-or-replace-a-pricing-calculator.html.md +0 -150
- data/docs/source/articles/add-remove-or-change-a-mongoid-validation.html.md +0 -147
- data/docs/source/articles/add-remove-or-change-a-product-template.html.md +0 -142
- data/docs/source/articles/add-remove-sort-and-group-storefront-search-filters.html.md +0 -483
- data/docs/source/articles/add-stylesheets-through-a-manifest.html.md +0 -276
- data/docs/source/articles/add-system-content.html.md +0 -138
- data/docs/source/articles/analytics-overview.html.md +0 -51
- data/docs/source/articles/analyze-storefront-search-results.html.md +0 -261
- data/docs/source/articles/api-overview.html.md +0 -35
- data/docs/source/articles/appending.html.md +0 -506
- data/docs/source/articles/application-document.html.md +0 -88
- data/docs/source/articles/automated-javascript-testing.html.md +0 -162
- data/docs/source/articles/b2b-overview.html.md +0 -64
- data/docs/source/articles/browser-and-device-support.html.md +0 -47
- data/docs/source/articles/change-product-placeholder-image.html.md +0 -39
- data/docs/source/articles/change-storefront-search-results.html.md +0 -283
- data/docs/source/articles/change-the-storefront-product-pricing-ui.html.md +0 -348
- data/docs/source/articles/change-the-storefront-search-filters-ui.html.md +0 -103
- data/docs/source/articles/checkout.html.md +0 -479
- data/docs/source/articles/commerce-model.html.md +0 -164
- data/docs/source/articles/configuration-for-hosting.html.md +0 -106
- data/docs/source/articles/configuration.html.md +0 -406
- data/docs/source/articles/configure-a-payment-gateway.html.md +0 -58
- data/docs/source/articles/configure-asset-storage.html.md +0 -29
- data/docs/source/articles/configure-asset-types.html.md +0 -18
- data/docs/source/articles/configure-contact-form-subjects-list.html.md +0 -24
- data/docs/source/articles/configure-imageoptim.html.md +0 -23
- data/docs/source/articles/configure-locales.html.md +0 -45
- data/docs/source/articles/configure-logins-and-authentication.html.md +0 -42
- data/docs/source/articles/configure-low-inventory-threshold.html.md +0 -26
- data/docs/source/articles/configure-product-image-sizes-and-processing.html.md +0 -28
- data/docs/source/articles/content.html.md +0 -554
- data/docs/source/articles/contentable.html.md +0 -41
- data/docs/source/articles/contribute-code.html.md +0 -69
- data/docs/source/articles/contribute-documentation.html.md +0 -60
- data/docs/source/articles/create-a-custom-discount.html.md +0 -234
- data/docs/source/articles/create-a-new-app.html.md +0 -131
- data/docs/source/articles/create-a-plugin.html.md +0 -19
- data/docs/source/articles/create-a-style-guide.html.md +0 -71
- data/docs/source/articles/create-a-theme.html.md +0 -134
- data/docs/source/articles/css-architectural-overview.html.md +0 -89
- data/docs/source/articles/customize-a-helper.html.md +0 -91
- data/docs/source/articles/decoration.html.md +0 -415
- data/docs/source/articles/define-and-configure-inventory-policies.html.md +0 -107
- data/docs/source/articles/documentation-style-guide.html.md +0 -48
- data/docs/source/articles/documentation.html.md +0 -54
- data/docs/source/articles/domain-modeling.html.md +0 -82
- data/docs/source/articles/error-pages.html.md.erb +0 -95
- data/docs/source/articles/extension-overview.html.md +0 -152
- data/docs/source/articles/favicon-support.html.md +0 -112
- data/docs/source/articles/feature-spec-helper-stylesheet.html.md +0 -25
- data/docs/source/articles/featurejs-and-feature-spec-helper.html.md +0 -20
- data/docs/source/articles/help-and-support.html.md +0 -34
- data/docs/source/articles/html-fragment-caching.html.md +0 -46
- data/docs/source/articles/http-caching.html.md +0 -43
- data/docs/source/articles/i18n.html.md +0 -35
- data/docs/source/articles/images-flow.html.md +0 -10
- data/docs/source/articles/index-storefront-search-documents.html.md +0 -104
- data/docs/source/articles/infrastructure.html.md +0 -46
- data/docs/source/articles/installing.html.md +0 -61
- data/docs/source/articles/integrate-a-payment-gateway.html.md +0 -124
- data/docs/source/articles/integrate-a-web-analytics-provider.html.md +0 -35
- data/docs/source/articles/integrate-an-inventory-management-system.html.md +0 -88
- data/docs/source/articles/integrating-with-other-software.html.md +0 -59
- data/docs/source/articles/inventory.html.md +0 -352
- data/docs/source/articles/javascript-coding-standards.html.md +0 -30
- data/docs/source/articles/javascript-modules.html.md +0 -174
- data/docs/source/articles/javascript-overview.html.md +0 -62
- data/docs/source/articles/javascript-reference-documentation.html.md +0 -51
- data/docs/source/articles/javascript-templates.html.md +0 -52
- data/docs/source/articles/low-level-caching.html.md +0 -25
- data/docs/source/articles/maintain-a-plugin.html.md +0 -12
- data/docs/source/articles/maintenance-policy.html.md +0 -79
- data/docs/source/articles/navigable.html.md +0 -51
- data/docs/source/articles/navigating-the-code.html.md +0 -149
- data/docs/source/articles/navigation.html.md +0 -386
- data/docs/source/articles/order-life-cycle.html.md +0 -546
- data/docs/source/articles/order-pricing.html.md +0 -389
- data/docs/source/articles/orders-and-items.html.md +0 -210
- data/docs/source/articles/orders.html.md +0 -66
- data/docs/source/articles/overriding.html.md +0 -155
- data/docs/source/articles/overview.html.md +0 -43
- data/docs/source/articles/plugins-overview.html.md +0 -12
- data/docs/source/articles/prerequisites-and-dependencies.html.md +0 -202
- data/docs/source/articles/products.html.md.erb +0 -1270
- data/docs/source/articles/progressive-web-application-support.html.md +0 -148
- data/docs/source/articles/rails-asset-manifests.html.md +0 -33
- data/docs/source/articles/rails-asset-view-helpers.html.md +0 -25
- data/docs/source/articles/reading-data.html.md +0 -10
- data/docs/source/articles/releasable.html.md +0 -37
- data/docs/source/articles/report-a-bug.html.md +0 -75
- data/docs/source/articles/ruby-coding-standards.html.md +0 -10
- data/docs/source/articles/run-sidekiq-in-a-local-environment.html.md +0 -40
- data/docs/source/articles/searching.html.md +0 -1005
- data/docs/source/articles/security-policy.html.md +0 -42
- data/docs/source/articles/seeds.html.md +0 -345
- data/docs/source/articles/shipping.html.md +0 -756
- data/docs/source/articles/sort-and-exclude-product-options.html.md +0 -47
- data/docs/source/articles/storefront-search-features.html.md +0 -568
- data/docs/source/articles/storefront-searches.html.md +0 -126
- data/docs/source/articles/style-guides.html.md +0 -21
- data/docs/source/articles/stylesheet-coding-standards.html.md +0 -24
- data/docs/source/articles/stylesheets-overview.html.md +0 -67
- data/docs/source/articles/swappable-list-data-structure.html.md +0 -81
- data/docs/source/articles/system-emails.html.md +0 -102
- data/docs/source/articles/taggable.html.md +0 -8
- data/docs/source/articles/test-a-credit-card-transaction.html.md +0 -16
- data/docs/source/articles/test-if-a-plugin-is-installed.html.md +0 -34
- data/docs/source/articles/testing.html.md +0 -914
- data/docs/source/articles/themes-overview.html.md +0 -155
- data/docs/source/articles/translate-administrable-content.html.md +0 -14
- data/docs/source/articles/translate-javascript-content.html.md +0 -16
- data/docs/source/articles/translate-or-customize-message-content.html.md +0 -29
- data/docs/source/articles/translate-or-customize-static-content.html.md +0 -30
- data/docs/source/articles/use-an-existing-workarea-app.html.md +0 -108
- data/docs/source/articles/view-models.html.md +0 -509
- data/docs/source/articles/views.html.md +0 -14
- data/docs/source/articles/workers.html.md +0 -613
- data/docs/source/articles/writing-data.html.md +0 -10
- data/docs/source/cli.html.md +0 -163
- data/docs/source/favicon.ico +0 -0
- data/docs/source/images/3-variants-1-option.png +0 -0
- data/docs/source/images/3-variants-3-options.png +0 -0
- data/docs/source/images/3-years-primary-image.png +0 -0
- data/docs/source/images/404-storefront-error-page.png +0 -0
- data/docs/source/images/404-system-content-admin.png +0 -0
- data/docs/source/images/404.jpg +0 -0
- data/docs/source/images/5-years-primary-image.png +0 -0
- data/docs/source/images/activity-dashboard.png +0 -0
- data/docs/source/images/activity-for-object.png +0 -0
- data/docs/source/images/activity-ui.png +0 -0
- data/docs/source/images/adding-captioned-image-block-custom-icon.png +0 -0
- data/docs/source/images/adding-captioned-image-block-default-icon.png +0 -0
- data/docs/source/images/admin-alerts-ui.png +0 -0
- data/docs/source/images/admin-category-range-filters.png +0 -0
- data/docs/source/images/admin-for-3-column-hero.png +0 -0
- data/docs/source/images/admin-help-index.png +0 -0
- data/docs/source/images/admin-help-ui.png +0 -0
- data/docs/source/images/admin-javascript.png +0 -0
- data/docs/source/images/admin-notification-for-deactivated-discount.png +0 -0
- data/docs/source/images/admin-notifications-ui.png +0 -0
- data/docs/source/images/admin-product-show-page.png +0 -0
- data/docs/source/images/admin-products-index-page.png +0 -0
- data/docs/source/images/admin-range-filters.png +0 -0
- data/docs/source/images/admin-style-guides-navigation.png +0 -0
- data/docs/source/images/after-re-seeding.png +0 -0
- data/docs/source/images/after-seeding-localhost-3000.png +0 -0
- data/docs/source/images/after-seeding.png +0 -0
- data/docs/source/images/arrow.svg +0 -1
- data/docs/source/images/arrow_white.svg +0 -1
- data/docs/source/images/aws-resource-map.png +0 -0
- data/docs/source/images/backordered-until-output-on-inventory-sku-card.png +0 -0
- data/docs/source/images/before-seeding-localhost-3000.png +0 -0
- data/docs/source/images/before-seeding.png +0 -0
- data/docs/source/images/browsing-workarea-versions-on-the-web.png +0 -0
- data/docs/source/images/bulk-asset-upload-on-assets-index-page.png +0 -0
- data/docs/source/images/bulk-asset-upload-while-editing-content.png +0 -0
- data/docs/source/images/bundle-show-workarea-core.png +0 -0
- data/docs/source/images/bundle-show-workarea.png +0 -0
- data/docs/source/images/calendar-for-backordered-until-field.png +0 -0
- data/docs/source/images/captioned-image-block-in-storefront.png +0 -0
- data/docs/source/images/captioned-image-content-block-storefront-component-style-guide.png +0 -0
- data/docs/source/images/cart-system-content-in-admin.png +0 -0
- data/docs/source/images/cart-system-content-in-storefront.png +0 -0
- data/docs/source/images/checkout-addresses-guest.png +0 -0
- data/docs/source/images/checkout-addresses-user.png +0 -0
- data/docs/source/images/checkout-confirmation.png +0 -0
- data/docs/source/images/checkout-flow-0.png +0 -0
- data/docs/source/images/checkout-flow-1.png +0 -0
- data/docs/source/images/checkout-flow-2.png +0 -0
- data/docs/source/images/checkout-flow-3.png +0 -0
- data/docs/source/images/checkout-flow-4.png +0 -0
- data/docs/source/images/checkout-payment-guest.png +0 -0
- data/docs/source/images/checkout-payment-user.png +0 -0
- data/docs/source/images/checkout-shipping.png +0 -0
- data/docs/source/images/color-picker-component-admin-style-guide.png +0 -0
- data/docs/source/images/color-picker-component-on-content-editing-screen.png +0 -0
- data/docs/source/images/commerce-model-carts-orders.png +0 -0
- data/docs/source/images/commerce-model-order-pricing.png +0 -0
- data/docs/source/images/commerce-model.png +0 -0
- data/docs/source/images/configuring-an-index-pattern-in-kibana.png +0 -0
- data/docs/source/images/content-block-presets.png +0 -0
- data/docs/source/images/content-search-customization.png +0 -0
- data/docs/source/images/country-with-region-data-in-address-form.png +0 -0
- data/docs/source/images/country-without-region-data-in-address-form.png +0 -0
- data/docs/source/images/create-content-block-preset-ui.png +0 -0
- data/docs/source/images/credit-card-icons.png +0 -0
- data/docs/source/images/css-added-through-admin.png +0 -0
- data/docs/source/images/css-admin-ui.png +0 -0
- data/docs/source/images/current-configuration-shown-in-admin-settings.png +0 -0
- data/docs/source/images/customer-impersonation-in-admin.png +0 -0
- data/docs/source/images/customer-impersonation-in-store-front.png +0 -0
- data/docs/source/images/date-filter-same-day.png +0 -0
- data/docs/source/images/developer-toolbar-in-store-front.png +0 -0
- data/docs/source/images/discounts-sorted-by-most-redeemed.png +0 -0
- data/docs/source/images/edit-help-article.png +0 -0
- data/docs/source/images/editing-content-for-search-customization.png +0 -0
- data/docs/source/images/editing-dynamic-captioned-image-block.png +0 -0
- data/docs/source/images/editing-product-fields-in-the-admin.png +0 -0
- data/docs/source/images/editing-search-system-content.png +0 -0
- data/docs/source/images/editing-static-captioned-image-block-custom-icon.png +0 -0
- data/docs/source/images/editing-static-captioned-image-block-default-icon.png +0 -0
- data/docs/source/images/external.svg +0 -1
- data/docs/source/images/favicon_16.png +0 -0
- data/docs/source/images/favicon_180.png +0 -0
- data/docs/source/images/favicon_32.png +0 -0
- data/docs/source/images/filters-all.png +0 -0
- data/docs/source/images/filters-control.png +0 -0
- data/docs/source/images/filters-custom.png +0 -0
- data/docs/source/images/filters-groups.png +0 -0
- data/docs/source/images/filters-material.png +0 -0
- data/docs/source/images/filters-omitted.png +0 -0
- data/docs/source/images/filters-pinned.png +0 -0
- data/docs/source/images/filters-range.png +0 -0
- data/docs/source/images/filters-sorted.png +0 -0
- data/docs/source/images/filters-wrapping-to-second-line-in-admin.png +0 -0
- data/docs/source/images/generic-product-template-images-no-options-selected.png +0 -0
- data/docs/source/images/generic-product-template-images-options-selected.png +0 -0
- data/docs/source/images/generic-template.png +0 -0
- data/docs/source/images/hosting.svg +0 -1
- data/docs/source/images/image-group-content-block-in-storefront.png +0 -0
- data/docs/source/images/images.svg +0 -1
- data/docs/source/images/import-export-screenshot.png +0 -0
- data/docs/source/images/invalid-display.png +0 -0
- data/docs/source/images/itcss.png +0 -0
- data/docs/source/images/kibana-dev-tools-console.png +0 -0
- data/docs/source/images/layout-content-admin-with-2-areas.png +0 -0
- data/docs/source/images/layout-content-admin-with-3-areas.png +0 -0
- data/docs/source/images/link-to-search-system-content.png +0 -0
- data/docs/source/images/logo.svg +0 -1
- data/docs/source/images/menu.svg +0 -2
- data/docs/source/images/mongo-replica-set.svg +0 -1
- data/docs/source/images/multi-column-hero-blocks.png +0 -0
- data/docs/source/images/option-selects-product-template-images-options-selected.png +0 -0
- data/docs/source/images/option-selects-template.png +0 -0
- data/docs/source/images/option-thumbnails-template.png +0 -0
- data/docs/source/images/order-item-total-price-diagram.png +0 -0
- data/docs/source/images/order-pricing-cart-example.png +0 -0
- data/docs/source/images/order-pricing-example-adjustments.png +0 -0
- data/docs/source/images/order-pricing-example-totals.png +0 -0
- data/docs/source/images/order-pricing-placed-order-example.png +0 -0
- data/docs/source/images/order-shipping-total-diagram.png +0 -0
- data/docs/source/images/order-show-with-multiple-tenders.png +0 -0
- data/docs/source/images/order-subtotal-price-diagram.png +0 -0
- data/docs/source/images/order-tax-total-diagram.png +0 -0
- data/docs/source/images/order-total-price-diagram.png +0 -0
- data/docs/source/images/order-total-value-diagram.png +0 -0
- data/docs/source/images/orders-dashboard-links.png +0 -0
- data/docs/source/images/oval.svg +0 -1
- data/docs/source/images/payment-icon-storefront-style-guide.png +0 -0
- data/docs/source/images/people-dashboard-links.png +0 -0
- data/docs/source/images/price-adjustments-diagram.png +0 -0
- data/docs/source/images/price-display-no-options.png +0 -0
- data/docs/source/images/price-display-options-selected.png +0 -0
- data/docs/source/images/pricing-calculators-diagram.png +0 -0
- data/docs/source/images/product-list-content-block-admin.png +0 -0
- data/docs/source/images/product-list-content-block-in-store-front.png +0 -0
- data/docs/source/images/promo-products-excluded-autocomplete-results-after.png +0 -0
- data/docs/source/images/promo-products-excluded-featured-category-results-after.png +0 -0
- data/docs/source/images/promo-products-excluded-recommendations-results-after.png +0 -0
- data/docs/source/images/promo-products-excluded-search-category-results-after.png +0 -0
- data/docs/source/images/promo-products-excluded-search-results-after.png +0 -0
- data/docs/source/images/promo-products-included-autocomplete-results-before.png +0 -0
- data/docs/source/images/promo-products-included-featured-category-results-before.png +0 -0
- data/docs/source/images/promo-products-included-recommendations-results-before.png +0 -0
- data/docs/source/images/promo-products-included-search-category-results-before.png +0 -0
- data/docs/source/images/promo-products-included-search-results-before.png +0 -0
- data/docs/source/images/rails-version-constraint.png +0 -0
- data/docs/source/images/re-enable-discount.png +0 -0
- data/docs/source/images/reading-data.svg +0 -1
- data/docs/source/images/readme-hero.png +0 -0
- data/docs/source/images/redesigned-customized-sort-for-search-results.png +0 -0
- data/docs/source/images/reviews-summary-above-share-buttons.png +0 -0
- data/docs/source/images/reviews-summary-below-product-name.png +0 -0
- data/docs/source/images/reviews-summary-below-share-buttons.png +0 -0
- data/docs/source/images/reviews-summary-removed.png +0 -0
- data/docs/source/images/rsa-fingerprint-for-stash.png +0 -0
- data/docs/source/images/ruby-version-constraint.png +0 -0
- data/docs/source/images/script-tag-added-through-admin.png +0 -0
- data/docs/source/images/search-analysis-admin-alternate-rendering.png +0 -0
- data/docs/source/images/search-analysis-admin.png +0 -0
- data/docs/source/images/search-quality-report.png +0 -0
- data/docs/source/images/search.svg +0 -1
- data/docs/source/images/searching-for-cart-system-content-in-admin.png +0 -0
- data/docs/source/images/searching-for-layout-system-content-in-admin.png +0 -0
- data/docs/source/images/seeded-admin.png +0 -0
- data/docs/source/images/seeds-from-plugins.png +0 -0
- data/docs/source/images/seo-metadata-automation-ui.png +0 -0
- data/docs/source/images/show-password-button.png +0 -0
- data/docs/source/images/storefront-autocomplete.png +0 -0
- data/docs/source/images/storefront-category-summary-content-block.png +0 -0
- data/docs/source/images/storefront-category.png +0 -0
- data/docs/source/images/storefront-product-after-overriding.png +0 -0
- data/docs/source/images/storefront-product-before-overriding.png +0 -0
- data/docs/source/images/storefront-product-browse-page.png +0 -0
- data/docs/source/images/storefront-product-recommendations.png +0 -0
- data/docs/source/images/storefront-product-show-page.png +0 -0
- data/docs/source/images/storefront-requests-and-search-requests.png +0 -0
- data/docs/source/images/storefront-search-request-handling.png +0 -0
- data/docs/source/images/storefront-search-response-creation.png +0 -0
- data/docs/source/images/storefront-search.png +0 -0
- data/docs/source/images/storefront-style-guides-navigation.png +0 -0
- data/docs/source/images/styles.css +0 -3
- data/docs/source/images/tax-categories-ui.png +0 -0
- data/docs/source/images/tax-rates-ui.png +0 -0
- data/docs/source/images/unpurchasable-product.png +0 -0
- data/docs/source/images/url-redirects-filtering.png +0 -0
- data/docs/source/images/utility-nav-area-in-admin.png +0 -0
- data/docs/source/images/utility-nav-area-in-storefront.png +0 -0
- data/docs/source/images/validation-message-in-storefront.png +0 -0
- data/docs/source/images/view-model-interface.png +0 -0
- data/docs/source/images/viewing-workarea-version-in-source.png +0 -0
- data/docs/source/images/workarea.svg +0 -1
- data/docs/source/images/worst-performing-searches-on-results-customization-page.png +0 -0
- data/docs/source/images/writing-data.svg +0 -1
- data/docs/source/index.html.erb +0 -166
- data/docs/source/javascripts/jquery.js +0 -2
- data/docs/source/javascripts/lunr.js +0 -7
- data/docs/source/javascripts/site.js +0 -299
- data/docs/source/javascripts/vendor/highlight.pack.js +0 -2
- data/docs/source/layouts/article.erb +0 -106
- data/docs/source/layouts/bare.erb +0 -46
- data/docs/source/layouts/layout.erb +0 -43
- data/docs/source/release-notes/workarea-3-0-0.html.md +0 -146
- data/docs/source/release-notes/workarea-3-0-1.html.md +0 -161
- data/docs/source/release-notes/workarea-3-0-10.html.md +0 -39
- data/docs/source/release-notes/workarea-3-0-11.html.md +0 -277
- data/docs/source/release-notes/workarea-3-0-12.html.md +0 -14
- data/docs/source/release-notes/workarea-3-0-13.html.md +0 -153
- data/docs/source/release-notes/workarea-3-0-14.html.md +0 -93
- data/docs/source/release-notes/workarea-3-0-15.html.md +0 -107
- data/docs/source/release-notes/workarea-3-0-16.html.md +0 -36
- data/docs/source/release-notes/workarea-3-0-17.html.md +0 -141
- data/docs/source/release-notes/workarea-3-0-18.html.md +0 -123
- data/docs/source/release-notes/workarea-3-0-19.html.md +0 -160
- data/docs/source/release-notes/workarea-3-0-2.html.md +0 -222
- data/docs/source/release-notes/workarea-3-0-20.html.md +0 -95
- data/docs/source/release-notes/workarea-3-0-21.html.md +0 -168
- data/docs/source/release-notes/workarea-3-0-22.html.md +0 -268
- data/docs/source/release-notes/workarea-3-0-23.html.md +0 -173
- data/docs/source/release-notes/workarea-3-0-24.html.md +0 -19
- data/docs/source/release-notes/workarea-3-0-25.html.md +0 -26
- data/docs/source/release-notes/workarea-3-0-26.html.md +0 -199
- data/docs/source/release-notes/workarea-3-0-27.html.md +0 -113
- data/docs/source/release-notes/workarea-3-0-28.html.md +0 -39
- data/docs/source/release-notes/workarea-3-0-29.html.md +0 -73
- data/docs/source/release-notes/workarea-3-0-3.html.md +0 -35
- data/docs/source/release-notes/workarea-3-0-30.html.md +0 -186
- data/docs/source/release-notes/workarea-3-0-31.html.md +0 -125
- data/docs/source/release-notes/workarea-3-0-32.html.md +0 -73
- data/docs/source/release-notes/workarea-3-0-33.html.md +0 -137
- data/docs/source/release-notes/workarea-3-0-34.html.md +0 -203
- data/docs/source/release-notes/workarea-3-0-35.html.md +0 -205
- data/docs/source/release-notes/workarea-3-0-36.html.md +0 -105
- data/docs/source/release-notes/workarea-3-0-37.html.md +0 -144
- data/docs/source/release-notes/workarea-3-0-38.html.md +0 -73
- data/docs/source/release-notes/workarea-3-0-39.html.md +0 -77
- data/docs/source/release-notes/workarea-3-0-4.html.md +0 -14
- data/docs/source/release-notes/workarea-3-0-40.html.md +0 -130
- data/docs/source/release-notes/workarea-3-0-41.html.md +0 -70
- data/docs/source/release-notes/workarea-3-0-42.html.md +0 -52
- data/docs/source/release-notes/workarea-3-0-43.html.md +0 -72
- data/docs/source/release-notes/workarea-3-0-44.html.md +0 -93
- data/docs/source/release-notes/workarea-3-0-45.html.md +0 -61
- data/docs/source/release-notes/workarea-3-0-46.html.md +0 -171
- data/docs/source/release-notes/workarea-3-0-47.html.md +0 -130
- data/docs/source/release-notes/workarea-3-0-48.html.md +0 -160
- data/docs/source/release-notes/workarea-3-0-49.html.md +0 -28
- data/docs/source/release-notes/workarea-3-0-5.html.md +0 -225
- data/docs/source/release-notes/workarea-3-0-50.html.md +0 -74
- data/docs/source/release-notes/workarea-3-0-51.html.md +0 -61
- data/docs/source/release-notes/workarea-3-0-52.html.md +0 -76
- data/docs/source/release-notes/workarea-3-0-53.html.md +0 -126
- data/docs/source/release-notes/workarea-3-0-54.html.md +0 -112
- data/docs/source/release-notes/workarea-3-0-55.html.md +0 -105
- data/docs/source/release-notes/workarea-3-0-56.html.md +0 -56
- data/docs/source/release-notes/workarea-3-0-57.html.md +0 -82
- data/docs/source/release-notes/workarea-3-0-58.html.md +0 -153
- data/docs/source/release-notes/workarea-3-0-59.html.md +0 -78
- data/docs/source/release-notes/workarea-3-0-6.html.md +0 -165
- data/docs/source/release-notes/workarea-3-0-60.html.md +0 -43
- data/docs/source/release-notes/workarea-3-0-61.html.md +0 -46
- data/docs/source/release-notes/workarea-3-0-62.html.md +0 -23
- data/docs/source/release-notes/workarea-3-0-63.html.md +0 -25
- data/docs/source/release-notes/workarea-3-0-64.html.md +0 -25
- data/docs/source/release-notes/workarea-3-0-65.html.md +0 -37
- data/docs/source/release-notes/workarea-3-0-7.html.md +0 -207
- data/docs/source/release-notes/workarea-3-0-8.html.md +0 -337
- data/docs/source/release-notes/workarea-3-0-9.html.md +0 -196
- data/docs/source/release-notes/workarea-3-1-0.html.md +0 -414
- data/docs/source/release-notes/workarea-3-1-1.html.md +0 -139
- data/docs/source/release-notes/workarea-3-1-10.html.md +0 -19
- data/docs/source/release-notes/workarea-3-1-11.html.md +0 -27
- data/docs/source/release-notes/workarea-3-1-12.html.md +0 -216
- data/docs/source/release-notes/workarea-3-1-13.html.md +0 -113
- data/docs/source/release-notes/workarea-3-1-14.html.md +0 -39
- data/docs/source/release-notes/workarea-3-1-15.html.md +0 -107
- data/docs/source/release-notes/workarea-3-1-16.html.md +0 -188
- data/docs/source/release-notes/workarea-3-1-17.html.md +0 -141
- data/docs/source/release-notes/workarea-3-1-18.html.md +0 -73
- data/docs/source/release-notes/workarea-3-1-19.html.md +0 -137
- data/docs/source/release-notes/workarea-3-1-2.html.md +0 -55
- data/docs/source/release-notes/workarea-3-1-20.html.md +0 -203
- data/docs/source/release-notes/workarea-3-1-21.html.md +0 -205
- data/docs/source/release-notes/workarea-3-1-22.html.md +0 -121
- data/docs/source/release-notes/workarea-3-1-23.html.md +0 -144
- data/docs/source/release-notes/workarea-3-1-24.html.md +0 -94
- data/docs/source/release-notes/workarea-3-1-25.html.md +0 -77
- data/docs/source/release-notes/workarea-3-1-26.html.md +0 -130
- data/docs/source/release-notes/workarea-3-1-27.html.md +0 -70
- data/docs/source/release-notes/workarea-3-1-28.html.md +0 -52
- data/docs/source/release-notes/workarea-3-1-29.html.md +0 -44
- data/docs/source/release-notes/workarea-3-1-3.html.md +0 -185
- data/docs/source/release-notes/workarea-3-1-30.html.md +0 -72
- data/docs/source/release-notes/workarea-3-1-31.html.md +0 -93
- data/docs/source/release-notes/workarea-3-1-32.html.md +0 -61
- data/docs/source/release-notes/workarea-3-1-33.html.md +0 -171
- data/docs/source/release-notes/workarea-3-1-34.html.md +0 -130
- data/docs/source/release-notes/workarea-3-1-35.html.md +0 -179
- data/docs/source/release-notes/workarea-3-1-36.html.md +0 -28
- data/docs/source/release-notes/workarea-3-1-37.html.md +0 -74
- data/docs/source/release-notes/workarea-3-1-38.html.md +0 -61
- data/docs/source/release-notes/workarea-3-1-39.html.md +0 -96
- data/docs/source/release-notes/workarea-3-1-4.html.md +0 -148
- data/docs/source/release-notes/workarea-3-1-40.html.md +0 -126
- data/docs/source/release-notes/workarea-3-1-41.html.md +0 -128
- data/docs/source/release-notes/workarea-3-1-42.html.md +0 -105
- data/docs/source/release-notes/workarea-3-1-43.html.md +0 -37
- data/docs/source/release-notes/workarea-3-1-44.html.md +0 -82
- data/docs/source/release-notes/workarea-3-1-45.html.md +0 -153
- data/docs/source/release-notes/workarea-3-1-46.html.md +0 -91
- data/docs/source/release-notes/workarea-3-1-47.html.md +0 -65
- data/docs/source/release-notes/workarea-3-1-48.html.md +0 -46
- data/docs/source/release-notes/workarea-3-1-49.html.md +0 -23
- data/docs/source/release-notes/workarea-3-1-5.html.md +0 -169
- data/docs/source/release-notes/workarea-3-1-50.html.md +0 -42
- data/docs/source/release-notes/workarea-3-1-51.html.md +0 -25
- data/docs/source/release-notes/workarea-3-1-52.html.md +0 -57
- data/docs/source/release-notes/workarea-3-1-6.html.md +0 -117
- data/docs/source/release-notes/workarea-3-1-7.html.md +0 -176
- data/docs/source/release-notes/workarea-3-1-8.html.md +0 -283
- data/docs/source/release-notes/workarea-3-1-9.html.md +0 -212
- data/docs/source/release-notes/workarea-3-2-0.html.md +0 -1705
- data/docs/source/release-notes/workarea-3-2-1.html.md +0 -216
- data/docs/source/release-notes/workarea-3-2-10.html.md +0 -237
- data/docs/source/release-notes/workarea-3-2-11.html.md +0 -121
- data/docs/source/release-notes/workarea-3-2-12.html.md +0 -145
- data/docs/source/release-notes/workarea-3-2-13.html.md +0 -138
- data/docs/source/release-notes/workarea-3-2-14.html.md +0 -77
- data/docs/source/release-notes/workarea-3-2-15.html.md +0 -130
- data/docs/source/release-notes/workarea-3-2-16.html.md +0 -111
- data/docs/source/release-notes/workarea-3-2-17.html.md +0 -52
- data/docs/source/release-notes/workarea-3-2-18.html.md +0 -44
- data/docs/source/release-notes/workarea-3-2-19.html.md +0 -72
- data/docs/source/release-notes/workarea-3-2-2.html.md +0 -145
- data/docs/source/release-notes/workarea-3-2-20.html.md +0 -93
- data/docs/source/release-notes/workarea-3-2-21.html.md +0 -61
- data/docs/source/release-notes/workarea-3-2-22.html.md +0 -154
- data/docs/source/release-notes/workarea-3-2-23.html.md +0 -130
- data/docs/source/release-notes/workarea-3-2-24.html.md +0 -200
- data/docs/source/release-notes/workarea-3-2-25.html.md +0 -28
- data/docs/source/release-notes/workarea-3-2-26.html.md +0 -94
- data/docs/source/release-notes/workarea-3-2-27.html.md +0 -61
- data/docs/source/release-notes/workarea-3-2-28.html.md +0 -96
- data/docs/source/release-notes/workarea-3-2-29.html.md +0 -126
- data/docs/source/release-notes/workarea-3-2-30.html.md +0 -112
- data/docs/source/release-notes/workarea-3-2-31.html.md +0 -105
- data/docs/source/release-notes/workarea-3-2-32.html.md +0 -56
- data/docs/source/release-notes/workarea-3-2-33.html.md +0 -82
- data/docs/source/release-notes/workarea-3-2-34.html.md +0 -153
- data/docs/source/release-notes/workarea-3-2-35.html.md +0 -91
- data/docs/source/release-notes/workarea-3-2-36.html.md +0 -118
- data/docs/source/release-notes/workarea-3-2-37.html.md +0 -46
- data/docs/source/release-notes/workarea-3-2-38.html.md +0 -23
- data/docs/source/release-notes/workarea-3-2-39.html.md +0 -42
- data/docs/source/release-notes/workarea-3-2-4.html.md +0 -109
- data/docs/source/release-notes/workarea-3-2-40.html.md +0 -25
- data/docs/source/release-notes/workarea-3-2-41.html.md +0 -90
- data/docs/source/release-notes/workarea-3-2-5.html.md +0 -186
- data/docs/source/release-notes/workarea-3-2-6.html.md +0 -173
- data/docs/source/release-notes/workarea-3-2-7.html.md +0 -89
- data/docs/source/release-notes/workarea-3-2-8.html.md +0 -137
- data/docs/source/release-notes/workarea-3-2-9.html.md +0 -219
- data/docs/source/release-notes/workarea-3-3-0.html.md +0 -1272
- data/docs/source/release-notes/workarea-3-3-1.html.md +0 -324
- data/docs/source/release-notes/workarea-3-3-10.html.md +0 -69
- data/docs/source/release-notes/workarea-3-3-11.html.md +0 -72
- data/docs/source/release-notes/workarea-3-3-12.html.md +0 -136
- data/docs/source/release-notes/workarea-3-3-13.html.md +0 -61
- data/docs/source/release-notes/workarea-3-3-14.html.md +0 -196
- data/docs/source/release-notes/workarea-3-3-15.html.md +0 -167
- data/docs/source/release-notes/workarea-3-3-16.html.md +0 -234
- data/docs/source/release-notes/workarea-3-3-17.html.md +0 -82
- data/docs/source/release-notes/workarea-3-3-18.html.md +0 -165
- data/docs/source/release-notes/workarea-3-3-19.html.md +0 -106
- data/docs/source/release-notes/workarea-3-3-2.html.md +0 -72
- data/docs/source/release-notes/workarea-3-3-20.html.md +0 -116
- data/docs/source/release-notes/workarea-3-3-21.html.md +0 -228
- data/docs/source/release-notes/workarea-3-3-22.html.md +0 -125
- data/docs/source/release-notes/workarea-3-3-23.html.md +0 -154
- data/docs/source/release-notes/workarea-3-3-24.html.md +0 -70
- data/docs/source/release-notes/workarea-3-3-25.html.md +0 -114
- data/docs/source/release-notes/workarea-3-3-26.html.md +0 -260
- data/docs/source/release-notes/workarea-3-3-27.html.md +0 -138
- data/docs/source/release-notes/workarea-3-3-28.html.md +0 -147
- data/docs/source/release-notes/workarea-3-3-29.html.md +0 -63
- data/docs/source/release-notes/workarea-3-3-3.html.md +0 -153
- data/docs/source/release-notes/workarea-3-3-30.html.md +0 -102
- data/docs/source/release-notes/workarea-3-3-31.html.md +0 -57
- data/docs/source/release-notes/workarea-3-3-32.html.md +0 -44
- data/docs/source/release-notes/workarea-3-3-33.html.md +0 -114
- data/docs/source/release-notes/workarea-3-3-34.html.md +0 -29
- data/docs/source/release-notes/workarea-3-3-4.html.md +0 -332
- data/docs/source/release-notes/workarea-3-3-5.html.md +0 -242
- data/docs/source/release-notes/workarea-3-3-6.html.md +0 -100
- data/docs/source/release-notes/workarea-3-3-7.html.md +0 -148
- data/docs/source/release-notes/workarea-3-3-8.html.md +0 -163
- data/docs/source/release-notes/workarea-3-3-9.html.md +0 -93
- data/docs/source/release-notes/workarea-3-4-0.html.md +0 -580
- data/docs/source/release-notes/workarea-3-4-1.html.md +0 -150
- data/docs/source/release-notes/workarea-3-4-10.html.md +0 -72
- data/docs/source/release-notes/workarea-3-4-11.html.md +0 -60
- data/docs/source/release-notes/workarea-3-4-12.html.md +0 -155
- data/docs/source/release-notes/workarea-3-4-15.html.md +0 -100
- data/docs/source/release-notes/workarea-3-4-16.html.md +0 -88
- data/docs/source/release-notes/workarea-3-4-2.html.md +0 -188
- data/docs/source/release-notes/workarea-3-4-3.html.md +0 -136
- data/docs/source/release-notes/workarea-3-4-4.html.md +0 -114
- data/docs/source/release-notes/workarea-3-4-5.html.md +0 -275
- data/docs/source/release-notes/workarea-3-4-6.html.md +0 -169
- data/docs/source/release-notes/workarea-3-4-7.html.md +0 -162
- data/docs/source/release-notes/workarea-3-4-8.html.md +0 -95
- data/docs/source/release-notes/workarea-3-4-9.html.md +0 -135
- data/docs/source/release-notes.html.md +0 -261
- data/docs/source/search.html.erb +0 -34
- data/docs/source/shared/_header.erb +0 -61
- data/docs/source/shared/_svgs.erb +0 -17
- data/docs/source/style_guide/index.html.erb +0 -382
- data/docs/source/stylesheets/_base.scss +0 -125
- data/docs/source/stylesheets/_components.scss +0 -669
- data/docs/source/stylesheets/_helpers.scss +0 -10
- data/docs/source/stylesheets/_opinions.scss +0 -42
- data/docs/source/stylesheets/_settings.scss +0 -56
- data/docs/source/stylesheets/_typography.scss +0 -119
- data/docs/source/stylesheets/site.css.scss +0 -14
- data/docs/source/stylesheets/vendor/_avalanche.scss +0 -328
- data/docs/source/stylesheets/vendor/_normalize.scss +0 -341
- data/docs/source/stylesheets/vendor/highlight/_tomorrow_night_blue.scss +0 -75
- data/docs/source/upgrade-guides/workarea-3-4-0.html.md +0 -152
- data/docs/source/upgrade-guides.html.md +0 -18
- data/docs/workarea_renderer.rb +0 -8
- data/docs/yarn.lock +0 -2522
@@ -1,415 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Decoration
|
3
|
-
excerpt: Decoration is an extension technique that allows Workarea applications and plugins to modify Ruby classes provided by the Workarea platform and other Ruby libraries. Ruby is a dynamic language that allows classes (and their instances) to be modifie
|
4
|
-
---
|
5
|
-
|
6
|
-
# Decoration
|
7
|
-
|
8
|
-
<dfn>Decoration</dfn> is an extension technique that allows Workarea applications and plugins to modify Ruby classes provided by the Workarea platform and other Ruby libraries. Ruby is a dynamic language that allows classes (and their instances) to be modified during runtime, however the syntax and APIs that Ruby provides for this purpose can be confusing to less experienced Ruby developers. Workarea therefore leverages <cite>Rails::Decorators</cite> ([gem](https://rubygems.org/gems/rails-decorators/versions/0.1.2), [docs](http://www.rubydoc.info/gems/rails-decorators/0.1.2), [source](https://github.com/weblinc/rails-decorators)), an open source Ruby library also maintained by Workarea, to simplify the process of extending classes.
|
9
|
-
|
10
|
-
Rails::Decorators specifies a DSL (based on Rails' [ActiveSupport::Concern](http://www.rubydoc.info/gems/activesupport/5.1.4/ActiveSupport/Concern)) to be used within <dfn>decorators</dfn>, which are Ruby files whose names end with _.decorator_. Each decorator extends one or more Ruby classes. Rails::Decorators ensures decorators within applications and plugins are autoloaded _after_ Rails autoloads the class definitions from the application and its dependencies.
|
11
|
-
|
12
|
-
## Decorators
|
13
|
-
|
14
|
-
Decorators allow application and plugin authors to extend existing Ruby classes in the following ways.
|
15
|
-
|
16
|
-
- Add new instance and class methods to a class
|
17
|
-
- Modify existing instance and class methods, with access to the pre-decoration implementation via `super`
|
18
|
-
- Execute class macros or other code as if you were in the original class definition
|
19
|
-
|
20
|
-
Because decorators contain only _differences_ from the classes they are extending, they are more lightweight than other extension techniques that completely replace the code to be customized. During an upgrade, if code you've decorated has changed, you may need to update your decorators. However, code changes you haven't decorated will be applied seamlessly to your application without additional upgrade cost.
|
21
|
-
|
22
|
-
## Decorator Example
|
23
|
-
|
24
|
-
I extracted the following example from the [Workarea Package Products](https://github.com/workarea-commerce/workarea-package-products) plugin and present it here with minor edits and annotations to demonstrate the structure of a decorator. Review the [Rails::Decorators documentation](http://www.rubydoc.info/gems/rails-decorators/0.1.2) for more details.
|
25
|
-
|
26
|
-
```ruby
|
27
|
-
# workarea-package_products-3.1.0/app/models/workarea/catalog/product.decorator
|
28
|
-
# The path of the decorator mimics the path of the class to be decorated
|
29
|
-
|
30
|
-
# Open namespace for convenience (to avoid fully qualified constants)
|
31
|
-
module Workarea
|
32
|
-
# Pass the classes to be decorated and any options to 'decorate', along with a block
|
33
|
-
# Decorators within plugins use the 'with' option to avoid naming collisions (see text below)
|
34
|
-
decorate Catalog::Product, with: :package_products do
|
35
|
-
# Code within the 'decorated' block is executed as if it were included in the class definition
|
36
|
-
# Use this block to execute class macros or other metaprogramming
|
37
|
-
decorated do
|
38
|
-
include FeaturedProducts
|
39
|
-
|
40
|
-
scope :packages_containing, ->(id) { where('product_ids' => id) }
|
41
|
-
end
|
42
|
-
|
43
|
-
# Use the 'class_methods' block to add and modify class methods
|
44
|
-
class_methods do
|
45
|
-
def find_for_update_by_sku(sku)
|
46
|
-
where('variants.sku' => sku).flat_map do |product|
|
47
|
-
[product] + packages_containing(product.id)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# Add and modify instance methods directly within the 'decorate' block
|
53
|
-
|
54
|
-
def package?
|
55
|
-
template == 'package' || product_ids.present?
|
56
|
-
end
|
57
|
-
|
58
|
-
def family?
|
59
|
-
template == 'family'
|
60
|
-
end
|
61
|
-
|
62
|
-
def active?
|
63
|
-
(read_attribute(:active) && variants.active.any? || product_ids.present?)
|
64
|
-
end
|
65
|
-
|
66
|
-
def purchasable?
|
67
|
-
# Use 'super' to find the same method in the ancestor chain and invoke it
|
68
|
-
# This provides access to the "pre-decorated" implementation (see examples below)
|
69
|
-
super && package?
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
```
|
74
|
-
|
75
|
-
## Decorating Tests
|
76
|
-
|
77
|
-
Because [tests](testing.html) are Ruby methods, you can extend tests by decorating test cases, the classes in which test methods are defined. When decorating features, you should always decorate the corresponding tests as well.
|
78
|
-
|
79
|
-
The following examples from [Workarea Browse Option](https://github.com/workarea-commerce/workarea-browse-option) demonstrate the need to decorate a feature and its tests together. In the first example, Browse Option decorates `Search::ProductEntries` so that products that "browse by option" are represented by multiple documents in Elasticsearch. This is new functionality, not covered by the existing test suite, so the plugin also decorates `Search::ProductEntriesTest` adding a new test to confirm the behavior.
|
80
|
-
|
81
|
-
```ruby
|
82
|
-
# workarea-browse_option-1.1.0/app/queries/search/product_entries.decorator
|
83
|
-
|
84
|
-
module Workarea
|
85
|
-
decorate Search::ProductEntries, with: :browse_option do
|
86
|
-
def index_entries_for(product)
|
87
|
-
if product.browses_by_option?
|
88
|
-
product.browse_options.map do |value|
|
89
|
-
Search::Storefront::ProductOption.new(
|
90
|
-
product,
|
91
|
-
option: product.browse_option,
|
92
|
-
value: value
|
93
|
-
)
|
94
|
-
end
|
95
|
-
else
|
96
|
-
super
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
# workarea-browse_option-1.1.0/test/queries/workarea/search/product_entries_test.decorator
|
103
|
-
|
104
|
-
require 'test_helper'
|
105
|
-
|
106
|
-
module Workarea
|
107
|
-
decorate Search::ProductEntriesTest, with: :browse_option do
|
108
|
-
def test_browse_option_entries
|
109
|
-
products = Array.new(2) { create_product }
|
110
|
-
|
111
|
-
products.first.update_attributes!(
|
112
|
-
browse_option: 'color',
|
113
|
-
variants: [
|
114
|
-
{ sku: 'SKU1', details: { color: ['Red'] } },
|
115
|
-
{ sku: 'SKU2', details: { color: ['Blue'] } }
|
116
|
-
]
|
117
|
-
)
|
118
|
-
|
119
|
-
assert(3, Search::ProductEntries.new(products).entries.size)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
```
|
124
|
-
|
125
|
-
In the next example, Browse Option decorates `BulkIndexProducts`, changing the behavior of `perform_by_models`. This change breaks an existing test for `perform`, since `perform_by_models` is used in that method's implementation. The plugin therefore decorates `BulkIndexProductsTest` as well, in order to fix the test for `perform`.
|
126
|
-
|
127
|
-
```ruby
|
128
|
-
# workarea-browse_option-1.1.0/app/workers/workarea/bulk_index_products.decorator
|
129
|
-
|
130
|
-
module Workarea
|
131
|
-
decorate BulkIndexProducts, with: :browse_option do
|
132
|
-
class_methods do
|
133
|
-
def perform_by_models(products)
|
134
|
-
return if products.blank?
|
135
|
-
|
136
|
-
documents = delete_actions(products) +
|
137
|
-
Search::ProductEntries.new(products).map(&:as_bulk_document)
|
138
|
-
|
139
|
-
Search::Storefront.bulk(documents)
|
140
|
-
products.each { |p| p.set(last_indexed_at: Time.current) }
|
141
|
-
end
|
142
|
-
|
143
|
-
# ...
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
# workarea-browse_option-1.1.0/test/workers/workarea/bulk_index_products_test.decorator
|
149
|
-
|
150
|
-
require 'test_helper'
|
151
|
-
|
152
|
-
module Workarea
|
153
|
-
decorate BulkIndexProductsTest, with: :browse_option do
|
154
|
-
def test_peform
|
155
|
-
Workarea::Search::Storefront.reset_indexes!
|
156
|
-
|
157
|
-
Sidekiq::Callbacks.disable(IndexProduct) do
|
158
|
-
products = Array.new(2) { create_product }
|
159
|
-
|
160
|
-
assert_equal(0, Search::Storefront.count)
|
161
|
-
BulkIndexProducts.new.perform(products.map(&:id))
|
162
|
-
assert_equal(2, Search::Storefront.count)
|
163
|
-
|
164
|
-
products.first.update_attributes!(
|
165
|
-
browse_option: 'color',
|
166
|
-
variants: [
|
167
|
-
{ sku: 'SKU1', details: { color: ['Red'] } },
|
168
|
-
{ sku: 'SKU2', details: { color: ['Blue'] } }
|
169
|
-
]
|
170
|
-
)
|
171
|
-
|
172
|
-
assert_equal(2, Search::Storefront.count)
|
173
|
-
BulkIndexProducts.new.perform(products.map(&:id))
|
174
|
-
assert_equal(3, Search::Storefront.count)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
# ...
|
179
|
-
end
|
180
|
-
end
|
181
|
-
```
|
182
|
-
|
183
|
-
Also see [Writing Test Decorators](testing.html#writing-test-decorators) within the [Testing](testing.html) guide for more on this topic.
|
184
|
-
|
185
|
-
## Compounding Decorators
|
186
|
-
|
187
|
-
Multiple engines may decorate the same class, in which case the effects of the decorators are cumulative. Decorators within the application are prepended last, giving them the opportunity to modify their classes after all plugin decorators.
|
188
|
-
|
189
|
-
For example, I've created a new application and added the following decorator within my app to begin implementing a loyalty program.
|
190
|
-
|
191
|
-
```ruby
|
192
|
-
# app/models/workarea/catalog/product.decorator
|
193
|
-
|
194
|
-
module Workarea
|
195
|
-
decorate Catalog::Product do
|
196
|
-
decorated do
|
197
|
-
field :loyalty_points, type: Integer, default: 100
|
198
|
-
end
|
199
|
-
|
200
|
-
def loyalty_promo?
|
201
|
-
loyalty_points > 100
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
```
|
206
|
-
|
207
|
-
My application depends on several Workarea plugins.
|
208
|
-
|
209
|
-
```bash
|
210
|
-
$ grep 'workarea' Gemfile
|
211
|
-
gem 'workarea', '~> 3.1.0'
|
212
|
-
gem 'workarea-blog'
|
213
|
-
gem 'workarea-browse_option'
|
214
|
-
gem 'workarea-clothing'
|
215
|
-
gem 'workarea-content_search'
|
216
|
-
gem 'workarea-package_products'
|
217
|
-
gem 'workarea-reviews'
|
218
|
-
gem 'workarea-share'
|
219
|
-
```
|
220
|
-
|
221
|
-
Most of these plugins include the same decorator I've included in my application. In the example below, I search for the path _workarea/catalog/product_ within my application and its dependencies. In the results, you can see the following.
|
222
|
-
|
223
|
-
- The original Product model from Workarea Core
|
224
|
-
- The Product decorator I added to my application
|
225
|
-
- Four additional Product decorators, one each from Workarea Browse Option, Workarea Clothing, Workarea Package Products, and Workarea Reviews
|
226
|
-
|
227
|
-
```bash
|
228
|
-
$ find . -path '*workarea/catalog/product.*'
|
229
|
-
./app/models/workarea/catalog/product.decorator
|
230
|
-
./vendor/ruby/2.4.0/gems/workarea-browse_option-1.1.0/app/models/workarea/catalog/product.decorator
|
231
|
-
./vendor/ruby/2.4.0/gems/workarea-clothing-2.1.0/app/models/workarea/catalog/product.decorator
|
232
|
-
./vendor/ruby/2.4.0/gems/workarea-core-3.1.1/app/models/workarea/catalog/product.rb
|
233
|
-
./vendor/ruby/2.4.0/gems/workarea-package_products-3.1.0/app/models/workarea/catalog/product.decorator
|
234
|
-
./vendor/ruby/2.4.0/gems/workarea-reviews-2.1.0/app/models/workarea/catalog/product.decorator
|
235
|
-
```
|
236
|
-
|
237
|
-
To quickly demonstrate the effect of multiple decorators on the Product class, the following example (which I've annotated) lists the class's immediate ancestors.
|
238
|
-
|
239
|
-
```bash
|
240
|
-
$ bin/rails r 'puts Workarea::Catalog::Product.ancestors' | grep 'Workarea'
|
241
|
-
Workarea::Catalog::Product::ProductDecorator # application decorator
|
242
|
-
Workarea::Catalog::Product::ReviewsProductDecorator # |
|
243
|
-
Workarea::Catalog::Product::PackageProductsProductDecorator # |-- plugin decorators
|
244
|
-
Workarea::Catalog::Product::ClothingProductDecorator # |
|
245
|
-
Workarea::Catalog::Product::BrowseOptionProductDecorator # |
|
246
|
-
Workarea::Catalog::Product # original class
|
247
|
-
Workarea::FeaturedProducts
|
248
|
-
Workarea::Details
|
249
|
-
Workarea::Commentable
|
250
|
-
Workarea::Navigable
|
251
|
-
Workarea::Releasable
|
252
|
-
Workarea::ApplicationDocument
|
253
|
-
```
|
254
|
-
|
255
|
-
When looking up methods originally defined in this class, Ruby will actually look through the modules and classes as they are ordered above (top to bottom). Note the plugin decorator modules are searched before the original class, and they are searched in the opposite order the plugins are included in the Gemfile. Each plugin decorator module has a prefix that is derived from the value of the `:with` option in the decorator. The `:with` value must be unique to the ecosystem to avoid naming conflicts.
|
256
|
-
|
257
|
-
The application decorator module is searched first. Notice it does not have a prefix, because the `:with` option is omitted from the decorator, which is common practice for application decorators. Because the application decorator module is searched first, it has the responsibility of resolving any conflicts resulting from the culmination of the other decorators.
|
258
|
-
|
259
|
-
## Super
|
260
|
-
|
261
|
-
Within a decorator's method definitions, calling `super` results in calling the same method on the closest ancestor in which it is defined. An example ancestor chain is shown above. As you can see from that example, a decorator may in fact be extending another decorator. Furthermore, calling `super` has various applications that may not be immediately obvious. The following examples, taken from various plugins, demonstrate uses of `super` within decorators.
|
262
|
-
|
263
|
-
In the following examples, <dfn>command</dfn> refers to a method concerned with side effects, while <dfn>query</dfn> refers to a method concerned with a return value.
|
264
|
-
|
265
|
-
### Prepend to a Command
|
266
|
-
|
267
|
-
```ruby
|
268
|
-
# workarea-browse_option-1.1.0/app/workers/workarea/index_product.decorator
|
269
|
-
|
270
|
-
module Workarea
|
271
|
-
decorate IndexProduct, with: :browse_option do
|
272
|
-
class_methods do
|
273
|
-
def perform(product)
|
274
|
-
clear(product)
|
275
|
-
super
|
276
|
-
end
|
277
|
-
|
278
|
-
def clear(product)
|
279
|
-
# ...
|
280
|
-
end
|
281
|
-
end
|
282
|
-
end
|
283
|
-
end
|
284
|
-
```
|
285
|
-
|
286
|
-
### Conditionally Append to a Command
|
287
|
-
|
288
|
-
```ruby
|
289
|
-
# workarea-package_products-3.1.0/app/controllers/workarea/storefront/products_controller.decorator
|
290
|
-
|
291
|
-
module Workarea
|
292
|
-
decorate Storefront::ProductsController, with: :package_products do
|
293
|
-
def show
|
294
|
-
super
|
295
|
-
render 'package_show' if @product.package?
|
296
|
-
end
|
297
|
-
end
|
298
|
-
end
|
299
|
-
```
|
300
|
-
|
301
|
-
### Conditionally Replace a Command
|
302
|
-
|
303
|
-
```ruby
|
304
|
-
# workarea-content_search-1.0.1/app/controllers/workarea/storefront/searches_controller.decorator
|
305
|
-
|
306
|
-
module Workarea
|
307
|
-
decorate Storefront::SearchesController, with: :content_search do
|
308
|
-
# ...
|
309
|
-
|
310
|
-
def set_search(response)
|
311
|
-
if response.template == 'content'
|
312
|
-
@search = Storefront::ContentSearchViewModel.new(response, view_model_options)
|
313
|
-
else
|
314
|
-
super
|
315
|
-
end
|
316
|
-
end
|
317
|
-
end
|
318
|
-
end
|
319
|
-
```
|
320
|
-
|
321
|
-
### Append to a Query
|
322
|
-
|
323
|
-
```ruby
|
324
|
-
# workarea-reviews-2.1.0/app/models/workarea/search/storefront/product.decorator
|
325
|
-
|
326
|
-
module Workarea
|
327
|
-
decorate Search::Storefront::Product, with: :reviews do
|
328
|
-
def sorts
|
329
|
-
super.merge(
|
330
|
-
rating: Review.find_sorting_score(model.id)
|
331
|
-
)
|
332
|
-
end
|
333
|
-
end
|
334
|
-
end
|
335
|
-
|
336
|
-
# workarea-reviews-2.1.0/app/queries/workarea/search/product_search.decorator
|
337
|
-
|
338
|
-
module Workarea
|
339
|
-
decorate Search::ProductSearch, with: :reviews do
|
340
|
-
class_methods do
|
341
|
-
def available_sorts
|
342
|
-
super.tap { |sorts| sorts << Sort.top_rated }
|
343
|
-
end
|
344
|
-
end
|
345
|
-
end
|
346
|
-
end
|
347
|
-
```
|
348
|
-
|
349
|
-
### Conditionally Prepend to a Query
|
350
|
-
|
351
|
-
```ruby
|
352
|
-
# workarea-browse_option-1.1.0/app/view_models/workarea/storefront/product_view_model/cache_key.decorator
|
353
|
-
|
354
|
-
module Workarea
|
355
|
-
decorate Storefront::ProductViewModel::CacheKey, with: :browse_option do
|
356
|
-
# ...
|
357
|
-
|
358
|
-
def option_parts
|
359
|
-
option = @product.browse_option
|
360
|
-
return super unless option.present? && @options[option].present?
|
361
|
-
|
362
|
-
super.unshift(@options[option])
|
363
|
-
end
|
364
|
-
end
|
365
|
-
end
|
366
|
-
```
|
367
|
-
|
368
|
-
### Conditionally Replace a Query
|
369
|
-
|
370
|
-
```ruby
|
371
|
-
# workarea-package_products-3.1.0/app/queries/workarea/search/product_entries.decorator
|
372
|
-
|
373
|
-
module Workarea
|
374
|
-
decorate Search::ProductEntries, with: :package_products do
|
375
|
-
def index_entries_for(product)
|
376
|
-
return Search::Storefront::PackageProduct.new(product) if product.package?
|
377
|
-
super
|
378
|
-
end
|
379
|
-
end
|
380
|
-
end
|
381
|
-
```
|
382
|
-
|
383
|
-
## Decorator Generator
|
384
|
-
|
385
|
-
Workarea provides a Rails generator that application developers can use to create a new decorator within an application. Given the path (relative to the engine root) to a file where a Workarea class is defined, the generator will create a decorator for that class within the application. The generator will also try to create decorators for applicable tests.
|
386
|
-
|
387
|
-
Run the generator with the _--help_ option for documentation and examples. The following example is from my demonstration app running Workarea 3.1.1.
|
388
|
-
|
389
|
-
```bash
|
390
|
-
$ bin/rails g workarea:decorator --help
|
391
|
-
Usage:
|
392
|
-
rails generate workarea:decorator PATH [options]
|
393
|
-
|
394
|
-
Runtime options:
|
395
|
-
-f, [--force] # Overwrite files that already exist
|
396
|
-
-p, [--pretend], [--no-pretend] # Run but do not make any changes
|
397
|
-
-q, [--quiet], [--no-quiet] # Suppress status output
|
398
|
-
-s, [--skip], [--no-skip] # Skip files that already exist
|
399
|
-
|
400
|
-
Description:
|
401
|
-
Generates a new decorator for a given PATH in a Workarea platform
|
402
|
-
component (or plugin), and a decorator for its unit test from the existing
|
403
|
-
codebase in your host app.
|
404
|
-
|
405
|
-
Example:
|
406
|
-
rails generate workarea:decorator app/models/workarea/search/storefront/product.rb
|
407
|
-
|
408
|
-
This will create:
|
409
|
-
app/models/workarea/search/storefront/product.decorator
|
410
|
-
test/models/workarea/search/storefront/product_test.decorator (if a test exists)
|
411
|
-
|
412
|
-
If no tests exist, it will also show a huge warning message stating the class you're
|
413
|
-
about to decorate has NO tests, so anything you change must be also
|
414
|
-
verified in the unit tests.
|
415
|
-
```
|
@@ -1,107 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Define & Configure Inventory Policies
|
3
|
-
excerpt: Procedures to define additional inventory policies and configure available policies
|
4
|
-
---
|
5
|
-
|
6
|
-
Define & Configure Inventory Policies
|
7
|
-
======================================================================
|
8
|
-
|
9
|
-
Workarea includes multiple inventory policies, which encapsulate the logic for translating the administrable inventory values (e.g. `:available` and `:backordered`) into inventory SKU states (e.g. `#purchasable` and `#displayable`).
|
10
|
-
( See [Inventory: Inventory Policies & SKU States](inventory.html#inventory-policies-amp-sku-states_5) for a full explanation. )
|
11
|
-
The included policies cover most use cases, but in order to satisfy the business requirements of a retailer, you may need to add one or more additional policies, or you may need to otherwise configure which policies are available (e.g. remove policies or re-order them within the Admin).
|
12
|
-
|
13
|
-
To perform these tasks, you need to know how to define and configure inventory policies, which is the subject of this document.
|
14
|
-
To define your own policy, add a class which implements the inventory policy interface: `#available_to_sell`, `#displayable?`, and `#purchase`.
|
15
|
-
Then, to make the policy available, or to otherwise affect the available policies, manipulate the configurable inventory policy collection: `Workarea.config.inventory_policies`.
|
16
|
-
|
17
|
-
|
18
|
-
Define New Policies
|
19
|
-
----------------------------------------------------------------------
|
20
|
-
|
21
|
-
To define a new policy, add a class definition at the following path:
|
22
|
-
|
23
|
-
`<app or plugin root>/app/models/workarea/inventory/policies/<policy name>.rb`
|
24
|
-
|
25
|
-
Within this file, define a class within the module `Workarea::Inventory::Policies` that inherits from `Base` or a policy on which you will base the new policy.
|
26
|
-
|
27
|
-
Finally, implement or re-implement any of the following methods that are unique to your policy (if inheriting from `Base`, you'll need to implement all of them):
|
28
|
-
|
29
|
-
* `#available_to_sell`
|
30
|
-
* `#displayable?`
|
31
|
-
* `#purchase(quantity)`
|
32
|
-
|
33
|
-
If you are unfamiliar with any of these methods, see [Inventory: Inventory Policies & SKU States](inventory.html#inventory-policies-amp-sku-states_5) and [Inventory: Purchasing, Capturing, and Releasing Inventory](inventory.html#purchasing-capturing-amp-releasing-inventory_14), and refer to the implementations of these methods within the existing inventory policies.
|
34
|
-
The following command will print the pathnames of the inventory policies available to your application:
|
35
|
-
|
36
|
-
```bash
|
37
|
-
find $(pwd) $(bundle show --paths | grep workarea) \
|
38
|
-
-path '*/app/*/inventory/policies/*.rb' | sort -u
|
39
|
-
```
|
40
|
-
|
41
|
-
|
42
|
-
### Examples
|
43
|
-
|
44
|
-
As an example, the "offline" policy ensures a shopper can view the item on the website but cannot purchase it (which must be done over the phone or by some other means explained on the screen):
|
45
|
-
|
46
|
-
```ruby
|
47
|
-
# <app or plugin root>/app/models/workarea/inventory/policies/offline.rb
|
48
|
-
|
49
|
-
module Workarea
|
50
|
-
module Inventory
|
51
|
-
module Policies
|
52
|
-
class Offline < Base
|
53
|
-
def displayable?
|
54
|
-
true
|
55
|
-
end
|
56
|
-
|
57
|
-
def available_to_sell
|
58
|
-
0
|
59
|
-
end
|
60
|
-
|
61
|
-
def purchase(quantity)
|
62
|
-
# noop
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
```
|
69
|
-
|
70
|
-
The "in store only" policy relies on other extensions that exist in the application or plugin:
|
71
|
-
|
72
|
-
```ruby
|
73
|
-
# <app or plugin root>/app/models/workarea/inventory/policies/in_store_only.rb
|
74
|
-
|
75
|
-
module Workarea
|
76
|
-
module Inventory
|
77
|
-
module Policies
|
78
|
-
class InStoreOnly < Standard
|
79
|
-
def available_to_sell
|
80
|
-
sku.available_in_store
|
81
|
-
end
|
82
|
-
|
83
|
-
def purchase(quantity)
|
84
|
-
# noop
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
```
|
91
|
-
|
92
|
-
|
93
|
-
Configure Available Policies
|
94
|
-
----------------------------------------------------------------------
|
95
|
-
|
96
|
-
Add your new policy to the configurable collection of available inventory policies:
|
97
|
-
|
98
|
-
```ruby
|
99
|
-
# <app or plugin root>/config/initializers/inventory_policies.rb
|
100
|
-
|
101
|
-
Workarea.config.inventory_policies << 'Workarea::Inventory::Policies::Offline'
|
102
|
-
```
|
103
|
-
|
104
|
-
You can also remove or sort the policies using the methods of [SwappableList](swappable-list-data-structure.html).
|
105
|
-
When saving an inventory policy, its policy is validated to ensure it is a member of this collection.
|
106
|
-
And this is the list of policies that is presented for selection within the inventory SKU administration screens.
|
107
|
-
The first policy in this collection is the default policy for new inventory SKUs.
|
@@ -1,48 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Documentation Style Guide
|
3
|
-
excerpt: Documentation contributions should uphold the following style rules
|
4
|
-
---
|
5
|
-
|
6
|
-
# Documentation Style Guide
|
7
|
-
|
8
|
-
Documentation contributions should uphold the following style rules.
|
9
|
-
|
10
|
-
## Voice
|
11
|
-
|
12
|
-
Write as an expert on the software, rather than one of its maintainers. This encourages contributions. For example, instead of “we decided to change…”, use “Workarea 3.3 changes…”.
|
13
|
-
|
14
|
-
## Titles & Headings
|
15
|
-
|
16
|
-
The title of each document and the heading of each document section should describe either a concept or the procedure to complete a task. Use _nouns_ for titles and headings that represent _concepts_. Use _verbs_ to represent _tasks_.
|
17
|
-
|
18
|
-
Capitalize the first word and important words.
|
19
|
-
|
20
|
-
Examples (concepts):
|
21
|
-
|
22
|
-
- Content
|
23
|
-
- Plugins
|
24
|
-
- Orders & Items
|
25
|
-
- Placing Orders
|
26
|
-
|
27
|
-
Examples (tasks):
|
28
|
-
|
29
|
-
- Add System Content
|
30
|
-
- Release a Plugin
|
31
|
-
- Export Orders
|
32
|
-
- Place an Order
|
33
|
-
|
34
|
-
Try to limit outline depth to three levels (h1-h3). If you find yourself needing a deeper outline, consider re-organizing the content into multiple documents.
|
35
|
-
|
36
|
-
## Proper Nouns
|
37
|
-
|
38
|
-
Names of software packages, such as _Admin_ and _Storefront_ are proper nouns, which are capitalized.
|
39
|
-
|
40
|
-
Names of features are _not_ proper nouns and are not capitalized. Examples:
|
41
|
-
|
42
|
-
- cart
|
43
|
-
- checkout
|
44
|
-
- Admin toolbar
|
45
|
-
|
46
|
-
## Spelling & Grammar
|
47
|
-
|
48
|
-
At this time there are no prescribed style rules regarding spelling, grammar, and language. However, always use a spell checker before submitting contributions.
|
@@ -1,54 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Documentation
|
3
|
-
excerpt: Workarea documentation is managed and versioned with the platform source code
|
4
|
-
---
|
5
|
-
|
6
|
-
# Documentation
|
7
|
-
|
8
|
-
Workarea documentation is managed and versioned with the platform source code.
|
9
|
-
|
10
|
-
## Published Documentation
|
11
|
-
|
12
|
-
Documentation is published automatically each time a new version of the platform is released. Beginning with Workarea 3.3, each major and minor version of the platform has its own documentation.
|
13
|
-
|
14
|
-
## Documentation Build System
|
15
|
-
|
16
|
-
A documentation build system builds the published documentation from the documentation sources that are included within each distribution of the platform.
|
17
|
-
|
18
|
-
The build system is based on [the Middleman static site generator](https://middlemanapp.com). The build system and documentation sources are located at _/docs_ within the Workarea source.
|
19
|
-
|
20
|
-
### Navigation
|
21
|
-
|
22
|
-
The build system includes [Middleman-NavTree](https://github.com/bryanbraun/middleman-navtree) for constructing navigation. The YAML file at the path _docs/data/articles.yml_ declares a tree representing the relationships of the platform article documents.
|
23
|
-
|
24
|
-
### Search
|
25
|
-
|
26
|
-
The build system includes [Middleman::Search](https://github.com/manastech/middleman-search) to provide search functionality.
|
27
|
-
|
28
|
-
This features requires each document to specify frontmatter for use in the search index. See [Document Source Files](#document-source-files) below.
|
29
|
-
|
30
|
-
## Documentation Sources
|
31
|
-
|
32
|
-
Within Workarea's _/doc_ directory, documentation source files and files that make up the build system are organized according to the [Middleman directory structure](https://middlemanapp.com/basics/directory-structure/).
|
33
|
-
|
34
|
-
### Image Source Files
|
35
|
-
|
36
|
-
Image source files are PNG or JPG files whose pathnames match the following pattern:
|
37
|
-
|
38
|
-
_docs/source/images/\*.{png,jpg}_
|
39
|
-
|
40
|
-
Words within filenames are separated with paths since the filenames are used in published URLs.
|
41
|
-
|
42
|
-
### Document Source Files
|
43
|
-
|
44
|
-
The pathnames of document source files match the following pattern:
|
45
|
-
|
46
|
-
_docs/source/{articles,release-notes}/\*.html.md_
|
47
|
-
|
48
|
-
Words within filenames are separated with paths since the filenames are used in published URLs.
|
49
|
-
|
50
|
-
The format of these documents is proprietary to the build system.
|
51
|
-
|
52
|
-
Each file begins with [YAML frontmatter](https://middlemanapp.com/basics/frontmatter/#yaml-frontmatter), which declares a title and excerpt used for search functionality.
|
53
|
-
|
54
|
-
Following the frontmatter is [Redcarpet](https://github.com/vmg/redcarpet) markdown with the `:tables`, `:no_intra_emphasis`, and `:fenced_code_blocks` extensions enabled.
|