[PATCH 7 of 7 v3] diffs: move 'show inline comments' checkbox to top of the whole diff
Jan Heylen
heyleke at gmail.com
Sat Jan 2 12:15:07 UTC 2016
# HG changeset patch
# User Jan Heylen <heyleke at gmail.com>
# Date 1451732051 -3600
# Sat Jan 02 11:54:11 2016 +0100
# Node ID 3bcc64425f739a4b728d04906828c9a9f89e1cd1
# Parent c81bb24c4c768b470202e2960368983b2970e8ba
diffs: move 'show inline comments' checkbox to top of the whole diff
* instead of doing it on a per-file basis, do it for the whole diff.
* show it for pull-requests too (unify diff templates)
diff -r c81bb24c4c76 -r 3bcc64425f73 kallithea/templates/changeset/diff_block.html
--- a/kallithea/templates/changeset/diff_block.html Sat Jan 02 11:53:38 2016 +0100
+++ b/kallithea/templates/changeset/diff_block.html Sat Jan 02 11:54:11 2016 +0100
@@ -31,6 +31,12 @@
<span target="${'diff-container-%s' % (id(change))}" class="diff-collapse-button">↑ ${_('Collapse Diff')} ↑</span>
</div>
<div class="diff-container" id="${'diff-container-%s' % (id(change))}">
+ <span style="float:right;margin-bottom:3px;margin-right:30px">
+ <label>
+ ${_('Show inline comments')}
+ ${h.checkbox('',checked="checked",class_="show-inline-comments",id_for="diff-container-%s" % (id(change)))}
+ </label>
+ </span>
%for FID,(cs1, cs2, change, path, diff, stats) in change.iteritems():
<div id="${FID}_target" style="clear:both;margin-top:25px"></div>
<div id="${FID}" class="diffblock margined comm">
@@ -56,12 +62,7 @@
${c.ignorews_url(request.GET, h.FID(cs2,path))}
${c.context_url(request.GET, h.FID(cs2,path))}
</div>
- <span style="float:right;margin-top:-3px">
- <label>
- ${_('Show inline comments')}
- ${h.checkbox('',checked="checked",class_="show-inline-comments",id_for=h.FID(cs2,path))}
- </label>
- </span>
+
</div>
</div>
<% code_body(diff,path,FID,change,c.repo_name,c.repo_name,cs1,cs2) %>
@@ -85,6 +86,12 @@
%endif
</div>
<div class="diff-container ${container_class}" id="${'diff-container-%s' % (id(changes))}">
+ <span style="float:right;margin-bottom:3px;margin-right:30px">
+ <label>
+ ${_('Show inline comments')}
+ ${h.checkbox('',checked="checked",class_="show-inline-comments",id_for="diff-container-%s" % (id(changes)))}
+ </label>
+ </span>
%for fid, ch, f, stat in files:
<%
change = [changes[fid]]
diff -r c81bb24c4c76 -r 3bcc64425f73 kallithea/templates/pullrequests/pullrequest_show.html
--- a/kallithea/templates/pullrequests/pullrequest_show.html Sat Jan 02 11:53:38 2016 +0100
+++ b/kallithea/templates/pullrequests/pullrequest_show.html Sat Jan 02 11:54:11 2016 +0100
@@ -376,6 +376,19 @@
<script type="text/javascript">
$(document).ready(function(){
+ $('.show-inline-comments').change(function(e){
+ var target = e.currentTarget;
+ if(target == null){
+ target = this;
+ }
+ var boxid = $(target).attr('id_for');
+ if(target.checked){
+ $('#{0} .inline-comments'.format(boxid)).show();
+ }else{
+ $('#{0} .inline-comments'.format(boxid)).hide();
+ }
+ });
+
PullRequestAutoComplete($('#user'), $('#reviewers_container'), _USERS_AC_DATA);
SimpleUserAutoComplete($('#owner'), $('#owner_completion_container'), _USERS_AC_DATA);
More information about the kallithea-general
mailing list