Starting to hook up "orphaned" actions.
Dan Brook [Fri, 20 Nov 2009 17:17:03 +0000 (17:17 +0000)]
Tweak /blame layout.

gitalist.conf
lib/Gitalist/Controller/Root.pm
root/_chroma_hash.tt2
root/blame.tt2
root/nav/actions.tt2
root/static/css/site.css

index 670b178..7a68c35 100644 (file)
@@ -7,28 +7,6 @@ name Gitalist
 
 sitename "Gitalist presently"
 
-# URI and label (title) of GIT logo link
-logo_url   http://git-scm.org
-logo_label "git homepage"
-logo_img   /git-logo.png
-
-home_link /
-home_link_str "A Gitalist"
-
-# show repository only if this file exists
-# (only effective if this variable evaluates to true)
-# export_ok 
-
-# XXX Code in config FAIL
-# show repository only if this subroutine returns true
-# when given the path to the project, for example:
-#    sub { return -e "$_[0]/git-daemon-export-ok"; }
-# export_auth_hook
-
-# stylesheet path/to/your/stylesheet.css
-logo /git-logo.png
-favicon /git-favicon.png
-
 # $feature{'blame'}{'default'} = [1];
 <feature>
   <blame>
index db32705..8d36844 100644 (file)
@@ -223,6 +223,7 @@ sub blobdiff : Local {
   $c->stash(
     commit    => $commit,
     diff      => $patch,
+    filename  => $filename,
     # XXX Hack hack hack, see View::SyntaxHighlight
     blobs     => [$patch->[0]->{diff}],
     language  => 'Diff',
@@ -296,12 +297,15 @@ Expose an abbreviated log of a given sha1.
 
 sub shortlog : Local {
   my ( $self, $c ) = @_;
-  my $project = $c->stash->{Project};
-  my $commit  = $self->_get_object($c);
+
+  my $project  = $c->stash->{Project};
+  my $commit   = $self->_get_object($c);
+  my $filename = $c->req->param('f') || '';
+
   my %logargs = (
       sha1   => $commit->sha1,
       count  => Gitalist->config->{paging}{log} || 25,
-      ($c->req->param('f') ? (file => $c->req->param('f')) : ())
+      ($filename ? (file => $filename) : ())
   );
 
   my $page = $c->req->param('pg') || 0;
@@ -312,8 +316,9 @@ sub shortlog : Local {
       commit    => $commit,
       log_lines => [$project->list_revs(%logargs)],
       refs      => $project->references,
-      action    => 'shortlog',
       page      => $page,
+      filename  => $filename,
+      action    => 'shortlog',
   );
 }
 
index aa10f7a..d7a0bb7 100644 (file)
@@ -1,11 +1,9 @@
-[% sha1 = sha1 || HEAD %]
-<span class='chroma-hash'>
-  [%
+[%- sha1 = sha1 || HEAD -%]
+<span class='chroma-hash'>[%-
     hptr = 0;
     WHILE hptr < sha1.length - 6;
       sha1part = sha1.substr(hptr, 6);
       "<span style='border-bottom: solid 4px #" _ sha1part _ ";'>" _ sha1part _ "</span>";
       hptr = hptr + 6;
     END;
-  %]
-</span>
+-%]</span>
index 1185953..23c7769 100644 (file)
@@ -7,14 +7,32 @@
 
 <h3>BLOB PATH</h3>
 
-<div class='blame'>
+<div id='blame'>
 <table>
-[% FOR info IN blame %]
-<tr>
-  <td><a title="[% info.commit.author %] on [% info.commit.author_dt %]" href='[% c.uri_for('commit', {h=info.commit.sha1}) %]'>[% info.commit.sha1.substr(0,6) %]</a></td>
-  <td>[% info.meta.lineno %]</td>
-  <td><pre class='blame-line'>[% info.line | html %]</pre></td>
-</tr>
-[% END %]
+ <thead>
+  <tr>
+   <th>sha1</th>
+   <th>line</th>
+   <th>data</th>
+  </tr>
+ </thead>
+
+ <tfoot>
+  <tr>
+   <td>sha1</td>
+   <td>line</td>
+   <td>data</td>
+  </tr>
+ </tfoot>
+
+ <tbody>
+ [% FOR info IN blame %]
+ <tr class=''>
+   <td class='commit-info'><a title="[% info.commit.author %] on [% info.commit.author_dt %]" href='[% c.uri_for('commit', {h=info.commit.sha1}) %]'>[% INCLUDE '_chroma_hash.tt2' sha1 = info.commit.sha1.substr(0,7) -%]</a></td>
+   <td class='lineno'><tt>[% info.meta.lineno %]</tt></td>
+   <td><pre>[% info.line | html %]</pre></td>
+ </tr>
+ [% END %]
+ </tbody>
 </table>
 </div>
index 4e647b2..0fe60b2 100644 (file)
@@ -7,5 +7,12 @@
     [% IF object.type == 'commit' %] •
     <a href="[% c.uri_for('tree', {h=object.tree_sha1, hb=object.sha1}) %]">tree</a>
     [% END %]
+    [% IF filename %]
+    §
+    <a href="[% c.uri_for('blob', {h=object.sha1,f=filename}) %]">blob</a> •
+    <a href="[% c.uri_for('blame', {h=object.sha1,f=filename}) %]">blame</a> •
+    <a href="[% c.uri_for('shortlog', {h=object.sha1,f=filename}) %]">history</a> •
+    <a href="[% c.uri_for(action, {f=filename}) %]">HEAD</a>
+    [% END %]
     <div class='chroma-hash'>[% INCLUDE '_chroma_hash.tt2' sha1 = object.sha1 %]</div>
 </div>
index 67c45fc..8fb3d80 100644 (file)
@@ -141,8 +141,24 @@ table.heads {
 }
 
 /* /blame */
-pre.blame-line {
+#blame pre, #blame tt {
   margin: 0;
+  font-size: 0.9em;
+}
+#blame .commit-info {
+}
+#blame .lineno {
+  text-align: right;
+  padding: 0 8px;
+}
+#blame a {
+  text-decoration: none;
+}
+#blame tr.alt {
+  background-color: #f7f7f7;
+}
+#blame tbody tr:hover {
+  background-color: #fefeaa;
 }
 
 /* /blob */