incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [10/41] git commit: [#5389] ticket:229 add styles for side-by-side diff
Date Tue, 18 Dec 2012 04:29:29 GMT
[#5389] ticket:229 add styles for side-by-side diff


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/b09028b3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b09028b3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b09028b3

Branch: refs/heads/tv/4957
Commit: b09028b37593bdfda75069351be5c776bdf8bb8d
Parents: a68e421
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Thu Dec 6 13:58:18 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Mon Dec 17 22:21:16 2012 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py    |    1 +
 Allura/allura/public/nf/css/forge/diff.css |   44 +++++++++++++++++++++++
 Allura/allura/templates/repo/commit.html   |    2 +
 Allura/allura/templates/repo/diff.html     |    1 +
 4 files changed, 48 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b09028b3/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 1d8a061..d93fe1d 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -588,6 +588,7 @@ class FileBrowser(BaseController):
         if fmt == 'sidebyside':
             hd = difflib.HtmlDiff(tabsize=4)
             diff = hd.make_table(la, lb, adesc, bdesc, context=True)
+            diff = diff.replace('&nbsp;', ' ')
         else:
             diff = ''.join(difflib.unified_diff(la, lb, adesc, bdesc))
         return dict(a=a, b=b, diff=diff)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b09028b3/Allura/allura/public/nf/css/forge/diff.css
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/css/forge/diff.css b/Allura/allura/public/nf/css/forge/diff.css
new file mode 100644
index 0000000..7e9e553
--- /dev/null
+++ b/Allura/allura/public/nf/css/forge/diff.css
@@ -0,0 +1,44 @@
+/* Styles for side-by-side diffs. Trying to match pygments styles for regular diffs */
+
+table.diff {
+  background: #f8f8f8;
+  margin: 0 !important;
+  width: 100% !important;
+}
+
+table.diff colgroup,
+table.diff td.diff_next,
+table.diff th.diff_next,
+.inline-diff-body table.diff thead { display: none; }
+
+table.diff,
+table.diff tr,
+table.diff td {
+  border: 0;
+  color: gray;
+  margin: 0;
+  padding: 0;
+  vertical-align: text-top;
+  white-space: pre-wrap;
+}
+
+table.diff td { padding: 0 .2em; }
+
+/* line number */
+table.diff td.diff_header {
+  background-color: #ebebeb;
+  display:inline-block;
+  padding: 0 .5em;
+  border-width: 0 1px 0 0;
+  border-style: solid;
+  border-color: #ddd;
+  height: 100%;
+  width: 2em;
+}
+
+/* colors */
+table.diff tr:hover { background-color: #ff9; }
+
+table.diff tr td span.diff_add { color: #000; background-color: #dfd; }
+table.diff tr td span.diff_sub { color: #000; background-color: #fdd; }
+table.diff tr td span.diff_chg { color: #000; background-color: #ff9; }

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b09028b3/Allura/allura/templates/repo/commit.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/commit.html b/Allura/allura/templates/repo/commit.html
index 6057f5a..52c38ad 100644
--- a/Allura/allura/templates/repo/commit.html
+++ b/Allura/allura/templates/repo/commit.html
@@ -1,5 +1,7 @@
 {% extends 'allura:templates/repo/repo_master.html' %}
 
+{% do g.register_forge_css('css/forge/diff.css') %}
+
 {% block title %}
   {{c.project.name}} / {{c.app.config.options.mount_label}} / Commit {{commit.shorthand_id()}}
 {% endblock %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b09028b3/Allura/allura/templates/repo/diff.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/diff.html b/Allura/allura/templates/repo/diff.html
index 5156bd8..6faede2 100644
--- a/Allura/allura/templates/repo/diff.html
+++ b/Allura/allura/templates/repo/diff.html
@@ -1,5 +1,6 @@
 {% extends 'allura:templates/repo/repo_master.html' %}
 {% do g.register_forge_css('css/forge/hilite.css') %}
+{% do g.register_forge_css('css/forge/diff.css') %}
 
 {% block title %}
   {{c.project.name}} / {{c.app.config.options.mount_label}} / Diff of {{h.really_unicode(b.path())}}


Mime
View raw message