Sha256: 85ace521b8d4e8bf3647ee14fb93fa6b018d0d823946ce1ce9dca9b8105a77f1

Contents?: true

Size: 1.28 KB

Versions: 62

Compression:

Stored size: 1.28 KB

Contents

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

    var buttonTemplate = JST['workarea/core/templates/reveal_password_button'],

        toggleButton = function ($field, event) {
            var $button = $(event.currentTarget);

            $button.addClass('hidden');
            $button.siblings('[data-reveal-password]').removeClass('hidden');

            if ($button.data('revealPassword') === 'show') {
                $field.attr('type', 'text');
            } else {
                $field.attr('type', 'password');
            }
        },

        bindButtonEvents = function ($field) {
            var $container = $field.closest('.property');

            $('[data-reveal-password]', $container)
            .on('click', _.partial(toggleButton, $field));
        },

        injectButtons = function (index, field) {
            return $(field).after(buttonTemplate());
        },

        initRevealPassword = _.flow(injectButtons, bindButtonEvents),

        /**
         * @method
         * @name init
         * @memberof WORKAREA.revealPassword
         */
        init = function ($scope) {
            $('input[type=password]', $scope).each(initRevealPassword);
        };

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

Version data entries

62 entries across 62 versions & 1 rubygems

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