<% # encoding: utf-8 %>

<%= flash_messages %>

<h1 class="h1"><%= @page.title %></h1>


<table class="table table-bordered">
  <tr>
      <%= content_tag (:th) do %>
        <%= t('announcement.bulletin.category') %>
      <% end  if (!params[:search_query].blank? or params[:category_id].blank?)-%>
	<th><%= t('announcement.bulletin.title') %></th>
	<th><%= t('announcement.bulletin.postdate') %></th>
  </tr>
    <% if !params[:name].blank?%>
      <%= t("search.unit_get",:unit_name => params[:name],:item_num=>@bulletins.count) %>
    <% end %>

    <% if @bulletins.blank? and !params[:search_query].blank? %>
      <%=render :partial => 'shared/search_not_found'  %>
      <% elsif  !params[:search_query].blank?  %>
        <%= t("search.result_get",:search_word => params[:search_query],:item_num=>@bulletins.count) unless (@bulletins.count == 30) %>
        <%= t("search.too_many",:search_word => params[:search_query],:exceed_num=>@bulletins.count) if (@bulletins.count ==30) %>
     <% end %>

<% @bulletins.each do |post| %>
  <tr class=<%= cycle('odd', '') %>>
      <%= content_tag(:th) do%>
	   <td><%= (post.bulletin_category.title rescue nil ) %></td>
     <% end if(!params[:search_query].blank?  or params[:category_id].blank?) %>
		<td><%= link_to post.title, panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
		<%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
		</td>
		<td class="date"><%= display_date_time(post.postdate) %></td>
  </tr>
  
<% end %>

</table>

<%= paginate @bulletins, :param_name => :page_main, :params => {:inner => 'false'} %>

