<commit_before>:ruby
  query = params[:query]
  params = request.params.except(:authenticity_token, :action, :controller, :utf8, :bulk_export)
  sort = params[:sort]
  sort_reverse = params[:sort_reverse]
  properties = @model_config.list.with(:view => self, :object => @abstract_model.model.new).visible_fields
  # columns paginate
  @filterable_fields = @model_config.list.fields.select(&:filterable?)
  @style, @other, properties = get_column_set(properties)
  @index = 0
  @ordered_filters = (params[:filters] || @model_config.list.filters).inject({}) { |memo, filter|
    field_name = filter.is_a?(Array) ? filter.first : filter
  (filter.is_a?(Array) ? filter.last : { (@index += 1) => { "value" => '' } }) .each do |index, filter_hash|
      memo[index] = { field_name => filter_hash } unless filter_hash['disabled']
    end
    memo
  }.to_a.sort_by(&:first)

  @ordered_filter_string = @ordered_filters.map do |duplet|
    filter_index = duplet[0]
    filter_for_field = duplet[1]
    filter_name = filter_for_field.keys.first
    filter_hash = filter_for_field.values.first
    field = @filterable_fields.find{ |field| field.name == filter_name.to_sym }

    field_options = case field.type
    when :enum
      CGI.escapeHTML options_for_select(field.with(:object => @abstract_model.model.new).enum, filter_hash['value']).gsub("\n", '')
    else
      ''
    end
    "$.filters.append('#{field.label}', '#{field.name}', '#{field.type}', '#{filter_hash['value']}', '#{filter_hash['operator']}', '#{field_options}', #{filter_index});"
  end.join if @ordered_filters


= javascript_tag do
  :plain
    jQuery(function($) {
      #{@ordered_filter_string}
    });

- can_bulk_action = (authorized?(:export, @abstract_model) || authorized?(:delete, @abstract_model))
- can_see_history = authorized? :see_history, @abstract_model
- show_label    = t("admin.list.show_action")
- delete_label  = t("admin.list.delete_action")
- edit_label    = t("admin.list.edit_action")

#list
  %style
  - @style.each do |key, value|
    \.grid thead #{".#{key}"}{
    width: #{value[:width]}px;
    }
  = form_tag(list_post_path(params.except(*%w[page filters query])), :method => :post, :remote => true, :class => "form", :style => "display:inline") do
    .row
      .span12
        #filters_box
    .row.clearfix
      .span3
        %input{:name => "query", :type => "search", :value => query, :placeholder => "#{t("admin.list.search")}"}
      .span3
        %button.btn.primary.search_submit{:type => "submit", :value => ""}Refresh

  = form_tag bulk_action_path(:model_name => @abstract_model.to_param), :method => :post, :id => "bulk_form", :class => "form" do
    = hidden_field_tag :bulk_action
    %table.zebra-striped
      %thead
        %tr
          %th.first
            - if can_bulk_action<commit_msg>oups [ci skip]<commit_after>:ruby
  query = params[:query]
  params = request.params.except(:authenticity_token, :action, :controller, :utf8, :bulk_export)
  sort = params[:sort]
  sort_reverse = params[:sort_reverse]
  properties = @model_config.list.with(:view => self, :object => @abstract_model.model.new).visible_fields
  # columns paginate
  @filterable_fields = @model_config.list.fields.select(&:filterable?)
  @style, @other, properties = get_column_set(properties)
  @index = 0
  @ordered_filters = (params[:filters] || @model_config.list.filters).inject({}) { |memo, filter|
    field_name = filter.is_a?(Array) ? filter.first : filter
  (filter.is_a?(Array) ? filter.last : { (@index += 1) => { "value" => '' } }) .each do |index, filter_hash|
      memo[index] = { field_name => filter_hash } unless filter_hash['disabled']
    end
    memo
  }.to_a.sort_by(&:first)

  @ordered_filter_string = @ordered_filters.map do |duplet|
    filter_index = duplet[0]
    filter_for_field = duplet[1]
    filter_name = filter_for_field.keys.first
    filter_hash = filter_for_field.values.first
    field = @filterable_fields.find{ |field| field.name == filter_name.to_sym }

    field_options = case field.type
    when :enum
      CGI.escapeHTML options_for_select(field.with(:object => @abstract_model.model.new).enum, filter_hash['value']).gsub("\n", '')
    else
      ''
    end
    "$.filters.append('#{field.label}', '#{field.name}', '#{field.type}', '#{filter_hash['value']}', '#{filter_hash['operator']}', '#{field_options}', #{filter_index});"
  end.join if @ordered_filters


= javascript_tag do
  :plain
    jQuery(function($) {
      #{@ordered_filter_string}
    });

- can_bulk_action = (authorized?(:export, @abstract_model) || authorized?(:delete, @abstract_model))
- can_see_history = authorized? :see_history, @abstract_model
- show_label    = t("admin.list.show_action")
- delete_label  = t("admin.list.delete_action")
- edit_label    = t("admin.list.edit_action")

#list
  %style
    - @style.each do |key, value|
      \.grid thead #{".#{key}"}{
      width: #{value[:width]}px;
      }
  = form_tag(list_post_path(params.except(*%w[page filters query])), :method => :post, :remote => true, :class => "form", :style => "display:inline") do
    .row
      .span12
        #filters_box
    .row.clearfix
      .span3
        %input{:name => "query", :type => "search", :value => query, :placeholder => "#{t("admin.list.search")}"}
      .span3
        %button.btn.primary.search_submit{:type => "submit", :value => ""}Refresh

  = form_tag bulk_action_path(:model_name => @abstract_model.to_param), :method => :post, :id => "bulk_form", :class => "form" do
    = hidden_field_tag :bulk_action
    %table.zebra-striped
      %thead
        %tr
          %th.first
            - if can_bulk_action
{'fraction_non_alphanumeric': 0.17202772347609738, 'fraction_numerical': 0.0031988626266216454, 'mean_word_length': 3.9411764705882355, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 43, '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': '4656856', 'n_tokens_mistral': 1919, 'n_tokens_neox': 1913, 'n_words': 343}