<ul>
  <% if @version %>
    <li><%= context_menu_link l(:button_edit), edit_version_path(@version, :back_url => params[:back_url]),
        :class => 'icon icon-edit', :disabled => !@can[:edit] %></li>
  <% else %>
    <li><%= content_tag :li, context_menu_link(l(:button_edit), {:controller => 'versions', :action => 'bulk_edit', :project_id => @project, :ids => params[:ids], :back_url => params[:back_url]},
        :class => 'icon icon-edit',
        :method => :post,
        :disabled => !@can[:edit]) -%></li>
  <% end %>


  <li class="folder">
    <%= link_to_function(l(:field_status), 'return false;', :class => 'submenu') %>
    <ul>
      <% Version::VERSION_STATUSES.each do |s| %>
        <li>
          <%= context_menu_link( l("version_status_#{s}"), {:controller => 'versions', :action => 'bulk_update', :project_id => @project, :version => {:status => s}, :ids => params[:ids], :back_url => params[:back_url]},
            :method => :put,
            :selected => (@versions.count == 1 && s == @versions.first.status),
            :disabled => !@can[:edit])%>
        </li>
      <% end %>
    </ul>
  </li>
  <% if EasyVersionCategory.active.any? %>
    <li class="folder">
      <%= link_to_function(l(:field_easy_version_category), 'return false;', :class => 'submenu') -%>
      <ul>
        <% EasyVersionCategory.active.each do |category| %>
          <li>
            <%= context_menu_link(category.name, {:controller => 'versions', :action => 'bulk_update', :project_id => @project, :ids => params[:ids] , :version => {:easy_version_category_id => category.id}, :back_url => params[:back_url] },
              :method => :put,
              :selected =>  (@versions.count == 1 && category.id == @versions.first.easy_version_category_id),
              :disabled => !@can[:edit]) -%>
          </li>
        <% end %>
      </ul>
    </li>
  <% end %>
  <%= content_tag :li, context_menu_link(l(:button_delete), {:controller => 'versions', :action => 'bulk_destroy', :project_id => @project, :ids => params[:ids], :back_url => params[:back_url]},
    :class => 'icon icon-del',
    :method => :delete,
    :data => {:confirm => l(:text_are_you_sure)},
    :disabled => !@can[:destroy]) %>
</ul>

