<commit_before>:css
  .flag-column {
    :width: 30px;
  }

.table-responsive
  %table.table.table-condensed.table-hover{:id => 'search_asset_server_table',
    :data => {:toggle => 'table',
    :url => new_search_path(:format => :json, :search_type => @search_type.id),
    :card_view => "false",
    :pagination => 'true',
    :sort_order => 'asc',
    :sortable => 'true',
    :side_pagination => 'server',
    :show_pagination_switch => 'true',
    :page_number => '1',
    :page_list => "[5, 10, 20, 50, 100, 200]",
    :page_size => current_user.num_table_rows,
    :search => 'false',
    :show_columns => 'true',
    :show_export => 'true',
    :row_style => 'row_style',
    :click_to_select => 'true',
    :show_export => 'true',
    :id_field => 'object_key',
    :export_types => "['csv', 'txt', 'excel']",
    :state_save => 'true',
    :state_save_id_table => "assetid",
    :state_save_expire => "1y",
    :maintain_selected => 'true',
    :single_select => 'false'}}
    %thead
      %tr

        - SystemConfig.transam_module_names.each do |mod|
          - if lookup_context.template_exists?("#{mod}_asset_table_head", 'assets', true)
            = render :partial => "assets/#{mod}_asset_table_head"

        %th.center.flag-column{:data => {:field => 'tasks', :formatter => 'tasks_formatter'}}
          %i.fa.fa-flag
        %th.center.flag-column{:data => {:field => 'comments', :visible => 'false', :formatter => 'comments_formatter'}}
          %i.fa.fa-comments
        %th.center.flag-column{:data => {:field => 'documents', :visible => 'false', :formatter => 'documents_formatter'}}
          %i.fa.fa-files-o
        %th.center.flag-column{:data => {:field => 'photos', :visible => 'false', :formatter => 'images_formatter'}}
          %i.fa.fa-image
:javascript

  var path = '#{inventory_path("x")}';

  function row_style(row, index) {
    return 'action-path';
  };

  $('#asset_server_table').on('sort.bs.table', function(e, name, order) {
    $('#asset_server_table').bootstrapTable('selectPage', 1);
  }).on('post-body.bs.table', function() {
    $('.fixed-table-container').css('min-height', '300px');
    $('#asset_server_table > tbody > tr').addClass('action-path');
  });

  $(window).resize(function() {
    $('#asset_server_table').bootstrapTable('resetView');
  });

  function boolean_formatter(value) {
    if (value) {
      // add hidden div for exporting
      return '<i class="fa fa-check"></i><div style = "visibility: hidden;">Yes</div>';
    } else {
      return '<div style = "visibility: hidden;">No</div>';
    }
  };

  function integer_formatter(value) {
    return format("###,##0.", value);
  };

  function currency_formatter(value) {
    return '$' + integer_formatter(value);
  };

  function percentage_formatter(value) {
    if (value) {
      return format("##0.00", value) + "%";
    } else {
      return value;
    }
  };

  function date_formatter(value) {
    if (value) {
      //console.log(value);
      var date = new Date(value);
      //console.log(date);
      var local_date = convertUTCDateToLocalDate(date);
      //console.log(local_date);
      return local_date.getMonth() + 1 + "/" + local_date.getDate() + "/" + local_date.getFullYear();
    } else {
      return value;
    }
  };

  function convertUTCDateToLocalDate(date) {
      var newDate = new Date(date.getTime()+date.getTimezoneOffset()*60*1000);

      var offset = date.getTimezoneOffset() / 60;
      var hours = date.getHours();

      newDate.setHours(hours - offset);

      return newDate;
  };
  function tagged_formatter(value) {
    if (value == '1') {
      return '<i class="fa fa-star"></i>';
    } else {
      return '<i class="fa fa-star-o"></i>';
    }
  };

  function tasks_formatter(value) {
    if (value > 0) {
      return '<i class="fa fa-flag"></i>';
    }
    return "";
  };

  function documents_formatter(value) {
    if (value > 0) {
      return '<i class="fa fa-file-o"></i>';
    }
    return "";
  };

  function comments_formatter(value) {
    if (value > 0) {
      return '<i class="fa fa-comments"></i>';
    }
    return "";
  };

  function images_formatter(value) {
    if (value > 0) {
      return '<i class="fa fa-image"></i>';
    }
    return "";
  };
