app/views/rails_admin/main/history.html.erb
<% params = request.params.except(:action, :controller, :model_name) %>
<% query = params[:query] %>
<% filter = params[:filter] %>
<% sort = params[:sort] %>
<% sort_reverse = params[:sort_reverse] %>
<% path_method = params[:id] ? "history_show_path" : "history_index_path" %>
<%= form_tag("", method: "get", class: "search form-inline") do %>
<div class="card mb-3 p-3 bg-light">
<div class="row">
<div class="col-sm-6">
<div class="input-group">
<input class="form-control" name="query" placeholder="<%= t("admin.misc.filter") %>" type="search" value="<%= query %>" />
<button class="btn btn-primary" data-disable-with="<%= '<i class="fas fa-sync"></i> ' + t('admin.misc.refresh') %>" type="submit">
<i class="fas fa-sync"></i>
<%= t("admin.misc.refresh") %>
</button>
</div>
</div>
</div>
</div>
<% end %>
<table class="table table-condensed table-striped table-hover" id="history">
<thead>
<tr>
<% columns = [] %>
<% columns << { property_name: "created_at", css_class: "created_at",link_text: t('admin.table_headers.created_at') } %>
<% columns << { property_name: "username", css_class: "username", link_text: t('admin.table_headers.username') } %>
<% columns << { property_name: "item", css_class: "item", link_text: t('admin.table_headers.item') } if @general %>
<% columns << { property_name: "message", css_class: "message", link_text: t('admin.table_headers.message') } %>
<% columns.each do |column| %>
<% property_name = column[:property_name] %>
<% selected = (sort == property_name) %>
<% sort_direction = (sort_reverse ? "headerSortUp" : "headerSortDown" if selected) %>
<% sort_location = send(path_method, params.except("sort_reverse").merge(model_name: @abstract_model.to_param, sort: property_name).merge(selected && sort_reverse != "true" ? {sort_reverse: "true"} : {})) %>
<th class="header <%= column[:css_class] %> <%= sort_direction if selected %>" data-href="<%= sort_location %>">
<%= column[:link_text] %>
</th>
<% end %>
</tr>
</thead>
<tbody class="table-group-divider">
<% @history.each_with_index do |object, index| %>
<tr>
<% unless object.created_at.nil? %>
<td>
<%= l(object.created_at, format: :long, default: l(object.created_at, format: :long)) %>
</td>
<% end %>
<td>
<%= object.username %>
</td>
<% if @general %>
<% if o = @abstract_model.get(object.item) %>
<% label = o.send(@abstract_model.config.object_label_method) %>
<% if show_action = action(:show, @abstract_model, o) %>
<td>
<%= link_to(label, url_for(action: show_action.action_name, model_name: @abstract_model.to_param, id: o.id)) %>
</td>
<% else %>
<td>
<%= label %>
</td>
<% end %>
<% else %>
<td>
<%= "#{@abstract_model.config.label} ##{object.item}" %>
</td>
<% end %>
<% end %>
<td>
<%= object.message.in?(['delete', 'new']) ? t("admin.actions.#{object.message}.done").capitalize : object.message %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% unless params[:all] || !@history.respond_to?(:current_page) %>
<%= paginate(@history, theme: 'ra-twitter-bootstrap') %>
<%= link_to(t("admin.misc.show_all"), send(path_method, params.merge(all: true)), class: "show-all btn btn-light") unless (tc = @history.total_count) <= @history.size || tc > 100 %>
<% end %>