Mercurial > kallithea
changeset 3321:a91fa221a3b8 beta
be more explicit about constructing compare url
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 04 Feb 2013 21:26:01 +0100 |
parents | 75431548602a |
children | c9b0f1d363c7 |
files | rhodecode/config/routing.py rhodecode/templates/pullrequests/pullrequest.html |
diffstat | 2 files changed, 26 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/config/routing.py Mon Feb 04 02:18:44 2013 +0100 +++ b/rhodecode/config/routing.py Mon Feb 04 21:26:01 2013 +0100 @@ -493,8 +493,8 @@ controller='compare', action='index', conditions=dict(function=check_repo), requirements=dict( - org_ref_type='(branch|book|tag|rev|org_ref_type)', - other_ref_type='(branch|book|tag|rev|other_ref_type)') + org_ref_type='(branch|book|tag|rev|__org_ref_type__)', + other_ref_type='(branch|book|tag|rev|__other_ref_type__)') ) rmap.connect('pullrequest_home',
--- a/rhodecode/templates/pullrequests/pullrequest.html Mon Feb 04 02:18:44 2013 +0100 +++ b/rhodecode/templates/pullrequests/pullrequest.html Mon Feb 04 21:26:01 2013 +0100 @@ -138,40 +138,35 @@ var loadPreview = function(){ YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display','none'); + //url template var url = "${h.url('compare_url', - repo_name='org_repo', - org_ref_type='org_ref_type', org_ref='org_ref', - other_repo='other_repo', - other_ref_type='other_ref_type', other_ref='other_ref', + repo_name='__org_repo__', + org_ref_type='__org_ref_type__', + org_ref='__org_ref__', + other_repo='__other_repo__', + other_ref_type='__other_ref_type__', + other_ref='__other_ref__', as_form=True, rev_start=request.GET.get('rev_start',''), rev_end=request.GET.get('rev_end',''))}"; - + var org_repo = YUQ('#pull_request_form #org_repo')[0].value; + var org_ref = YUQ('#pull_request_form #org_ref')[0].value.split(':'); + + var other_repo = YUQ('#pull_request_form #other_repo')[0].value; + var other_ref = YUQ('#pull_request_form #other_ref')[0].value.split(':'); + var select_refs = YUQ('#pull_request_form select.refs') - var rev_data = {}; // gather the org/other ref and repo here - for(var i=0;i<select_refs.length;i++){ - var select_ref = select_refs[i]; - var select_ref_data = select_ref.value.split(':'); - var key = null; - var val = null; - - if(select_ref_data.length>1){ - key = select_ref.name+"_type"; - val = select_ref_data[0]; - url = url.replace(key,val); - rev_data[key] = val; - - key = select_ref.name; - val = select_ref_data[1]; - url = url.replace(key,val); - rev_data[key] = val; - - }else{ - key = select_ref.name; - val = select_ref.value; - url = url.replace(key,val); - rev_data[key] = val; - } + var rev_data = { + 'org_repo': org_repo, + 'org_ref': org_ref[1], + 'org_ref_type': org_ref[0], + 'other_repo': other_repo, + 'other_ref': other_ref[1], + 'other_ref_type': other_ref[0], + }; // gather the org/other ref and repo here + + for (k in rev_data){ + url = url.replace('__'+k+'__',rev_data[k]); } YUE.on('other_repo', 'change', function(e){