From: Tomas Doran Date: Mon, 7 Dec 2009 23:29:54 +0000 (+0000) Subject: Merge remote branch 'broquaint/frontend-tweaks' X-Git-Tag: 0.000004~25 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=75813ed3840460d238df28a8709f2fd9c6ae18d7;hp=5c1db42462ff135456a7a382f5c589a596061f12;p=catagits%2FGitalist.git Merge remote branch 'broquaint/frontend-tweaks' * broquaint/frontend-tweaks: Starting to streamline and generally rejig the layout. Hacked in syntax highlighting to the blame view. Further tweaks to the blame view. Made the blame view a bit more informative. Dropped the dependence on File::Stat::ModeString which didn't work and wasn't --- diff --git a/Makefile.PL b/Makefile.PL index 5e110ca..b01ddd4 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -46,7 +46,6 @@ requires 'CGI'; requires 'DateTime'; requires 'DateTime::Format::Mail'; requires 'File::Copy::Recursive'; -requires 'File::Stat::ModeString'; requires 'File::Which'; requires 'HTML::Entities'; requires 'IPC::Run'; diff --git a/lib/Gitalist/Controller/Root.pm b/lib/Gitalist/Controller/Root.pm index 064ea6d..f67e4b5 100644 --- a/lib/Gitalist/Controller/Root.pm +++ b/lib/Gitalist/Controller/Root.pm @@ -161,12 +161,19 @@ sub blame : Local { || die "Couldn't discern the corresponding head."; my $filename = $c->req->param('f') || ''; + my $blame = $project->get_object($hb)->blame($filename); $c->stash( - blame => $project->get_object($hb)->blame($filename), + blame => $blame, head => $project->get_object($hb), filename => $filename, + + # XXX Hack hack hack, see View::SyntaxHighlight + language => ($filename =~ /\.p[lm]$/i ? 'Perl' : ''), + blob => join("\n", map $_->{line}, @$blame), ); - + + $c->forward('View::SyntaxHighlight') + unless $c->stash->{no_wrapper}; } sub _blob_objs { @@ -204,7 +211,7 @@ sub blob : Local { head => $head, filename => $filename, # XXX Hack hack hack, see View::SyntaxHighlight - language => ($filename =~ /\.p[lm]$/ ? 'Perl' : ''), + language => ($filename =~ /\.p[lm]$/i ? 'Perl' : ''), action => 'blob', ); diff --git a/lib/Gitalist/Git/Object.pm b/lib/Gitalist/Git/Object.pm index 544b473..6ae5aac 100644 --- a/lib/Gitalist/Git/Object.pm +++ b/lib/Gitalist/Git/Object.pm @@ -4,7 +4,6 @@ use Moose::Autobox; class Gitalist::Git::Object { use MooseX::Types::Moose qw/Str Int Bool Maybe ArrayRef/; use MooseX::Types::Common::String qw/NonEmptySimpleStr/; - use File::Stat::ModeString qw/mode_to_string/; # project and sha1 are required initargs has project => ( isa => 'Gitalist::Git::Project', @@ -64,13 +63,46 @@ class Gitalist::Git::Object { return $v; } + method _cat_file_with_flag ($flag) { + $self->_run_cmd('cat-file', '-' . $flag, $self->{sha1}) + } + method _build_modestr { - my $modestr = mode_to_string($self->mode); - return $modestr; + return _mode_str($self->mode); } - method _cat_file_with_flag ($flag) { - $self->_run_cmd('cat-file', '-' . $flag, $self->{sha1}) + # via gitweb.pm circa line 1305 + use Fcntl ':mode'; + use constant { + S_IFINVALID => 0030000, + S_IFGITLINK => 0160000, + }; + + # submodule/subproject, a commit object reference + sub S_ISGITLINK($) { + return (($_[0] & S_IFMT) == S_IFGITLINK) + } + + # convert file mode in octal to symbolic file mode string + sub _mode_str { + my $mode = shift; + + if (S_ISGITLINK($mode)) { + return 'm---------'; + } elsif (S_ISDIR($mode & S_IFMT)) { + return 'drwxr-xr-x'; + } elsif (S_ISLNK($mode)) { + return 'lrwxrwxrwx'; + } elsif (S_ISREG($mode)) { + # git cares only about the executable bit + if ($mode & S_IXUSR) { + return '-rwxr-xr-x'; + } else { + return '-rw-r--r--'; + } + } else { + return '----------'; + } } } # end class diff --git a/root/blame.tt2 b/root/blame.tt2 index edd4a46..04f55f9 100644 --- a/root/blame.tt2 +++ b/root/blame.tt2 @@ -1,8 +1,10 @@ [% PROCESS 'nav/actions.tt2' object = head %] + + +
+ [% IF object.type == 'commit' %] -
-[% head.comment.substr(0, 85) %] ... -
+
[% short_cmt(head.comment) %]
[% END %] [% INCLUDE 'nav/path.tt2' %] @@ -11,28 +13,47 @@ + + - - + + + + - - + + + [% blame_lines = blob.split("\n") %] [% FOR info IN blame %] - - - + [%- + linecolour = info.commit.sha1.substr(0,6); + IF info.commit.sha1 != lastsha1; + styleinfo = " style='border-top: solid 3px #" _ linecolour _ ";'"; -%] + + + + [%- ELSE -%] + + + + [%- END -%] + + + [% lastsha1 = info.commit.sha1 %] [% END %]
authordate sha1linedatadata
authordate sha1linedatadata
[% INCLUDE '_chroma_hash.tt2' sha1 = info.commit.sha1.substr(0,7) -%][% info.meta.lineno %]
[% info.line | html %]
[% info.commit.author %][% info.commit.author_dt.ymd %][% linecolour %][% info.meta.lineno %]
[% blame_lines.${loop.index} %]
+ + diff --git a/root/blob.tt2 b/root/blob.tt2 index 5f8299d..fc87985 100644 --- a/root/blob.tt2 +++ b/root/blob.tt2 @@ -1,12 +1,14 @@ - [% PROCESS 'nav/actions.tt2' object = head %] - [% IF object.type == 'commit' %] -
- [% short_cmt(head.comment) %] -
-[% END %] -[% INCLUDE 'nav/path.tt2' %] -
-
[% blob %]
+ +
+ [% IF object.type == 'commit' %] +
+ [% short_cmt(head.comment) %] +
+ [% END %] + [% INCLUDE 'nav/path.tt2' %] +
+
[% blob %]
+
diff --git a/root/blobdiff.tt2 b/root/blobdiff.tt2 index 93e0aaf..b771f74 100644 --- a/root/blobdiff.tt2 +++ b/root/blobdiff.tt2 @@ -1,7 +1,9 @@ [% PROCESS 'nav/actions.tt2' object = commit %] -
-[% short_cmt(commit.comment) | html %] ... -
+
+
+ [% short_cmt(commit.comment) | html %] ... +
-[% INCLUDE '_diff.tt2' %] + [% INCLUDE '_diff.tt2' %] +
diff --git a/root/commit.tt2 b/root/commit.tt2 index 2922e9e..408eedc 100644 --- a/root/commit.tt2 +++ b/root/commit.tt2 @@ -1,41 +1,43 @@ [% INCLUDE 'nav/actions.tt2' object = commit %] -
-[% - short_cmt(commit.comment) | html; - INCLUDE '_refs.tt2' object = commit; -%] -
- -
-
author
-
[% commit.author.name | html %] <[% commit.author.email %]>
- [% commit.authored_time %]
-
committer
-
[% commit.committer.name %] <[% commit.committer.email %]>
- [% commit.committed_time %]
-
commit
-
[% commit.sha1 %]
-
tree
-
[% commit.tree_sha1 %] - tree -
- [% FOREACH parent IN commit.parents %] -
parent
-
[% parent.sha1 %] - - commit - diff - -
- [% END %] -
+
+
+ [% + short_cmt(commit.comment) | html; + INCLUDE '_refs.tt2' object = commit; + %] +
+ +
+
author
+
[% commit.author.name | html %] <[% commit.author.email %]>
+ [% commit.authored_time %]
+
committer
+
[% commit.committer.name %] <[% commit.committer.email %]>
+ [% commit.committed_time %]
+
commit
+
[% commit.sha1 %]
+
tree
+
[% commit.tree_sha1 %] + tree +
+ [% FOREACH parent IN commit.parents %] +
parent
+
[% parent.sha1 %] + + commit + diff + +
+ [% END %] +
-
[% commit.comment | html%]
+
[% commit.comment | html%]
-[% - # In the case of merge commits there will be no diff tree. - IF diff_tree.size > 0; - INCLUDE '_diff_tree.tt2'; - END; -%] + [% + # In the case of merge commits there will be no diff tree. + IF diff_tree.size > 0; + INCLUDE '_diff_tree.tt2'; + END; + %] +
diff --git a/root/commitdiff.tt2 b/root/commitdiff.tt2 index 401b036..9db50ec 100644 --- a/root/commitdiff.tt2 +++ b/root/commitdiff.tt2 @@ -1,31 +1,33 @@ [% PROCESS 'nav/actions.tt2' object = commit %] -
-[% # XXX Wah, stuff like this doesn't work because end() isn't called as we forward to View::SyntaxHighlight -short_cmt(commit.comment) | html %] -
+
+
+ [% # XXX Wah, stuff like this doesn't work because end() isn't called as we forward to View::SyntaxHighlight + short_cmt(commit.comment) | html %] +
-
- [% commit.author.name | html %] [[% commit.authored_time %]] -
+
+ [% commit.author.name | html %] [[% commit.authored_time %]] +
-[% -# In the case of merge commits there will be no diff tree. -IF diff_tree.size > 0; - INCLUDE '_diff_tree.tt2'; -END; -IF diff.size > 0; - INCLUDE '_diff.tt2'; -ELSE -%] -
-[% - IF commit.parents > 1; - 'Trivial merge'; - ELSE; - 'No differences found'; + [% + # In the case of merge commits there will be no diff tree. + IF diff_tree.size > 0; + INCLUDE '_diff_tree.tt2'; END; -%] + IF diff.size > 0; + INCLUDE '_diff.tt2'; + ELSE + %] +
+ [% + IF commit.parents > 1; + 'Trivial merge'; + ELSE; + 'No differences found'; + END; + %] +
+ [% END %]
-[% END %] diff --git a/root/default.tt2 b/root/default.tt2 index 7ab9716..db90b2c 100644 --- a/root/default.tt2 +++ b/root/default.tt2 @@ -2,7 +2,6 @@ - @@ -29,6 +28,8 @@ +
+ [% site_header %] +
+ [%- END -%] diff --git a/root/heads.tt2 b/root/heads.tt2 index 5161cbd..1c5e263 100644 --- a/root/heads.tt2 +++ b/root/heads.tt2 @@ -1,7 +1,9 @@ [% INCLUDE 'nav/actions.tt2' object = commit %] -
-[% Project.name %] -
+
+
+ [% Project.name %] +
-[% INCLUDE '_heads.tt2' %] + [% INCLUDE '_heads.tt2' %] +
diff --git a/root/index.tt2 b/root/index.tt2 index 2cdd1ea..428e932 100644 --- a/root/index.tt2 +++ b/root/index.tt2 @@ -1,52 +1,45 @@ -[% IF home_text_contents %] -
- [% home_text_contents %] -
-[% END %] - -
-

Search: - -

-
+
+
+

Search: + +

+
- - - - - - - - - - - - - - - - - - - - - +
ProjectDescriptionOwnerLast Change
ProjectDescriptionOwnerLast Change
+ + + + + + + + + + + + + + + + + + + + - - [% - USE Cycle('dark', 'light'); - FOR p IN projects %] - - - - - - - - [% END %] - - -
ProjectDescriptionOwnerLast Change
ProjectDescriptionOwnerLast Change
[% p.name %][% abridged_description(p.description) %][% p.owner %][% time_since(p.last_change) %]
+ + [% FOR p IN projects %] + + [% p.name %] + [% abridged_description(p.description) %] + [% p.owner %] + [% time_since(p.last_change) %] + summary + | shortlog + | log + | tree + + [% END %] + + +
diff --git a/root/log.tt2 b/root/log.tt2 index cc0ff56..3e3908a 100644 --- a/root/log.tt2 +++ b/root/log.tt2 @@ -1,36 +1,35 @@ [% INCLUDE 'nav/actions.tt2' object = commit %] -[% INCLUDE '_log_pager.tt2' %] +
+ [% INCLUDE '_log_pager.tt2' %] -
-[%# XXX Nabbed the HTML below from gitweb's log action. %] -[% FOREACH line IN log_lines %] -
-
- [% message = line.comment | html; - message.replace("\n", "
") %] -
[% INCLUDE '_chroma_hash.tt2' sha1 = line.sha1 %]
+
+ [% FOREACH line IN log_lines %] +
+
+ [% message = line.comment | html; + message.replace("\n", "
") %] +
[% INCLUDE '_chroma_hash.tt2' sha1 = line.sha1 %]
+
+
+ + + + [% IF line.author.name != line.committer.name %] + + + [% END %] +
author[% line.author.name | html %]
authored time[% line.authored_time %]
committer[% line.committer.name | html %]
committered time[% line.committed_time %]
+ [% time_since(line.authored_time) %] +
+ commit + | commitdiff + | tree +
+
-
- - - - [% IF line.author.name != line.committer.name %] - - - [% END %] -
author[% line.author.name | html %]
authored time[% line.authored_time %]
committer[% line.committer.name | html %]
committered time[% line.committed_time %]
- [% time_since(line.authored_time) %] -
- commit - | commitdiff - | tree -
-
- + [% END %]
-[% END %] -
- -[% INCLUDE '_log_pager.tt2' %] + [% INCLUDE '_log_pager.tt2' %] +
diff --git a/root/nav/actions.tt2 b/root/nav/actions.tt2 index dd51adf..52ca63e 100644 --- a/root/nav/actions.tt2 +++ b/root/nav/actions.tt2 @@ -1,4 +1,5 @@
+ summaryshortloglog • diff --git a/root/search.tt2 b/root/search.tt2 index 1355fa6..2504b82 100644 --- a/root/search.tt2 +++ b/root/search.tt2 @@ -1,34 +1,35 @@ [% INCLUDE 'nav/actions.tt2' object = commit %] +
+ [%# INCLUDE '_log_pager.tt2' %] -[%# INCLUDE '_log_pager.tt2' %] + [%# XXX Nabbed the HTML below from gitweb's log action. %] + [% FOREACH result IN results %] + -[%# XXX Nabbed the HTML below from gitweb's log action. %] -[% FOREACH result IN results %] - +
+ + [% result.author.name | html %] [% line.authored_time %] +
-
- - [% result.author.name | html %] [% line.authored_time %] -
+
+ [% + # XXX This is fragile at best. + html_comment = result.comment | html; + html_comment.replace( + c.req.param('text'), '' _ c.req.param('text') _ '' + ); + %] +
+ [% END %] -
- [% - # XXX This is fragile at best. - html_comment = result.comment | html; - html_comment.replace( - c.req.param('text'), '' _ c.req.param('text') _ '' - ); - %] + [%# INCLUDE '_log_pager.tt2' %]
-[% END %] - -[%# INCLUDE '_log_pager.tt2' %] diff --git a/root/shortlog.tt2 b/root/shortlog.tt2 index b98bb7f..6f9636e 100644 --- a/root/shortlog.tt2 +++ b/root/shortlog.tt2 @@ -1,7 +1,9 @@ [% INCLUDE 'nav/actions.tt2' object = commit %] +
[% INCLUDE '_log_pager.tt2'; INCLUDE '_shortlog.tt2'; INCLUDE '_log_pager.tt2'; %] +
diff --git a/root/static/css/site.css b/root/static/css/site.css index 8fb3d80..a968bc5 100644 --- a/root/static/css/site.css +++ b/root/static/css/site.css @@ -1,5 +1,21 @@ +#the-container { + margin: 1em 100px; + text-align: center; + background-color: white; +} +#body { + text-align: justify; +} +div.content { + padding: 0 7px; +} + +/* +14d2f2ca3732551d1585e7590e60b82492f3 +^^ A rather nice chroma hash +*/ body { - margin: 1em; + background-color: #555; } thead, tfoot { @@ -22,7 +38,7 @@ tfoot td { background-color: #fefeaa; } -span.chroma-hash { +.chroma-hash { font-family: monospace; font-size: 1em; font-style: normal; @@ -59,7 +75,8 @@ div.chroma-hash { padding: 8px; font-size: 1.5em; font-weight: bold; - background-color: #d9d8d1; + border-bottom: solid 1px #777; + text-align: justify; } img.logo { @@ -82,10 +99,9 @@ img.logo { .actions { padding-bottom: 4px 0; font-style: italic; - border-top: solid 1px #777; border-bottom: solid 1px #777; margin-bottom: 10px; - padding: 5px 0; + padding: 5px 7px; } /* pager include */ @@ -154,12 +170,26 @@ table.heads { #blame a { text-decoration: none; } +#blame { + overflow-x: scroll; +} #blame tr.alt { background-color: #f7f7f7; } #blame tbody tr:hover { background-color: #fefeaa; } +#blame td { + padding: 0 0.2em; +} +#blame td.lineno { + background-color: #eee; +} +#blame td.date, #blame td.author, #blame td.commit-info { +} +#blame .data { + padding-left: 5px; +} /* /blob */ pre.blob { diff --git a/root/summary.tt2 b/root/summary.tt2 index ce0f77a..06efaa9 100644 --- a/root/summary.tt2 +++ b/root/summary.tt2 @@ -1,6 +1,6 @@ [% PROCESS 'nav/actions.tt2' object = commit %] -
+