<commit_before>function _addCurationButton() {
    $('.g-folder-actions-menu').append(girder.templates.curation_button());
}

// add curation button to hiearchy widget
girder.wrap(girder.views.HierarchyWidget, 'render', function (render) {
    render.call(this);

    if (this.parentModel.get('_modelType') === 'folder') {
        // add button if an admin or if curation is enabled
        if (girder.currentUser.get('admin')) {
            _addCurationButton();
        } else {
            girder.restRequest({
                path: 'folder/' + this.parentModel.get('_id') + '/curation'
            }).done(_.bind(function (resp) {
                if (resp.enabled) {
                    _addCurationButton();
                }
            }, this));
        }
    }

    return this;
});

// launch modal when curation button is clicked
girder.views.HierarchyWidget.prototype.events['click .g-curation-button'] = function (e) {
    new girder.views.CurationDialog({
        el: $('#g-dialog-container'),
        parentView: this,
        folder: this.parentModel
    });
};

// curation dialog
girder.views.CurationDialog = girder.View.extend({
    events: {
        'click #g-curation-enable': function (event) {
            event.preventDefault();
            this._save('Enabled folder curation', {
                id: this.folder.get('_id'),
                enabled: true
            });
        },
        'click #g-curation-disable': function (event) {
            event.preventDefault();
            this._save('Disabled folder curation', {
                id: this.folder.get('_id'),
                enabled: false
            });
        },
        'click #g-curation-request': function (event) {
            event.preventDefault();<commit_msg>Ignore eslint error<commit_after>function _addCurationButton() {
    $('.g-folder-actions-menu').append(girder.templates.curation_button());
}

// add curation button to hiearchy widget
girder.wrap(girder.views.HierarchyWidget, 'render', function (render) {
    render.call(this);

    if (this.parentModel.get('_modelType') === 'folder') {
        // add button if an admin or if curation is enabled
        if (girder.currentUser.get('admin')) {
            _addCurationButton();
        } else {
            girder.restRequest({
                path: 'folder/' + this.parentModel.get('_id') + '/curation'
            }).done(_.bind(function (resp) {
                if (resp.enabled) {
                    _addCurationButton();
                }
            }, this));
        }
    }

    return this;
});

// launch modal when curation button is clicked
girder.views.HierarchyWidget.prototype.events['click .g-curation-button'] = function (e) {
    /* eslint-disable */
    new girder.views.CurationDialog({
        el: $('#g-dialog-container'),
        parentView: this,
        folder: this.parentModel
    });
    /* eslint-enable */
};

// curation dialog
girder.views.CurationDialog = girder.View.extend({
    events: {
        'click #g-curation-enable': function (event) {
            event.preventDefault();
            this._save('Enabled folder curation', {
                id: this.folder.get('_id'),
                enabled: true
            });
        },
        'click #g-curation-disable': function (event) {
            event.preventDefault();
            this._save('Disabled folder curation', {
                id: this.folder.get('_id'),
                enabled: false
            });
        },
        'click #g-curation-request': function (event) {
            event.preventDefault();
{'fraction_non_alphanumeric': 0.14121602689829083, 'fraction_numerical': 0.0, 'mean_word_length': 1.962655601659751, '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': '512218', 'n_tokens_mistral': 1018, 'n_tokens_neox': 1005, 'n_words': 197}