universal_table/app/views/admin/universal_tables/_index.html.erb

48 lines
2.0 KiB
Plaintext

<table class="table main-list">
<thead>
<tr class="sort-header">
<% @table_fields.each do |f| %>
<%= thead(f) %>
<% end %>
</tr>
</thead>
<tbody>
<% @tables.each do |table| %>
<% can_edit = can_edit_or_delete?(table) %>
<tr id="table_<%= table.id.to_s %>">
<td>
<a href="<%= admin_universal_table_path(table) %>"><%= table.title %></a>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit %>
<li><a href="<%= edit_admin_universal_table_path(table) %>"><%= t(:edit) %></a></li>
<% if table.ordered_with_sort_number %>
<li><a href="<%= admin_universal_table_edit_sort_path(table) %>"><%= t('universal_table.edit_sort') %></a></li>
<% end %>
<li><a href="/admin/universal_tables/<%=table.id.to_s%>/export_data?format=xlsx" data-table-id="<%= table.id.to_s %>" class="export-xls"><%= t('universal_table.export_xls') %></a></li>
<li><a href="<%= admin_universal_table_path(table) %>" class="delete text-error" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
<% end %>
</ul>
</div>
</td>
<td>
<%= table.created_at.strftime("%Y-%m-%d") %>
</td>
<td>
<%= table.table_entries.count %>
</td>
<td>
<% if can_edit %>
<form action="/admin/universal_tables/import_data_from_excel" method="post" enctype="multipart/form-data" class="import_from_excel_form">
<%= hidden_field_tag :authenticity_token, form_authenticity_token %>
<input type="file" name="import_data" />
<button class="btn btn-primary btn-small"><i class="icons-upload"></i></button>
<input type="hidden" name="universal_table_id" value="<%= table.id.to_s %>" />
<a href="<%= admin_universal_table_export_structure_path(table, :format => "xlsx") %>"><%= t("universal_table.export_structure") %></a>
</form>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>