Permalink
Browse files

Gitweb compat: repository summary

- Show the summary data again, but nicely formatted
- Repository owner and clone url can be set in the gitweb section of .git/config
- Add the url to the model and template
  • Loading branch information...
1 parent 4837a63 commit 58961087b36a0b9426944a0fd3d4ffc23237a373 @seveas committed Jul 28, 2012
Showing with 26 additions and 15 deletions.
  1. +14 −0 lib/Gitalist/Git/Repository.pm
  2. +6 −5 root/fragment/repository/summary.tt2
  3. +1 −3 root/repository/summary.tt2
  4. +5 −7 root/static/css/core.css
@@ -58,6 +58,11 @@ class Gitalist::Git::Repository with (Gitalist::Git::HasUtils, Gitalist::Git::Se
lazy_build => 1,
);
+ has url => ( isa => Str,
+ is => 'ro',
+ lazy_build => 1
+ );
+
has last_change => ( isa => Maybe[DateTime],
is => 'ro',
lazy_build => 1,
@@ -228,11 +233,20 @@ class Gitalist::Git::Repository with (Gitalist::Git::HasUtils, Gitalist::Git::Se
method _build_owner {
return 'system' if $^O =~ 'MSWin32';
+ my $owner = $self->run_cmd("config", "--get", "gitweb.owner");
+ chomp($owner);
+ return $owner if $owner;
my ($gecos, $name) = map { decode(langinfo(CODESET()), $_) } (getpwuid $self->path->stat->uid)[6,0];
$gecos =~ s/,+$//;
return length($gecos) ? $gecos : $name;
}
+ method _build_url {
+ my $url = $self->run_cmd("config", "--get", "gitweb.url");
+ chomp($url);
+ return $url;
+ }
+
method _build_last_change {
my $last_change;
my $output = $self->run_cmd(
@@ -1,5 +1,6 @@
-<dl>
- <dt>description</dt><dd>[% Repository.description %]</dd>
- <dt>owner</dt><dd>[% Repository.owner %]</dd>
- <dt>last change</dt><dd>[% time_since(Repository.last_change) %]</dd>
-</dl>
+<h2>[% Repository.description %]</h2>
+<table class="summary">
+ <tr><th>Owner</th><td>[% Repository.owner %]</td></tr>
+ <tr><th>Last change</th><td>[% time_since(Repository.last_change) %]</td></tr>
+ <tr><th>Clone url</th><td>[% Repository.url %]</td></tr>
+</table>
@@ -1,8 +1,6 @@
+ [% subinclude('/fragment/repository/summary', c.req.captures) %]
- <!-- [% subinclude('/fragment/repository/summary', c.req.captures) %]
-
- <h2><a href='[% c.uri_for(c.controller.action_for('shortlog'), c.req.captures) %]'>shortlog</a></h2> -->
[% subinclude('/fragment/repository/shortlog', c.req.captures) %]
<h2><a href='[% c.uri_for(c.controller.action_for('heads'), c.req.captures) %]'>Branches</a></h2>
@@ -373,13 +373,6 @@ th a{
th a:hover{
color:#f0f0f0;
}
-.summary tr{
- background-color:#FAFAFA;
- border-bottom:1px solid #fff;
-}
-.summary td{
- vertical-align:middle !important;
-}
tr{
background-color:#fff;
}
@@ -426,6 +419,11 @@ table.listing thead {
padding-right: 10px;
}
+.summary th {
+ color: #666;
+ font-weight: bold;
+}
+
/*
puts the repo description on one line which gets truncated if the repo name is too long

0 comments on commit 5896108

Please sign in to comment.