[PATCH 3 of 7 v3] diff: diff_block_simple: make it collapsable

Jan Heylen heyleke at gmail.com
Sat Jan 2 12:15:03 UTC 2016


# HG changeset patch
# User Jan Heylen <heyleke at gmail.com>
# Date 1448811822 -3600
#      Sun Nov 29 16:43:42 2015 +0100
# Node ID 1965658b1e2a30a05ae38c4d5ab3c4f0b0eda89d
# Parent  460232c9255e08d54e6f61bd0ed9e1fa60b7d3e2
diff: diff_block_simple: make it collapsable

* make diff_block_simple behave more like diff_block (collapsable)
* as there are use case to have it default collapsed,
  make its default behavior selectable

diff -r 460232c9255e -r 1965658b1e2a kallithea/templates/changeset/diff_block.html
--- a/kallithea/templates/changeset/diff_block.html	Sat Jan 02 11:56:09 2016 +0100
+++ b/kallithea/templates/changeset/diff_block.html	Sun Nov 29 16:43:42 2015 +0100
@@ -66,6 +66,20 @@
 </%def>
 
 <%def name="diff_block_simple(files, changes, hidden=False)">
+<%
+if hidden:
+    container_class = "hidden"
+else:
+    container_class = ""
+%>
+<div class="diff-collapse">
+    %if hidden:
+    <span target="${'diff-container-%s' % (id(changes))}" class="diff-collapse-button">↓ ${_('Expand Diff')} ↓</span>
+    %else:
+    <span target="${'diff-container-%s' % (id(changes))}" class="diff-collapse-button">↑ ${_('Collapse Diff')} ↑</span>
+    %endif
+</div>
+<div class="diff-container ${container_class}" id="${'diff-container-%s' % (id(changes))}">
 %for fid, ch, f, stat in files:
   <%
   change = [changes[fid]]
@@ -128,6 +142,7 @@
     </div>
   %endfor
 %endfor
+</div>
 </%def>
 
 <%def name="diff_block_js()">


More information about the kallithea-general mailing list