% max_column ||= 8 %>
<% columns ||= @columns_on_steroid %>
<% omit_columns ||= [] %>
<% omit_columns.each{ |o| columns.delete(o) } %>
<% search_lambda ||= @global_search_lambda %>
<% download_csv ||= nil %>
<% table_on_steroid_id ||= "table_on_steroids" %>
<% column_param = params['columns' + table_on_steroid_id] || [] %>
<% selected_columns = ((column_param.count > 1) ? column_param : columns.keys.first(max_column)) %>
<% title ||= nil %>
<% subtext ||= nil %>
<% subtext_partial ||= nil %>
<% csv_image ||= nil %>
<% param_hash = CGI::parse(request.query_string) %>
<% expected_column_keys = columns.map{|col,col_values| col }+columns.map{|col,col_values|("search_" + col)}+columns.map{|col,col_values|("search_operator_" + col)} %>
<%= form_tag request.path, method: "get", id: ("knowledge_base_filters" + table_on_steroid_id) do %>
<% param_hash.select{ |k,v| !expected_column_keys.include?(k) && !["utf8","columns[]"].include?(k) }.each do |k,v| %>
<%= hidden_field_tag k, v[0] %>
<% end %>
<%end%>
<% if(search_lambda) %>
<%= text_field_tag 'search', params[:search], placeholder: 'Search ..', onchange: "$('#knowledge_base_filters#{table_on_steroid_id}').submit();", class: 'form-control global-search', form: "knowledge_base_filters#{table_on_steroid_id}" %>
<% end %>
<% if(subtext_partial) %>
<%= render partial: subtext_partial, locals: local_assigns %>
<% end %>
<% if(!columns.collect{ |c,v| params["search_" + c]}.reject!(&:blank?).empty?) %>
<%= link_to request.path, style: "text-decoration:none;padding-right:5px;" do %>
<% end %>
<%= t('shared.table_on_steroid.remove_search') %>
<% end %>
<%= select_tag("columns#{table_on_steroid_id}", options_for_select(columns.map{|c| [c[1][:label], c[0]]}, selected_columns), multiple: true, class: "column-selector table-on-steroids-selectpicker #{table_on_steroid_id}", data: {"none-selected-text" => "Display columns (max #{max_column})", "max-options" => max_column }, form: "knowledge_base_filters#{table_on_steroid_id}") %>
<% if(download_csv) %>
<% end %>
<% if(objects.is_a?(ActiveRecord::Base) || objects.is_a?(ActiveRecord::Relation)) %>
<%= paginate objects, theme: 'twitter-bootstrap-4' %>
<% end %>
<% columns.each_pair do | k , v | %>
<% if v[:type] == 'order' %>
<% else %>
<%= v[:label] %>
<% end %>
|
<% end %>
<%= render partial: "table_on_steroids/table_on_steroids_filters", locals: {columns_on_steroid: columns, selected_columns: selected_columns, table_on_steroid_id: table_on_steroid_id} %>
<% objects.each do |o| %>
<% columns.each_pair do | k , v | %>
<% val = v[:value_lambda].call(o, self) %>
<%= val.is_a?(String) ? val.html_safe : val %>
|
<% end %>
<% end %>
<% if(objects.is_a?(ActiveRecord::Base) || objects.is_a?(ActiveRecord::Relation)) %>
<%= paginate objects, theme: 'twitter-bootstrap-4' %>
<% end %>