Added authorization for index

This commit is contained in:
Harry Bomrah 2019-03-09 13:28:52 +08:00
parent 0e80705437
commit 4da6436267
1 changed files with 4 additions and 1 deletions

View File

@ -8,12 +8,13 @@
</thead> </thead>
<tbody> <tbody>
<% @tables.each do |table| %> <% @tables.each do |table| %>
<% can_edit = can_edit_or_delete?(table) %>
<tr id="table_<%= table.id.to_s %>"> <tr id="table_<%= table.id.to_s %>">
<td> <td>
<a href="<%= admin_universal_table_path(table) %>"><%= table.title %></a> <a href="<%= admin_universal_table_path(table) %>"><%= table.title %></a>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<% if can_edit_or_delete?(table) %> <% if can_edit %>
<li><a href="<%= edit_admin_universal_table_path(table) %>"><%= t(:edit) %></a></li> <li><a href="<%= edit_admin_universal_table_path(table) %>"><%= t(:edit) %></a></li>
<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_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> <li><a href="<%= admin_universal_table_path(table) %>" class="delete text-error" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
@ -28,6 +29,7 @@
<%= table.table_entries.count %> <%= table.table_entries.count %>
</td> </td>
<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"> <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 %> <%= hidden_field_tag :authenticity_token, form_authenticity_token %>
<input type="file" name="import_data" /> <input type="file" name="import_data" />
@ -35,6 +37,7 @@
<input type="hidden" name="universal_table_id" value="<%= table.id.to_s %>" /> <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> <a href="<%= admin_universal_table_export_structure_path(table, :format => "xlsx") %>"><%= t("universal_table.export_structure") %></a>
</form> </form>
<% end %>
</td> </td>
</tr> </tr>
<% end %> <% end %>