<% 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.announcement_list'), panel_announcement_back_end_bulletins_path %></li>
	  <li><%= link_to t('bulletin.new_announcement_class'), panel_announcement_back_end_bulletin_categorys_path %></li>
  </ul>
<% end -%>

<%= flash_messages %>

<br />
<br />
<br />
<br />
<br />
  
  <fieldset><legend><%= t('bulletin.search') %></legend>	

  <%= form_for :bulletin, :action => 'search', :method => 'get', :url => panel_announcement_back_end_bulletins_path do |f| %>
  
  <%#= f.select :bulletin_category_id, @bulletin_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ] },{ :include_blank => t('bulletin.select') }%>
  
  Category <%= select_tag "category_id", options_for_select(@bulletin_categorys.collect{|t| [t.i18n_variable[I18n.locale], t.id]}), :prompt => t('bulletin.select') %>
  
  KeyWord <%= text_field_tag :search, params[:search], :id => 'search_field' %>
  
  <%= submit_tag "Search", :name => nil %> 
  
  <% end %>

  
  </fieldset>

<br />
<br />

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



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

	<% @bulletins.each do |post| %>
	  <tr>
		<td></td>
		<td><%= post.postdate %></td>
		<td><%= (post.deadline) ? post.deadline : t('bulletin.no_deadline') %></td>
		<td><%= post.bulletin_category.i18n_variable[I18n.locale] %></td>
		<td><%#= link_to post.title, panel_announcement_front_end_bulletin_path(post) %>
		<%= link_to post.title_variable[I18n.locale], panel_announcement_back_end_bulletin_path(post) %>
		</td>
		<td>
		<%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(post) %> | 
		
		<%= link_to t(:set_top), eval("panel_announcement_back_end_bulletin_path(post, :authenticity_token => form_authenticity_token, :bulletin => {:is_top => true})"), :remote => true, :method => :put, :id => "disable_#{post.id}", :style => "display:#{post.is_top? ? 'none' : ''}", :class => 'switch' %>
		<%= link_to t(:cancel_top), eval("panel_announcement_back_end_bulletin_path(post, :authenticity_token => form_authenticity_token, :bulletin => {:is_top => false})"), :remote => true, :method => :put, :id => "enable_#{post.id}", :style => "display:#{post.is_top? ? '' : 'none'}", :class => 'switch' %>
				
		 | <%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(post), :confirm => t('announcement.sure?'), :method => :delete %>
		</td>
	  </tr>
	  
	<% end %>
	
	</table>

<br />

