<commit_before>module.exports = Backbone.View.extend({
    tagName: 'form',
    className: 'dropzone',
    initialize: function(opts) {
        opts = opts || {};
        this.getName = opts.getName;
    },
    render: function(selector) {
        var that = this;
        this.$el.dropzone({
            init: function () {
                this.on('sending', function(file, xhr, formData) {
                    xhr.withCredentials = true;

                    var name = that.getName();

                    console.log(name);

                    formData.append('name', name);
                });

                this.on('success', function(file, response) {
                   console.log(file, response);
                });

                this.on('error', function(file, error, xhr) {
                    console.log(file, error, xhr);
                });
            },
            url: api.url + 'exec',
            acceptedFiles: '.zip',
            maxFilesize: 4096,
            accept: function(file, done) {
                console.log(file);
                done();
            }
        });
        this.$el.appendTo(selector);
        return this;
    }
});
<commit_msg>enforce choosing a name<commit_after>module.exports = Backbone.View.extend({
    tagName: 'form',
    className: 'dropzone',
    initialize: function(opts) {
        opts = opts || {};
        this.getName = opts.getName;
    },
    render: function(selector) {
        var that = this;
        this.$el.dropzone({
            init: function () {
                this.on('sending', function(file, xhr, formData) {
                    xhr.withCredentials = true;
                    var name = that.getName();
                    formData.append('name', name);
                });

                this.on('success', function(file, response) {
                   console.log(file, response);
                });

                this.on('error', function(file, error, xhr) {
                    console.log(file, error, xhr);
                });
            },
            url: api.url + 'exec',
            acceptedFiles: '.zip',
            maxFilesize: 4096,
            accept: function(file, done) {
                if(that.getName().length === 0) {
                    var msg = 'Please choose a name';
                    done(msg);
                    alert(msg);
                }
                else {
                    done();
                }
            }
        });
        this.$el.appendTo(selector);
        return this;
    }
});

{'fraction_non_alphanumeric': 0.13026367571822117, 'fraction_numerical': 0.0035419126328217238, 'mean_word_length': 1.2065972222222223, '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': '6062197', 'n_tokens_mistral': 684, 'n_tokens_neox': 640, 'n_words': 130}