<commit_before>module ActiveScaffold
  module Helpers
    # Helpers that assist with the rendering of a Form Column
    module FormColumnHelpers
      def active_scaffold_input_file_column(column, options)
        if @record.send(column.name) 
          # we already have a value?  display the form for deletion.
          content_tag(
            :div, 
            content_tag(
              :div, 
              get_column_value(@record, column) + " " +
              hidden_field(:record, "delete_#{column.name}", :value => "false") +
              " | " +
              link_to_function(as_(:remove_file), "$(this).previous().value='true'; p=$(this).up(); p.hide(); p.next().show();"),
              {}
            ) +
            content_tag(
              :div,
              file_column_field("record", column.name, options),
              :style => "display: none"
            ),
            {}
          )
        else
          # no, just display the file_column_field
          file_column_field("record", column.name, options)
        end
      end      
    end
  end
end<commit_msg>jquery: file column remove function<commit_after>module ActiveScaffold
  module Helpers
    # Helpers that assist with the rendering of a Form Column
    module FormColumnHelpers
      def active_scaffold_input_file_column(column, options)
        if @record.send(column.name) 
          # we already have a value?  display the form for deletion.
          if ActiveScaffold.js_framework == :jquery
            js_remove_file_code = "$(this).prev().val('true'); $(this).parent().hide().next().show();";
          else
            js_remove_file_code = "$(this).previous().value='true'; p=$(this).up(); p.hide(); p.next().show();";
          end
          content_tag(
            :div, 
            content_tag(
              :div, 
              get_column_value(@record, column) + " " +
              hidden_field(:record, "delete_#{column.name}", :value => "false") +
              " | " +
                link_to_function(as_(:remove_file), js_remove_file_code ),
              {}
            ) +
            content_tag(
              :div,
              file_column_field("record", column.name, options),
              :style => "display: none"
            ),
            {}
          )
        else
          # no, just display the file_column_field
          file_column_field("record", column.name, options)
        end
      end      
    end
  end
end
{'fraction_non_alphanumeric': 0.11671411142740952, 'fraction_numerical': 0.0, 'mean_word_length': 1.7333333333333334, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6642953', 'n_tokens_mistral': 673, 'n_tokens_neox': 664, 'n_words': 149}