<commit_msg>fix bug in loading inevntory table by asset type in search [#141050521]<commit_after>:css
  .flag-column {
    :width: 30px;
  }
:ruby
  # set table type
  @asset_class_name = @searcher.asset_type_class_name
  @view = "#{@asset_class_name.underscore}_index"

.table-responsive
  %table.table.table-condensed.table-hover{:id => 'search_asset_server_table',
    :data => {:toggle => 'table',
    :url => new_search_path(:format => :json, :search_type => @search_type.id),
    :card_view => "false",
    :pagination => 'true',
    :sort_order => 'asc',
    :sortable => 'true',
    :side_pagination => 'server',
    :show_pagination_switch => 'true',
    :page_number => '1',
    :page_list => "[5, 10, 20, 50, 100, 200]",
    :page_size => current_user.num_table_rows,
    :search => 'false',
    :show_columns => 'true',
    :show_export => 'true',
    :row_style => 'row_style',
    :click_to_select => 'true',
    :show_export => 'true',
    :id_field => 'object_key',
    :export_types => "['csv', 'txt', 'excel']",
    :state_save => 'true',
    :state_save_id_table => "assetid",
    :state_save_expire => "1y",
    :maintain_selected => 'true',
    :single_select => 'false'}}
    %thead
      %tr

        - SystemConfig.transam_module_names.each do |mod|
          - if lookup_context.template_exists?("#{mod}_asset_table_head", 'assets', true)
            = render :partial => "assets/#{mod}_asset_table_head"

        %th.center.flag-column{:data => {:field => 'tasks', :formatter => 'tasks_formatter'}}
          %i.fa.fa-flag
        %th.center.flag-column{:data => {:field => 'comments', :visible => 'false', :formatter => 'comments_formatter'}}
          %i.fa.fa-comments
        %th.center.flag-column{:data => {:field => 'documents', :visible => 'false', :formatter => 'documents_formatter'}}
          %i.fa.fa-files-o
        %th.center.flag-column{:data => {:field => 'photos', :visible => 'false', :formatter => 'images_formatter'}}
          %i.fa.fa-image
:javascript

  var path = '#{inventory_path("x")}';

  function row_style(row, index) {
    return 'action-path';
  };

  $('#asset_server_table').on('sort.bs.table', function(e, name, order) {
    $('#asset_server_table').bootstrapTable('selectPage', 1);
  }).on('post-body.bs.table', function() {
    $('.fixed-table-container').css('min-height', '300px');
    $('#asset_server_table > tbody > tr').addClass('action-path');
  });

  $(window).resize(function() {
    $('#asset_server_table').bootstrapTable('resetView');
  });

  function boolean_formatter(value) {
    if (value) {
      // add hidden div for exporting
      return '<i class="fa fa-check"></i><div style = "visibility: hidden;">Yes</div>';
    } else {
      return '<div style = "visibility: hidden;">No</div>';
    }
  };

  function integer_formatter(value) {
    return format("###,##0.", value);
  };

  function currency_formatter(value) {
    return '$' + integer_formatter(value);
  };

  function percentage_formatter(value) {
    if (value) {
      return format("##0.00", value) + "%";
    } else {
      return value;
    }
  };

  function date_formatter(value) {
    if (value) {
      //console.log(value);
      var date = new Date(value);
      //console.log(date);
      var local_date = convertUTCDateToLocalDate(date);
      //console.log(local_date);
      return local_date.getMonth() + 1 + "/" + local_date.getDate() + "/" + local_date.getFullYear();
    } else {
      return value;
    }
  };

  function convertUTCDateToLocalDate(date) {
      var newDate = new Date(date.getTime()+date.getTimezoneOffset()*60*1000);

      var offset = date.getTimezoneOffset() / 60;
      var hours = date.getHours();

      newDate.setHours(hours - offset);

      return newDate;
  };
  function tagged_formatter(value) {
    if (value == '1') {
      return '<i class="fa fa-star"></i>';
    } else {
      return '<i class="fa fa-star-o"></i>';
    }
  };

  function tasks_formatter(value) {
    if (value > 0) {
      return '<i class="fa fa-flag"></i>';
    }
    return "";
  };

  function documents_formatter(value) {
    if (value > 0) {
      return '<i class="fa fa-file-o"></i>';
    }
    return "";
  };

  function comments_formatter(value) {
    if (value > 0) {
      return '<i class="fa fa-comments"></i>';
    }
    return "";
  };

  function images_formatter(value) {
    if (value > 0) {
      return '<i class="fa fa-image"></i>';
    }
    return "";
  };

{'fraction_non_alphanumeric': 0.1901367973330268, 'fraction_numerical': 0.010001149557420394, 'mean_word_length': 3.029643353404354, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 139, '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': '1780912', 'n_tokens_mistral': 3056, 'n_tokens_neox': 2892, 'n_words': 551}