changeset 2411:95ad05b805b2

adds diff view
author sharky93 <rishabhr123@gmail.com>
date Sat, 24 Aug 2013 16:28:26 +0530
parents 89ce7644a01d
children 47049e68f589
files MoinMoin/themes/basic/static/css/basic.css MoinMoin/themes/basic/static/custom-less/basic.less MoinMoin/themes/basic/static/custom-less/variables.less MoinMoin/themes/basic/templates/diff.html MoinMoin/themes/basic/templates/diff_text.html
diffstat 5 files changed, 73 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/themes/basic/static/css/basic.css	Sat Aug 24 15:24:03 2013 +0530
+++ b/MoinMoin/themes/basic/static/css/basic.css	Sat Aug 24 16:28:26 2013 +0530
@@ -4208,6 +4208,12 @@
     display: none !important;
   }
 }
+.moin-diff-added {
+  background-color: #ccffcc;
+}
+.moin-diff-removed {
+  background-color: #ffdddd;
+}
 .moin-breadcrumb {
   padding: 8px 15px;
   margin-bottom: 20px;
--- a/MoinMoin/themes/basic/static/custom-less/basic.less	Sat Aug 24 15:24:03 2013 +0530
+++ b/MoinMoin/themes/basic/static/custom-less/basic.less	Sat Aug 24 16:28:26 2013 +0530
@@ -1,5 +1,13 @@
 @import "bootstrap.less";
 
+.moin-diff-added {
+  background-color: @moin-diff-added;
+}
+
+.moin-diff-removed {
+  background-color: @moin-diff-removed;
+}
+
 .moin-breadcrumb {
   .breadcrumb;
   > li {
--- a/MoinMoin/themes/basic/static/custom-less/variables.less	Sat Aug 24 15:24:03 2013 +0530
+++ b/MoinMoin/themes/basic/static/custom-less/variables.less	Sat Aug 24 16:28:26 2013 +0530
@@ -6,6 +6,11 @@
 // Global values
 // --------------------------------------------------
 
+// Diffs
+// -------------------------
+@moin-diff-removed:		 #ffdddd;
+@moin-diff-added:		 #ccffcc;
+
 // Grays
 // -------------------------
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/themes/basic/templates/diff.html	Sat Aug 24 16:28:26 2013 +0530
@@ -0,0 +1,7 @@
+{% extends theme("show.html") %}
+{% block content %}
+{% block headline %}
+<h2>{{ _("Diff for '%(item_name)s'", item_name=newrev.item.name) }}</h2>
+{% endblock %}
+{{ diff_html }}
+{% endblock %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/themes/basic/templates/diff_text.html	Sat Aug 24 16:28:26 2013 +0530
@@ -0,0 +1,47 @@
+{% import "utils.html" as utils %}
+
+{% macro show_meta(rev) %}
+    <div class="moin-diff-info moin-diff-info-rev-id">
+        <span class="moin-diff-info-caption">Revision:</span>
+        <span class="moin-diff-info-value">{{ rev.meta['revid'] | shorten_id }}</span>
+    </div>
+    <div class="moin-diff-info moin-diff-info-rev-author">
+        <span class="moin-diff-info-caption">Editor:</span>
+        <span class="moin-diff-info-value">
+            {{ utils.editor_info(rev.meta) }}
+        </span>
+    </div>
+    <div class="moin-diff-info moin-diff-info-rev-size">
+        <span class="moin-diff-info-caption">Size:</span>
+        <span class="moin-diff-info-value">{{ rev.meta['size'] }}</span>
+    </div>
+    <div class="moin-diff-info moin-diff-info-rev-comment">
+        <span class="moin-diff-info-caption">Comment:</span>
+        <span class="moin-diff-info-value">{{ rev.meta['comment'] }}</span>
+    </div>
+{% endmacro %}
+
+<table class="table table-condensed">
+    <tr>
+        <td class="moin-diff-header">
+            {{ show_meta(oldrev) }}
+        </td>
+        <td class="moin-diff-header">
+            {{ show_meta(newrev) }}
+        </td>
+    </tr>
+    <tr>
+        <td class="moin-diff-removed"><span>{{ _('Deletions are marked like this.') }}</span></td>
+        <td class="moin-diff-added"><span>{{ _('Additions are marked like this.') }}</span></td>
+    </tr>
+    {% for llineno, lcontent, rlineno, rcontent in diffs %}
+        <tr class="moin-diff-line-number">
+            <td><a href="#{{ llineno }}">{{ _('Line') }} {{ llineno }}:</a></td>
+            <td><a href="#{{ rlineno }}">{{ _('Line') }} {{ rlineno }}:</a></td>
+        </tr>
+        <tr>
+            <td class="moin-diff-removed">{{ lcontent }}</td>
+            <td class="moin-diff-added">{{ rcontent }}</td>
+        </tr>
+    {% endfor %}
+</table>