<commit_before>form_selector = "#{element_form_id(:action => :update)}"

page << "var action_link = ActiveScaffold.find_action_link('#{form_selector}');"
page << "action_link.update_flash_messages('#{escape_javascript(render(:partial => 'messages').strip)}');"
if controller.send :successful?
  if render_parent? && controller.respond_to?(:render_component_into_view)
    parent_rendered = controller.send(:render_component_into_view, render_parent_options)
    if nested_singular_association?
      page << "action_link.close('#{escape_javascript(parent_rendered)}');"
    else
      if render_parent_action == :row
        page << "action_link.close('#{escape_javascript(parent_rendered)}');"
      elsif render_parent_action == :index
        page << parent_rendered
      end
    end
    #page.call 'ActiveScaffold.replace', active_scaffold_calculations_id, render(:partial => 'list_calculations') if active_scaffold_config.list.columns.any? {|c| c.calculation?}
  elsif update_refresh_list?
    page.call 'ActiveScaffold.replace_html', active_scaffold_content_id, render(:partial => 'list', :layout => false)
  else
    updated_row = render :partial => 'list_record', :locals => {:record => @record}
    page << "action_link.close('#{escape_javascript(updated_row)}');"
    page.call 'ActiveScaffold.replace', active_scaffold_calculations_id, render(:partial => 'list_calculations') if active_scaffold_config.list.columns.any? {|c| c.calculation?}
  end
else
  page.call 'ActiveScaffold.replace', form_selector, render(:partial => 'update_form', :locals => {:xhr => true})
  page.call 'ActiveScaffold.scroll_to', form_selector
end<commit_msg>changed code to erb syntax<commit_after>try {
<% form_selector = "#{element_form_id(:action => :update)}" %>
var action_link = ActiveScaffold.find_action_link('<%= form_selector%>');
action_link.update_flash_messages('<%=escape_javascript(render(:partial => 'messages').strip)%>');
<% if controller.send :successful? %>
  <% if render_parent? && controller.respond_to?(:render_component_into_view) %>
    <% parent_rendered = controller.send(:render_component_into_view, render_parent_options) %>
    <% if nested_singular_association? %>
      action_link.close('<%= escape_javascript(parent_rendered)%>');
    <% else %>
      <% if render_parent_action == :row %>
        action_link.close('<%= escape_javascript(parent_rendered)%>');
      <% elsif render_parent_action == :index %>
        <%= escape_javascript(parent_rendered) %>
      <% end %>
    <% end %>
    <%#page.call 'ActiveScaffold.replace', active_scaffold_calculations_id, render(:partial => 'list_calculations') if active_scaffold_config.list.columns.any? {|c| c.calculation?}%>
  <% elsif update_refresh_list? %>
    ActiveScaffold.replace_html(<%= active_scaffold_content_id%>, <%= escape_javascript(render(:partial => 'list', :layout => false)) %>);
   <% else %>
    <% updated_row = render :partial => 'list_record', :locals => {:record => @record}%>
    action_link.close('<%= escape_javascript(updated_row)%>');
    <% if active_scaffold_config.list.columns.any? {|c| c.calculation?}%>
      ActiveScaffold.replace('<%=active_scaffold_calculations_id%>', '<%=escape_javascript(render(:partial => 'list_calculations'))%>');
    <% end %>
  <% end %>
<% else %>
  ActiveScaffold.replace('<%=form_selector%>','<%=escape_javascript(render(:partial => 'update_form', :locals => {:xhr => true}))%>');
  ActiveScaffold.scroll_to('<%=form_selector%>');
<% end %>
} catch (e) { alert('RJS error:\n\n' + e.toString());}
{'fraction_non_alphanumeric': 0.16921335597057158, 'fraction_numerical': 0.0, 'mean_word_length': 6.055888223552894, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 59, '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': '2636477', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1119, 'n_words': 174}