<% content_for :secondary do %>
<br />
<br />
<br />
<br />
<br />
  <ul class="list">
	  <li><%= link_to t('bulletin.new_announcement'), new_panel_announcement_back_end_bulletin_path %></li>
	  <li><%= link_to t('bulletin.new_announcement_class'), panel_announcement_back_end_bulletin_categorys_path %></li>
  </ul>
<% end -%>

<%= flash_messages %>

<h1><%= t('bulletin.list_announcement') %></h1>
<br />
<br />
<br />
<br />
<br />

<% @bulletin_categorys.each do |t| %>

	<h4><%= link_to t.i18n_variable[I18n.locale], panel_announcement_back_end_bulletins_path(:bulletin_category_id => t.id ) %></h4>

	<table>
	  <tr>
		<th><%= t('bulletin.category') %></th>
		<th><%= t('bulletin.title') %></th>
		<th><%= t('bulletin.image') %></th>
		<th><%= t('bulletin.file') %></th>
		<th><%= t('bulletin.text') %></th>
		<th><%= t('bulletin.postdate') %></th>
		<th><%= t('bulletin.deadline') %></th>
		<th><%= t('bulletin.action') %></th>
	  </tr>

	<% t.bulletins.each do |post| %>
	  <tr>
		<td><%= link_to post.bulletin_category.i18n_variable[I18n.locale], panel_announcement_front_end_bulletin_path(post) %></td>
		<td><%= post.title %></td>
		<td><%= link_to t('bulletin.image'), post.image.url, {:target => '_blank', :title => post.alt} if post.image.file %></td>
        <td>
		<% post.bulletin_files.each do | bfile | %>
		<%= link_to bfile.filetitle, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
		<% end %>
		</td>
		<td><%= truncate(post.text,:length=>15) %></td>
		<td><%= post.postdate %></td>
		<td><%= post.deadline %></td>
		<td>
		<%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(post) %> | 
		<%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(post), :confirm => t('announcement.sure?'), :method => :delete, :confirm => 'Are you sure?' %>
		</td>
	  </tr>
	  
	<% end %>
	
	</table>

<% end %>

<br />

