recruitment/app/views/admin/recruitments/categories.html.erb

61 lines
1.9 KiB
Plaintext
Raw Normal View History

<span id="index_table">
<table class="table main-list">
<thead>
<tr class="sort-header">
<th>Title</th>
</tr>
</thead>
<tbody>
<% @categories.each do |category| %>
<tr>
<td>
<%= category.job_category_translations["en"] %> / <%= category.job_category_translations["zh_tw"] %>
<div class="quick-edit">
<ul class="nav nav-pills">
<li><a href="<%= editcategory_admin_recruitment_path(category) %>" class="categoryBtn"><%= t(:edit) %></a></li>
<li><a href="<%= deletecategory_admin_recruitment_path(category) %>" class="delete text-error" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
</ul>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
</span>
<div class="bottomnav clearfix">
<div class="pull-right">
<a href="<%= addcategory_admin_recruitments_path %>" id="addIndustryBtn" class="btn btn-primary categoryBtn">Add Category</a>
</div>
</div>
<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Job Category</h3>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary" id="save-btn">Save</button>
</div>
</div>
<script type="text/javascript">
var modal = $("#myModal");
$(".categoryBtn").on("click",function(){
var url = $(this).attr("href");
$.ajax({
url : url,
type : "get",
dataType : "html"
}).done(function(html){
modal.find(".modal-body").html(html);
modal.modal("show");
})
return false;
})
$("#save-btn").on("click",function(){
$("#category_form").submit();
})
</script>