Sha256: a8a42925237c771c3759c0c27ec6a191f13a5ffb8c635783135f4d407424fdbb

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

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

    var userWelcomeTemplate = JST['workarea/storefront/templates/user_welcome'],

        injectUserWelcomeMessage = function (currentUser, index, element) {
            $(element).replaceWith(userWelcomeTemplate({
                username: currentUser.first_name
            }));
        },

        testPlaceholders = function ($scope, currentUser) {
            $('[data-user-welcome-placeholder]', $scope).each(_.partial(injectUserWelcomeMessage, currentUser));
        },

        testCurrentUser = function ($scope, currentUser) {
            if (!currentUser.logged_in) { return; }

            testPlaceholders($scope, currentUser);
        },

        /**
         * @method
         * @name init
         * @memberof WORKAREA.userWelcomePlaceholders
         */
        init = function ($scope) {
            WORKAREA.currentUser.gettingUserData
            .done(_.partial(testCurrentUser, $scope));
        };

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

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
workarea-nvy_theme-1.2.1 app/assets/javascripts/workarea/storefront/modules/user_welcome_placeholder.js
workarea-haven_theme-1.4.0 app/assets/javascripts/workarea/storefront/modules/user_welcome_placeholder.js
workarea-haven_theme-1.3.0 app/assets/javascripts/workarea/storefront/modules/user_welcome_placeholder.js
workarea-nvy_theme-1.2.0 app/assets/javascripts/workarea/storefront/modules/user_welcome_placeholder.js
workarea-nvy_theme-1.1.4 app/assets/javascripts/workarea/storefront/modules/user_welcome_placeholder.js
workarea-nvy_theme-1.1.3 app/assets/javascripts/workarea/storefront/modules/user_welcome_placeholder.js
workarea-nvy_theme-1.1.2 app/assets/javascripts/workarea/storefront/modules/user_welcome_placeholder.js