<% # API my $api = gitprep_api; # Git my $git = $self->app->git; # Parameters my $user = param('user'); my $project = param('project'); my $rev_file = param('rev_file'); my ($rev, $file) = $git->parse_rev_path(app->rep_info($user, $project), $rev_file); # Commit my $commit = $git->last_change_commit(app->rep_info($user, $project), $rev, $file); # Authors my $authors = $git->authors(app->rep_info($user, $project), $rev, $file); # File size my $file_size = $git->blob_size(app->rep_info($user, $project), $rev, $file); # File mode my $mode = $git->blob_mode(app->rep_info($user, $project), $rev, $file); my $file_type = $git->file_type_long($mode); # MIME type my $mime_type = $git->blob_mime_type(app->rep_info($user, $project), $rev, $file); # Blame my $blame = $git->blame(app->rep_info($user, $project), $rev, $file); my $blame_lines = $blame->{lines}; my $blame_min_author_time = $blame->{min_author_time}; my $blame_max_author_time = $blame->{max_author_time}; # Color my $colors = [ '#ffeca7', '#ffdd8c', '#ffdd7c', '#fba447', '#f68736', '#f37636', '#ca6632', '#c0513f', '#a2503a', '#793738' ]; # Variables for included template stash(id => $rev, project => $project, rev => $rev); %> % layout 'common' , title => "$user/$project at $rev"; %= include '/include/header';
%= include '/include/page_path', Path => $file;
Newer % for my $color (@$colors) { % } Older
<%= @$blame_lines %> lines | <%= $file_size %>kb
% for my $line (@$blame_lines) { <% my $blame_commit = $line->{commit}; my $summary = $line->{summary}; my $summary_short= length $summary > 28 ? substr($summary, 0, 28) . '...' : $summary; my $time_rate = $blame_max_author_time == $blame_min_author_time ? 1 : ($blame_max_author_time - $line->{author_time}) / ($blame_max_author_time - $blame_min_author_time); my $color_number = int($time_rate * 10); $color_number = 9 if $color_number == 10; my $hot_color = $colors->[$color_number]; %> % if ($line->{before_same_commit}) { % } else { % } % }
<%= $line->{author} %> authored on <%= $line->{author_age_string_date_local} %>
<%= $line->{number} %>
<%= $line->{content} %>
%= include '/include/footer';