From patchwork Fri Jul 12 12:40:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [V2] hgweb: showDiffstat javascript function accepts flag argument From: Alexander Plavin X-Patchwork-Id: 1842 Message-Id: <241ecd26c3e18f60fede.1373632820@debian-alexander.dolgopa> To: mercurial-devel@selenic.com Date: Fri, 12 Jul 2013 16:40:20 +0400 # HG changeset patch # User Alexander Plavin # Date 1373630471 -14400 # Fri Jul 12 16:01:11 2013 +0400 # Node ID 241ecd26c3e18f60fede3659865d73a1e08a62e4 # Parent 965d2ac231bc500fabbdd21bd11b0333098511a1 hgweb: showDiffstat javascript function accepts flag argument This eliminates the need of another almost equal function hideDiffstat and makes the code cleaner. diff -r 965d2ac231bc -r 241ecd26c3e1 mercurial/templates/paper/changeset.tmpl --- a/mercurial/templates/paper/changeset.tmpl Thu Jul 04 14:19:43 2013 +0400 +++ b/mercurial/templates/paper/changeset.tmpl Fri Jul 12 16:01:11 2013 +0400 @@ -66,9 +66,9 @@ diffstat {diffsummary} - [+] + [+] diff -r 965d2ac231bc -r 241ecd26c3e1 mercurial/templates/static/mercurial.js --- a/mercurial/templates/static/mercurial.js Thu Jul 04 14:19:43 2013 +0400 +++ b/mercurial/templates/static/mercurial.js Fri Jul 12 16:01:11 2013 +0400 @@ -265,12 +265,7 @@ } })(document, RegExp, Math, isNaN, Date, false, true) -function showDiffstat() { - document.getElementById('diffstatdetails').style.display = 'inline'; - document.getElementById('diffstatexpand').style.display = 'none'; +function showDiffstat(flag) { + document.getElementById('diffstatdetails').style.display = flag ? 'inline' : 'none'; + document.getElementById('diffstatexpand').style.display = flag ? 'none' : 'inline'; } - -function hideDiffstat() { - document.getElementById('diffstatdetails').style.display = 'none'; - document.getElementById('diffstatexpand').style.display = 'inline'; -} diff -r 965d2ac231bc -r 241ecd26c3e1 tests/test-hgweb-commands.t --- a/tests/test-hgweb-commands.t Thu Jul 04 14:19:43 2013 +0400 +++ b/tests/test-hgweb-commands.t Fri Jul 12 16:01:11 2013 +0400 @@ -423,9 +423,9 @@ 2 files changed, 2 insertions(+), 0 deletions(-) - [+] + [+]