# HG changeset patch # User Marcin Kuzminski # Date 2013-03-01 14:25:36 # Node ID efc00d363d1ef55ba74f712c1cc384650e12129e # Parent 9fe4543b6823ef429c731a5960794d72749249d9 collapsable diff container in changeset, makes quick review easier diff --git a/rhodecode/public/css/style.css b/rhodecode/public/css/style.css --- a/rhodecode/public/css/style.css +++ b/rhodecode/public/css/style.css @@ -244,7 +244,6 @@ div:hover > a.permalink { #header { } - #header ul#logged-user { margin-bottom: 5px !important; -webkit-border-radius: 0px 0px 8px 8px; @@ -4639,6 +4638,23 @@ PULL REQUESTS /***************************************************************************** DIFFS CSS ******************************************************************************/ +.diff-collapse{ + text-align: center; +} +.diff-collapse-button{ + cursor: pointer; + color: #666; + font-size: 16px; +} +.diff-container { + margin-bottom: -15px; +} + +.diff-container.hidden{ + display: none; + overflow: hidden; +} + div.diffblock { overflow: auto; diff --git a/rhodecode/public/js/rhodecode.js b/rhodecode/public/js/rhodecode.js --- a/rhodecode/public/js/rhodecode.js +++ b/rhodecode/public/js/rhodecode.js @@ -2161,3 +2161,26 @@ var MultiSelectWidget = function(selecte }); } } + + +// global hooks after DOM is loaded + +YUE.onDOMReady(function(){ + YUE.on(YUQ('.diff-collapse-button'), 'click', function(e){ + var button = e.currentTarget; + var t = YUD.get(button).getAttribute('target'); + console.log(t); + if(YUD.hasClass(t, 'hidden')){ + YUD.removeClass(t, 'hidden'); + YUD.get(button).innerHTML = "↑ {0} ↑".format(_TM['collapse diff']); + } + else if(!YUD.hasClass(t, 'hidden')){ + YUD.addClass(t, 'hidden'); + YUD.get(button).innerHTML = "↓ {0} ↓".format(_TM['expand diff']); + } + }); + + + +}); + diff --git a/rhodecode/templates/base/root.html b/rhodecode/templates/base/root.html --- a/rhodecode/templates/base/root.html +++ b/rhodecode/templates/base/root.html @@ -51,6 +51,8 @@ 'Open new pull request for selected changesets': "${_('Open new pull request for selected changesets')}", 'Show selected changes __S -> __E': "${_('Show selected changes __S -> __E')}", 'Selection link': "${_('Selection link')}", + 'collapse diff': "${_('collapse diff')}", + 'expand diff': "${_('expand diff')}", }; var _TM = TRANSLATION_MAP; diff --git a/rhodecode/templates/changeset/diff_block.html b/rhodecode/templates/changeset/diff_block.html --- a/rhodecode/templates/changeset/diff_block.html +++ b/rhodecode/templates/changeset/diff_block.html @@ -4,7 +4,10 @@ ## ${diff_block.diff_block(change)} ## <%def name="diff_block(change)"> - +
+ ↑ ${_('collapse diff')} ↑ +
+
%for FID,(cs1, cs2, change, path, diff, stats) in change.iteritems(): ##%if op !='removed':
@@ -37,7 +40,7 @@
##%endif %endfor - + <%def name="diff_block_simple(change)">