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

65 lines
2.2 KiB
Plaintext
Raw Permalink Normal View History

2019-05-28 15:54:32 +00:00
<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="send-newsletter" href="<%= send_newsletter_admin_e_paper_criteria_path(criteria.id) %>"><%= t('e_paper.send_newsletter') %></a></li>
2019-05-28 15:54:32 +00:00
<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;
})
$(".send-newsletter").on("click",function(){
var el = $(this);
if(confirm("Are you sure?")){
$.ajax({
url : el.attr("href"),
dataType : "json",
type : "get"
}).done(function(){
alert("Newsletter sent.")
})
}
return false;
})
2019-05-28 15:54:32 +00:00
</script>