<commit_before>function RestInPlaceEditor(e) {
  this.element = jQuery(e);
  this.initOptions();
  this.bindForm();
  
  this.element.bind('click', {editor: this}, this.clickHandler);
}

RestInPlaceEditor.prototype = {
  // Public Interface Functions //////////////////////////////////////////////
  
  activate : function() {
    this.oldValue = this.element.html();    
    this.element.unbind('click', this.clickHandler)
    this.activateForm();
  },
  
  abort : function() {
    this.element
      .html(this.oldValue)
      .bind('click', {editor: this}, this.clickHandler);
  },
  
  update : function() {
    var editor = this;
    editor.ajax({
      "type"       : "post",
      "data"       : editor.requestData(),
      "success"    : function(){
        editor.ajax({
          "dataType" : 'json',
          "success"  : function(data){ editor.loadSuccessCallback(data) }
        });
      }
    });
    editor.element.html("saving...");
  },
  
  activateForm : function() {
    alert("The form was not properly initialized. activateForm is unbound");
  },
  
  // Helper Functions ////////////////////////////////////////////////////////
  
  initOptions : function() {
    // Try parent supplied info
    var self = this;
    self.element.parents().each(function(){
      self.url           = self.url           || jQuery(this).attr("data-url");
      self.formType      = self.formType      || jQuery(this).attr("data-formtype");
      self.objectName    = self.objectName    || jQuery(this).attr("data-object");
      self.attributeName = self.attributeName || jQuery(this).attr("data-attribute");
    });
    // Try Rails-id based if parents did not explicitly supply something
    self.element.parents().each(function(){
      var res;
      if (res = this.id.match(/^(\w+)_(\d+)$/i)) {<commit_msg>Add 'active' class for CSS styling when the form is active<commit_after>function RestInPlaceEditor(e) {
  this.element = jQuery(e);
  this.initOptions();
  this.bindForm();
  
  this.element.bind('click', {editor: this}, this.clickHandler);
}

RestInPlaceEditor.prototype = {
  // Public Interface Functions //////////////////////////////////////////////
  
  activate : function() {
    this.oldValue = this.element.html();
    this.element.addClass('active');
    this.element.unbind('click', this.clickHandler)
    this.activateForm();
  },
  
  abort : function() {
    this.element
      .html(this.oldValue)
      .removeClass('active')
      .bind('click', {editor: this}, this.clickHandler);
  },
  
  update : function() {
    var editor = this;
    editor.ajax({
      "type"       : "post",
      "data"       : editor.requestData(),
      "success"    : function(){
        editor.ajax({
          "dataType" : 'json',
          "success"  : function(data){ editor.loadSuccessCallback(data) }
        });
        editor.element.removeClass('active');
      }
    });
    editor.element.html("saving...");
  },
  
  activateForm : function() {
    alert("The form was not properly initialized. activateForm is unbound");
  },
  
  // Helper Functions ////////////////////////////////////////////////////////
  
  initOptions : function() {
    // Try parent supplied info
    var self = this;
    self.element.parents().each(function(){
      self.url           = self.url           || jQuery(this).attr("data-url");
      self.formType      = self.formType      || jQuery(this).attr("data-formtype");
      self.objectName    = self.objectName    || jQuery(this).attr("data-object");
      self.attributeName = self.attributeName || jQuery(this).attr("data-attribute");
    });
    // Try Rails-id based if parents did not explicitly supply something
    self.element.parents().each(function(){
      var res;
      if (res = this.id.match(/^(\w+)_(\d+)$/i)) {
{'fraction_non_alphanumeric': 0.204431548404115, 'fraction_numerical': 0.0, 'mean_word_length': 2.1261335531739487, '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': '3086314', 'n_tokens_mistral': 1080, 'n_tokens_neox': 1072, 'n_words': 211}