Sha256: 62e8d1199baae1bccafa3568cc0cb9b3fdebf50b095cd24082475e71f6764950

Contents?: true

Size: 1021 Bytes

Versions: 27

Compression:

Stored size: 1021 Bytes

Contents

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

    /**
     * @method
     * @name init
     * @memberof WORKAREA.selects
     */
    var getConfig = function (select) {
            var config = _.assign({}, $(select).data('select'));

            if ( ! _.isUndefined(config.dropdownParent)) {
                config.dropdownParent = $(config.dropdownParent);
            }

            return config;
        },

        setup = function(index, select) {
            var config = getConfig(select),
                $select = $(select);

            if (config.allowClear) {
                $select.before(JST['workarea/core/templates/hidden_input']({
                    name: $select.attr('name'),
                    value: ''
               }));
            }

            $select.select2(config);
        },

        init = function ($scope) {
            $('[data-select]', $scope).each(setup);
        };

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

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.26 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.25 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.23 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.22 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.21 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.20 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.19 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.18 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.17 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.16 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.15 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.14 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.13 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.12 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.11 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.10 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.9 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.8 app/assets/javascripts/workarea/admin/modules/selects.js
workarea-admin-3.5.7 app/assets/javascripts/workarea/admin/modules/selects.js