epaper/app/views/admin/e_paper_criterias/_index.html.erb

51 lines
1.7 KiB
Plaintext

<table class="table main-list">
<thead>
<tr class="sort-header">
<% @table_fields.each do |f| %>
<%= thead(f) %>
<% end %>
</tr>
</thead>
<tbody>
<% @criterias.each do |criteria| %>
<tr>
<td>
<%= criteria.title %>
<div class="quick-edit">
<ul class="nav nav-pills">
<li><a href="<%= edit_admin_e_paper_criteria_path(criteria.id) %>"><%= t(:edit) %></a></li>
<li><a class="test-email" href="<%= send_test_email_admin_e_paper_criteria_path(criteria.id) %>"><%= t('e_paper.test_mail') %></a></li>
<li><a class="delete text-error" href="<%= admin_e_paper_criteria_path(criteria.id) %>" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
</ul>
</div>
</td>
<td><%= criteria.start_date.strftime("%Y/%m/%d") rescue "N/A" %> ~ <%= criteria.end_date.strftime("%Y/%m/%d") rescue "N/A" %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="bottomnav clearfix" style="left: 81px;">
<%= content_tag :div, paginate(@criterias), class: "pagination pagination-centered" %>
<div class="action pull-right">
<a class="btn btn-primary" href="<%= new_admin_e_paper_criteria_path %>">
<%= t("e_paper.new_criteria") %>
</a>
</div>
</div>
<script type="text/javascript">
$(".test-email").on("click",function(){
var el = $(this),
email = prompt("Please enter an email address to send test email.", "<%= current_user.member_profile.email rescue "" %>");
if(email != null){
$.ajax({
url : el.attr("href"),
data : {"email" : email},
dataType : "json",
type : "get"
}).done(function(){
alert("Email sent.")
})
}
return false;
})
</script>