<commit_before>$(document).ready(function() {
  $('form.as_form').live('ajax:beforeSend', function(event) {
    var as_form = $(this).closest("form");
    if (as_form && as_form.attr('data-loading') == 'true') {
      ActiveScaffold.disable_form(as_form);
    }
    return true;
  });
  
  $('form.as_form').live('ajax:complete', function(event) {
    var as_form = $(this).closest("form");
    if (as_form && as_form.attr('data-loading') == 'true') {
      ActiveScaffold.enable_form(as_form);
    }
  });
  $('form.as_form').live('ajax:error', function(event, xhr, status, error) {
    var as_div = $(this).closest("div.active-scaffold");
    if (as_div) {
      ActiveScaffold.report_500_response(as_div)
    }
  });
  $('form.as_form.as_remote_upload').live('submit', function(event) {
    var as_form = $(this).closest("form");
    if (as_form && as_form.attr('data-loading') == 'true') {
      setTimeout("ActiveScaffold.disable_form('" + as_form.attr('id') + "')", 10);
    }
    return true;
  });
  $('a.as_action').live('ajax:before', function(event) {
    var action_link = ActiveScaffold.ActionLink.get($(this));
    if (action_link) {
      if (action_link.is_disabled()) {
        return false;
      } else {
        if (action_link.loading_indicator) action_link.loading_indicator.css('visibility','visible');
        action_link.disable();
      }
    }
    return true;
  });
  $('a.as_action').live('ajax:success', function(event, response) {
    var action_link = ActiveScaffold.ActionLink.get($(this));
    if (action_link) {
      if (action_link.position) {
        action_link.insert(response);
        if (action_link.hide_target) action_link.target.hide();
      } else {
        action_link.enable();
      }
      $(this).trigger('as:action_success', action_link);
    }
    return true;
  });
  $('a.as_action').live('ajax:complete', function(event) {
    var action_link = ActiveScaffold.ActionLink.get($(this));
    if (action_link) {
      if (action_link.loading_indicator) action_link.loading_indicator.css('visibility','hidden');  
    }
    return true;
  });
  $('a.as_action').live('ajax:error', function(event, xhr, status, error) {
    var action_link = ActiveScaffold.ActionLink.get($(this));
    if (action_link) {
      ActiveScaffold.report_500_response(action_link.scaffold_id());
      action_link.enable();
    }
    return true;
  });
  $('a.as_cancel').live('ajax:before', function(event) {
    var as_cancel = $(this);
    var action_link = ActiveScaffold.find_action_link(as_cancel);  
    
    if (action_link) {
      var cancel_url = as_cancel.attr('href');
      var refresh_data = as_cancel.attr('data-refresh');
      if (refresh_data !== 'true' || !cancel_url) {
        action_link.close();
        return false;
      }
    }
    return true;
  });
  $('a.as_cancel').live('ajax:success', function(event, response) {
    var action_link = ActiveScaffold.find_action_link($(this));

    if (action_link) {
      if (action_link.position) {
        action_link.close(response);
      } else {
        response.evalResponse(); 
      }
    }
    return true;
  });
  $('a.as_cancel').live('ajax:error', function(event, xhr, status, error) {
    var action_link = ActiveScaffold.find_action_link($(this));
    if (action_link) {
      ActiveScaffold.report_500_response(action_link.scaffold_id());
    }
    return true;
  });
  $('a.as_sort').live('ajax:before', function(event) {
    var as_sort = $(this);
    var history_controller_id = as_sort.attr('data-page-history');
    if (history_controller_id) addActiveScaffoldPageToHistory(as_sort.attr('href'), history_controller_id);
    as_sort.closest('th').addClass('loading');
    return true;
  });
  $('a.as_sort').live('ajax:error', function(event, xhr, status, error) {
    var as_scaffold = $(this).closest('.active-scaffold');
    ActiveScaffold.report_500_response(as_scaffold);
    return true;
  });
  $('span.in_place_editor_field').live('hover', function(event) {
    $(this).data(); // jquery 1.4.2 workaround
    if (event.type == 'mouseenter') {
      if (typeof($(this).data('editInPlace')) === 'undefined') $(this).addClass("hover");
     }
    if (event.type == 'mouseleave') {
      if (typeof($(this).data('editInPlace')) === 'undefined') $(this).removeClass("hover");
    }
    return true;
  });
  $('span.in_place_editor_field').live('click', function(event) {
    ActiveScaffold.in_place_editor_field_clicked($(this));
  });
  $('a.as_paginate').live('ajax:before',function(event) {
    var as_paginate = $(this);
    var history_controller_id = as_paginate.attr('data-page-history');
    if (history_controller_id) addActiveScaffoldPageToHistory(as_paginate.attr('href'), history_controller_id);
    as_paginate.prevAll('img.loading-indicator').css('visibility','visible');
    return true;
  });
  $('a.as_paginate').live('ajax:error', function(event, xhr, status, error) {
    var as_scaffold = $(this).closest('.active-scaffold');
    ActiveScaffold.report_500_response(as_scaffold);
    return true;
  });
  $('a.as_paginate').live('ajax:complete', function(event) {
    $(this).prevAll('img.loading-indicator').css('visibility','hidden');
    return true;
  });
  $('a.as_add_existing, a.as_replace_existing').live('ajax:before', function(event) {
    var id = $(this).prev().val();
    if (id) {
      if (!$(this).data('href')) $(this).data('href', $(this).attr('href'));
      $(this).attr('href', $(this).data('href').replace('--ID--', id));
      return true;
    } else return false;
  });
  $('input.update_form, textarea.update_form, select.update_form').live('change', function(event) {
    var element = $(this);
    var value = element.is("input:checkbox:not(:checked)") ? null : element.val();
    ActiveScaffold.update_column(element, element.attr('data-update_url'), element.attr('data-update_send_form'), element.attr('id'), value);
    return true;
  });
  $('input.recordselect.update_form').live('recordselect:change', function(event, id, label) {
    var element = $(this);
    ActiveScaffold.update_column(element, element.attr('data-update_url'), element.attr('data-update_send_form'), element.attr('id'), id);
    return true;
  });
  
  $('select.as_search_range_option').live('change', function(event) {
    ActiveScaffold[$(this).val() == 'BETWEEN' ? 'show' : 'hide']($(this).parent().find('.as_search_range_between'));
    return true;
  });
  
  $('select.as_search_range_option').live('change', function(event) {
    var element = $(this);
    ActiveScaffold[!(element.val() == 'PAST' || element.val() == 'FUTURE' || element.val() == 'RANGE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_numeric'));
    ActiveScaffold[(element.val() == 'PAST' || element.val() == 'FUTURE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_trend'));
    ActiveScaffold[(element.val() == 'RANGE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_range'));
    return true;
  });

  $('select.as_update_date_operator').live('change', function(event) {
    ActiveScaffold[$(this).val() == 'REPLACE' ? 'show' : 'hide']($(this).next());
    ActiveScaffold[$(this).val() == 'REPLACE' ? 'hide' : 'show']($(this).next().next());
    return true;
  });
<commit_msg>fix recordselect with update_form, it wasn't working after typing to search<commit_after>$(document).ready(function() {
  $('form.as_form').live('ajax:beforeSend', function(event) {
    var as_form = $(this).closest("form");
    if (as_form && as_form.attr('data-loading') == 'true') {
      ActiveScaffold.disable_form(as_form);
    }
    return true;
  });
  
  $('form.as_form').live('ajax:complete', function(event) {
    var as_form = $(this).closest("form");
    if (as_form && as_form.attr('data-loading') == 'true') {
      ActiveScaffold.enable_form(as_form);
    }
  });
  $('form.as_form').live('ajax:error', function(event, xhr, status, error) {
    var as_div = $(this).closest("div.active-scaffold");
    if (as_div) {
      ActiveScaffold.report_500_response(as_div)
    }
  });
  $('form.as_form.as_remote_upload').live('submit', function(event) {
    var as_form = $(this).closest("form");
    if (as_form && as_form.attr('data-loading') == 'true') {
      setTimeout("ActiveScaffold.disable_form('" + as_form.attr('id') + "')", 10);
    }
    return true;
  });
  $('a.as_action').live('ajax:before', function(event) {
    var action_link = ActiveScaffold.ActionLink.get($(this));
    if (action_link) {
      if (action_link.is_disabled()) {
        return false;
      } else {
        if (action_link.loading_indicator) action_link.loading_indicator.css('visibility','visible');
        action_link.disable();
      }
    }
    return true;
  });
  $('a.as_action').live('ajax:success', function(event, response) {
    var action_link = ActiveScaffold.ActionLink.get($(this));
    if (action_link) {
      if (action_link.position) {
        action_link.insert(response);
        if (action_link.hide_target) action_link.target.hide();
      } else {
        action_link.enable();
      }
      $(this).trigger('as:action_success', action_link);
    }
    return true;
  });
  $('a.as_action').live('ajax:complete', function(event) {
    var action_link = ActiveScaffold.ActionLink.get($(this));
    if (action_link) {
      if (action_link.loading_indicator) action_link.loading_indicator.css('visibility','hidden');  
    }
    return true;
  });
  $('a.as_action').live('ajax:error', function(event, xhr, status, error) {
    var action_link = ActiveScaffold.ActionLink.get($(this));
    if (action_link) {
      ActiveScaffold.report_500_response(action_link.scaffold_id());
      action_link.enable();
    }
    return true;
  });
  $('a.as_cancel').live('ajax:before', function(event) {
    var as_cancel = $(this);
    var action_link = ActiveScaffold.find_action_link(as_cancel);  
    
    if (action_link) {
      var cancel_url = as_cancel.attr('href');
      var refresh_data = as_cancel.attr('data-refresh');
      if (refresh_data !== 'true' || !cancel_url) {
        action_link.close();
        return false;
      }
    }
    return true;
  });
  $('a.as_cancel').live('ajax:success', function(event, response) {
    var action_link = ActiveScaffold.find_action_link($(this));

    if (action_link) {
      if (action_link.position) {
        action_link.close(response);
      } else {
        response.evalResponse(); 
      }
    }
    return true;
  });
  $('a.as_cancel').live('ajax:error', function(event, xhr, status, error) {
    var action_link = ActiveScaffold.find_action_link($(this));
    if (action_link) {
      ActiveScaffold.report_500_response(action_link.scaffold_id());
    }
    return true;
  });
  $('a.as_sort').live('ajax:before', function(event) {
    var as_sort = $(this);
    var history_controller_id = as_sort.attr('data-page-history');
    if (history_controller_id) addActiveScaffoldPageToHistory(as_sort.attr('href'), history_controller_id);
    as_sort.closest('th').addClass('loading');
    return true;
  });
  $('a.as_sort').live('ajax:error', function(event, xhr, status, error) {
    var as_scaffold = $(this).closest('.active-scaffold');
    ActiveScaffold.report_500_response(as_scaffold);
    return true;
  });
  $('span.in_place_editor_field').live('hover', function(event) {
    $(this).data(); // jquery 1.4.2 workaround
    if (event.type == 'mouseenter') {
      if (typeof($(this).data('editInPlace')) === 'undefined') $(this).addClass("hover");
     }
    if (event.type == 'mouseleave') {
      if (typeof($(this).data('editInPlace')) === 'undefined') $(this).removeClass("hover");
    }
    return true;
  });
  $('span.in_place_editor_field').live('click', function(event) {
    ActiveScaffold.in_place_editor_field_clicked($(this));
  });
  $('a.as_paginate').live('ajax:before',function(event) {
    var as_paginate = $(this);
    var history_controller_id = as_paginate.attr('data-page-history');
    if (history_controller_id) addActiveScaffoldPageToHistory(as_paginate.attr('href'), history_controller_id);
    as_paginate.prevAll('img.loading-indicator').css('visibility','visible');
    return true;
  });
  $('a.as_paginate').live('ajax:error', function(event, xhr, status, error) {
    var as_scaffold = $(this).closest('.active-scaffold');
    ActiveScaffold.report_500_response(as_scaffold);
    return true;
  });
  $('a.as_paginate').live('ajax:complete', function(event) {
    $(this).prevAll('img.loading-indicator').css('visibility','hidden');
    return true;
  });
  $('a.as_add_existing, a.as_replace_existing').live('ajax:before', function(event) {
    var id = $(this).prev().val();
    if (id) {
      if (!$(this).data('href')) $(this).data('href', $(this).attr('href'));
      $(this).attr('href', $(this).data('href').replace('--ID--', id));
      return true;
    } else return false;
  });
  $('input.update_form:not(.recordselect), textarea.update_form, select.update_form').live('change', function(event) {
    var element = $(this);
    var value = element.is("input:checkbox:not(:checked)") ? null : element.val();
    ActiveScaffold.update_column(element, element.attr('data-update_url'), element.attr('data-update_send_form'), element.attr('id'), value);
    return true;
  });
  $('input.recordselect.update_form').live('recordselect:change', function(event, id, label) {
    var element = $(this);
    ActiveScaffold.update_column(element, element.attr('data-update_url'), element.attr('data-update_send_form'), element.attr('id'), id);
    return true;
  });
  
  $('select.as_search_range_option').live('change', function(event) {
    ActiveScaffold[$(this).val() == 'BETWEEN' ? 'show' : 'hide']($(this).parent().find('.as_search_range_between'));
    return true;
  });
  
  $('select.as_search_range_option').live('change', function(event) {
    var element = $(this);
    ActiveScaffold[!(element.val() == 'PAST' || element.val() == 'FUTURE' || element.val() == 'RANGE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_numeric'));
    ActiveScaffold[(element.val() == 'PAST' || element.val() == 'FUTURE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_trend'));
    ActiveScaffold[(element.val() == 'RANGE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_range'));
    return true;
  });

  $('select.as_update_date_operator').live('change', function(event) {
    ActiveScaffold[$(this).val() == 'REPLACE' ? 'show' : 'hide']($(this).next());
    ActiveScaffold[$(this).val() == 'REPLACE' ? 'hide' : 'show']($(this).next().next());
    return true;
  });

{'fraction_non_alphanumeric': 0.19652066286185793, 'fraction_numerical': 0.002750464140823764, 'mean_word_length': 4.1103302881236825, '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': '2005388', 'n_tokens_mistral': 4951, 'n_tokens_neox': 4912, 'n_words': 704}