<%= render :partial => "submenu" %>

<div id="main"><!-- メイン -->

<h2>新着情報</h2>
<br />
<div class="btn_t">
  <%= button_to '新規登録', new_admin_new_information_path ,:class =>"btn_s"%>
</div>
<br />
<%=h flash[:notice] %>
<%=h flash[:errors] %>

<% if !@new_informations.blank? %>
<table class="data2" cellspacing="1">
  <tr>
    <th>順序</th>
    <th>日付</th>
    <th>タイトル</th>
    <th>編集</th>
    <th>削除</th>
    <th>移動</th>
  </tr>
  <% @new_informations.each_with_index do |ni, idx| %>
  <tr>
    <td class="t_center"><%=h ni.position %></td>
    <td class="t_center"><%=h date(ni.date) %></td>
    <td><%=h ni.name %></td>
    <td class="t_center"><%= link_to "編集", edit_admin_new_information_path(ni.id) %></td>
    <td class="t_center"><%= link_to "削除", admin_new_information_path(ni.id), :confirm => "本当に削除しますか？", :method => "delete" %></td>
    <td class="t_center">
      <% form_tag :action => "change_position", :id => ni.id do %>
        <%= text_field_tag 'position', nil, :size => 3 %>番目へ<%= submit_tag "移動" %>
      <% end %>
      <% if idx > 0 %>
        <%= link_to "上へ", :action => "up", :id=> ni.id %>
      <%end%>
      <% if idx < @new_informations.size-1 %>
        <%= link_to "下へ", :action => "down", :id=> ni.id %>
      <% end %>
    </td>
  </tr>
  <% end %>
</table>
<% end %>

</div><!-- /メイン -->
