Sha256: 62af2ddd078c401ac15c71f7aa82c6f11c7cdeb7ebdb9c08b676ba298d03ba3d

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

/**
 * @namespace WORKAREA.quickviewButtonPlaceholders
 */
WORKAREA.registerModule('quickviewButtonPlaceholders', (function () {
    'use strict';

    var quickviewButtonTemplate = JST['workarea/storefront/product_quickview/templates/quickview_button'],

        openQuickview = function (event) {
            var $quickviewButtonLink = $(event.currentTarget),
                url = $quickviewButtonLink.attr('href');

            event.preventDefault();

            WORKAREA.dialog.createFromUrl(url);
        },

        replacePlaceholder = function (index, placeholder) {
            var $placeholder = $(placeholder),
                data = $placeholder.data('quickviewButtonPlaceholder'),
                $quickviewButton = $(quickviewButtonTemplate({
                    analytics_data: data.analytics_data,
                    url: data.url
                }));

            WORKAREA.initModules($quickviewButton);

            $(placeholder).replaceWith($quickviewButton);

            $quickviewButton
            .on('click', 'a', openQuickview);
        },

        /**
         * @method
         * @name init
         * @memberof WORKAREA.quickviewButtonPlaceholders
         */
        init = function ($scope) {
            $('[data-quickview-button-placeholder]', $scope)
            .each(replacePlaceholder);
        };

    return {
        init: init
    };
}()));

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
workarea-product_quickview-2.0.4 app/assets/javascripts/workarea/storefront/product_quickview/modules/quickview_button_placeholders.js
workarea-product_quickview-2.0.3 app/assets/javascripts/workarea/storefront/product_quickview/modules/quickview_button_placeholders.js
workarea-product_quickview-2.0.2 app/assets/javascripts/workarea/storefront/product_quickview/modules/quickview_button_placeholders.js