Sha256: b1f46cbfbf46ff5e43d3123e0ca2e49c22aea0aa538e5f53bce151a29c019740

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

var Admin = function() {

    return {
        initPopUp : function() {
            $('a[data-popup=true]').click(function(e) {
                e.preventDefault();
                window.open($(this).attr('href'));
            })
        },

        hideAndDestroyFields : function(self) {
            var $self = $(self);
            $self.closest(".fields").hide().
                find("input[type=hidden]").val("1");
        },

        addFields : function(selector, content, association) {
            var object_id = new Date().getTime().toString().substring(5);
            var regexp = new RegExp("new_" + association, "g");
            content = content.replace(regexp, object_id);

            content = $(content);
            content.find("input[data-kind=position]").val(object_id);
            $('label', content).each(function(i) {
                var id = 'id-' + new Date().getTime() + i;
                $(this).attr('for', id).next().find('select:enabled, input:enabled').attr('id', id);
                $(this).next('input, textarea, select').attr('id', id);
            });

            $(selector).append(content);
        }
    }
}();

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
etabliocms_core-0.0.12 app/assets/javascripts/core.js
etabliocms_core-0.0.11 app/assets/javascripts/core.js
etabliocms_core-0.0.10 app/assets/javascripts/core.js
etabliocms_core-0.0.9 app/assets/javascripts/core.js