<commit_before><%= javascript_tag do %>
$(function() {
  $('dd.form-select').each(function() {
    return changeForm($(this));
  });
  $(document).on('change', 'dd.form-select', function(e) {
    return changeForm($(this));
  });
});

this.changeForm = function(self) {
  self.find('input').each(function(i) {
    if ($(this).prop('checked') || <%= confirm %>) {
      var value = $(this).val();
      $("dl").each(function() {
        $(this).find('span.required').remove();
        var span;
        if ($(this).hasClass(value) && $(this).children('span').text() === '') {
          span = $("<span>").attr('class', 'required').text('<%= t('inquiry.required_field') %>');
          span.appendTo($(this).children('dt'));
        }
      });
    };
  });
};
<% end %>
<div class="columns">
<% content = @answer.source_content if @answer %>
<% if content %>
  <dl class="column">
    <dt><%= Cms::Page.t :name %></dt>
    <dd><%= content.name %></dd>
  </dl>
<% end %>
<% form_select = @cur_node.columns.where(input_type: 'form_select').first if @cur_node.present? %>
<% @items.each do |column, data, confirm_data| %>
  <% html_class = '' %>
  <% if form_select %>
    <% form_select.select_options.each do |option| %>
      <% html_class += " #{option}" if column.required?(option) %>
    <% end %>
  <% end %>
  <dl class="column<%= html_class %>">
    <dt>
    <%= column.name %>
    <% if column.required == "required" %>
      <span class="required"><%= t('inquiry.required_field') %></span>
    <% end %>
    </dt>
    <dd class='<%= 'form-select' if column.input_type == 'form_select' %>'>
    <% if confirm %>
      <% if data.kind_of? Hash %>
        <% data.each do |key, value| %>
          <% opt = {id: "#{f.object_name}_#{column.id}_#{key}" } %>
          <%= hidden_field_tag "#{f.object_name}[#{column.id}][#{key}]", value, opt %><%= value %><br />
        <% end %><commit_msg>[Fix]Use @columns instead of @cur_node.columns (#1835)<commit_after><%= javascript_tag do %>
$(function() {
  $('dd.form-select').each(function() {
    return changeForm($(this));
  });
  $(document).on('change', 'dd.form-select', function(e) {
    return changeForm($(this));
  });
});

this.changeForm = function(self) {
  self.find('input').each(function(i) {
    if ($(this).prop('checked') || <%= confirm %>) {
      var value = $(this).val();
      $("dl").each(function() {
        $(this).find('span.required').remove();
        var span;
        if ($(this).hasClass(value) && $(this).children('span').text() === '') {
          span = $("<span>").attr('class', 'required').text('<%= t('inquiry.required_field') %>');
          span.appendTo($(this).children('dt'));
        }
      });
    };
  });
};
<% end %>
<div class="columns">
<% content = @answer.source_content if @answer %>
<% if content %>
  <dl class="column">
    <dt><%= Cms::Page.t :name %></dt>
    <dd><%= content.name %></dd>
  </dl>
<% end %>
<% form_select = @columns.where(input_type: 'form_select').first if @columns.present? %>
<% @items.each do |column, data, confirm_data| %>
  <% html_class = '' %>
  <% if form_select %>
    <% form_select.select_options.each do |option| %>
      <% html_class += " #{option}" if column.required?(option) %>
    <% end %>
  <% end %>
  <dl class="column<%= html_class %>">
    <dt>
    <%= column.name %>
    <% if column.required == "required" %>
      <span class="required"><%= t('inquiry.required_field') %></span>
    <% end %>
    </dt>
    <dd class='<%= 'form-select' if column.input_type == 'form_select' %>'>
    <% if confirm %>
      <% if data.kind_of? Hash %>
        <% data.each do |key, value| %>
          <% opt = {id: "#{f.object_name}_#{column.id}_#{key}" } %>
          <%= hidden_field_tag "#{f.object_name}[#{column.id}][#{key}]", value, opt %><%= value %><br />
        <% end %>
{'fraction_non_alphanumeric': 0.2537313432835821, 'fraction_numerical': 0.0010473946059177796, 'mean_word_length': 3.1703056768558953, 'pattern_counts': {'":': 0, '<': 93, '<?xml version=': 0, '>': 93, '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': '972896', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1289, 'n_words': 233}