Sha256: 8b32317773578387146458c95107f45230b668118cd447ab030cc5c121dbb2ba

Contents?: true

Size: 923 Bytes

Versions: 62

Compression:

Stored size: 923 Bytes

Contents

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

    var inputHandler = function (field, type, event) {
            var property = $(field).closest('.property');

            event.preventDefault();

            $('input[type=' +type+']', property).val($(event.currentTarget).val());
        },

        setupField = function (index, field) {
            $('input[type="range"]', field)
            .on('input change', _.partial(inputHandler, field, 'number'));

            $('input[type="number"]', field)
            .on('input change', _.partial(inputHandler, field, 'range'));
        },

        /**
         * @method
         * @name init
         * @memberof WORKAREA.rangeFields
         */
        init = function ($scope) {
            $('[data-range-field]', $scope).each(setupField);
        };

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

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.4.13 app/assets/javascripts/workarea/admin/modules/range_fields.js
workarea-admin-3.4.12 app/assets/javascripts/workarea/admin/modules/range_fields.js