Sha256: b48ce3d5c848b5c870f47bab6b2b62c3a55e1d71f26a3faab78b2663acc832e7

Contents?: true

Size: 1.04 KB

Versions: 62

Compression:

Stored size: 1.04 KB

Contents

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

    var getConfig = function (anchor) {
            return _.assign({}, WORKAREA.config.popupButtons,
                $(anchor).data('popupButton')
            );
        },

        getOptionString = function (anchor) {
            return _.map(getConfig(anchor), function (val, key) {
                return key + '=' + val;
            }).join(',');
        },

        openPopup = function (anchor) {
            window.open(anchor.href, '', getOptionString(anchor));
        },

        handleButtonClick = function (event) {
            event.preventDefault();

            openPopup(event.currentTarget);
        },

        /**
         * @method
         * @name init
         * @memberof WORKAREA.popupButtons
         */
        init = function ($scope) {
            $('[data-popup-button]', $scope).on('click', handleButtonClick);
        };

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

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.5.15 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.4.36 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.5.14 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.4.35 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.5.13 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.4.34 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.5.12 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.4.33 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.5.11 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.5.10 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.4.32 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.5.9 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.4.31 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.5.8 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.4.30 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.5.7 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.4.29 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.5.6 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.4.28 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js
workarea-storefront-3.5.5 app/assets/javascripts/workarea/storefront/modules/popup_buttons.js