added compare diffs feature and fixed a couple of css issues
Foxtons Web Design [Thu, 8 Apr 2010 14:18:03 +0000 (15:18 +0100)]
root/fragment/ref/history.tt2
root/fragment/repository/shortlog.tt2
root/static/css/core.css
root/static/i/bg_top.png
root/static/i/icons/Thumbs.db
root/static/js/common.js [new file with mode: 0755]
root/wrapper.tt2

index 92b22b1..0e5ee10 100755 (executable)
@@ -1,6 +1,8 @@
 [% BLOCK history_table_headfoot %]
 [% SET cell = type == 'head' ? 'th' : 'td' %]
+[%# FIXME: should  c.req.arguments.0 be path instead? %]
 <tr>
+<[% cell %] colspan="2"><a href="#" onclick="compareDiffs('[% Repository.name %]','[% c.req.arguments.0 %]');return false;">Compare</a></[% cell %]>
  <[% cell %]>sha1</[% cell %]>
  <[% cell %]>time</[% cell %]>
  <[% cell %]>message</[% cell %]>
  <[% cell %]>actions</[% cell %]>
 </tr>
 [% END %]
+<form name="theform">
  <table class='listing'>
    <thead>[% PROCESS history_table_headfoot type = 'head' %]</thead
 
    <tbody>
    [% FOREACH line IN log_lines %]
  <tr [% "class='invert'" IF loop.count % 2 %]>
+       <td><input type="radio" name="sha1_a" value="[% line.sha1 %]" [% "checked" IF loop.count == 2 %] /></td>
+       <td><input type="radio" name="sha1_b" value="[% line.sha1 %]" [% "checked" IF loop.count == 1 %]/></td>
      <td class='sha1' title='[% line.sha1 %]'>[% INCLUDE 'inc/chroma_hash.tt2' sha1 = line.sha1.substr(0, 7) %]</td>
      <td class='time-since' title='[% line.authored_time %]'>[% time_since(line.authored_time) %]</td>
     
      </td>
     </tr>
    [% END %]
+  <tr>
+       <td colspan="2"><a href="#" onclick="compareDiffs('[% Repository.name %]');return false;">Compare</a></td>
+       <td colspan="5"></td>
+</tr>
    </tbody>
   </table>
+</form>
 [%
   INCLUDE 'inc/log_pager.tt2';
 %]
index 68167b8..bd9f16d 100755 (executable)
@@ -1,6 +1,7 @@
 [% BLOCK shortlog_table_headfoot %]
 [% SET cell = type == 'head' ? 'th' : 'td' %]
 <tr>
+       <[% cell %] colspan="2"><a href="#" onclick="compareDiffs('[% Repository.name %]');return false;">Compare</a></[% cell %]>
        <[% cell %]>ID (sha1)</[% cell %]>
        <[% cell %]>Last change</[% cell %]>
        <[% cell %]>Message</[% cell %]>
 </tr>
 [% END %]
 
+<form name="theform">
 <table class='listing'>
 <thead>[% PROCESS shortlog_table_headfoot type = 'head' %]</thead>
 <tbody>
  [% FOREACH line IN log_lines %]
  <tr [% "class='invert'" IF loop.count % 2 %]>
+       <td><input type="radio" name="sha1_a" value="[% line.sha1 %]" [% "checked" IF loop.count == 2 %] /></td>
+       <td><input type="radio" name="sha1_b" value="[% line.sha1 %]" [% "checked" IF loop.count == 1 %]/></td>
        <td class='sha1' title='[% line.sha1 %]'>[% INCLUDE 'inc/chroma_hash.tt2' sha1 = line.sha1.substr(0, 7) %]</td>
        <td class='time-since' title='[% line.authored_time %]'>[% time_since(line.authored_time) %]</td>
        <td>
        </td>
 </tr>
 [% END %]
+<tr>
+       <td colspan="2"><a href="#" onclick="compareDiffs('[% Repository.name %]');return false;">Compare</a></td>
+       <td colspan="5"></td>
+</tr>
 </tbody>
 </table>
+</form>
 
 [% INCLUDE 'inc/log_pager.tt2' %]
index 698445d..37e4762 100755 (executable)
@@ -1,6 +1,6 @@
 #debug_holder{
        
-       display:none;
+       adisplay:none;
        
        clear:both;
        padding-top:30px;
@@ -79,7 +79,7 @@ a img{
 
 /* nav tabs */
 #nav_logs{
-       width:80%;
+       width:100%;
        clear:both;
        float:right;
        margin:-5px 10px 0 0;
@@ -303,6 +303,9 @@ th{
 th a{
        color:#fff;
 }
+th a:hover{
+       color:#f0f0f0;
+}
 .summary tr{
        background-color:#FAFAFA;
        border-bottom:1px solid #fff;
@@ -310,6 +313,12 @@ th a{
 .summary td{
        vertical-align:middle !important;
 }
+tr{
+       background-color:#fff;
+}
+thead tr{
+       background-color:transparent !important;
+}
 tr.invert{
        background-color:#f0f0f0;
 }
@@ -369,6 +378,7 @@ table.listing{
        padding:10px;
        border:1px solid #ddd;
        background-color:#f0f0f0;
+       min-height:40px;
 }
 .diff-head{
        background-color:#666;
index 39b765f..65601c4 100755 (executable)
Binary files a/root/static/i/bg_top.png and b/root/static/i/bg_top.png differ
index bdf3302..cb41d4c 100644 (file)
Binary files a/root/static/i/icons/Thumbs.db and b/root/static/i/icons/Thumbs.db differ
diff --git a/root/static/js/common.js b/root/static/js/common.js
new file mode 100755 (executable)
index 0000000..921c4f4
--- /dev/null
@@ -0,0 +1,24 @@
+function compareDiffs(repo, path){
+       var f = document.theform;
+       if(!repo){
+               var repo = "";
+       }
+       if(!path){
+               var path = "";
+       }
+       var sha1,sha2;
+       for(var i=0,len=f.length;i<len;i++){
+               if(f[i].name == "sha1_a"){
+                       if(f[i].checked){
+                               sha1 = f[i].value;
+                       }
+               }
+               if(f[i].name == "sha1_b"){
+                       if(f[i].checked){
+                               sha2 = f[i].value;
+                       }
+               }
+       }
+       //document.location.href = [% c.uri_for("/" + repo + "/"+ sha1 + "/diff/" + sha2 + "/" + path) %];
+       document.location.href = "/" + repo + "/"+ sha1 + "/diff/" + sha2 + "/" + path;
+}
index e42e8d9..27abff8 100755 (executable)
    
        <link rel="stylesheet" type="text/css" href="[% c.uri_for('/core.css') %]" />
        <link rel="shortcut icon" href="[% c.uri_for('/static/git-favicon.png') %]" type="image/png" />
+       <script type="text/javascript">
+       // FIXME: this should be in an external js file once c.uri_for works in js files
+       function compareDiffs(repo, path){
+               var f = document.theform;
+               if(!repo){
+                       var repo = "";
+               }
+               if(!path){
+                       var path = "";
+               }
+               var sha1,sha2;
+               for(var i=0,len=f.length;i<len;i++){
+                       if(f[i].name == "sha1_a"){
+                               if(f[i].checked){
+                                       sha1 = f[i].value;
+                               }
+                       }
+                       if(f[i].name == "sha1_b"){
+                               if(f[i].checked){
+                                       sha2 = f[i].value;
+                               }
+                       }
+               }
+               document.location.href = "[% c.uri_for("/") %]" + repo + "/"+ sha1 + "/diff/" + sha2 + "/" + path;
+       }
+       </script>
 </head>
 
 <body>
        [% USE Dumper %]
        <pre>
        [% Repository.path %]
-       [%# Dumper.dump(c.req.path) %]
+       [%# Dumper.dump(c.req.arguments.0) %]
        </pre>
        
        </div>