<%= render :partial => 'common/scrum_sprint_menu' %>

<h2>
  <%= l(:label_sprint_board) %>
</h2>

<div id="messages"></div>

<%= render :partial => 'post_its/sprint_board/head',
           :locals => {:project => @project, :sprint => @sprint, :path => method(:sprint_path)} %>

<%- sprint_board_id = 'sprint_board' -%>
<%= render :layout => 'common/fullscreen_content' do %>
  <table class="sprint-board">
    <thead class="sprint-board">
      <tr class="sprint-board">
        <th></th>
        <th class="sprint-board"><%= l(:label_pbi_plural) %></th>
        <%- task_statuses = IssueStatus.task_statuses
            task_statuses.each do |status| -%>
          <th class="sprint-board"><%= status.name %></th>
        <%- end -%>
      </tr>
    </thead>
    <tbody id="<%= sprint_board_id %>" class="sprint-board">
    <%- @sprint.pbis.each do |pbi| -%>
      <%= render :partial => 'post_its/sprint_board/pbi_row', :formats => [:html],
                 :locals => {:project => @project,
                             :sprint_board_id => sprint_board_id,
                             :pbi => pbi,
                             :task_statuses => task_statuses} %>
    <%- end -%>
    </tbody>
  </table>

  <%= render :partial => 'post_its/sprint_board/footer',
             :locals => {:project => @project, :sprint => @sprint, :path => method(:sprint_path)} %>

  <%- if User.current.allowed_to?(:add_issues, @project) and
      User.current.allowed_to?(:edit_sprint_board, @project) and
      @sprint.open? -%>
    <div>
      <%- Tracker.pbi_trackers(@project).each do |tracker| -%>
      <span class="post-it settings-post-it <%= tracker.post_it_css_class %>">
        <%= link_to tracker.name, new_pbi_path(@sprint, tracker), :remote => true,
                    :method => 'GET', :class => 'icon icon-add' %>
      </span>
      <%- end -%>
    </div>
  <%- end -%>
<% end %>

<%= render :partial => 'sprints/show', :formats => [:js],
           :locals => {:sprint => @sprint,
                       :sprint_board_id => sprint_board_id} %>

<%= render :partial => 'common/scrum_footer' %>

<%- heads_for_wiki_formatter -%>
