announcement-test/app/views/admin/announcements/index.html.erb

95 lines
2.9 KiB
Plaintext
Raw Normal View History

2014-05-01 08:41:00 +00:00
<script type="text/javascript">
url = "";
filters = [];
filter = "";
$(".accordion-inner a").click(function(){
if(window.location.search==""){
filters = [];
}else{
filters = window.location.search.replace('?','').split('&');
}
filter = $(this).attr("href").split('?')[1];
if( (index = filters.indexOf(filter) ) > -1){
filters.splice(index,1);
}else{
filters.push(filter);
}
if(filters.length==0){
url = window.location.origin+window.location.pathname
}else{
url = window.location.origin+window.location.pathname+'?'+filters.join('&');
}
window.location.assign(url);
return false;
});
</script>
<% content_for :right_nav do %>
<ul class="nav nav-pills filter-nav pull-right">
<% @filter_fields.keys.each do |field| %>
<li class="accordion-group">
<div class="accordion-heading">
<a href="#collapse-<%= field %>" data-toggle="collapse" data-parent="#filter" class="accordion-toggle"><%= t(field) %></a>
</div>
</li>
<% end %>
</ul>
<div class="filter-group accordion-group">
<% @filter_fields.keys.each do |field| %>
<div class="accordion-body collapse" id="collapse-<%= field %>">
<div class="accordion-inner pagination-right" data-toggle="buttons-checkbox">
<% @filter_fields[field].each do |val| %>
<%= link_to t(val[:title]), "?filters[#{field}][]=#{val[:id]}", :class => "btn btn-small #{is_filter_active?(field, val[:id])}" %>
<% end %>
</div>
<div class="filter-clear">
<a href="" class="btn btn-link btn-small"><i class="icons-cycle"></i> <%= t(:clear) %></a>
</div>
</div>
<% end %>
</div>
<% end %>
<table class="table main-list">
<thead>
<tr class="sort-header">
<% @table_fields.each do |f| %>
<%= thead(f) %>
<% end %>
</tr>
</thead>
<tbody>
<% @bulletins.each do |b| %>
<tr>
<td><%= b.status_for_table %></td>
<td><%= b.category.title %></td>
<td>
<a href="/news/<%=b.id.to_s%>"><%= b.title %></a>
<div class="quick-edit">
<ul class="nav nav-pills">
<li><a href="/admin/announcements/<%=b.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="detail-row"><%= t(:detail) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/announcements/<%=b.id.to_s%>"><%= t(:delete_) %></a></li>
</ul>
</div>
</td>
<td><%= format_value b.postdate %></td>
<td><%= format_value b.deadline %></td>
<td><%= b.update_user.user_name %></td>
</tr>
<% end %>
</tbody>
</table>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag :div, paginate(@bulletins), class: "pagination pagination-centered"
end
%>
<%= render 'layouts/delete_modal', delete_options: @delete_options %>