<div class="project_r_h">
  <h2 class="project_h2"><%= l(:label_roadmap) %></h2>
</div>
<div class="roadmap">
    <fieldset id="filters" class="collapsible collapsed" >
      <legend><%= l(:label_version_display_settings)%></legend>
      <%= form_tag({}, :method => :get) do %>
          <% @trackers.each do |tracker| %>
              <label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s), :id => nil %>
                <%=h tracker.name %></label>
          <% end %>
          <label for="completed"><%= check_box_tag "completed", 1, params[:completed] %> <%= l(:label_show_completed_versions) %></label>
          <% if @project.descendants.active.any? %>
              <%= hidden_field_tag 'with_subprojects', 0 %>
              <label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label>
          <% end %>
          <%= submit_tag l(:button_apply), :class => 'sub_btn ml10', :name => nil %>
          <%= link_to l(:label_version_new), new_project_version_path(@project), :class => 'green_u_btn fr' if User.current.allowed_to?(:manage_versions, @project) %>
      <% end %>
    </fieldset>


<% if @versions.empty? %>
      <p class="nodata"><%= l(:label_no_data) %></p>
<% else %>
      <% @versions.each do |version| %>

<div class="roadmap_box">
      <p><a href="javascript:void(0)" class=" f16 fb c_dblue " target="_blank">
            <%= link_to_version_show version, :name => version_anchor(version) %>
            <% if version.completed? %>
                <span style="color: #E8770D;float:right;"><%= format_date(version.effective_date) %></span>
            <% elsif version.effective_date %>
                <span style="color: #E8770D;float:right;"><strong><%= due_date_distance_in_words(version.effective_date) %></strong> (<%= format_date(version.effective_date) %>)</span>
            <% end %>
         </a>
      </p>
      <div class="roadmap_pro mb10">
        <%= render :partial => 'versions/overview', :locals => {:version => version} %>
        <%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %>

      </div><!--roadmap_pro end-->
  <% if (issues = @issues_by_version[version]) && issues.size > 0 %>
      <div class="roadmap_list">
        <%= form_tag({}) do -%>
            <p class="f14 mb5">&#187;<%= l(:label_related_issues) %></p>
            <ul class="roadmap_list_ul">
                <% issues.each do |issue| -%>
                    <li style="overflow:hidden">
                        <%= link_to_issue_version(issue, :project => (@project != issue.project)) %>
                     </li>
                <% end -%>
            </ul>
        <% end  %>
      </div>
      <% end %><!--roadmap_list end-->
      <div class="roadmap_list">
        <p class="f14 mb5">&#187;<%= l(:label_versions_description)%></p>
        <p><%=h version.description %></p>
      </div><!--roadmap_list end-->
    </div><!--roadmap_box end-->
   <% end %>

    <ul class="wlist" >
      <%= pagination_links_full @versions_pages%>
    </ul>
    <div class="cl"></div>
  <% end %>
</div><!--roadmap end-->

<% html_title(l(:label_roadmap)) %>

<%= context_menu issues_context_menu_path %>
