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.27 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.5.26 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.4.45 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.5.25 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.5.23 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.4.44 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.5.22 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.4.43 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.5.21 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.4.42 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.5.20 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.4.41 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.5.19 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.4.40 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.5.18 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.4.39 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.5.17 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.4.38 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.5.16 app/assets/javascripts/workarea/core/modules/reveal_password.js
workarea-core-3.4.37 app/assets/javascripts/workarea/core/modules/reveal_password.js