pullrequest.html
231 lines
| 8.7 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()"> | ||||
|
r3602 | ${_('New pull request')} | ||
r2244 | </%def> | |||
|
r3609 | <%def name="page_nav()"> | ||
${self.menu('repositories')} | ||||
</%def> | ||||
r2244 | <%def name="main()"> | |||
|
r3988 | ${self.repo_context_bar('showpullrequest')} | ||
r2244 | <div class="box"> | |||
<!-- box / title --> | ||||
<div class="title"> | ||||
${self.breadcrumbs()} | ||||
</div> | ||||
r2434 | ||||
|
r3814 | ${h.form(url('pullrequest', repo_name=c.repo_name), method='post', id='pull_request_form')} | ||
r2673 | ||||
r2395 | <h3>${_('Create new pull request')}</h3> | |||
r2434 | ||||
r2244 | <div class="form"> | |||
<!-- fields --> | ||||
|
r3814 | <div class="fields" style="float:left;width:50%;padding-right:30px;"> | ||
r2244 | ||||
<div class="field"> | ||||
<div class="label"> | ||||
<label for="pullrequest_title">${_('Title')}:</label> | ||||
</div> | ||||
<div class="input"> | ||||
r3815 | ${h.text('pullrequest_title', class_="large")} | |||
r2244 | </div> | |||
</div> | ||||
<div class="field"> | ||||
<div class="label label-textarea"> | ||||
|
r3516 | <label for="pullrequest_desc">${_('Description')}:</label> | ||
r2244 | </div> | |||
<div class="textarea text-area editor"> | ||||
r3815 | ${h.textarea('pullrequest_desc',size=30, style="height:100px")} | |||
<span class="help-block">${_('Write a short description on this pull request')}</span> | ||||
r2244 | </div> | |||
</div> | ||||
|
r3814 | <div class="field"> | ||
<div class="label label-textarea"> | ||||
<label for="pullrequest_desc">${_('Changeset flow')}:</label> | ||||
</div> | ||||
<div class="input"> | ||||
##ORG | ||||
r3815 | <div> | |||
|
r3814 | <div> | ||
r3815 | <div style="padding:5px 3px 3px 3px;"> | |||
<b>${_('Origin repository')}:</b> ${c.rhodecode_db_repo.description} | ||||
</div> | ||||
|
r3814 | <span style="font-size: 20px"> | ||
${h.select('org_repo','',c.org_repos,class_='refs')}:${h.select('org_ref',c.default_org_ref,c.org_refs,class_='refs')} | ||||
</span> | ||||
</div> | ||||
</div> | ||||
##OTHER, most Probably the PARENT OF THIS FORK | ||||
r3815 | <div style="border-top: 1px solid #EEE; margin: 5px 0px 0px 0px"> | |||
|
r3814 | <div> | ||
r3815 | ## filled with JS | |||
<div id="other_repo_desc" style="padding:5px 3px 3px 3px;"> | ||||
</div> | ||||
|
r3814 | <span style="font-size: 20px"> | ||
${h.select('other_repo',c.default_other_repo,c.other_repos,class_='refs')}:${c.default_other_repo_info['revs']} | ||||
</span> | ||||
</div> | ||||
</div> | ||||
<div style="clear:both"></div> | ||||
</div> | ||||
</div> | ||||
<div class="field"> | ||||
<div class="buttons"> | ||||
${h.submit('save',_('Send pull request'),class_="ui-btn large")} | ||||
${h.reset('reset',_('Reset'),class_="ui-btn large")} | ||||
</div> | ||||
</div> | ||||
</div> | ||||
## Reviewers | ||||
<div style="float:left; border-left:1px dashed #eee"> | ||||
<h4>${_('Pull request reviewers')}</h4> | ||||
<div id="reviewers" style="padding:0px 0px 0px 15px"> | ||||
## members goes here ! | ||||
<div class="group_members_wrap"> | ||||
<ul id="review_members" class="group_members"> | ||||
%for member in [c.default_other_repo_info['user']]: | ||||
<li id="reviewer_${member['user_id']}"> | ||||
<div class="reviewers_member"> | ||||
<div class="gravatar"><img alt="gravatar" src="${member['gravatar_link']}"/> </div> | ||||
<div style="float:left">${member['firstname']} ${member['lastname']} (${_('owner')})</div> | ||||
<input type="hidden" value="${member['user_id']}" name="review_members" /> | ||||
<span class="delete_icon action_button" onclick="removeReviewMember(${member['user_id']})"></span> | ||||
</div> | ||||
</li> | ||||
%endfor | ||||
</ul> | ||||
</div> | ||||
<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> | ||||
<div id="reviewers_container"></div> | ||||
</div> | ||||
</div> | ||||
</div> | ||||
</div> | ||||
<div style="clear:both;padding: 0 0 30px 0;"></div> | ||||
<h4>${_('Changesets')}</h4> | ||||
<div style="float:left;padding:0px 30px 30px 30px"> | ||||
## overview pulled by ajax | ||||
<div style="float:left" id="pull_request_overview"></div> | ||||
<div style="float:left;clear:both;padding:10px 10px 10px 0px;display:none"> | ||||
<a id="pull_request_overview_url" href="#">${_('Detailed compare view')}</a> | ||||
r2244 | </div> | |||
</div> | ||||
|
r3814 | <div style="clear:both;"></div> | ||
r2244 | </div> | |||
|
r3814 | |||
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 | ||||
|
r3514 | var otherrepoChanged = function(){ | ||
var sel_box = YUQ('#pull_request_form #other_repo')[0]; | ||||
var repo_name = sel_box.options[sel_box.selectedIndex].value; | ||||
r3815 | var _tmpl = "<b>${_('Destination repository')}</b>: {0}".format(other_repos_info[repo_name]['description']); | |||
YUD.get('other_repo_desc').innerHTML = _tmpl | ||||
|
r3514 | // replace options of other_ref with the ones for the current other_repo | ||
var other_ref_selector = YUD.get('other_ref'); | ||||
var new_select = YUD.createElementFromMarkup(other_repos_info[repo_name]['revs']); | ||||
var new_selectedIndex = new_select.selectedIndex; | ||||
other_ref_selector.innerHTML = ""; // clear old options | ||||
while (new_select.length > 0){ // children will be popped when appened to other_ref_selector | ||||
other_ref_selector.appendChild(new_select.children[0]); | ||||
} | ||||
// browsers lost track of selected when appendChild was used | ||||
other_ref_selector.selectedIndex = new_selectedIndex; | ||||
// reset && add the reviewer based on selected repo | ||||
var _data = other_repos_info[repo_name]; | ||||
YUD.get('review_members').innerHTML = ''; | ||||
addReviewMember(_data.user.user_id, _data.user.firstname, | ||||
_data.user.lastname, _data.user.username, | ||||
_data.user.gravatar_link); | ||||
} | ||||
r2395 | var loadPreview = function(){ | |||
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, | ||
|
r3486 | merge=True, | ||
|
r3484 | )}"; | ||
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 = { | |||
|
r3441 | 'org_repo': org_repo, | ||
'org_ref': org_ref[2], | ||||
'org_ref_type': 'rev', | ||||
'other_repo': other_repo, | ||||
'other_ref': other_ref[2], | ||||
'other_ref_type': 'rev', | ||||
r3321 | }; // gather the org/other ref and repo here | |||
r3338 | ||||
r3321 | for (k in rev_data){ | |||
r3449 | url = url.replace('__'+k+'__',rev_data[k]); | |||
r2395 | } | |||
r2434 | ||||
|
r3438 | YUD.get('pull_request_overview').innerHTML = "${_('Loading ...')}"; | ||
|
r3513 | ypjax(url,'pull_request_overview'); | ||
|
r3439 | YUD.get('pull_request_overview_url').href = url; // shouldn't have as_form ... but ... | ||
YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display',''); | ||||
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){ | ||
|
r3514 | otherrepoChanged(); | ||
|
r3326 | loadPreview(); | ||
|
r3325 | }); | ||
|
r3326 | YUE.on('other_ref', 'change', function(e){ | ||
loadPreview(); | ||||
}); | ||||
r2434 | ||||
|
r3514 | otherrepoChanged(); | ||
r2434 | //lazy load overview after 0.5s | |||
|
r3514 | setTimeout(loadPreview, 500); | ||
r2434 | ||||
r2395 | </script> | |||
r2244 | </%def> | |||