hps_member/app/views/admin/member_counselors/index.html.erb

91 lines
3.9 KiB
Plaintext

<% content_for :right_nav do %>
<div class="searchClear pull-left">
<form id="module-search-form">
<input type="text" id="filter-input" class="search-query input-medium" placeholder="<%= t(:search_) %>" name="keywords" value="<%=params[:keywords]%>">
<% if params[:keywords].present? %>
<a href="<%= admin_member_counselors_path %>" class="btn btn-link btn-small"><i class="icons-cycle"></i> <%= t(:clear) %></a>
<% end %>
</form>
</div>
<div class="pull-right">
<ul class="nav nav-pills filter-nav pull-right">
<li class="accordion-group <%= params[:user_type].present? ? "active" : "" %>">
<div class="accordion-heading">
<a href="#collapse-type" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">User Type</a>
</div>
</li>
</ul>
<div class="filter-group accordion-group">
<div class="accordion-body <%= params[:user_type].present? ? "" : "collapse" %>" id="collapse-type">
<div class="accordion-inner pagination-right" >
<form action="" method="get" id="filter-form" >
<label style="display: inline;" for="user_type_0"><input id="user_type_0" type="checkbox" name="user_type[]" <%= params[:user_type].present? && params[:user_type].include?("0") ? "checked=checked" : "" %> value="0" class="filterable"> <%= t("member_counselor.type1") %></label>
<label style="display: inline;" for="user_type_1"><input id="user_type_1" type="checkbox" name="user_type[]" <%= params[:user_type].present? && params[:user_type].include?("1") ? "checked=checked" : "" %> value="1" class="filterable"> <%= t("member_counselor.type2") %></label>
<label style="display: inline;" for="user_type_2"><input id="user_type_2" type="checkbox" name="user_type[]" <%= params[:user_type].present? && params[:user_type].include?("2") ? "checked=checked" : "" %> value="2" class="filterable"> <%= t("member_counselor.type3") %></label>
</form>
</div>
<% if params[:user_type].present? %>
<div class="filter-clear">
<a href="<%= admin_member_counselors_path %>" class="btn btn-link btn-small"><i class="icons-cycle"></i> <%= t(:clear) %></a>
</div>
<% end %>
</div>
</div>
<% end %>
<table class="table main-list">
<thead>
<tr class="sort-header">
<% @table_fields.each do |f| %>
<%= thead(f) %>
<% end %>
</tr>
</thead>
<tbody>
<% @counselors.each do |counselor| %>
<tr>
<td>
<a href="#"><%= counselor.account %></a>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(counselor) %>
<li><a href="<%= edit_admin_member_counselor_path(counselor, :page => params[:page]) %>"><%= t(:edit) %></a></li>
<li><a href="<%= admin_member_counselor_path(counselor, :page => params[:page]) %>" data-method="delete" data-confirm="Are you sure?" class="delete text-error"><%= t(:delete_) %></a></li>
<% end %>
</ul>
</div>
</td>
<td>
<%= counselor.name rescue "" %>
<% if (!counselor.enabled) %>
<span class='label'><%= t(:disabled) %></span>
<% end %>
</td>
<td>
<%= counselor.get_user_type %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag :div, paginate(@counselors), class: "pagination pagination-centered"
end
%>
<script type="text/javascript">
$(function() {
$("#filter-form").submit(function() {
$(this).find(":input").filter(function(){ return !this.value; }).attr("disabled", "disabled");
return true; // ensure form still submits
});
});
$(".filterable").on("click",function(){
$("#filter-form").submit();
})
$("#filter-input").on("keyup",function(){
if(e.keycode == 13){
$("#module-search-form").submit();
}
})
</script>