{% extends "svnlit/base.html" %}

{% load timesince %}

{% block title %}{{ repository.label }}{{ node.path }}{% endblock %}

{% block content %}
<div class="svn-node">

<h1 class="node-path">{% include "svnlit/node_path.html" %}</h1>

{% block node_content %}{% endblock %}

{% if node.has_properties %}
<ul class="svn-properties">
{% for property in node.properties.all %}
<li>
  <span class="property-name">{{ property.key }}:</span>
  <span class="property-value">{{ property.value }}</span>
</li>
{% endfor %}
</ul>
{% endif %}

{% if node.is_file %}
<div class="node-download">
<a href="{{ node.content.get_absolute_url }}">download</a>
<span class="node-size">({{ node.size|filesizeformat }})</span>
</div>
{% endif %}

<div class="node-details">
  <p class="revision-panel">
    <a class="revision-number"
       href="{{ changeset.get_absolute_url }}">{{ changeset }}</a>
  </p>

  <form action="" method="post">
  <p class="revision-details">
    <span class="revision-form">
      <input name="revision" type="text" size="4" />
      <button type="submit">View revision</button>
    </span> |
    {% with node.get_last_changeset as last_changeset %}
    {% with last_changeset.get_previous as previous_changeset %}
    {% if node.is_file and previous_changeset %}
    <a href="{% url svnlit_node_diff repository_label,previous_changeset.revision,changeset.revision,path %}">
      diff</a> |
    {% endif %}
    {% endwith %}

    <a href="{% url svnlit_changeset_list repository_label %}">Revision list</a> |

    Last changed in
    <a href="{{ last_changeset.get_absolute_url }}">{{ last_changeset }}</a>
    by {{ last_changeset.author }}
    {{ last_changeset.date|timesince }}
    {% endwith %}
  </p>
  </form>

  {% if repository.uri %}
  <p class="checkout">
    <tt>
      svn
      {% if node.is_directory %}co{% else %}cat{% endif %}
      {% ifnotequal repository.get_latest_revision revision %}
      -r {{ revision }}
      {% endifnotequal %}
      {{ repository.uri }}{{ node.path }}
      {% if node.is_file %}&gt; {{ node.get_basename }}{% endif %}
    </tt>
  </p>
  {% endif %}
</div>

</div>
{% endblock %}
