<commit_before>(function(jQuery, undefined) {
    
    jQuery.widget('Midgard.midgardWorkflows', {
        options: {
            url: function(model){},
            renderers: {
              button: function(model, workflow, action_cb, final_cb) {
                  button_id = 'midgardcreate-workflow_' + workflow.get('name');
                  html = jQuery('<button id="'+button_id+'">'+workflow.get('label')+'</button>').button();

                  html.bind('click', function(evt) {
                      action_cb(model, workflow, final_cb);
                  });
                  return html;
              }
            },
            action_types: {
                backbone_save: function(model, workflow, callback) {
                    copy_of_url = model.url;
                    original_model = model.clone();
                    original_model.url = copy_of_url;

                    action = workflow.get("action")
                    if (action.url) {
                        model.url = action.url                        
                    }
                    original_model.save(null, {
                        success: function(m) {
                            model.url = copy_of_url;
                            model.change();
                            callback(null, model);
                        },
                        error: function(m, err) {
                            model.url = copy_of_url;
                            model.change();
                            callback(err, model);
                        }
                    });
                },
                backbone_destroy: function(model, workflow, callback) {
                    copy_of_url = model.url;
                    original_model = model.clone();
                    original_model.url = copy_of_url;
                    
                    action = workflow.get("action")
                    if (action.url) {
                        model.url = action.url
                    }

                    model.destroy({
                        success: function(m) {
                            model.url = copy_of_url;
                            model.change();
                            callback(null, m);
                        },
                        error: function(m, err) {
                            model.url = copy_of_url;
                            model.change();
                            callback(err, model);
                        }
                    });
                },
                ajax: function(model, workflow, callback) {
                    action = workflow.get("action")
                    if (!action.url) {
                        return callback('No action url defined!');
                    }
                    
                    wf_opts = {};
                    if (action.ajax) {
                      wf_opts = action.ajax;
                    }
                    
                    ajax_options = jQuery.extend({
                        url: action.url,
                        type: 'POST',
                        data: model.toJSON(),
                        success: function() {
                            model.fetch({
                              success: function(model) {<commit_msg>Renamed action type ajax to http<commit_after>(function(jQuery, undefined) {
    
    jQuery.widget('Midgard.midgardWorkflows', {
        options: {
            url: function(model){},
            renderers: {
              button: function(model, workflow, action_cb, final_cb) {
                  button_id = 'midgardcreate-workflow_' + workflow.get('name');
                  html = jQuery('<button id="'+button_id+'">'+workflow.get('label')+'</button>').button();

                  html.bind('click', function(evt) {
                      action_cb(model, workflow, final_cb);
                  });
                  return html;
              }
            },
            action_types: {
                backbone_save: function(model, workflow, callback) {
                    copy_of_url = model.url;
                    original_model = model.clone();
                    original_model.url = copy_of_url;

                    action = workflow.get("action")
                    if (action.url) {
                        model.url = action.url                        
                    }
                    original_model.save(null, {
                        success: function(m) {
                            model.url = copy_of_url;
                            model.change();
                            callback(null, model);
                        },
                        error: function(m, err) {
                            model.url = copy_of_url;
                            model.change();
                            callback(err, model);
                        }
                    });
                },
                backbone_destroy: function(model, workflow, callback) {
                    copy_of_url = model.url;
                    original_model = model.clone();
                    original_model.url = copy_of_url;
                    
                    action = workflow.get("action")
                    if (action.url) {
                        model.url = action.url
                    }

                    model.destroy({
                        success: function(m) {
                            model.url = copy_of_url;
                            model.change();
                            callback(null, m);
                        },
                        error: function(m, err) {
                            model.url = copy_of_url;
                            model.change();
                            callback(err, model);
                        }
                    });
                },
                http: function(model, workflow, callback) {
                    action = workflow.get("action")
                    if (!action.url) {
                        return callback('No action url defined!');
                    }
                    
                    wf_opts = {};
                    if (action.http) {
                      wf_opts = action.http;
                    }
                    
                    ajax_options = jQuery.extend({
                        url: action.url,
                        type: 'POST',
                        data: model.toJSON(),
                        success: function() {
                            model.fetch({
                              success: function(model) {
{'fraction_non_alphanumeric': 0.09269108038292052, 'fraction_numerical': 0.0, 'mean_word_length': 0.7963973799126638, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7305702', 'n_tokens_mistral': 1506, 'n_tokens_neox': 1360, 'n_words': 247}