Skip to content

Commit

Permalink
Add age to commit info.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Brook committed Aug 1, 2010
1 parent 3818dce commit e404e9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lib/Gitalist/Controller/Fragment/Ref.pm
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 128,13 @@ after file_commit_info => sub {
file => $c->stash->{filename},
);

my $json_obj = $commit
? { sha1 => $commit->sha1, comment => $c->stash->{short_cmt}->($commit->comment) }
: { };
my $json_obj = !$commit
? { }
: {
sha1 => $commit->sha1,
comment => $c->stash->{short_cmt}->($commit->comment),
age => $c->stash->{time_since}->($commit->authored_time),
};

$c->response->content_type('application/json');
# XXX Make use of the json branch
Expand Down
2 changes: 1 addition & 1 deletion root/fragment/ref/tree.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 7,7 @@ $(window).load(function() {
var filename = cell.parent().find('.file-name').text();
$.getJSON('/fragment/Gitalist/[% Commit.sha1 %]/file_commit_info/' filename, {}, function(commitInfo) {
cell.empty();
cell.html('<a href="/Gitalist/' commitInfo.sha1 '/commit">' commitInfo.comment '</a>');
cell.html('<a href="/Gitalist/' commitInfo.sha1 '/commit">' commitInfo.comment '</a> ' commitInfo.age);
});
});
});
Expand Down

0 comments on commit e404e9a

Please sign in to comment.