pullrequest.html
195 lines
| 7.3 KiB
| text/html
|
HtmlLexer
r2244 | <%inherit file="/base/base.html"/> | |||
<%def name="title()"> | ||||
r2434 | ${c.repo_name} ${_('New pull request')} | |||
r2244 | </%def> | |||
<%def name="breadcrumbs_links()"> | ||||
|
r2492 | ${h.link_to(_(u'Home'),h.url('/'))} | ||
r2244 | » | |||
${h.link_to(c.repo_name,h.url('changelog_home',repo_name=c.repo_name))} | ||||
» | ||||
r2434 | ${_('New pull request')} | |||
r2244 | </%def> | |||
<%def name="main()"> | ||||
<div class="box"> | ||||
<!-- box / title --> | ||||
<div class="title"> | ||||
${self.breadcrumbs()} | ||||
</div> | ||||
r2434 | ${h.form(url('pullrequest', repo_name=c.repo_name), method='post', id='pull_request_form')} | |||
<div style="float:left;padding:0px 30px 30px 30px"> | ||||
r3023 | <input type="hidden" name="rev_start" value="${request.GET.get('rev_start')}" /> | |||
<input type="hidden" name="rev_end" value="${request.GET.get('rev_end')}" /> | ||||
r3029 | ||||
r2244 | ##ORG | |||
<div style="float:left"> | ||||
|
r3330 | <div> | ||
r2244 | <span style="font-size: 20px"> | |||
|
r3329 | ${h.select('org_repo','',c.org_repos,class_='refs')}:${h.select('org_ref',c.default_org_ref,c.org_refs,class_='refs')} | ||
r2244 | </span> | |||
<div style="padding:5px 3px 3px 42px;">${c.rhodecode_db_repo.description}</div> | ||||
</div> | ||||
<div style="clear:both;padding-top: 10px"></div> | ||||
</div> | ||||
<div style="float:left;font-size:24px;padding:0px 20px"> | ||||
r2395 | <img height=32 width=32 src="${h.url('/images/arrow_right_64.png')}"/> | |||
r2244 | </div> | |||
r2434 | ||||
r2244 | ##OTHER, most Probably the PARENT OF THIS FORK | |||
<div style="float:left"> | ||||
|
r3330 | <div> | ||
r2244 | <span style="font-size: 20px"> | |||
|
r3327 | ${h.select('other_repo',c.default_other_repo,c.other_repos,class_='refs')}:${h.select('other_ref',c.default_other_ref,c.default_other_refs,class_='refs')} | ||
r2244 | </span> | |||
r2541 | <div id="other_repo_desc" style="padding:5px 3px 3px 42px;"></div> | |||
r2244 | </div> | |||
<div style="clear:both;padding-top: 10px"></div> | ||||
</div> | ||||
r2434 | <div style="clear:both;padding-top: 10px"></div> | |||
## overview pulled by ajax | ||||
<div style="float:left" id="pull_request_overview"></div> | ||||
r2396 | <div style="float:left;clear:both;padding:10px 10px 10px 0px;display:none"> | |||
<a id="pull_request_overview_url" href="#">${_('Detailed compare view')}</a> | ||||
r2434 | </div> | |||
r2244 | </div> | |||
r2395 | <div style="float:left; border-left:1px dashed #eee"> | |||
<h4>${_('Pull request reviewers')}</h4> | ||||
<div id="reviewers" style="padding:0px 0px 0px 15px"> | ||||
r2612 | ## members goes here ! | |||
<div class="group_members_wrap"> | ||||
<ul id="review_members" class="group_members"> | ||||
%for member in c.review_members: | ||||
r2613 | <li id="reviewer_${member.user_id}"> | |||
<div class="reviewers_member"> | ||||
<div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(member.email,14)}"/> </div> | ||||
<div style="float:left">${member.full_name} (${_('owner')})</div> | ||||
<input type="hidden" value="${member.user_id}" name="review_members" /> | ||||
<span class="delete_icon action_button" onclick="removeReviewer(${member.user_id})"></span> | ||||
</div> | ||||
</li> | ||||
r2612 | %endfor | |||
</ul> | ||||
r2673 | </div> | |||
r2612 | <div class='ac'> | |||
<div class="reviewer_ac"> | ||||
${h.text('user', class_='yui-ac-input')} | ||||
<span class="help-block">${_('Add reviewer to this pull request.')}</span> | ||||
r2673 | <div id="reviewers_container"></div> | |||
r2612 | </div> | |||
</div> | ||||
r2395 | </div> | |||
r2434 | </div> | |||
r2395 | <h3>${_('Create new pull request')}</h3> | |||
r2434 | ||||
r2244 | <div class="form"> | |||
<!-- fields --> | ||||
<div class="fields"> | ||||
<div class="field"> | ||||
<div class="label"> | ||||
<label for="pullrequest_title">${_('Title')}:</label> | ||||
</div> | ||||
<div class="input"> | ||||
${h.text('pullrequest_title',size=30)} | ||||
</div> | ||||
</div> | ||||
<div class="field"> | ||||
<div class="label label-textarea"> | ||||
<label for="pullrequest_desc">${_('description')}:</label> | ||||
</div> | ||||
<div class="textarea text-area editor"> | ||||
${h.textarea('pullrequest_desc',size=30)} | ||||
</div> | ||||
</div> | ||||
<div class="buttons"> | ||||
r2607 | ${h.submit('save',_('Send pull request'),class_="ui-btn large")} | |||
${h.reset('reset',_('Reset'),class_="ui-btn large")} | ||||
r2244 | </div> | |||
</div> | ||||
</div> | ||||
r2434 | ${h.end_form()} | |||
r2244 | </div> | |||
r2395 | <script type="text/javascript"> | |||
r2612 | var _USERS_AC_DATA = ${c.users_array|n}; | |||
var _GROUPS_AC_DATA = ${c.users_groups_array|n}; | ||||
PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA); | ||||
r2541 | var other_repos_info = ${c.other_repos_info|n}; | |||
r2907 | ||||
r2395 | var loadPreview = function(){ | |||
|
r3197 | YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display','none'); | ||
r3321 | //url template | |||
r2434 | var url = "${h.url('compare_url', | |||
|
r3322 | repo_name='__other_repo__', | ||
org_ref_type='__other_ref_type__', | ||||
org_ref='__other_ref__', | ||||
other_repo='__org_repo__', | ||||
other_ref_type='__org_ref_type__', | ||||
other_ref='__org_ref__', | ||||
|
r3304 | as_form=True, | ||
r3023 | rev_start=request.GET.get('rev_start',''), | |||
rev_end=request.GET.get('rev_end',''))}"; | ||||
r3321 | var org_repo = YUQ('#pull_request_form #org_repo')[0].value; | |||
var org_ref = YUQ('#pull_request_form #org_ref')[0].value.split(':'); | ||||
r3338 | ||||
r3321 | var other_repo = YUQ('#pull_request_form #other_repo')[0].value; | |||
var other_ref = YUQ('#pull_request_form #other_ref')[0].value.split(':'); | ||||
r3338 | ||||
r2395 | var select_refs = YUQ('#pull_request_form select.refs') | |||
r3321 | 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], | ||||
r3338 | 'other_ref_type': other_ref[0], | |||
r3321 | }; // gather the org/other ref and repo here | |||
r3338 | ||||
r3321 | for (k in rev_data){ | |||
url = url.replace('__'+k+'__',rev_data[k]); | ||||
r2395 | } | |||
r2434 | ||||
r2396 | ypjax(url,'pull_request_overview', function(data){ | |||
|
r3197 | var sel_box = YUQ('#pull_request_form #other_repo')[0]; | ||
var repo_name = sel_box.options[sel_box.selectedIndex].value; | ||||
YUD.get('pull_request_overview_url').href = url; | ||||
YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display',''); | ||||
YUD.get('other_repo_desc').innerHTML = other_repos_info[repo_name]['description']; | ||||
YUD.get('other_ref').innerHTML = other_repos_info[repo_name]['revs']; | ||||
// select back the revision that was just compared | ||||
setSelectValue(YUD.get('other_ref'), rev_data['other_ref']); | ||||
r2434 | }) | |||
r2395 | } | |||
|
r3325 | |||
|
r3326 | ## refresh automatically when something changes (org_repo can't change) | ||
YUE.on('org_ref', 'change', function(e){ | ||||
loadPreview(); | ||||
}); | ||||
|
r3325 | YUE.on('other_repo', 'change', function(e){ | ||
var repo_name = e.currentTarget.value; | ||||
// replace the <select> of changed repo | ||||
YUD.get('other_ref').innerHTML = other_repos_info[repo_name]['revs']; | ||||
|
r3326 | loadPreview(); | ||
|
r3325 | }); | ||
|
r3326 | YUE.on('other_ref', 'change', function(e){ | ||
loadPreview(); | ||||
}); | ||||
r2434 | ||||
//lazy load overview after 0.5s | ||||
setTimeout(loadPreview, 500) | ||||
r2395 | </script> | |||
r2244 | </%def> | |||