workarea 3.4.12
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/.rubocop.yml +326 -0
- data/CHANGELOG.md +20501 -0
- data/README.md +163 -0
- data/docker-compose.yml +27 -0
- data/docs/Gemfile +8 -0
- data/docs/bin/middleman +29 -0
- data/docs/config.rb +87 -0
- data/docs/config.ru +7 -0
- data/docs/data/articles.yml +157 -0
- data/docs/package.json +15 -0
- data/docs/source/404.html.erb +13 -0
- data/docs/source/articles/access-routes-in-javascript.html.md +33 -0
- data/docs/source/articles/add-a-content-area.html.md +169 -0
- data/docs/source/articles/add-a-content-block-type.html.md +334 -0
- data/docs/source/articles/add-a-report.html.md +202 -0
- data/docs/source/articles/add-css-through-the-admin-ui.html.md +30 -0
- data/docs/source/articles/add-javascript-through-a-manifest.html.md +367 -0
- data/docs/source/articles/add-javascript-through-a-view.html.md +80 -0
- data/docs/source/articles/add-javascript-through-the-admin-ui.html.md +30 -0
- data/docs/source/articles/add-metrics.html.md +58 -0
- data/docs/source/articles/add-or-replace-a-pricing-calculator.html.md +150 -0
- data/docs/source/articles/add-remove-or-change-a-mongoid-validation.html.md +147 -0
- data/docs/source/articles/add-remove-or-change-a-product-template.html.md +142 -0
- data/docs/source/articles/add-remove-sort-and-group-storefront-search-filters.html.md +483 -0
- data/docs/source/articles/add-stylesheets-through-a-manifest.html.md +276 -0
- data/docs/source/articles/add-system-content.html.md +138 -0
- data/docs/source/articles/analytics-overview.html.md +51 -0
- data/docs/source/articles/analyze-storefront-search-results.html.md +261 -0
- data/docs/source/articles/api-overview.html.md +35 -0
- data/docs/source/articles/appending.html.md +506 -0
- data/docs/source/articles/application-document.html.md +88 -0
- data/docs/source/articles/automated-javascript-testing.html.md +162 -0
- data/docs/source/articles/b2b-overview.html.md +64 -0
- data/docs/source/articles/browser-and-device-support.html.md +47 -0
- data/docs/source/articles/change-product-placeholder-image.html.md +39 -0
- data/docs/source/articles/change-storefront-search-results.html.md +283 -0
- data/docs/source/articles/change-the-storefront-product-pricing-ui.html.md +348 -0
- data/docs/source/articles/change-the-storefront-search-filters-ui.html.md +103 -0
- data/docs/source/articles/checkout.html.md +479 -0
- data/docs/source/articles/commerce-model.html.md +164 -0
- data/docs/source/articles/configuration-for-hosting.html.md +106 -0
- data/docs/source/articles/configuration.html.md +406 -0
- data/docs/source/articles/configure-a-payment-gateway.html.md +58 -0
- data/docs/source/articles/configure-asset-storage.html.md +29 -0
- data/docs/source/articles/configure-asset-types.html.md +18 -0
- data/docs/source/articles/configure-contact-form-subjects-list.html.md +24 -0
- data/docs/source/articles/configure-imageoptim.html.md +23 -0
- data/docs/source/articles/configure-locales.html.md +45 -0
- data/docs/source/articles/configure-logins-and-authentication.html.md +42 -0
- data/docs/source/articles/configure-low-inventory-threshold.html.md +26 -0
- data/docs/source/articles/configure-product-image-sizes-and-processing.html.md +28 -0
- data/docs/source/articles/content.html.md +554 -0
- data/docs/source/articles/contentable.html.md +41 -0
- data/docs/source/articles/contribute-code.html.md +69 -0
- data/docs/source/articles/contribute-documentation.html.md +60 -0
- data/docs/source/articles/create-a-custom-discount.html.md +234 -0
- data/docs/source/articles/create-a-new-app.html.md +131 -0
- data/docs/source/articles/create-a-plugin.html.md +19 -0
- data/docs/source/articles/create-a-style-guide.html.md +71 -0
- data/docs/source/articles/create-a-theme.html.md +134 -0
- data/docs/source/articles/css-architectural-overview.html.md +89 -0
- data/docs/source/articles/customize-a-helper.html.md +91 -0
- data/docs/source/articles/decoration.html.md +415 -0
- data/docs/source/articles/define-and-configure-inventory-policies.html.md +107 -0
- data/docs/source/articles/documentation-style-guide.html.md +48 -0
- data/docs/source/articles/documentation.html.md +54 -0
- data/docs/source/articles/domain-modeling.html.md +82 -0
- data/docs/source/articles/error-pages.html.md.erb +95 -0
- data/docs/source/articles/extension-overview.html.md +152 -0
- data/docs/source/articles/favicon-support.html.md +112 -0
- data/docs/source/articles/feature-spec-helper-stylesheet.html.md +25 -0
- data/docs/source/articles/featurejs-and-feature-spec-helper.html.md +20 -0
- data/docs/source/articles/help-and-support.html.md +34 -0
- data/docs/source/articles/html-fragment-caching.html.md +46 -0
- data/docs/source/articles/http-caching.html.md +43 -0
- data/docs/source/articles/i18n.html.md +35 -0
- data/docs/source/articles/images-flow.html.md +10 -0
- data/docs/source/articles/index-storefront-search-documents.html.md +104 -0
- data/docs/source/articles/infrastructure.html.md +46 -0
- data/docs/source/articles/installing.html.md +61 -0
- data/docs/source/articles/integrate-a-payment-gateway.html.md +124 -0
- data/docs/source/articles/integrate-a-web-analytics-provider.html.md +35 -0
- data/docs/source/articles/integrate-an-inventory-management-system.html.md +88 -0
- data/docs/source/articles/integrating-with-other-software.html.md +59 -0
- data/docs/source/articles/inventory.html.md +352 -0
- data/docs/source/articles/javascript-coding-standards.html.md +30 -0
- data/docs/source/articles/javascript-modules.html.md +174 -0
- data/docs/source/articles/javascript-overview.html.md +62 -0
- data/docs/source/articles/javascript-reference-documentation.html.md +51 -0
- data/docs/source/articles/javascript-templates.html.md +52 -0
- data/docs/source/articles/low-level-caching.html.md +25 -0
- data/docs/source/articles/maintain-a-plugin.html.md +12 -0
- data/docs/source/articles/maintenance-policy.html.md +79 -0
- data/docs/source/articles/navigable.html.md +51 -0
- data/docs/source/articles/navigating-the-code.html.md +149 -0
- data/docs/source/articles/navigation.html.md +386 -0
- data/docs/source/articles/order-life-cycle.html.md +546 -0
- data/docs/source/articles/order-pricing.html.md +389 -0
- data/docs/source/articles/orders-and-items.html.md +210 -0
- data/docs/source/articles/orders.html.md +66 -0
- data/docs/source/articles/overriding.html.md +155 -0
- data/docs/source/articles/overview.html.md +43 -0
- data/docs/source/articles/plugins-overview.html.md +12 -0
- data/docs/source/articles/prerequisites-and-dependencies.html.md +202 -0
- data/docs/source/articles/products.html.md.erb +1270 -0
- data/docs/source/articles/progressive-web-application-support.html.md +148 -0
- data/docs/source/articles/rails-asset-manifests.html.md +33 -0
- data/docs/source/articles/rails-asset-view-helpers.html.md +25 -0
- data/docs/source/articles/reading-data.html.md +10 -0
- data/docs/source/articles/releasable.html.md +37 -0
- data/docs/source/articles/report-a-bug.html.md +75 -0
- data/docs/source/articles/ruby-coding-standards.html.md +10 -0
- data/docs/source/articles/run-sidekiq-in-a-local-environment.html.md +40 -0
- data/docs/source/articles/searching.html.md +1005 -0
- data/docs/source/articles/security-policy.html.md +42 -0
- data/docs/source/articles/seeds.html.md +345 -0
- data/docs/source/articles/shipping.html.md +756 -0
- data/docs/source/articles/sort-and-exclude-product-options.html.md +47 -0
- data/docs/source/articles/storefront-search-features.html.md +568 -0
- data/docs/source/articles/storefront-searches.html.md +126 -0
- data/docs/source/articles/style-guides.html.md +21 -0
- data/docs/source/articles/stylesheet-coding-standards.html.md +24 -0
- data/docs/source/articles/stylesheets-overview.html.md +67 -0
- data/docs/source/articles/swappable-list-data-structure.html.md +81 -0
- data/docs/source/articles/system-emails.html.md +102 -0
- data/docs/source/articles/taggable.html.md +8 -0
- data/docs/source/articles/test-a-credit-card-transaction.html.md +16 -0
- data/docs/source/articles/test-if-a-plugin-is-installed.html.md +34 -0
- data/docs/source/articles/testing.html.md +914 -0
- data/docs/source/articles/themes-overview.html.md +155 -0
- data/docs/source/articles/translate-administrable-content.html.md +14 -0
- data/docs/source/articles/translate-javascript-content.html.md +16 -0
- data/docs/source/articles/translate-or-customize-message-content.html.md +29 -0
- data/docs/source/articles/translate-or-customize-static-content.html.md +30 -0
- data/docs/source/articles/use-an-existing-workarea-app.html.md +108 -0
- data/docs/source/articles/view-models.html.md +509 -0
- data/docs/source/articles/views.html.md +14 -0
- data/docs/source/articles/workers.html.md +613 -0
- data/docs/source/articles/writing-data.html.md +10 -0
- data/docs/source/cli.html.md +163 -0
- 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 +1 -0
- data/docs/source/images/arrow_white.svg +1 -0
- 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 +1 -0
- 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 +1 -0
- data/docs/source/images/image-group-content-block-in-storefront.png +0 -0
- data/docs/source/images/images.svg +1 -0
- 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 +1 -0
- data/docs/source/images/menu.svg +2 -0
- data/docs/source/images/mongo-replica-set.svg +1 -0
- 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 +1 -0
- 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 +1 -0
- 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 +1 -0
- 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 +3 -0
- 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 +1 -0
- data/docs/source/images/worst-performing-searches-on-results-customization-page.png +0 -0
- data/docs/source/images/writing-data.svg +1 -0
- data/docs/source/index.html.erb +167 -0
- data/docs/source/javascripts/jquery.js +2 -0
- data/docs/source/javascripts/lunr.js +7 -0
- data/docs/source/javascripts/site.js +299 -0
- data/docs/source/javascripts/vendor/highlight.pack.js +2 -0
- data/docs/source/layouts/article.erb +106 -0
- data/docs/source/layouts/bare.erb +46 -0
- data/docs/source/layouts/layout.erb +43 -0
- data/docs/source/release-notes.html.md +258 -0
- data/docs/source/release-notes/workarea-3-0-0.html.md +146 -0
- data/docs/source/release-notes/workarea-3-0-1.html.md +161 -0
- data/docs/source/release-notes/workarea-3-0-10.html.md +39 -0
- data/docs/source/release-notes/workarea-3-0-11.html.md +277 -0
- data/docs/source/release-notes/workarea-3-0-12.html.md +14 -0
- data/docs/source/release-notes/workarea-3-0-13.html.md +153 -0
- data/docs/source/release-notes/workarea-3-0-14.html.md +93 -0
- data/docs/source/release-notes/workarea-3-0-15.html.md +107 -0
- data/docs/source/release-notes/workarea-3-0-16.html.md +36 -0
- data/docs/source/release-notes/workarea-3-0-17.html.md +141 -0
- data/docs/source/release-notes/workarea-3-0-18.html.md +123 -0
- data/docs/source/release-notes/workarea-3-0-19.html.md +160 -0
- data/docs/source/release-notes/workarea-3-0-2.html.md +222 -0
- data/docs/source/release-notes/workarea-3-0-20.html.md +95 -0
- data/docs/source/release-notes/workarea-3-0-21.html.md +168 -0
- data/docs/source/release-notes/workarea-3-0-22.html.md +268 -0
- data/docs/source/release-notes/workarea-3-0-23.html.md +173 -0
- data/docs/source/release-notes/workarea-3-0-24.html.md +19 -0
- data/docs/source/release-notes/workarea-3-0-25.html.md +26 -0
- data/docs/source/release-notes/workarea-3-0-26.html.md +199 -0
- data/docs/source/release-notes/workarea-3-0-27.html.md +113 -0
- data/docs/source/release-notes/workarea-3-0-28.html.md +39 -0
- data/docs/source/release-notes/workarea-3-0-29.html.md +73 -0
- data/docs/source/release-notes/workarea-3-0-3.html.md +35 -0
- data/docs/source/release-notes/workarea-3-0-30.html.md +186 -0
- data/docs/source/release-notes/workarea-3-0-31.html.md +125 -0
- data/docs/source/release-notes/workarea-3-0-32.html.md +73 -0
- data/docs/source/release-notes/workarea-3-0-33.html.md +137 -0
- data/docs/source/release-notes/workarea-3-0-34.html.md +203 -0
- data/docs/source/release-notes/workarea-3-0-35.html.md +205 -0
- data/docs/source/release-notes/workarea-3-0-36.html.md +105 -0
- data/docs/source/release-notes/workarea-3-0-37.html.md +144 -0
- data/docs/source/release-notes/workarea-3-0-38.html.md +73 -0
- data/docs/source/release-notes/workarea-3-0-39.html.md +77 -0
- data/docs/source/release-notes/workarea-3-0-4.html.md +14 -0
- data/docs/source/release-notes/workarea-3-0-40.html.md +130 -0
- data/docs/source/release-notes/workarea-3-0-41.html.md +70 -0
- data/docs/source/release-notes/workarea-3-0-42.html.md +52 -0
- data/docs/source/release-notes/workarea-3-0-43.html.md +72 -0
- data/docs/source/release-notes/workarea-3-0-44.html.md +93 -0
- data/docs/source/release-notes/workarea-3-0-45.html.md +61 -0
- data/docs/source/release-notes/workarea-3-0-46.html.md +171 -0
- data/docs/source/release-notes/workarea-3-0-47.html.md +130 -0
- data/docs/source/release-notes/workarea-3-0-48.html.md +160 -0
- data/docs/source/release-notes/workarea-3-0-49.html.md +28 -0
- data/docs/source/release-notes/workarea-3-0-5.html.md +225 -0
- data/docs/source/release-notes/workarea-3-0-50.html.md +74 -0
- data/docs/source/release-notes/workarea-3-0-51.html.md +61 -0
- data/docs/source/release-notes/workarea-3-0-52.html.md +76 -0
- data/docs/source/release-notes/workarea-3-0-53.html.md +126 -0
- data/docs/source/release-notes/workarea-3-0-54.html.md +112 -0
- data/docs/source/release-notes/workarea-3-0-55.html.md +105 -0
- data/docs/source/release-notes/workarea-3-0-56.html.md +56 -0
- data/docs/source/release-notes/workarea-3-0-57.html.md +82 -0
- data/docs/source/release-notes/workarea-3-0-58.html.md +153 -0
- data/docs/source/release-notes/workarea-3-0-59.html.md +78 -0
- data/docs/source/release-notes/workarea-3-0-6.html.md +165 -0
- data/docs/source/release-notes/workarea-3-0-60.html.md +43 -0
- data/docs/source/release-notes/workarea-3-0-61.html.md +46 -0
- data/docs/source/release-notes/workarea-3-0-62.html.md +23 -0
- data/docs/source/release-notes/workarea-3-0-63.html.md +25 -0
- data/docs/source/release-notes/workarea-3-0-64.html.md +25 -0
- data/docs/source/release-notes/workarea-3-0-65.html.md +37 -0
- data/docs/source/release-notes/workarea-3-0-7.html.md +207 -0
- data/docs/source/release-notes/workarea-3-0-8.html.md +337 -0
- data/docs/source/release-notes/workarea-3-0-9.html.md +196 -0
- data/docs/source/release-notes/workarea-3-1-0.html.md +414 -0
- data/docs/source/release-notes/workarea-3-1-1.html.md +139 -0
- data/docs/source/release-notes/workarea-3-1-10.html.md +19 -0
- data/docs/source/release-notes/workarea-3-1-11.html.md +27 -0
- data/docs/source/release-notes/workarea-3-1-12.html.md +216 -0
- data/docs/source/release-notes/workarea-3-1-13.html.md +113 -0
- data/docs/source/release-notes/workarea-3-1-14.html.md +39 -0
- data/docs/source/release-notes/workarea-3-1-15.html.md +107 -0
- data/docs/source/release-notes/workarea-3-1-16.html.md +188 -0
- data/docs/source/release-notes/workarea-3-1-17.html.md +141 -0
- data/docs/source/release-notes/workarea-3-1-18.html.md +73 -0
- data/docs/source/release-notes/workarea-3-1-19.html.md +137 -0
- data/docs/source/release-notes/workarea-3-1-2.html.md +55 -0
- data/docs/source/release-notes/workarea-3-1-20.html.md +203 -0
- data/docs/source/release-notes/workarea-3-1-21.html.md +205 -0
- data/docs/source/release-notes/workarea-3-1-22.html.md +121 -0
- data/docs/source/release-notes/workarea-3-1-23.html.md +144 -0
- data/docs/source/release-notes/workarea-3-1-24.html.md +94 -0
- data/docs/source/release-notes/workarea-3-1-25.html.md +77 -0
- data/docs/source/release-notes/workarea-3-1-26.html.md +130 -0
- data/docs/source/release-notes/workarea-3-1-27.html.md +70 -0
- data/docs/source/release-notes/workarea-3-1-28.html.md +52 -0
- data/docs/source/release-notes/workarea-3-1-29.html.md +44 -0
- data/docs/source/release-notes/workarea-3-1-3.html.md +185 -0
- data/docs/source/release-notes/workarea-3-1-30.html.md +72 -0
- data/docs/source/release-notes/workarea-3-1-31.html.md +93 -0
- data/docs/source/release-notes/workarea-3-1-32.html.md +61 -0
- data/docs/source/release-notes/workarea-3-1-33.html.md +171 -0
- data/docs/source/release-notes/workarea-3-1-34.html.md +130 -0
- data/docs/source/release-notes/workarea-3-1-35.html.md +179 -0
- data/docs/source/release-notes/workarea-3-1-36.html.md +28 -0
- data/docs/source/release-notes/workarea-3-1-37.html.md +74 -0
- data/docs/source/release-notes/workarea-3-1-38.html.md +61 -0
- data/docs/source/release-notes/workarea-3-1-39.html.md +96 -0
- data/docs/source/release-notes/workarea-3-1-4.html.md +148 -0
- data/docs/source/release-notes/workarea-3-1-40.html.md +126 -0
- data/docs/source/release-notes/workarea-3-1-41.html.md +128 -0
- data/docs/source/release-notes/workarea-3-1-42.html.md +105 -0
- data/docs/source/release-notes/workarea-3-1-43.html.md +37 -0
- data/docs/source/release-notes/workarea-3-1-44.html.md +82 -0
- data/docs/source/release-notes/workarea-3-1-45.html.md +153 -0
- data/docs/source/release-notes/workarea-3-1-46.html.md +91 -0
- data/docs/source/release-notes/workarea-3-1-47.html.md +65 -0
- data/docs/source/release-notes/workarea-3-1-48.html.md +46 -0
- data/docs/source/release-notes/workarea-3-1-49.html.md +23 -0
- data/docs/source/release-notes/workarea-3-1-5.html.md +169 -0
- data/docs/source/release-notes/workarea-3-1-50.html.md +42 -0
- data/docs/source/release-notes/workarea-3-1-51.html.md +25 -0
- data/docs/source/release-notes/workarea-3-1-52.html.md +57 -0
- data/docs/source/release-notes/workarea-3-1-6.html.md +117 -0
- data/docs/source/release-notes/workarea-3-1-7.html.md +176 -0
- data/docs/source/release-notes/workarea-3-1-8.html.md +283 -0
- data/docs/source/release-notes/workarea-3-1-9.html.md +212 -0
- data/docs/source/release-notes/workarea-3-2-0.html.md +1705 -0
- data/docs/source/release-notes/workarea-3-2-1.html.md +216 -0
- data/docs/source/release-notes/workarea-3-2-10.html.md +237 -0
- data/docs/source/release-notes/workarea-3-2-11.html.md +121 -0
- data/docs/source/release-notes/workarea-3-2-12.html.md +145 -0
- data/docs/source/release-notes/workarea-3-2-13.html.md +138 -0
- data/docs/source/release-notes/workarea-3-2-14.html.md +77 -0
- data/docs/source/release-notes/workarea-3-2-15.html.md +130 -0
- data/docs/source/release-notes/workarea-3-2-16.html.md +111 -0
- data/docs/source/release-notes/workarea-3-2-17.html.md +52 -0
- data/docs/source/release-notes/workarea-3-2-18.html.md +44 -0
- data/docs/source/release-notes/workarea-3-2-19.html.md +72 -0
- data/docs/source/release-notes/workarea-3-2-2.html.md +145 -0
- data/docs/source/release-notes/workarea-3-2-20.html.md +93 -0
- data/docs/source/release-notes/workarea-3-2-21.html.md +61 -0
- data/docs/source/release-notes/workarea-3-2-22.html.md +154 -0
- data/docs/source/release-notes/workarea-3-2-23.html.md +130 -0
- data/docs/source/release-notes/workarea-3-2-24.html.md +200 -0
- data/docs/source/release-notes/workarea-3-2-25.html.md +28 -0
- data/docs/source/release-notes/workarea-3-2-26.html.md +94 -0
- data/docs/source/release-notes/workarea-3-2-27.html.md +61 -0
- data/docs/source/release-notes/workarea-3-2-28.html.md +96 -0
- data/docs/source/release-notes/workarea-3-2-29.html.md +126 -0
- data/docs/source/release-notes/workarea-3-2-30.html.md +112 -0
- data/docs/source/release-notes/workarea-3-2-31.html.md +105 -0
- data/docs/source/release-notes/workarea-3-2-32.html.md +56 -0
- data/docs/source/release-notes/workarea-3-2-33.html.md +82 -0
- data/docs/source/release-notes/workarea-3-2-34.html.md +153 -0
- data/docs/source/release-notes/workarea-3-2-35.html.md +91 -0
- data/docs/source/release-notes/workarea-3-2-36.html.md +118 -0
- data/docs/source/release-notes/workarea-3-2-37.html.md +46 -0
- data/docs/source/release-notes/workarea-3-2-38.html.md +23 -0
- data/docs/source/release-notes/workarea-3-2-39.html.md +42 -0
- data/docs/source/release-notes/workarea-3-2-4.html.md +109 -0
- data/docs/source/release-notes/workarea-3-2-40.html.md +25 -0
- data/docs/source/release-notes/workarea-3-2-41.html.md +90 -0
- data/docs/source/release-notes/workarea-3-2-5.html.md +186 -0
- data/docs/source/release-notes/workarea-3-2-6.html.md +173 -0
- data/docs/source/release-notes/workarea-3-2-7.html.md +89 -0
- data/docs/source/release-notes/workarea-3-2-8.html.md +137 -0
- data/docs/source/release-notes/workarea-3-2-9.html.md +219 -0
- data/docs/source/release-notes/workarea-3-3-0.html.md +1272 -0
- data/docs/source/release-notes/workarea-3-3-1.html.md +324 -0
- data/docs/source/release-notes/workarea-3-3-10.html.md +69 -0
- data/docs/source/release-notes/workarea-3-3-11.html.md +72 -0
- data/docs/source/release-notes/workarea-3-3-12.html.md +136 -0
- data/docs/source/release-notes/workarea-3-3-13.html.md +61 -0
- data/docs/source/release-notes/workarea-3-3-14.html.md +196 -0
- data/docs/source/release-notes/workarea-3-3-15.html.md +167 -0
- data/docs/source/release-notes/workarea-3-3-16.html.md +234 -0
- data/docs/source/release-notes/workarea-3-3-17.html.md +82 -0
- data/docs/source/release-notes/workarea-3-3-18.html.md +165 -0
- data/docs/source/release-notes/workarea-3-3-19.html.md +106 -0
- data/docs/source/release-notes/workarea-3-3-2.html.md +72 -0
- data/docs/source/release-notes/workarea-3-3-20.html.md +116 -0
- data/docs/source/release-notes/workarea-3-3-21.html.md +228 -0
- data/docs/source/release-notes/workarea-3-3-22.html.md +125 -0
- data/docs/source/release-notes/workarea-3-3-23.html.md +154 -0
- data/docs/source/release-notes/workarea-3-3-24.html.md +70 -0
- data/docs/source/release-notes/workarea-3-3-25.html.md +114 -0
- data/docs/source/release-notes/workarea-3-3-26.html.md +260 -0
- data/docs/source/release-notes/workarea-3-3-27.html.md +138 -0
- data/docs/source/release-notes/workarea-3-3-28.html.md +147 -0
- data/docs/source/release-notes/workarea-3-3-29.html.md +63 -0
- data/docs/source/release-notes/workarea-3-3-3.html.md +153 -0
- data/docs/source/release-notes/workarea-3-3-30.html.md +102 -0
- data/docs/source/release-notes/workarea-3-3-31.html.md +57 -0
- data/docs/source/release-notes/workarea-3-3-32.html.md +44 -0
- data/docs/source/release-notes/workarea-3-3-33.html.md +114 -0
- data/docs/source/release-notes/workarea-3-3-4.html.md +332 -0
- data/docs/source/release-notes/workarea-3-3-5.html.md +242 -0
- data/docs/source/release-notes/workarea-3-3-6.html.md +100 -0
- data/docs/source/release-notes/workarea-3-3-7.html.md +148 -0
- data/docs/source/release-notes/workarea-3-3-8.html.md +163 -0
- data/docs/source/release-notes/workarea-3-3-9.html.md +93 -0
- data/docs/source/release-notes/workarea-3-4-0.html.md +580 -0
- data/docs/source/release-notes/workarea-3-4-1.html.md +150 -0
- data/docs/source/release-notes/workarea-3-4-10.html.md +72 -0
- data/docs/source/release-notes/workarea-3-4-11.html.md +60 -0
- data/docs/source/release-notes/workarea-3-4-12.html.md +155 -0
- data/docs/source/release-notes/workarea-3-4-2.html.md +188 -0
- data/docs/source/release-notes/workarea-3-4-3.html.md +136 -0
- data/docs/source/release-notes/workarea-3-4-4.html.md +114 -0
- data/docs/source/release-notes/workarea-3-4-5.html.md +275 -0
- data/docs/source/release-notes/workarea-3-4-6.html.md +169 -0
- data/docs/source/release-notes/workarea-3-4-7.html.md +162 -0
- data/docs/source/release-notes/workarea-3-4-8.html.md +95 -0
- data/docs/source/release-notes/workarea-3-4-9.html.md +135 -0
- data/docs/source/search.html.erb +34 -0
- data/docs/source/shared/_header.erb +61 -0
- data/docs/source/shared/_svgs.erb +17 -0
- data/docs/source/style_guide/index.html.erb +382 -0
- data/docs/source/stylesheets/_base.scss +125 -0
- data/docs/source/stylesheets/_components.scss +669 -0
- data/docs/source/stylesheets/_helpers.scss +10 -0
- data/docs/source/stylesheets/_opinions.scss +42 -0
- data/docs/source/stylesheets/_settings.scss +56 -0
- data/docs/source/stylesheets/_typography.scss +119 -0
- data/docs/source/stylesheets/site.css.scss +14 -0
- data/docs/source/stylesheets/vendor/_avalanche.scss +328 -0
- data/docs/source/stylesheets/vendor/_normalize.scss +341 -0
- data/docs/source/stylesheets/vendor/highlight/_tomorrow_night_blue.scss +75 -0
- data/docs/source/upgrade-guides.html.md +18 -0
- data/docs/source/upgrade-guides/workarea-3-4-0.html.md +152 -0
- data/docs/workarea_renderer.rb +8 -0
- data/docs/yarn.lock +2522 -0
- metadata +669 -0
@@ -0,0 +1,261 @@
|
|
1
|
+
---
|
2
|
+
title: Analyze Storefront Search Results
|
3
|
+
excerpt: Use the following tools and techniques to analyze and debug search results in the Storefront.
|
4
|
+
---
|
5
|
+
|
6
|
+
Analyze Storefront Search Results
|
7
|
+
================================================================================
|
8
|
+
|
9
|
+
Use the following tools and techniques to analyze and debug search results in the Storefront.
|
10
|
+
|
11
|
+
While the search analysis admin is specific to Storefront searches (i.e. search results pages), the other tools and techniques apply to search results for any of the Storefront search features.
|
12
|
+
(See [Storefront Search Features](storefront-search-features.html).)
|
13
|
+
|
14
|
+
|
15
|
+
Search Analysis Admin
|
16
|
+
--------------------------------------------------------------------------------
|
17
|
+
|
18
|
+
Each Storefront search feature uses a search query object to query Elasticsearch for results.
|
19
|
+
However, the code path to initialize the search query object is different for each Storefront search feature.
|
20
|
+
|
21
|
+
Of these features, Storefront searches have the most complicated code path to initialize the search query, and the business logic represented by this code path may not be evident to administrators and developers when searching for products in the Storefront.
|
22
|
+
(See [Storefront Searches](storefront-searches.html).)
|
23
|
+
|
24
|
+
The _search analysis admin_ is a feature within the Workarea Admin that aims to help developers and technically inclined admins understand specific Storefront searches.
|
25
|
+
To analyze a search using this feature, you must create a search customization for the specific query you'd like to analyze.
|
26
|
+
After creating (or finding) the search customization in the Admin, use the _Analyze_ card to navigate to the search analysis admin for the particular query.
|
27
|
+
|
28
|
+
The following figures show two examples of the search analysis admin:
|
29
|
+
|
30
|
+

