##// END OF EJS Templates
Added autocomplete widget for pull request reviewers, in exchange of 90s style...
Added autocomplete widget for pull request reviewers, in exchange of 90s style multi select widget

File last commit:

r2612:9364776d beta
r2612:9364776d beta
Show More
pullrequest.html
187 lines | 6.7 KiB | text/html | HtmlLexer
<%inherit file="/base/base.html"/>
<%def name="title()">
${c.repo_name} ${_('New pull request')}
</%def>
<%def name="breadcrumbs_links()">
${h.link_to(_(u'Home'),h.url('/'))}
&raquo;
${h.link_to(c.repo_name,h.url('changelog_home',repo_name=c.repo_name))}
&raquo;
${_('New pull request')}
</%def>
<%def name="main()">
<div class="box">
<!-- box / title -->
<div class="title">
${self.breadcrumbs()}
</div>
${h.form(url('pullrequest', repo_name=c.repo_name), method='post', id='pull_request_form')}
<div style="float:left;padding:0px 30px 30px 30px">
<div style="padding:0px 5px 5px 5px">
<span>
<a id="refresh" href="#">
<img class="icon" title="${_('Refresh')}" alt="${_('Refresh')}" src="${h.url('/images/icons/arrow_refresh.png')}"/>
${_('refresh overview')}
</a>
</span>
</div>
##ORG
<div style="float:left">
<div class="fork_user">
<div class="gravatar">
<img alt="gravatar" src="${h.gravatar_url(c.rhodecode_db_repo.user.email,24)}"/>
</div>
<span style="font-size: 20px">
${h.select('org_repo','',c.org_repos,class_='refs')}:${h.select('org_ref','',c.org_refs,class_='refs')}
</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">
<img height=32 width=32 src="${h.url('/images/arrow_right_64.png')}"/>
</div>
##OTHER, most Probably the PARENT OF THIS FORK
<div style="float:left">
<div class="fork_user">
<div class="gravatar">
<img id="other_repo_gravatar" alt="gravatar" src=""/>
</div>
<span style="font-size: 20px">
${h.select('other_repo',c.default_pull_request ,c.other_repos,class_='refs')}:${h.select('other_ref','',c.other_refs,class_='refs')}
</span>
<div id="other_repo_desc" style="padding:5px 3px 3px 42px;"></div>
</div>
<div style="clear:both;padding-top: 10px"></div>
</div>
<div style="clear:both;padding-top: 10px"></div>
## 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>
</div>
</div>
<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.review_members:
<li>
<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" />
</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>
<h3>${_('Create new pull request')}</h3>
<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">
${h.submit('save',_('Send pull request'),class_="ui-btn large")}
${h.reset('reset',_('Reset'),class_="ui-btn large")}
</div>
</div>
</div>
${h.end_form()}
</div>
<script type="text/javascript">
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);
var other_repos_info = ${c.other_repos_info|n};
var loadPreview = function(){
YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display','none');
var url = "${h.url('compare_url',
repo_name='org_repo',
org_ref_type='branch', org_ref='org_ref',
other_ref_type='branch', other_ref='other_ref',
repo='other_repo',
as_form=True)}";
var select_refs = YUQ('#pull_request_form select.refs')
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);
key = select_ref.name;
val = select_ref_data[1];
url = url.replace(key,val);
}else{
key = select_ref.name;
val = select_ref.value;
url = url.replace(key,val);
}
}
ypjax(url,'pull_request_overview', function(data){
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_gravatar').src = other_repos_info[repo_name]['gravatar'];
YUD.get('other_repo_desc').innerHTML = other_repos_info[repo_name]['description'];
})
}
YUE.on('refresh','click',function(e){
loadPreview()
})
//lazy load overview after 0.5s
setTimeout(loadPreview, 500)
</script>
</%def>