Showing 4 changed files with 43 additions and 18 deletions
+2
devel/css_color.txt
... ...
@@ -1,2 +1,4 @@
1 1
 # CSS color
2 2
 link blue:#4183C4
3
+header background:#F3F3F3;
4
+
+16
lib/Gitprep/Git.pm
... ...
@@ -97,6 +97,22 @@ sub blob_contenttype {
97 97
   return $type;
98 98
 }
99 99
 
100
+sub blob_size_kb {
101
+  my ($self, $rep, $rev, $file) = @_;
102
+  
103
+  # Command "git diff-tree"
104
+  my @cmd = ($self->cmd($rep), 'cat-file', '-s', "$rev:$file");
105
+  open my $fh, "-|", @cmd
106
+    or croak 500, "Open cat-file failed";
107
+  my $size = $self->dec(scalar <$fh>);
108
+  chomp $size;
109
+  close $fh or croak 'Reading cat-file failed';
110
+  
111
+  my $size_kb = sprintf('%.3f', $size / 1024);
112
+  
113
+  return $size_kb;
114
+}
115
+
100 116
 sub check_head_link {
101 117
   my ($self, $dir) = @_;
102 118
   
-16
templates/layouts/new_common.html.ep
... ...
@@ -1,16 +0,0 @@
1
-<%
2
-  my $title = stash('title') || '';
3
-%>
4
-
5
-<!doctype html>
6
-<html>
7
-  <head>
8
-    <meta charset="UTF-8">
9
-    <title><%= $title ? "$title・Gitprep" : 'Gitprep' %></title>
10
-    <link rel="shortcut icon" href="<%= url_for('/git-favicon.png') %>" type="image/png" >
11
-    %= javascript '/js/jquery-1.8.3.min.js';
12
-  </head>
13
-  <body>
14
-    %= content;
15
-  </body>
16
-</html>
+25 -2
templates/main/blob.html.ep
... ...
@@ -34,6 +34,9 @@
34 34
   open my $fh, '-|', @cmd
35 35
     or $api->croak(qq/Couldn't cat "$file", "$bid"/);
36 36
   
37
+  # Blob size
38
+  my $blob_size = $git->blob_size_kb($rep, $id, $file);
39
+  
37 40
   # Blob plain
38 41
   my $commit;
39 42
   my $mimetype;
... ...
@@ -125,13 +128,28 @@
125 128
     
126 129
     /* Soruce */
127 130
     .source .sheader {
128
-      
131
+      margin-top:15px;
132
+      padding:10px;
133
+      padding-left:27px;
134
+      border:1px gray solid;
135
+      background-image:url(<%= url_for('/image/file_min.png') %>);
136
+      background-repeat:no-repeat;
137
+      background-position: 7px center;
138
+      background-color:#F3F3F3;
139
+      overflow:hidden;
140
+    }
141
+    .source .sleft_header {
142
+      float:left;
143
+    }
144
+    .source .sright_header {
145
+      float:right;
129 146
     }
130 147
     .source .sbody {
131 148
       padding: 10px;
132 149
       padding-left:0;
133 150
       font-family: monospace;
134 151
       border:1px gray solid;
152
+      border-top:none;
135 153
     }
136 154
     .source .sline {
137 155
       font-family: monospace;
... ...
@@ -180,7 +198,12 @@
180 198
 
181 199
     <div class="source">
182 200
       <div class="sheader">
183
-        file | 23 lines | 33.174kb Raw Blame History
201
+        <div class="sleft_header">
202
+          file <span style="color:gray">|</span> <%= @$lines %> lines <span style="color:gray">|</span> <%= $blob_size %>kb
203
+        </div>
204
+        <div class="sright_header">
205
+          Raw Blame History
206
+        </div>
184 207
       </div>
185 208
       <div class="sbody">
186 209
         % if ($mimetype =~ m#^image/#) {