# HG changeset patch # User domruf # Date 1508791970 -7200 # Node ID 77a88040a262d2a95c01cb66a52dc4d2e1215002 # Parent 5f9de2b237255f7b2c7a8324831b1859a8a53bd4 js: fix parent/child navigation with more than 2 parents/children Before, it would only work with 0-2 parents/children. diff -r 5f9de2b23725 -r 77a88040a262 kallithea/public/js/base.js --- a/kallithea/public/js/base.js Mon Oct 23 22:52:50 2017 +0200 +++ b/kallithea/public/js/base.js Mon Oct 23 22:52:50 2017 +0200 @@ -1515,24 +1515,24 @@ var commit = data.results[0]; window.location = pyroutes.url('changeset_home', {'repo_name': repo_name, 'revision': commit.raw_id}); } - else if(data.results.length === 2){ + else if(data.results.length > 1){ $this.addClass('disabled'); $this.addClass('double'); var template = ($this.data('linktype') == 'parent' ? ' ' : '') + '__rev__' + ($this.data('linktype') == 'child' ? ' ' : ''); - var _html = ''; - _html += template - .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6))) - .replace('__title__', data.results[0].message) - .replace('__url__', pyroutes.url('changeset_home', {'repo_name': repo_name, 'revision': data.results[0].raw_id})); - _html +='
' - _html += template - .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6))) - .replace('__title__', data.results[1].message) - .replace('__url__', pyroutes.url('changeset_home', {'repo_name': repo_name, 'revision': data.results[1].raw_id})); - $this.html(_html); + var _html = []; + for(var i = 0; i < data.results.length; i++){ + _html.push(template + .replace('__rev__', 'r{0}:{1}'.format(data.results[i].revision, data.results[i].raw_id.substr(0, 6))) + .replace('__title__', data.results[i].message) + .replace('__url__', pyroutes.url('changeset_home', { + 'repo_name': repo_name, + 'revision': data.results[i].raw_id})) + ); + } + $this.html(_html.join('
')); } } });