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,506 +0,0 @@
|
|
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
|
-
![Appended rating stars and share buttons](images/reviews-summary-above-share-buttons.png)
|
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
|
-
![Reviews summary above share buttons](images/reviews-summary-above-share-buttons.png)
|
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
|
-
![Reviews summary removed](images/reviews-summary-removed.png)
|
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
|
-
![Reviews summary below share buttons](images/reviews-summary-below-share-buttons.png)
|
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
|
-
![Reviews summary below product name](images/reviews-summary-below-product-name.png)
|
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.
|
@@ -1,88 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Application Document
|
3
|
-
excerpt: An application document is a persistable model with a global id, timestamps, an audit log, and life cycle callbacks providing hooks for callbacks workers. An application document cleans some of its data before validation and before create.
|
4
|
-
---
|
5
|
-
|
6
|
-
# Application Document
|
7
|
-
|
8
|
-
An <dfn>application document</dfn> is a persistable model with a global id, timestamps, an audit log, and life cycle callbacks providing hooks for [callbacks workers](workers.html#callbacks-worker). An application document cleans some of its data before validation and before create.
|
9
|
-
|
10
|
-
## Mongoid
|
11
|
-
|
12
|
-
Workarea employs [Mongoid](https://rubygems.org/gems/mongoid) ([docs](https://docs.mongodb.com/ruby-driver/master/mongoid/), [source](https://github.com/mongodb/mongoid)), MongoDB's <abbr title="object document mapper">ODM</abbr> written in Ruby, to map between in-memory models and documents persisted to disk.
|
13
|
-
|
14
|
-
### Document
|
15
|
-
|
16
|
-
An application document includes the `Mongoid::Document` module ([docs](https://docs.mongodb.com/ruby-driver/master/tutorials/6.1.0/mongoid-documents/), [docs](http://www.rubydoc.info/gems/mongoid/6.0.0/Mongoid/Document)), providing a large API for document persistence, queries, relations, callbacks, validations, indexes, and more.
|
17
|
-
|
18
|
-
### Timestamps
|
19
|
-
|
20
|
-
An application document also includes Mongoid's `Mongoid::Timestamps` module ([docs](http://www.rubydoc.info/gems/mongoid/6.0.0/Mongoid/Timestamps)), which provides timestamp fields and accessor methods such as `ApplicationDocument#created_at` and `ApplicationDocument#updated_at`.
|
21
|
-
|
22
|
-
### Audit Log
|
23
|
-
|
24
|
-
An application document additionally includes the `Mongoid::AuditLog` module ([docs](http://www.rubydoc.info/gems/mongoid-audit_log/0.4.0/Mongoid/AuditLog)) from the [mongoid-audit\_log](https://rubygems.org/gems/mongoid-audit_log) library ([docs](http://www.rubydoc.info/gems/mongoid-audit_log/0.4.0), [source](https://github.com/bencrouse/mongoid-audit_log)). This library provides basic audit logging for each application document. `ApplicationDocument#audit_log_entries` provides access to the audit log entries for an application document instance.
|
25
|
-
|
26
|
-
## Global ID
|
27
|
-
|
28
|
-
An application document includes `GlobalID::Identification` ([docs](http://www.rubydoc.info/gems/globalid/0.3.7/GlobalID/Identification)), providing the model with a global id that is guaranteed to be unique within the application, independent of its type.
|
29
|
-
|
30
|
-
## Callbacks Workers
|
31
|
-
|
32
|
-
An application document includes `Sidekiq::Callbacks`, providing `ApplicationDocument#run_callbacks`, an extension of `ActiveSupport::Callbacks#run_callbacks` ([docs](http://api.rubyonrails.org/classes/ActiveSupport/Callbacks.html#method-i-run_callbacks)) allowing [callbacks workers](workers.html#callbacks-worker) to run or enqueue in response to the document's life cycle callbacks, such as `after_save` and `after_destroy`.
|
33
|
-
|
34
|
-
## Data Cleaning
|
35
|
-
|
36
|
-
An application document cleans array fields before validation and ensures default locale values before create.
|
37
|
-
|
38
|
-
### Reject Blank Array Members
|
39
|
-
|
40
|
-
Before validation, each field value of type `Array` is cleaned to remove blank members.
|
41
|
-
|
42
|
-
```
|
43
|
-
category = Workarea::Catalog::Category.new(terms_facets: ['color', '', nil, 'size'])
|
44
|
-
|
45
|
-
category.terms_facets
|
46
|
-
# => ["color", "", nil, "size"]
|
47
|
-
|
48
|
-
category.validate
|
49
|
-
|
50
|
-
category.terms_facets
|
51
|
-
# => ["color", "size"]
|
52
|
-
```
|
53
|
-
|
54
|
-
### Ensure Default Locale Values
|
55
|
-
|
56
|
-
Before create, for each localized field with a value, the value is copied to the default locale if that value is blank within the default locale. Ensuring a value for the default locale avoids a class of errors when locales switch or fall back.
|
57
|
-
|
58
|
-
```
|
59
|
-
I18n.default_locale
|
60
|
-
# => :en
|
61
|
-
|
62
|
-
I18n.locale
|
63
|
-
# => :en
|
64
|
-
|
65
|
-
# change to non-default locale
|
66
|
-
I18n.locale = :fr
|
67
|
-
|
68
|
-
I18n.locale
|
69
|
-
# => :fr
|
70
|
-
|
71
|
-
# within this locale, create a product with a name (a localized field)
|
72
|
-
red_dress = Workarea::Catalog::Product.create!(name: 'Robe Rouge')
|
73
|
-
|
74
|
-
red_dress.name
|
75
|
-
# => "Robe Rouge"
|
76
|
-
|
77
|
-
# switch back to the default locale
|
78
|
-
I18n.locale = I18n.default_locale
|
79
|
-
|
80
|
-
# the 'name' value from the :fr locale has been copied to the :en locale to
|
81
|
-
# avoid errors when switching or falling back
|
82
|
-
red_dress.name
|
83
|
-
# => "Robe Rouge"
|
84
|
-
|
85
|
-
# red_dress.name_translations
|
86
|
-
# => {"fr"=>"Robe Rouge", "en"=>"Robe Rouge"}
|
87
|
-
```
|
88
|
-
|