<commit_before>(function () {
    $.widget("execut.EditDialog", {
        formEl: null,
        alertEl: null,
        editButtons: null,
        addButton: null,
        _sourceAction: null,
        _create: function () {
            var t = this;
            t._initElements();
            t._initEvents();
        },
        _initElements: function () {
            var t = this;
            t.formEl = t.element.find('form');
            t.alertEl = $('#' + t.options.alertId).hide();
            t.modalEl = t.element.find('div').first();
            t._sourceAction = t.formEl.attr('action');
            if (typeof t.options.editButtons !== 'undefined') {
                t.editButtons = $(t.options.editButtons);
            }

            t.addButton = $('#' + t.element.attr('id') + '-add-button');
        },
        _initEvents: function () {
            var t = this;
            t.formEl.on('ajaxComplete', function (e, resp) {
                if (typeof resp.responseJSON.message !== 'undefined') {
                    t.message = resp.responseJSON.message;
                    t.alertEl.show().find('span').html(t.message);
                    setTimeout(function () {
                        t.alertEl.hide(1000);
                    }, 1000);
                    t.modalEl.modal('hide');
                    if (typeof t.options.gridId !== 'undefined') {
                        $.pjax.reload('#' + t.options.gridId);
                    }
                }
            });

            t.addButton.click(function () {
                t.open();
            });

            t.formEl.on('beforeSubmit', function (event) {
                event.result = false;
                return false;
            });

            if (typeof t.options.editButtons !== 'undefined') {
                t.editButtons.click(function (e) {
                    var curButton = $(this),
                        attributes;
                    if (typeof t.options.attributesElement === 'undefined') {
                        targetEl = $(e.target);
                        if (targetEl.parents('a').length || targetEl.is('a') || targetEl.is(':button')) {
                            return true;
                        }

                        attributes = curButton.attr('attributes');
                    } else {
                        attributes = curButton.parents(t.options.attributesElement).attr('attributes');
                    }

                    attributes = JSON.parse(attributes);
                    t.values(attributes).open();

                    return false;
                });
            }
        },
        values: function (attributes) {
            var t = this,
                el = t.element;
            for (var key in attributes) {
                $('#' + t.options.inputsPrefix + '-' + key).val(null).val(attributes[key]).trigger('change.select2');
            }

            var realAction = t._sourceAction;
            if (typeof attributes.id !== 'undefined') {
                realAction += '?id=' + attributes.id;
            }

            t.formEl.attr('action', realAction)
                .data('yiiActiveForm').settings.validationUrl = realAction;

            return t;
        },
        close: function () {
            var t = this,
                el = t.element;
            t.modalEl.modal('hide');
        },
        open: function () {
            var t = this,
                el = t.element;
            t.modalEl.modal('show');
        },
    })
})();<commit_msg>Fixed bug with ajax without json<commit_after>(function () {
    $.widget("execut.EditDialog", {
        formEl: null,
        alertEl: null,
        editButtons: null,
        addButton: null,
        _sourceAction: null,
        _create: function () {
            var t = this;
            t._initElements();
            t._initEvents();
        },
        _initElements: function () {
            var t = this;
            t.formEl = t.element.find('form');
            t.alertEl = $('#' + t.options.alertId).hide();
            t.modalEl = t.element.find('div').first();
            t._sourceAction = t.formEl.attr('action');
            if (typeof t.options.editButtons !== 'undefined') {
                t.editButtons = $(t.options.editButtons);
            }

            t.addButton = $('#' + t.element.attr('id') + '-add-button');
        },
        _initEvents: function () {
            var t = this;
            t.formEl.on('ajaxComplete', function (e, resp) {
                if (typeof resp !== 'undefined' && typeof resp.responseJSON.message !== 'undefined') {
                    t.message = resp.responseJSON.message;
                    t.alertEl.show().find('span').html(t.message);
                    setTimeout(function () {
                        t.alertEl.hide(1000);
                    }, 1000);
                    t.modalEl.modal('hide');
                    if (typeof t.options.gridId !== 'undefined') {
                        $.pjax.reload('#' + t.options.gridId);
                    }
                }
            });

            t.addButton.click(function () {
                t.open();
            });

            t.formEl.on('beforeSubmit', function (event) {
                event.result = false;
                return false;
            });

            if (typeof t.options.editButtons !== 'undefined') {
                t.editButtons.click(function (e) {
                    var curButton = $(this),
                        attributes;
                    if (typeof t.options.attributesElement === 'undefined') {
                        targetEl = $(e.target);
                        if (targetEl.parents('a').length || targetEl.is('a') || targetEl.is(':button')) {
                            return true;
                        }

                        attributes = curButton.attr('attributes');
                    } else {
                        attributes = curButton.parents(t.options.attributesElement).attr('attributes');
                    }

                    attributes = JSON.parse(attributes);
                    t.values(attributes).open();

                    return false;
                });
            }
        },
        values: function (attributes) {
            var t = this,
                el = t.element;
            for (var key in attributes) {
                $('#' + t.options.inputsPrefix + '-' + key).val(null).val(attributes[key]).trigger('change.select2');
            }

            var realAction = t._sourceAction;
            if (typeof attributes.id !== 'undefined') {
                realAction += '?id=' + attributes.id;
            }

            t.formEl.attr('action', realAction)
                .data('yiiActiveForm').settings.validationUrl = realAction;

            return t;
        },
        close: function () {
            var t = this,
                el = t.element;
            t.modalEl.modal('hide');
        },
        open: function () {
            var t = this,
                el = t.element;
            t.modalEl.modal('show');
        },
    })
})();
{'fraction_non_alphanumeric': 0.13792617638771484, 'fraction_numerical': 0.00253592561284869, 'mean_word_length': 1.197152584339214, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2948014', 'n_tokens_mistral': 1836, 'n_tokens_neox': 1746, 'n_words': 318}