changeset 5643:150431aae9ba

diff: move looping over files into diff_block_simple Make it slightly more like regular diff_block and make the next changes possible.
author Jan Heylen <heyleke@gmail.com>
date Sat, 02 Jan 2016 11:55:36 +0100
parents a1a517ebf550
children e8229d389948
files kallithea/templates/changeset/diff_block.html kallithea/templates/compare/compare_diff.html kallithea/templates/pullrequests/pullrequest_show.html
diffstat 3 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/templates/changeset/diff_block.html	Sat Jan 02 10:58:06 2016 +0100
+++ b/kallithea/templates/changeset/diff_block.html	Sat Jan 02 11:55:36 2016 +0100
@@ -65,9 +65,11 @@
 </div>
 </%def>
 
-<%def name="diff_block_simple(change)">
-
-  %for op,filenode_path,diff in change:
+<%def name="diff_block_simple(files, changes)">
+  %for fid, ch, f, stat in files:
+    <%
+    op, filenode_path, diff = changes[fid]
+    %>
     <div id="${h.FID('',filenode_path)}_target" style="clear:both;margin-top:25px"></div>
     <div id="${h.FID('',filenode_path)}" class="diffblock  margined comm">
       <div class="code-header">
--- a/kallithea/templates/compare/compare_diff.html	Sat Jan 02 10:58:06 2016 +0100
+++ b/kallithea/templates/compare/compare_diff.html	Sat Jan 02 11:55:36 2016 +0100
@@ -88,9 +88,7 @@
         ## diff block
         <%namespace name="diff_block" file="/changeset/diff_block.html"/>
         ${diff_block.diff_block_js()}
-        %for fid, change, f, stat in c.files:
-          ${diff_block.diff_block_simple([c.changes[fid]])}
-        %endfor
+        ${diff_block.diff_block_simple(c.files, c.changes)}
         % if c.limited_diff:
           <h4>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}">${_('Show full diff')}</a></h4>
         % endif
--- a/kallithea/templates/pullrequests/pullrequest_show.html	Sat Jan 02 10:58:06 2016 +0100
+++ b/kallithea/templates/pullrequests/pullrequest_show.html	Sat Jan 02 11:55:36 2016 +0100
@@ -356,9 +356,7 @@
     <div class="commentable-diff">
     <%namespace name="diff_block" file="/changeset/diff_block.html"/>
     ${diff_block.diff_block_js()}
-    %for fid, change, f, stat in c.files:
-      ${diff_block.diff_block_simple([c.changes[fid]])}
-    %endfor
+    ${diff_block.diff_block_simple(c.files, c.changes)}
     % if c.limited_diff:
       <h4>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}">${_('Show full diff anyway')}</a></h4>
     % endif