First try at CSS-layout diffs instead of table. Some nice gradient touches; a few...
authorChuck Hagenbuch <chuck@horde.org>
Sun, 14 Nov 2010 04:26:10 +0000 (23:26 -0500)
committerChuck Hagenbuch <chuck@horde.org>
Sun, 14 Nov 2010 04:37:19 +0000 (23:37 -0500)
chora/app/views/diff/added.html.php
chora/app/views/diff/change.html.php
chora/app/views/diff/context.html.php
chora/app/views/diff/diff.html.php
chora/app/views/diff/removed.html.php
chora/themes/screen.css

index d889322..368fcb9 100644 (file)
@@ -1,4 +1,4 @@
-<tr>
- <td class="diff-added-empty"></td>
- <td class="diff-added"><div class="diff"><pre><?php foreach ($lines as $l) echo $this->escape($l) . '<br>' ?></pre></div></td>
-</tr>
+<div class="diff-container">
+ <div class="diff-left diff-added-empty">&nbsp;</div>
+ <div class="diff-right diff-added"><pre><?php foreach ($lines as $l) echo $this->escape($l) . '<br>' ?></pre></div>
+</div>
index d54ba5d..c73cab4 100644 (file)
@@ -1,20 +1,17 @@
-<tr>
+<div class="diff-container">
 <?php if (!empty($left)): ?>
- <td class="diff-modified">
-  <div class="diff"><pre><?php echo $left ?></pre></div>
- </td>
+ <div class="diff-left diff-modified"><pre><?php echo $left ?></pre></div>
 <?php elseif ($row < $oldsize): ?>
- <td class="diff-modified"></td>
+ <div class="diff-left diff-modified">&nbsp;</div>
 <?php else: ?>
- <td class="diff-unmodified"></td>
+ <div class="diff-left diff-unmodified">&nbsp;</div>
 <?php endif; ?>
+
 <?php if (!empty($right)): ?>
- <td class="diff-modified">
-  <div class="diff"><pre><?php echo $right ?></pre></div>
- </td>
+ <div class="diff-right diff-modified"><pre><?php echo $right ?></pre></div>
 <?php elseif ($row < $newsize): ?>
- <td class="diff-modified"></td>
+ <div class="diff-right diff-modified">&nbsp;</div>
 <?php else: ?>
- <td class="diff-unmodified"></td>
+ <div class="diff-right diff-unmodified">&nbsp;</div>
 <?php endif; ?>
-</tr>
+</div>
index 4658932..cd92d04 100644 (file)
@@ -1,4 +1,4 @@
-<tr class="diff-unmodified">
- <td><div class="diff"><pre><?php echo $context ?></pre></div></td>
- <td><div class="diff"><pre><?php echo $context ?></pre></div></td>
-</tr>
+<div class="diff-container">
+ <div class="diff-left diff-unmodified"><pre><?php echo $context ?></pre></div>
+ <div class="diff-right diff-unmodified"><pre><?php echo $context ?></pre></div>
+</div>
index 64c0425..4d73155 100644 (file)
@@ -1,10 +1,9 @@
-<table cellspacing="0" class="diff">
+<div class="diff">
 <?php foreach ($diff as $section): ?>
-<tbody>
-<tr>
- <th><?php printf(_("Line %s"), $section['oldline']) ?></th>
- <th><?php printf(_("Line %s"), $section['newline']) ?></th>
-</tr>
+<div class="diff-container diff-section">
+ <div class="diff-left"><h3><?php printf(_("Line %s"), $section['oldline']) ?></h3></div>
+ <div class="diff-right"><h3><?php printf(_("Line %s"), $section['newline']) ?></h3></div>
+</div>
 <?php
 foreach ($section['contents'] as $change) {
     if ($this->hasContext() && $change['type'] != 'empty') {
@@ -18,7 +17,7 @@ foreach ($section['contents'] as $change) {
 if ($this->hasContext()) {
     echo $this->diffContext();
 }
+
+endforeach;
 ?>
-</tbody>
-<?php endforeach ?>
-</table>
+</div>
index ca3d2a6..c62e95f 100644 (file)
@@ -1,4 +1,4 @@
-<tr>
- <td class="diff-removed"><div class="diff"><pre><?php foreach ($lines as $l) echo $this->escape($l) . '<br>' ?></pre></div></td>
- <td class="diff-removed-empty"></td>
-</tr>
+<div class="diff-container">
+ <div class="diff-left diff-removed"><pre><?php foreach ($lines as $l) echo $this->escape($l) . '<br>' ?></pre></div>
+ <div class="diff-right diff-removed-empty">&nbsp;</div>
+</div>
index bb7408c..6fb17aa 100644 (file)
@@ -224,43 +224,62 @@ table.annotate .logentry {
 }
 
 /* Diff styles. */
-table.diff {
-    width: 100%;
+div.diff {
     font-size: 100%;
-    margin: 0 0 8px 0;
+    color: #111;
 }
-table.diff th {
-    font-size: 80%;
+div.diff-section {
+    margin-top: 1em;
+}
+div.diff-container:after {
+    content: ".";
+    display: block;
+    height: 0;
+    clear: both;
+    visibility: hidden;
+}
+div.diff-container h3 {
     font-weight: bold;
 }
 
-div.diff {
-    overflow: auto;
+div.diff-left {
+    float: left;
+    width: 50%;
+    overflow-y: auto;
+}
+div.diff-right {
+    float: right;
+    width: 50%;
+    overflow-y: auto;
 }
 
 .diff-unmodified {
     background: #fff;
-    color: #666;
+    color: #999;
 }
 .diff-added {
-    background: #afa;
+    background: #cfc;
 }
 .diff-added-empty {
-    background: #cfc;
+    background: #efe;
+    background: -webkit-gradient(linear, left top, right top, from(#efe), to(#cfc));
+    background: -moz-linear-gradient(left top, #efe, #cfc);
 }
 .diff-modified {
-    background: #cdf;
+    background: #def;
 }
 .diff-removed {
-    background: #f99;
+    background: #fcc;
 }
 .diff-removed-empty {
-    background: #fcc;
+    background: #fee;
+    background: -webkit-gradient(linear, left top, right top, from(#fcc), to(#fee));
+    background: -moz-linear-gradient(left top, #fcc, #fee);
 }
 
 .diff-caption {
     text-align: left;
-    margin: 0 0 8px 0;
+    margin-top: 1em;
     font-size: 90%;
     font-weight: bold;
     padding: 5px;