<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>

<div class="contextual">
  <%= render :partial => 'navigation' %>
</div>

<h2><%= render :partial => 'breadcrumbs',
               :locals => { :path => @path, :kind => 'dir', :revision => @rev } %></h2>

<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
  <%= render :partial => 'dir_list' %>
<% end %>

<%= render_properties(@properties) %>

<% if authorize_for('repositories', 'revisions') %>
  <% if @changesets && !@changesets.empty? %>
    <h3><%= l(:label_latest_revision_plural) %></h3>
    <%= render :partial => 'revisions',
              :locals => {:project => @project, :path => @path,
                          :revisions => @changesets, :entry => nil }%>
  <% end %>
  <p>
  <% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0)
     sep = '' %>
  <% if @repository.supports_all_revisions? && @path.blank? %>
    <%= link_to l(:label_view_all_revisions), :action => 'revisions', :id => @project,
                :repository_id => @repository.identifier_param %>
    <% sep = '|' %>
  <% end %>
  <% if @repository.supports_directory_revisions? &&
         ( has_branches || !@path.blank? || !@rev.blank? ) %>
    <%= sep %>
    <%= link_to l(:label_view_revisions),
                   :action => 'changes',
                   :path   => to_path_param(@path),
                   :id     => @project,
                   :repository_id => @repository.identifier_param,
                   :rev    => @rev %>
  <% end %>
  </p>
  <% if @repository.supports_all_revisions? %>
    <% content_for :header_tags do %>
      <%= auto_discovery_link_tag(
                   :atom,
                   :action => 'revisions', :id => @project,
                   :repository_id => @repository.identifier_param,
                   :key => User.current.rss_key) %>
   <% end %>

   <% other_formats_links do |f| %>
    <%= f.link_to 'Atom',
                  :url => {:action => 'revisions', :id => @project,
                           :repository_id => @repository.identifier_param,
                           :key => User.current.rss_key} %>
    <% end %>
  <% end %>
<% end %>

<% if @repositories.size > 1 %>
  <% content_for :sidebar do %>
    <h3><%= l(:label_repository_plural) %></h3>
    <p>
      <%= @repositories.sort.collect {|repo|
          link_to repo.name, 
                  {:controller => 'repositories', :action => 'show',
                   :id => @project, :repository_id => repo.identifier_param, :rev => nil, :path => nil},
                  :class => 'repository' + (repo == @repository ? ' selected' : '')
        }.join('<br />').html_safe %>
    </p>
  <% end %>
<% end %>

<% content_for :header_tags do %>
  <%= stylesheet_link_tag "scm" %>
<% end %>

<% html_title(l(:label_repository)) -%>
