ask/app/views/admin/ask_admins/index.html.erb

63 lines
1.7 KiB
Plaintext

<%= render 'layouts/delete_modal', delete_options: @delete_options %>
<table class="table main-list">
<thead>
<tr class="sort-header">
<% @table_fields.each do |f| %>
<%= thead(f) %>
<% end %>
</tr>
</thead>
<tbody>
<% @ask_admins.each do |a| %>
<tr>
<td>
<%= a.email %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(a) %>
<li><a href="/admin/ask_admins/<%=a.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/ask_admins/<%=a.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %>
</ul>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= javascript_include_tag 'validator' %>
<%= form_for @ask_admin, url: admin_ask_admins_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<h2><%= @ask_admin.new_record? ? t(:add) : t(:edit) %></h2>
<div id="widget-title">
<div class="control-group">
<%= f.label :email, class: 'control-label' %>
<div class="controls">
<%= f.text_field :email, class: 'input-xxlarge', data: {"fv-validation" => "required;check_email;", "fv-messages" => "必填欄位;Email不正確;"} %>
</div>
</div>
</div>
<div class="form-actions">
<%= f.submit t(:submit), class: 'btn btn-primary' %>
</div>
<% end %>
<script type='text/javascript'>
$(function(){
var fv = new FormValidator($("#new_ask_admin"));
fv.validate_functions.check_email = function(value){
reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
if (reg.test(value)) {
return true;
}else{
return false;
}
}
})
</script>