|
31
|
+
|
32
|
+

|
33
|
+
|
34
|
+
The figures above illustrate the various sections of the search analysis admin, which are described below.
|
35
|
+
|
36
|
+
* _Search Analysis_
|
37
|
+
* Includes one row for each `ProductSearch` query initialized during the Storefront search request
|
38
|
+
* Displays in each row the query string as originally entered, as rewritten by a query rewrite specified on the search customization (if present), and as rewritten by the spelling correction middleware (if applicable)
|
39
|
+
* Displays in each row the search middleware which caused this particular `ProductSearch` query to be initialized (if multiple queries)
|
40
|
+
* Displays in each row the operator specified in the query's request body, the value of the `:pass` param used to initialize the query object, and the total hits in the response
|
41
|
+
* _Tokens_
|
42
|
+
* Analyzes the query string using the Elasticsearch [Analyze](https://www.elastic.co/guide/en/elasticsearch/reference/5.5/indices-analyze.html) API
|
43
|
+
* Includes one row for each token returned by the analyzer, including synonyms
|
44
|
+
* _Rendering_
|
45
|
+
* Displays a UI representing the flow of the search response through the search middleware chain
|
46
|
+
* (Refer to the inline help tooltip for the meaning of the icons)
|
47
|
+
* (See [Storefront Searches, Creating the Response](storefront-searches.html#creating-the-response_2) for an explanation of this flow)
|
48
|
+
* _Ranking_
|
49
|
+
* Lists the top hits from the final search response
|
50
|
+
* Indicates results which appear due to being featured (manually administrated)
|
51
|
+
|
52
|
+
This feature provides visibility into how the search query object(s) are initialized for a particular Storefront search.
|
53
|
+
However, you may need greater visibility into the specifics of the request sent to Elasticsearch and the response returned from Elasticsearch.
|
54
|
+
You may also need to analyze the query or results from one of the other Storefront search features.
|
55
|
+
For these purposes, you can use an Elasticsearch client.
|
56
|
+
|
57
|
+
|
58
|
+
Elasticsearch Clients
|
59
|
+
--------------------------------------------------------------------------------
|
60
|
+
|
61
|
+
Use an _Elasticsearch client_ to talk directly to your Elasticsearch cluster.
|
62
|
+
For command line / programmatic access, use the Ruby client, and for web / GUI access, use Kibana.
|
63
|
+
|
64
|
+
|
65
|
+
### Elasticsearch Ruby Client
|
66
|
+
|
67
|
+
You can access the Elasticsearch Ruby client from any environment in which you can access a Rails console.
|
68
|
+
If you need access to a particular environment, open a [support request](http://support.workarea.com).
|
69
|
+
Within each environment, an Elasticsearch client is already initialized as `Workarea.elasticsearch`:
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
Workarea.elasticsearch.class
|
73
|
+
# => Elasticsearch::Transport::Client
|
74
|
+
```
|
75
|
+
|
76
|
+
This client provides access to most Elasticsearch APIs.
|
77
|
+
For details, review the documentation for [Elasticsearch::API (version 5.x)](https://www.rubydoc.info/gems/elasticsearch-api/5.0.5).
|
78
|
+
|
79
|
+
Unlike querying Elasticsearch with a search query object, with this client you are responsible for constructing the entire request and knowing which index(es) to search.
|
80
|
+
|
81
|
+
The following example lists indexes matching a pattern:
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
puts Workarea.elasticsearch.cat.indices(index: '*storefront', h: ['index'])
|
85
|
+
# boardgamez_test_en_storefront
|
86
|
+
# boardgamez_development_en_storefront
|
87
|
+
```
|
88
|
+
|
89
|
+
And the following example searches for all documents in an index and then manipulates the response (views the total hits):
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
Workarea.elasticsearch
|
93
|
+
.search(
|
94
|
+
index: 'boardgamez_development_en_storefront',
|
95
|
+
body: { query: { match_all: {} } }
|
96
|
+
)
|
97
|
+
.dig('hits', 'total')
|
98
|
+
# => '141'
|
99
|
+
```
|
100
|
+
|
101
|
+
|
102
|
+
### Kibana (Web Client)
|
103
|
+
|
104
|
+
You can access Kibana, an Elasticsearch GUI, in your web browser.
|
105
|
+
To install Kibana in a local environment, refer to the [Kibana User Guide (version 5.x)](https://www.elastic.co/guide/en/kibana/5.6/index.html).
|
106
|
+
Kibana is installed for you in Workarea cloud environments.
|
107
|
+
If you need access to a particular environment, open a [support request](http://support.workarea.com).
|
108
|
+
|
109
|
+
One useful feature in Kibana is the dev tools console, which allows you to construct requests using the Elasticsearch query DSL and view the results:
|
110
|
+
|
111
|
+

|
112
|
+
|
113
|
+
As with the Ruby client, you are responsible for choosing the indexes you'd like to search and analyze.
|
114
|
+
Kibana allows you to configure index patterns, which identify the indexes to be used for searches and analysis within Kibana:
|
115
|
+
|
116
|
+

|
117
|
+
|
118
|
+
|
119
|
+
Analyzing Queries
|
120
|
+
--------------------------------------------------------------------------------
|
121
|
+
|
122
|
+
When dealing with unexpected or confusing search results, you may want to begin by analyzing the search query object that is responsible for constructing the query (the request body).
|
123
|
+
|
124
|
+
To analyze a "real world" query, you may need to insert logging or debugging code into your application to view the state of the query object.
|
125
|
+
Given the params or ID of a search query object, you can initialize another instance with the same state by calling `.new` or `.find` on the query's class.
|
126
|
+
The following example uses a simple product search query to demonstrate the relationship and usage of `#params`, `#id`, `.new`, and `.find`:
|
127
|
+
|
128
|
+
```ruby
|
129
|
+
# initialize a search query object with a :q param
|
130
|
+
search = Workarea::Search::ProductSearch.new(q: 'marble')
|
131
|
+
|
132
|
+
# ask for the params; returns a hash of the params
|
133
|
+
puts search.params
|
134
|
+
# {"q"=>"marble"}
|
135
|
+
|
136
|
+
# ask for the id; returns the params as a JSON string
|
137
|
+
puts search.id
|
138
|
+
# {"q":"marble"}
|
139
|
+
|
140
|
+
# initialize a second query from the same params
|
141
|
+
search2 = Workarea::Search::ProductSearch.new(search.params)
|
142
|
+
|
143
|
+
# initialize a third query, this time from the original query's id
|
144
|
+
search3 = Workarea::Search::ProductSearch.find(search.id)
|
145
|
+
|
146
|
+
# all 3 queries have the same id (and by extension, the same state)
|
147
|
+
search.id == search2.id && search2.id == search3.id
|
148
|
+
# => true
|
149
|
+
```
|
150
|
+
|
151
|
+
Refer to [Storefront Search Features, Initialization & Parameters](storefront-search-features.html#initialization-amp-parameters_9) to see the search query class and initialization code path for each Storefront search feature.
|
152
|
+
From these points in the application you can examine or log attributes of actual search query instances.
|
153
|
+
|
154
|
+
After initializing an equivalent search query object, you can inspect it.
|
155
|
+
Most likely you will want to examine the `#body`, which returns the request body sent to Elasticsearch.
|
156
|
+
|
157
|
+
Although the search query's params represent its own state, the state of the request body depends additionally on many external values.
|
158
|
+
Depending on the search query class these may include the following:
|
159
|
+
|
160
|
+
* Administrable values, accessible to admins and developers
|
161
|
+
* Search settings (administration of all searches)
|
162
|
+
* Search settings views factor (product popularity multiplier)
|
163
|
+
* Search settings boosts (text field boosts)
|
164
|
+
* Search settings terms facets
|
165
|
+
* Search settings range facets
|
166
|
+
* Search customizations & categories (per-search administration)
|
167
|
+
* Category terms facets
|
168
|
+
* Category range facets
|
169
|
+
* Search customization product IDs (featured products)
|
170
|
+
* Category product IDs (featured products)
|
171
|
+
* Search customization product rules
|
172
|
+
* Category product rules
|
173
|
+
* Search customization rewrite (query rewrite)
|
174
|
+
* Category default sort
|
175
|
+
* Configurable values, accessible only to developers
|
176
|
+
* `Workarea.config.default_search_boosts`
|
177
|
+
* `Workarea.config.default_search_facet_result_sizes`
|
178
|
+
* `Workarea.config.permitted_facet_params`
|
179
|
+
* `Workarea.config.search_dismax_tie_breaker`
|
180
|
+
* `Workarea.config.search_facet_default_sort`
|
181
|
+
* `Workarea.config.search_facet_dynamic_sorting_size`
|
182
|
+
* `Workarea.config.search_facet_result_sizes`
|
183
|
+
* `Workarea.config.search_facet_size_sort`
|
184
|
+
* `Workarea.config.search_facet_sorts`
|
185
|
+
* `Workarea.config.search_name_phrase_match_boost`
|
186
|
+
* `Workarea.config.search_query_options`
|
187
|
+
* `Workarea.config.search_suggestion_min_doc_freq`
|
188
|
+
* `Workarea.config.search_suggestions`
|
189
|
+
|
190
|
+
You may need to examine these values to determine how the request body reached its final state.
|
191
|
+
|
192
|
+
If your goal is to modify the request body (for a platform extension), you may want to log the request body and then use it directly within one of the Elasticsearch clients above, particularly the Kibana dev tools console.
|
193
|
+
|
194
|
+
|
195
|
+
Analyzing Indexes & Documents
|
196
|
+
--------------------------------------------------------------------------------
|
197
|
+
|
198
|
+
In addition to analyzing the query sent to Elasticsearch, you may also need to analyze the current state of the indexes and documents.
|
199
|
+
Search results are created by the intersection of the query's state and the states of the documents being searched.
|
200
|
+
|
201
|
+
Typically, complaints of unexpected search results mean either a particular document is matching or not matching (_matching_), or a matching document is sorted unexpectedly (_relevance_).
|
202
|
+
If the state of the search request is what you are expecting (see section above), then examine the specific documents next.
|
203
|
+
|
204
|
+
Use the Elasticsearch clients listed above to examine documents on their own or within the context of a particular query.
|
205
|
+
For example, the Elasticsearch [Explain](https://www.elastic.co/guide/en/elasticsearch/reference/5.5/search-explain.html) API "computes a score explanation for a query and a specific document."
|
206
|
+
|
207
|
+
Be aware that a particular search document may be missing or stale due to changes in MongoDB that have not yet migrated to Elasticsearch.
|
208
|
+
Search indexing jobs may be pending in your Sidekiq queue, or there may be an issue with automated search indexing in your environment (See [Search, Indexing](searching.html#indexing_7)).
|
209
|
+
To resolve an issue, you may need to manually re-index all documents or specific documents (See [Index Storefront Search Documents](index-storefront-search-documents.html)).
|
210
|
+
|
211
|
+
Finally, if your search documents are up to date but do not contain the correct fields, field mappings, or field values, review the logic of your search models.
|
212
|
+
For example, you may have added a new field to the Mongoid model but it is absent in the corresponding search model, or mapped incorrectly.
|
213
|
+
See [Storefront Search Features, Search Models](storefront-search-features.html#search-models_13) for coverage of search models, including dynamic mapping.
|
214
|
+
|
215
|
+
You may need to verify the field mappings for the `'storefront'` Elasticsearch type used for Storefront Elasticsearch documents.
|
216
|
+
To do so, use the Elasticsearch _Get Mapping_ API, which is demonstrated below:
|
217
|
+
|
218
|
+
```ruby
|
219
|
+
puts JSON.pretty_generate(
|
220
|
+
Workarea.elasticsearch.indices
|
221
|
+
.get_mapping(type: 'storefront')
|
222
|
+
.dig(
|
223
|
+
'boardgamez_development_en_storefront',
|
224
|
+
'mappings',
|
225
|
+
'storefront',
|
226
|
+
'properties'
|
227
|
+
)
|
228
|
+
)
|
229
|
+
# {
|
230
|
+
# "active": {
|
231
|
+
# "properties": {
|
232
|
+
# "now": {
|
233
|
+
# "type": "boolean"
|
234
|
+
# }
|
235
|
+
# }
|
236
|
+
# },
|
237
|
+
# "cache": { ... },
|
238
|
+
# "content": {
|
239
|
+
# "properties": {
|
240
|
+
# "category_names": {
|
241
|
+
# "type": "text",
|
242
|
+
# "analyzer": "text_analyzer"
|
243
|
+
# },
|
244
|
+
# "description": { ... },
|
245
|
+
# "details": { ... },
|
246
|
+
# "facets": { ... },
|
247
|
+
# "name": { ... }
|
248
|
+
# }
|
249
|
+
# },
|
250
|
+
# ...
|
251
|
+
```
|
252
|
+
|
253
|
+
|
254
|
+
Storefront Caching
|
255
|
+
--------------------------------------------------------------------------------
|
256
|
+
|
257
|
+
As a final concern, be aware of caching within the Storefront.
|
258
|
+
In environments where caching is enabled, the entire HTTP response may be cached, or fragments of the response may be cached.
|
259
|
+
(See [HTTP Caching](http-caching.html) and [HTML Fragment Caching](html-fragment-caching.html).)
|
260
|
+
|
261
|
+
All Storefront search features except for autocomplete (which is an async/XHR feature) may be affected by both types of caching.
|
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
title: API Overview
|
3
|
+
excerpt: Workarea provides 2 separate REST APIs, Admin and Storefront.
|
4
|
+
---
|
5
|
+
|
6
|
+
# API Overview
|
7
|
+
|
8
|
+
Workarea provides two separate REST APIs for different purposes:
|
9
|
+
|
10
|
+
* The [Admin API](https://github.com/workarea-commerce/workarea-api/tree/master/admin) provides CRUD
|
11
|
+
operations on all data models in the application and is primarily used for
|
12
|
+
integration with external service providers, such as an OMS or ERP. Access is
|
13
|
+
only available to admin users with the necessary "API Access" permissions.
|
14
|
+
* The [Storefront API](https://github.com/workarea-commerce/workarea-api/tree/master/storefront) is
|
15
|
+
suitable for building alternative user interfaces to Workarea. Some possible
|
16
|
+
uses for the Storefront API are: mobile apps, kiosks, or retail integrations.
|
17
|
+
|
18
|
+
Both of these APIs are contained in the
|
19
|
+
[workarea-api](https://github.com/workarea-commerce/workarea-api) plugin.
|
20
|
+
|
21
|
+
## API Documentation
|
22
|
+
|
23
|
+
Out of the box documentation for the Workarea APIs are available here:
|
24
|
+
|
25
|
+
* [Admin API](https://demo.workarea.com/api/docs/admin)
|
26
|
+
* [Storefront API](https://demo.workarea.com/api/docs/storefront)
|
27
|
+
|
28
|
+
When running the Workarea API in your application you should reference the
|
29
|
+
documentation generated for your application specifically. Generated API docs
|
30
|
+
include customizations to data models, as well as any endpoints available for
|
31
|
+
installed plugins. Generated docs are available at <https://your.staging.url.com/api/docs>.
|
32
|
+
|
33
|
+
For instructions on generating app specific API documentation, see the
|
34
|
+
Documentation section of the
|
35
|
+
[Workarea API Readme](https://github.com/workarea-commerce/workarea-api)
|
@@ -0,0 +1,506 @@
|
|
1
|
+
---
|
2
|
+
title: Appending
|
3
|
+
excerpt: Appending is an extension technique whereby plugins and applications inject their own partials, stylesheets, and JavaScript into designated areas within Workarea UIs.
|
4
|
+
---
|
5
|
+
|
6
|
+
# Appending
|
7
|
+
|
8
|
+
_Appending_ is an [extension](extension-overview.html) technique whereby plugins and applications inject their own partials, stylesheets, and JavaScript into designated areas within Workarea UIs.
|
9
|
+
|
10
|
+
## General Concepts
|
11
|
+
|
12
|
+
Workarea provides uniquely identified <dfn>append points</dfn> within views and asset manifests to which plugins and applications may append their own files, which are informally referred to as <dfn>appends</dfn>. The mappings of appends to append points are stored in <dfn>appends hashes</dfn>.
|
13
|
+
|
14
|
+
### Append Points
|
15
|
+
|
16
|
+
The following helper methods are used within Workarea views and asset manifests to declare append points.
|
17
|
+
|
18
|
+
- `Workarea::PluginsHelper#append_partials` to provide append points within views
|
19
|
+
- `Workarea::Plugin::AssetAppendsHelper#append_stylesheets` to provide append points within stylesheet manifests
|
20
|
+
- `Workarea::Plugin::AssetAppendsHelper#append_javascripts` to provide append points within JavaScript manifests
|
21
|
+
|
22
|
+
These methods each take an argument to provide a name for the append point, which is namespaced to a particular UI, and `append_partials` takes an additional argument for local variables. The behavior of each is slightly different, so review the details and examples for each type of append, below.
|
23
|
+
|
24
|
+
Append points are generally provided by the _base platform_ for use by plugins and applications. However, in some cases a plugin may also want to provide append points to allow it to be extended by other plugins and applications.
|
25
|
+
|
26
|
+
### Appends
|
27
|
+
|
28
|
+
Appends are the files a plugin or application assigns to particular append points within the platform. Plugins and applications use the following methods to declare the mappings of appends to append points.
|
29
|
+
|
30
|
+
- `Workarea::Plugin.append_partials` to assign one or more partials to an append point within a view
|
31
|
+
- `Workarea::Plugin.append_stylesheets` to assign one or more stylesheets to an append point within a stylesheet manifest
|
32
|
+
- `Workarea::Plugin.append_javascripts` to assign one or more JavaScript files to an append point within a JavaScript manifest
|
33
|
+
|
34
|
+
Each of these methods takes a variable number of arguments, where the first argument is the name of the append point and the additional arguments are paths to appends. See the examples below for details.
|
35
|
+
|
36
|
+
The methods above are also accessible via the aliases `Workarea.append_partials`, `Workarea.append_stylesheets`, and `Workarea.append_javascripts`. These aliases are the preferred form when used in applications.
|
37
|
+
|
38
|
+
### Appends Hashes
|
39
|
+
|
40
|
+
Three appends hashes store the lists of appends that have been assigned to append points, grouped by append point name. These hashes are directly accessible via the following APIs.
|
41
|
+
|
42
|
+
- `Workarea::Plugin.partials_appends`
|
43
|
+
- `Workarea::Plugin.stylesheets_appends`
|
44
|
+
- `Workarea::Plugin.javascripts_appends`
|
45
|
+
|
46
|
+
Each method above returns a hash where each key is the name of an append point, and each value is an ordered list of files assigned to that append point. Each file is identified by a logical path—see the following sections for more on this. The example below looks at the partials appends hash within my demonstration app, which has several plugins installed.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
Workarea::Plugin.partials_appends
|
50
|
+
# => {"admin.primary_nav"=>["workarea/admin/blog/menu"], "admin.dashboard.index.navigation"=>["workarea/admin/blog/dashboard_navigation"] ...
|
51
|
+
```
|
52
|
+
|
53
|
+
The following view of the same data is easier to read and shows the appends nested under their append points.
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
puts Workarea::Plugin.partials_appends.sort.to_yaml.gsub('-', ' ')
|
57
|
+
#
|
58
|
+
# admin.catalog_product_aux_navigation
|
59
|
+
# workarea/admin/reviews/catalog_products_aux_link
|
60
|
+
# admin.catalog_product_cards
|
61
|
+
# workarea/admin/catalog_products/packaged_products_card
|
62
|
+
# workarea/admin/catalog_products/swatches_card
|
63
|
+
# admin.dashboard.index.navigation
|
64
|
+
# workarea/admin/blog/dashboard_navigation
|
65
|
+
# admin.marketing_menu
|
66
|
+
# workarea/admin/reviews/menu
|
67
|
+
# admin.primary_nav
|
68
|
+
# workarea/admin/blog/menu
|
69
|
+
# admin.product_attributes_card
|
70
|
+
# workarea/admin/catalog_products/browse_option_attribute_card
|
71
|
+
# admin.product_bulk_update_settings
|
72
|
+
# workarea/admin/bulk_action_product_edits/browse_option_field
|
73
|
+
# admin.product_fields
|
74
|
+
# workarea/admin/catalog_products/browse_option_field
|
75
|
+
# workarea/admin/catalog_products/clothing_fields
|
76
|
+
# admin.product_index_actions
|
77
|
+
# workarea/admin/catalog_products/create_package_button
|
78
|
+
# admin.releasable_models
|
79
|
+
# workarea/admin/content_blog_entries/releasable_model
|
80
|
+
# storefront.above_search_results
|
81
|
+
# workarea/storefront/searches/search_type_toggle
|
82
|
+
# storefront.product_details
|
83
|
+
# workarea/storefront/products/reviews_aggregate
|
84
|
+
# workarea/storefront/products/share
|
85
|
+
# storefront.product_show
|
86
|
+
# workarea/storefront/products/reviews
|
87
|
+
# storefront.product_summary
|
88
|
+
# workarea/storefront/products/reviews_summary
|
89
|
+
# workarea/storefront/products/clothing_summary
|
90
|
+
# storefront.style_guide_product_summary
|
91
|
+
# workarea/storefront/style_guides/reviews_product_summary_docs
|
92
|
+
# workarea/storefront/style_guides/clothing_product_summary_docs
|
93
|
+
```
|
94
|
+
|
95
|
+
## Details & Examples
|
96
|
+
|
97
|
+
The following sections cover additional details and provide examples for each append type.
|
98
|
+
|
99
|
+
### Appending Partials
|
100
|
+
|
101
|
+
When a Workarea application renders a view which contains append points, each invocation of `append_partials` looks in the partials appends hash for the partials assigned to that append point. The paths assigned to the append point are then rendered in the order in which they appear in the hash. The paths must therefore be in a format that Rails' `render` helper can resolve. Paths are typically specified relative to _engine\_root/app/views/_ and the leading underscore and trailing extension are omitted from the file's basename (see examples above).
|
102
|
+
|
103
|
+
Additionally, each rendered partial has access to the local variables provided as the second argument to that specific append point.
|
104
|
+
|
105
|
+
For example, review the following Storefront product template excerpt. Following the add-to-cart form is the _storefront.product\_details_ append point, to which the partial passes its local variable `product`. Each partial rendered here by `append_partials` has access to this local variable.
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
/ workarea-storefront-3.1.1/app/views/workarea/storefront/products/templates/_generic.html.haml
|
109
|
+
|
110
|
+
= form_tag cart_items_path, method: 'post', class: 'product-details__add-to-cart-form', /...
|
111
|
+
/ ...
|
112
|
+
|
113
|
+
%p.product-details__add-to-cart-action= button_tag, /...
|
114
|
+
|
115
|
+
/ ...
|
116
|
+
|
117
|
+
= append_partials('storefront.product_details', product: product)
|
118
|
+
```
|
119
|
+
|
120
|
+
Workarea Reviews, which I've installed in my demonstration app, includes a partial which is appended to the above append point. The partial, shown below, makes use of the `product` variable.
|
121
|
+
|
122
|
+
```ruby
|
123
|
+
/ workarea-reviews-2.1.0/app/views/workarea/storefront/products/_reviews_aggregate.html.haml
|
124
|
+
|
125
|
+
- if product.has_reviews?
|
126
|
+
.reviews-aggregate{ itemprop: 'aggregateRating', itemscope: true, itemtype: 'http://schema.org/AggregateRating' }
|
127
|
+
= link_to "#{product_path(product, product.browse_link_options)}#reviews", data: { scroll_to_button: '' }, class: 'reviews-aggregate__rating-link' do
|
128
|
+
= rating_stars(product.average_rating, aggregate: true)
|
129
|
+
|
130
|
+
/ ...
|
131
|
+
```
|
132
|
+
|
133
|
+
Similarly, Workarea Share, which I've also installed, provides a partial for this append point. That partial also makes use of the `product` variable. <sup><a href="#notes" id="note-1-context">[1]</a></sup>
|
134
|
+
|
135
|
+
```ruby
|
136
|
+
/ workarea-share-1.1.0/app/views/workarea/storefront/products/_share.html.haml
|
137
|
+
|
138
|
+
= render 'workarea/storefront/shares/share_buttons', share_url: share_product_url(product, sku: product.options[:sku]), /...
|
139
|
+
```
|
140
|
+
|
141
|
+
Each of these plugins also provides an initializer which calls `Workarea::Plugin.append_partials` to assign the partial within the plugin to the append point within the Storefront.
|
142
|
+
|
143
|
+
```ruby
|
144
|
+
# workarea-reviews-2.1.0/config/initializers/append_points.rb
|
145
|
+
|
146
|
+
module Workarea
|
147
|
+
# ...
|
148
|
+
|
149
|
+
Plugin.append_partials(
|
150
|
+
'storefront.product_details',
|
151
|
+
'workarea/storefront/products/reviews_aggregate'
|
152
|
+
)
|
153
|
+
|
154
|
+
# ...
|
155
|
+
end
|
156
|
+
|
157
|
+
# workarea-share/config/initializers/appends.rb
|
158
|
+
|
159
|
+
Workarea.append_partials(
|
160
|
+
'storefront.product_details',
|
161
|
+
'workarea/storefront/products/share'
|
162
|
+
)
|
163
|
+
|
164
|
+
# ...
|
165
|
+
```
|
166
|
+
|
167
|
+
When my application boots, Reviews loads before Share because Reviews appears earlier in my Gemfile. The Reviews initializer is therefore loaded before the Share initializer, and the Reviews partial is appended first. The following example shows the state of this append point within the appends hash.
|
168
|
+
|
169
|
+
```ruby
|
170
|
+
Workarea::Plugin.partials_appends['storefront.product_details']
|
171
|
+
# => ["workarea/storefront/products/reviews_aggregate", "workarea/storefront/products/share"]
|
172
|
+
```
|
173
|
+
|
174
|
+
Browsing to a page that renders the above Storefront template reveals the result: review stars and share buttons rendered below the product form.
|
175
|
+
|
176
|
+

|
177
|
+
|
178
|
+
### Appending Assets
|
179
|
+
|
180
|
+
The same concepts apply when appending stylesheets and JavaScript files to asset manifests. Within manifests, calls to `append_stylesheets` and `append_javascripts` denote append points.
|
181
|
+
|
182
|
+
Within a stylesheet manifest, stylesheets are included via `@import` statements. The `append_stylesheets` method therefore finds all appends for the given append point and constructs an `@import` for each. Paths to stylesheet appends are therefore specified as any path that Sass's `@import` can resolve. Paths are typically specified relative to _engine\_root/app/assets/stylesheets/_, and the leading underscore and trailing extension are omitted from the basename. See examples below.
|
183
|
+
|
184
|
+
In a similar fashion, JavaScript files are included in a JavaScript manifest using `require_asset` statements. The `append_javascripts` method therefore constructs a `require_asset` statement for each JavaScript append within each append point. JavaScript paths are specified as any path that Sprockets' `require_asset` can resolve. Paths are typically specified relative to _engine\_root/app/assets/javascripts/_, and the trailing extension is omitted from the basename.
|
185
|
+
|
186
|
+
I'll re-use my app from above and the Reviews plugin to demonstrate asset appending.
|
187
|
+
|
188
|
+
The Storefront stylesheet manifest provides the _storefront.components_ append point, which allows plugins and applications to append additional component stylesheets after the Storefront's own components.
|
189
|
+
|
190
|
+
```ruby
|
191
|
+
<%# workarea-storefront-3.1.1/app/assets/stylesheets/workarea/storefront/application.scss.erb %>
|
192
|
+
|
193
|
+
<%# ... %>
|
194
|
+
|
195
|
+
@import 'workarea/storefront/components/pagination';
|
196
|
+
@import 'workarea/storefront/components/svg_icon';
|
197
|
+
@import 'workarea/storefront/components/sitemap';
|
198
|
+
@import 'workarea/storefront/components/sitemap_pagination';
|
199
|
+
<%= append_stylesheets('storefront.components') %>
|
200
|
+
|
201
|
+
<%# ... %>
|
202
|
+
```
|
203
|
+
|
204
|
+
And the Storefront JavaScript manifest provides the _storefront.modules_ append point, which allows plugins and applications to append additional JavaScript module files after the Storefront's own modules.
|
205
|
+
|
206
|
+
```ruby
|
207
|
+
<%# workarea-storefront-3.1.1/app/assets/javascripts/workarea/storefront/application.js.erb %>
|
208
|
+
|
209
|
+
<%
|
210
|
+
# ...
|
211
|
+
%w(
|
212
|
+
# ...
|
213
|
+
workarea/storefront/modules/recommendations_placeholders
|
214
|
+
workarea/storefront/modules/recent_views
|
215
|
+
workarea/storefront/modules/workarea_analytics
|
216
|
+
workarea/storefront/modules/mobile_nav_button
|
217
|
+
).each do |asset|
|
218
|
+
require_asset asset
|
219
|
+
end
|
220
|
+
|
221
|
+
# ...
|
222
|
+
|
223
|
+
append_javascripts('storefront.modules')
|
224
|
+
%>
|
225
|
+
|
226
|
+
<%# ... %>
|
227
|
+
```
|
228
|
+
|
229
|
+
Workarea Reviews includes five Storefront component stylesheets and three Storefront modules. The plugin uses an initializer to append these stylesheets and JavaScript files to the append points shown above.
|
230
|
+
|
231
|
+
```ruby
|
232
|
+
# workarea-reviews-2.1.0/config/initializers/append_points.rb
|
233
|
+
|
234
|
+
module Workarea
|
235
|
+
# ...
|
236
|
+
|
237
|
+
Plugin.append_stylesheets(
|
238
|
+
'storefront.components',
|
239
|
+
'workarea/storefront/reviews/components/product_summary',
|
240
|
+
'workarea/storefront/reviews/components/rating',
|
241
|
+
'workarea/storefront/reviews/components/reviews',
|
242
|
+
'workarea/storefront/reviews/components/reviews_aggregate',
|
243
|
+
'workarea/storefront/reviews/components/write_review',
|
244
|
+
)
|
245
|
+
|
246
|
+
# ...
|
247
|
+
|
248
|
+
Plugin.append_javascripts(
|
249
|
+
'storefront.modules',
|
250
|
+
'workarea/storefront/reviews/modules/product_review_ajax_submit',
|
251
|
+
'workarea/storefront/reviews/modules/product_reviews_sort_menus',
|
252
|
+
'workarea/storefront/reviews/modules/rating_buttons',
|
253
|
+
)
|
254
|
+
|
255
|
+
# ...
|
256
|
+
end
|
257
|
+
```
|
258
|
+
|
259
|
+
Booting my app and examining the appends hashes reveals the five Reviews stylesheets and the three Reviews JS modules are present.
|
260
|
+
|
261
|
+
```ruby
|
262
|
+
puts Workarea::Plugin.stylesheets_appends['storefront.components'].grep(/reviews/)
|
263
|
+
# workarea/storefront/reviews/components/product_summary
|
264
|
+
# workarea/storefront/reviews/components/rating
|
265
|
+
# workarea/storefront/reviews/components/reviews
|
266
|
+
# workarea/storefront/reviews/components/reviews_aggregate
|
267
|
+
# workarea/storefront/reviews/components/write_review
|
268
|
+
|
269
|
+
puts Workarea::Plugin.javascripts_appends['storefront.modules'].grep(/reviews/)
|
270
|
+
# workarea/storefront/reviews/modules/product_review_ajax_submit
|
271
|
+
# workarea/storefront/reviews/modules/product_reviews_sort_menus
|
272
|
+
# workarea/storefront/reviews/modules/rating_buttons
|
273
|
+
```
|
274
|
+
|
275
|
+
Furthermore, I can confirm the home page HTML contains script tags for the JavaScript files, and the compiled application manifest references the imported stylesheets. <sup><a href="#notes" id="note-2-context">[2]</a></sup> <sup><a href="#notes" id="note-3-context">[3]</a></sup>
|
276
|
+
|
277
|
+
```bash
|
278
|
+
$ curl -s 'http://10.10.10.10:3000' | # request home page
|
279
|
+
> grep 'reviews\/modules' | # find lines with 'reviews/modules'
|
280
|
+
> sed -e 's,/assets/workarea/storefront/, ... ,' -e 's,self-.*\.js?body=1,js ...,' # remove noise
|
281
|
+
<script src=" ... reviews/modules/product_review_ajax_submit.js ..."></script>
|
282
|
+
<script src=" ... reviews/modules/product_reviews_sort_menus.js ..."></script>
|
283
|
+
<script src=" ... reviews/modules/rating_buttons.js ..."></script>
|
284
|
+
|
285
|
+
$ curl -s 'http://10.10.10.10:3000/assets/workarea/storefront/application.css' | # request compiled manifest
|
286
|
+
> grep 'reviews\/components' | # find lines with 'reviews/components'
|
287
|
+
> sed 's/^.*\(reviews\/components\/_.*\.scss\).*$/\1/'| # remove noise
|
288
|
+
> uniq # remove duplicate lines
|
289
|
+
reviews/components/_product_summary.scss
|
290
|
+
reviews/components/_rating.scss
|
291
|
+
reviews/components/_reviews.scss
|
292
|
+
reviews/components/_reviews_aggregate.scss
|
293
|
+
reviews/components/_write_review.scss
|
294
|
+
```
|
295
|
+
|
296
|
+
### Appending from an Application
|
297
|
+
|
298
|
+
Appending from an application is no different than appending from a plugin. In the following examples, I append the files necessary to create a _loyalty-badge_ component in the Storefront. First I create the files to append: a style guide partial, a stylesheet, and a JavaScript module.
|
299
|
+
|
300
|
+
```bash
|
301
|
+
$ touch app/views/workarea/storefront/style_guides/components/_loyalty_badge.html.haml
|
302
|
+
$ touch app/assets/stylesheets/workarea/storefront/components/_loyalty_badge.scss
|
303
|
+
$ touch app/assets/javascripts/workarea/storefront/modules/loyalty_badge.js
|
304
|
+
```
|
305
|
+
|
306
|
+
Then I create an initializer to append the files to the appropriate append points.
|
307
|
+
|
308
|
+
```ruby
|
309
|
+
# config/initializers/appends.rb
|
310
|
+
|
311
|
+
Workarea.append_partials(
|
312
|
+
'storefront.product_details',
|
313
|
+
'workarea/storefront/style_guides/components/loyalty_badge'
|
314
|
+
)
|
315
|
+
|
316
|
+
Workarea.append_stylesheets(
|
317
|
+
'storefront.components',
|
318
|
+
'workarea/storefront/components/loyalty_badge'
|
319
|
+
)
|
320
|
+
|
321
|
+
Workarea.append_javascripts(
|
322
|
+
'storefront.modules',
|
323
|
+
'workarea/storefront/modules/loyalty_badge'
|
324
|
+
)
|
325
|
+
```
|
326
|
+
|
327
|
+
## Limitations & Workarounds
|
328
|
+
|
329
|
+
### Clearing the Application Assets Cache
|
330
|
+
|
331
|
+
At times, it may seem as though appended assets are not being applied to your application while developing. This occurs in environments where assets are compiled on the fly (such as Development), because Sprockets caches the compiled assets and loads the assets from this cache if no changes have occurred between requests. Changing appends hashes does not bust the Sprockets cache, so for example, if you install an additional plugin between requests, Sprockets is unaware the new plugin has appended additional assets and uses its existing cache.
|
332
|
+
|
333
|
+
To resolve this issue, you must clear your application's assets cache in _tmp/cache/assets_. You can delete the directory or use one of the Rake tasks Rails provides for this purpose.
|
334
|
+
|
335
|
+
The following example shows the _tmp_ directory of my demonstration app after browsing to the home page. I've limited the output to 4 levels since the assets cache is composed of a staggering number of directories and files.
|
336
|
+
|
337
|
+
```bash
|
338
|
+
$ find tmp -maxdepth 4
|
339
|
+
tmp
|
340
|
+
tmp/.keep
|
341
|
+
tmp/cache
|
342
|
+
tmp/cache/.gitkeep
|
343
|
+
tmp/cache/assets
|
344
|
+
tmp/cache/assets/sprockets
|
345
|
+
tmp/cache/assets/sprockets/v3.0
|
346
|
+
tmp/pids
|
347
|
+
tmp/restart.txt
|
348
|
+
tmp/sockets
|
349
|
+
```
|
350
|
+
|
351
|
+
Next, I used _rails -T_ to list the tasks Rails provides for managing the _tmp_ directory.
|
352
|
+
|
353
|
+
```bash
|
354
|
+
$ bin/rails -T tmp
|
355
|
+
rails tmp:clear # Clear cache and socket files from tmp/ (narrow w/ tmp:cache:clear, tmp:sockets:clear)
|
356
|
+
rails tmp:create # Creates tmp directories for cache, sockets, and pids
|
357
|
+
```
|
358
|
+
|
359
|
+
Finally, I ran the appropriate task to clear the assets cache, and then I listed the _tmp_ directory again to confirm the assets cache files were gone.
|
360
|
+
|
361
|
+
```bash
|
362
|
+
$ bin/rails tmp:cache:clear
|
363
|
+
$ find tmp -maxdepth 4
|
364
|
+
tmp
|
365
|
+
tmp/.keep
|
366
|
+
tmp/cache
|
367
|
+
tmp/cache/.gitkeep
|
368
|
+
tmp/pids
|
369
|
+
tmp/restart.txt
|
370
|
+
tmp/sockets
|
371
|
+
```
|
372
|
+
|
373
|
+
### Adding "Missing" Append Points
|
374
|
+
|
375
|
+
Another issue you may experience while developing (particularly plugins) is the append point you need does not exist in the platform. To resolve this, first try to find a "nearby" append point that you can use instead. Generally speaking, the placement of appends is inexact.
|
376
|
+
|
377
|
+
Applications can use [overriding](overriding.html) in place of or in addition to appending when precise placement of new code is required. For more on this, see Re-Positioning Partials within a View, below.
|
378
|
+
|
379
|
+
If you must use appending (e.g. you're developing a plugin) and there is no suitable append point for your needs, open a pull request that adds the new append point(s) to the platform. Platform append points are often added in patch releases, making the new append points available to all new and patched applications.
|
380
|
+
|
381
|
+
### Removing Appends from Append Points
|
382
|
+
|
383
|
+
**Workarea 3.2 added convenience methods for removing appends that improve the process described below.**
|
384
|
+
|
385
|
+
When developing applications, you may want to remove appends from append points. For example, in the image below, the reviews summary and share buttons are appended to _storefront.product\_details_ and rendered below the "Add to Cart" button. However, business requirements may call for the reviews summary to be removed from this particular view.
|
386
|
+
|
387
|
+

|
388
|
+
|
389
|
+
Prior to Workarea 3.2, there is no formal API to remove an append from an append point. However, you can manipulate the appends hashes directly. To prevent the reviews summary from displaying, you can remove that partial from that append point within the partials appends hash. The following initializer does the trick.
|
390
|
+
|
391
|
+
```ruby
|
392
|
+
# config/initializers/appends.rb
|
393
|
+
|
394
|
+
Workarea::Plugin.partials_appends['storefront.product_details']
|
395
|
+
.delete('workarea/storefront/products/reviews_aggregate')
|
396
|
+
```
|
397
|
+
|
398
|
+
After rebooting the app and re-visiting the page, the reviews summary is gone.
|
399
|
+
|
400
|
+

|
401
|
+
|
402
|
+
Looking at the code example above, notice that I deleted a specific member of the array, referencing it by its value. When removing appends, do not reference them by index, since the indexes may change as you add, remove, and re-order the plugins you have installed.
|
403
|
+
|
404
|
+
Furthermore, always mutate the existing array rather than replacing its value entirely. This ensures that external changes to the appends hash (from adding/removing plugins or upgrading to newer versions) will cascade through to your application as intended.
|
405
|
+
|
406
|
+
#### Convenience Methods for Removing Appends
|
407
|
+
|
408
|
+
Workarea 3.2.0 [added convenience methods to remove appends](workarea-3-2-0.html#adds-convenience-methods-to-remove-appends), providing parity with the original methods for appending to appends hashes. These methods are
|
409
|
+
|
410
|
+
- `Workarea::Plugin.remove_partials`
|
411
|
+
- `Workarea::Plugin.remove_stylesheets`
|
412
|
+
- `Workarea::Plugin.remove_javascripts`
|
413
|
+
|
414
|
+
#### Removing Appends via Configuration
|
415
|
+
|
416
|
+
Since Workarea 3.4.0, applications may be configured to exclude appends from being added in the first place, by modifying the following config values:
|
417
|
+
|
418
|
+
```ruby
|
419
|
+
config.skip_partials = []
|
420
|
+
config.skip_stylesheets = []
|
421
|
+
config.skip_javascripts = []
|
422
|
+
```
|
423
|
+
|
424
|
+
The items in these arrays may be of type `String`, `RegExp` or `Proc`, giving a wider range of flexibility to the developer.
|
425
|
+
|
426
|
+
```ruby
|
427
|
+
config.skip_partials = [
|
428
|
+
'workarea/storefront/products/reviews_aggregate',
|
429
|
+
/wishlists/
|
430
|
+
]
|
431
|
+
|
432
|
+
config.skip_stylesheets = [
|
433
|
+
Proc.new { |p| p.include?('reviews') }
|
434
|
+
]
|
435
|
+
```
|
436
|
+
|
437
|
+
### Re-Ordering Appends within an Append Point
|
438
|
+
|
439
|
+
Although less common than removing appends from append points, applications may also need to re-order the appends within an append point. For example, instead of removing the reviews summary like the example above, you may need to ensure the reviews summary is the last partial rendered within the _storefront.product\_details_ append point.
|
440
|
+
|
441
|
+
As with removing appends, there is no formal API for re-ordering appends, but you can accomplish the task by manipulating the appends hashes directly. The same caveats apply to re-ordering that applied to removing: reference each append by its value rather than its index, and mutate specific members, leaving the remainder of the array unchanged. One way to ensure a particular order under these constraints is to remove the appends for which order matters and push them back onto the array in the desired order.
|
442
|
+
|
443
|
+
For the particular example I described above, I needed to ensure the reviews summary is the last partial in its append point. The following initializer removes the append from the append point and then pushes it back onto the end of the array, ensuring it comes last.
|
444
|
+
|
445
|
+
```ruby
|
446
|
+
# config/initializers/appends.rb
|
447
|
+
|
448
|
+
Workarea::Plugin.partials_appends['storefront.product_details']
|
449
|
+
.delete('workarea/storefront/products/reviews_aggregate')
|
450
|
+
|
451
|
+
Workarea::Plugin.partials_appends['storefront.product_details']
|
452
|
+
.push('workarea/storefront/products/reviews_aggregate')
|
453
|
+
```
|
454
|
+
|
455
|
+
After a restart, the reviews summary renders below the share buttons.
|
456
|
+
|
457
|
+

|
458
|
+
|
459
|
+
You can manipulate the appends hashes as much as needed, however, anything more involved than the above example is likely going beyond the intended use cases for appending. [Overriding](overriding.html) provides more granular control over UI code, as demonstrated below.
|
460
|
+
|
461
|
+
### Re-Positioning Partials within a View
|
462
|
+
|
463
|
+
Partials may be appended only at the append points provided by the platform. Applications may need to move an entire append point or particular appends to another location within the DOM. To do so, you must [override](overriding.html) the view which contains the append point. Then, within that override, you can either move the entire append point, or you can remove particular partials from the append point and render them separately within the view override.
|
464
|
+
|
465
|
+
For example, your design may call for the reviews summary to be output below the product name and id, while the share buttons are to stay below the "Add to Cart" button. You can achieve this using an initializer to remove the partial from the append point, and an override to render the partial immediately following the `.product-details__name` element in the DOM.
|
466
|
+
|
467
|
+
The following initializer removes the append from the append point.
|
468
|
+
|
469
|
+
```ruby
|
470
|
+
# config/initializers/appends.rb
|
471
|
+
|
472
|
+
Workarea::Plugin.partials_appends['storefront.product_details']
|
473
|
+
.delete('workarea/storefront/products/reviews_aggregate')
|
474
|
+
```
|
475
|
+
|
476
|
+
And the following diff shows the changes I made within my view override (see [Overriding](overriding.html) for more on that subject). When rendering the partials outside of the append point, be sure to pass through the same local variables provided by the append point (`product` in my example below).
|
477
|
+
|
478
|
+
```diff
|
479
|
+
diff --git a/app/views/workarea/storefront/products/templates/_generic.html.haml b/app/views/workarea/storefront/products/templates/_generic.html.haml
|
480
|
+
index 09579b2..a5725e8 100644
|
481
|
+
--- a/app/views/workarea/storefront/products/templates/_generic.html.haml
|
482
|
+
+++ b/app/views/workarea/storefront/products/templates/_generic.html.haml
|
483
|
+
@@ -4,12 +4,14 @@
|
484
|
+
.product-details__name
|
485
|
+
%h1{ itemprop: 'name' }= product.name
|
486
|
+
|
487
|
+
%p.product-details__id
|
488
|
+
%span{ itemprop: 'productID' }= product.id
|
489
|
+
|
490
|
+
+ = render 'workarea/storefront/products/reviews_aggregate', product: product
|
491
|
+
+
|
492
|
+
.product-prices.product-prices--details{ itemprop: 'offers', itemscope: true, itemtype: 'http://schema.org/Offer' }
|
493
|
+
= render 'workarea/storefront/products/pricing', product: product
|
494
|
+
```
|
495
|
+
|
496
|
+
The final result (after rebooting and reloading the page) is as follows.
|
497
|
+
|
498
|
+

|
499
|
+
|
500
|
+
## Notes
|
501
|
+
|
502
|
+
[1] This partial immediately renders another partial called _share\_buttons_, but the share buttons partial expects the `share_url` and `sku` local variables to be present, so values must be constructed for those variables using the value of `product`.
|
503
|
+
|
504
|
+
[2] Understanding these Unix command lines is not important. But it _is_ important you know _where_ to look and _what_ to look for when things aren't working. You can confirm these details equally well by inspecting the output manually in your browser.
|
505
|
+
|
506
|
+
[3] These inspections depend on debugging output that is present in Rails' Development environment that may not be present in other environments.
|