Converting inline diff bits to be CSS classes
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 10 Sep 2005 17:47:13 +0000 (17:47 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 10 Sep 2005 17:47:13 +0000 (17:47 +0000)
diff.php
templates/default/diff.tpl
templates/default/diff_line.tpl

index 5df40cdaf9c32900f2916f8ceeedc8ecb4ee93ae..0888cc27288a4f922d05f9c7bf577d7568c8734b 100644 (file)
--- a/diff.php
+++ b/diff.php
@@ -68,15 +68,15 @@ foreach ($diff->fetch() AS $filename => $file)
                        {
                                if ($line['act'] == '+')
                                {
-                                       $color = '#DDFFDD';
+                                       $class = 'diff_add_bit';
                                }
                                else if ($line['act'] == '-')
                                {
-                                       $color = '#FFDDDD';
+                                       $class = 'diff_del_bit';
                                }
                                else
                                {
-                                       $color = 'white';
+                                       $class = 'diff_norm';
                                }
                                
                                $line['line_clean'] = $viewsvn->svn->format($line['line']);
index b631ab45a875d74850199e081f9f6ed16f532f3d..a51276d3ad689e08df84d7368cbdbc5cf0d44a11 100644 (file)
@@ -22,6 +22,21 @@ $navbar
                font: normal 11px monospace;
        }
        
+       .diff_add_bit
+       {
+               background-color: #DDFFDD;
+       }
+       
+       .diff_del_bit
+       {
+               background-color: #FFDDDD;
+       }
+       
+       .diff_norm
+       {
+               background-color: white;
+       }
+       
 //-->
 </style>
 
index 523d79635fd4b67ba11008c6351131af442c64b6..3aef0c8720131b77431cf7c8f55059ede8e25520 100644 (file)
@@ -8,6 +8,6 @@
        <tr style="background-color: #EEEEDD; border-width: 0px 1px 1px 0px">
                <td>$line[oldlineno]</td>
                <td>$line[newlineno]</td>
-               <td style="background-color: $color">$line[line_clean]</td>
+               <td class="$class">$line[line_clean]</td>
        </tr>
 </if>
\ No newline at end of file