Fix the path in the /blob & /blame header.
Dan Brook [Sat, 21 Nov 2009 01:00:47 +0000 (01:00 +0000)]
Whilst simultaneously exposing a /tree & /blame based nav bug (e.g they don't
resolve h vs. hb correctly which /blob should now do).

root/blame.tt2
root/blob.tt2
root/nav/path.tt2 [new file with mode: 0644]

index 23c7769..edd4a46 100644 (file)
@@ -5,7 +5,7 @@
 </div>
 [% END %]
 
-<h3>BLOB PATH</h3>
+[% INCLUDE 'nav/path.tt2' %]
 
 <div id='blame'>
 <table>
index 3a49fed..5f8299d 100644 (file)
@@ -1,18 +1,12 @@
 <link rel="stylesheet" type="text/css" href="/static/css/syntax/[% language %].css"/>
 
 [% PROCESS 'nav/actions.tt2' object = head %]
-[% IF object.type == 'commit' %]
-<div class='commit-message'>
-[% head.comment.substr(0, 85) %] ...
-</div>
+ [% IF object.type == 'commit' %]
+ <div class='commit-message'>
+  [% short_cmt(head.comment) %]
+ </div>
 [% END %]
-<div class='path'>
- <a href="[% c.uri_for("tree", {hb=head.sha1}) %]">[% Project.name %]</a>
- [% # XXX The last part should link to blob_plain (or something) but doesn't ATM
-    FOREACH part IN filename.split('/') %]
- / <a href="[% c.uri_for("tree", {hb=head.sha1}) %]">[% part %]</a>
- [% END %]
-</div>
+[% INCLUDE 'nav/path.tt2' %]
 <div>
  <pre class='blob'>[% blob %]</pre>
 </div>
diff --git a/root/nav/path.tt2 b/root/nav/path.tt2
new file mode 100644 (file)
index 0000000..c6df728
--- /dev/null
@@ -0,0 +1,7 @@
+<div class='path'>
+ <a href="[% c.uri_for("tree", {hb=head.sha1}) %]">[% Project.name %]</a>
+ [% FOREACH part IN filename.split('/') %]
+  [% path = loop.first ? part : path _ '/' _ part %]
+  / <a href="[% c.uri_for(loop.last ? 'blob' : 'tree', {hb=head.sha1,f=path}) %]">[% part %]</a>
+ [% END %]
+</div>