e_paper/app/views/admin/e_papers/_index.html.erb

57 lines
1.9 KiB
Plaintext

<table class="table main-list">
<thead>
<tr class="sort-header">
<% @table_fields.each do |f| %>
<%= thead(f) %>
<% end %>
</tr>
</thead>
<tbody>
<% user_has_rights = (current_user.is_admin? ? true : (current_user.is_manager?(@module_app) ? true : current_user.is_manager_with_role?(@module_app) ? true : false)) rescue false %>
<% @papers.each do |paper| %>
<tr>
<td>
<%= paper.category.title rescue "" %>
<% if (paper.category.disable rescue false) %>
<span class="label"><%= t(:disable) %></span>
<% end %>
</td>
<td>
<%= paper.title %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(paper) %>
<li><a href="<%= admin_e_paper_path(paper.id) %>"><%= t('e_paper.add') %></a></li>
<% end %>
<% if user_has_rights %>
<li><a href="<%= edit_admin_e_paper_path(paper.id) %>"><%= t(:edit) %></a></li>
<li><a href="<%= admin_e_paper_path(paper.id) %>" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
<% if paper.ready_to_send %>
<li><span class="label"><%= t('e_paper.sending') %></span></li>
<% elsif !paper.ready_to_send && paper.mailed %>
<li><span class="label"><%= t('e_paper.published') %></span></li>
<% else %>
<li><a href="<%= send_email_to_subscribers_admin_e_paper_path(paper.id) %>"><%= t('e_paper.send') %></a></li>
<% end %>
<% end %>
</ul>
</div>
</td>
<td>
<%= paper.period rescue nil %>
</td>
</tr>
<% end %>
</tbody>
</table>
<div class="bottomnav clearfix" style="left: 81px;">
<% if user_has_rights %>
<div class="action pull-right">
<a class="btn btn-primary" href="<%= new_admin_e_paper_path %>">
<%= t("e_paper.new_paper") %>
</a>
</div>
<% end %>
</div>