# HG changeset patch # User Mads Kiilerich # Date 2014-08-01 20:28:42 # Node ID e457b951aabe0186d5393239093e6fbd0e47e276 # Parent 47e54cf3047bcb6ecfcc8ce3e0e206ca8d4e5452 diff: option for showing images diff --git a/kallithea/public/css/style.css b/kallithea/public/css/style.css --- a/kallithea/public/css/style.css +++ b/kallithea/public/css/style.css @@ -5122,6 +5122,17 @@ div.comment:target>.comment-wrapp { margin: -2px; } +.btn-image-diff-show, +.btn-image-diff-swap { + margin: 5px; +} + +.img-diff { + max-width: 45%; + height: auto; + margin: 5px; +} + .img-preview { max-width: 100%; height: auto; diff --git a/kallithea/templates/changeset/changeset.html b/kallithea/templates/changeset/changeset.html --- a/kallithea/templates/changeset/changeset.html +++ b/kallithea/templates/changeset/changeset.html @@ -157,6 +157,7 @@ ${self.repo_context_bar('changelog', c.c ## diff block <%namespace name="diff_block" file="/changeset/diff_block.html"/> + ${diff_block.diff_block_js()} ${diff_block.diff_block(c.changes[c.changeset.raw_id])} % if c.limited_diff: diff --git a/kallithea/templates/changeset/changeset_range.html b/kallithea/templates/changeset/changeset_range.html --- a/kallithea/templates/changeset/changeset_range.html +++ b/kallithea/templates/changeset/changeset_range.html @@ -75,7 +75,8 @@ ${self.repo_context_bar('changelog')} <%namespace name="comment" file="/changeset/changeset_file_comment.html"/> <%namespace name="diff_block" file="/changeset/diff_block.html"/> - %for cs in c.cs_ranges: + ${diff_block.diff_block_js()} + %for cs in c.cs_ranges: ##${comment.comment_inline_form(cs)} ## diff block
@@ -109,6 +110,6 @@ ${self.repo_context_bar('changelog')}
${diff_block.diff_block(c.changes[cs.raw_id])} - %endfor - + %endfor + diff --git a/kallithea/templates/changeset/diff_block.html b/kallithea/templates/changeset/diff_block.html --- a/kallithea/templates/changeset/diff_block.html +++ b/kallithea/templates/changeset/diff_block.html @@ -44,6 +44,17 @@
${diff|n} + %if path.rsplit('.')[-1] in ['png', 'gif', 'jpg', 'bmp']: +
Show images
+ +
+ +
+ %endif
%endfor @@ -88,7 +99,45 @@
${diff|n} + %if filenode_path.rsplit('.')[-1] in ['png', 'gif', 'jpg', 'bmp']: +
Show images
+ +
+ +
+ %endif
%endfor + +<%def name="diff_block_js()"> + + diff --git a/kallithea/templates/compare/compare_diff.html b/kallithea/templates/compare/compare_diff.html --- a/kallithea/templates/compare/compare_diff.html +++ b/kallithea/templates/compare/compare_diff.html @@ -81,6 +81,7 @@ ${self.repo_context_bar('changelog')} ## 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 --git a/kallithea/templates/files/file_diff.html b/kallithea/templates/files/file_diff.html --- a/kallithea/templates/files/file_diff.html +++ b/kallithea/templates/files/file_diff.html @@ -25,6 +25,7 @@ ${self.repo_context_bar('changelog')}
## diff block <%namespace name="diff_block" file="/changeset/diff_block.html"/> + ${diff_block.diff_block_js()} ${diff_block.diff_block(c.changes)}
diff --git a/kallithea/templates/pullrequests/pullrequest_show.html b/kallithea/templates/pullrequests/pullrequest_show.html --- a/kallithea/templates/pullrequests/pullrequest_show.html +++ b/kallithea/templates/pullrequests/pullrequest_show.html @@ -307,6 +307,7 @@ ${self.repo_context_bar('showpullrequest ## 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