Files
@ f787c028ffc0
Branch filter:
Location: kallithea/kallithea/templates/pullrequests/pullrequest.html
f787c028ffc0
7.3 KiB
text/html
utils: drop conditional_cache - an unused beaker cache
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | <%inherit file="/base/base.html"/>
<%block name="title">
${c.repo_name} ${_('New Pull Request')}
</%block>
<%def name="breadcrumbs_links()">
${_('New Pull Request')}
</%def>
<%block name="header_menu">
${self.menu('repositories')}
</%block>
<%def name="main()">
${self.repo_context_bar('showpullrequest')}
<div class="panel panel-primary">
<div class="panel-heading clearfix">
${self.breadcrumbs()}
</div>
${h.form(url('pullrequest', repo_name=c.repo_name), method='post', id='pull_request_form')}
<div class="form panel-body">
<div class="settings clearfix">
<div class="form-group">
<label class="control-label" for="pullrequest_title">${_('Title')}:</label>
<div>
${h.text('pullrequest_title',class_='form-control',placeholder=_('Summarize the changes - or leave empty'))}
</div>
</div>
<div class="form-group">
<label class="control-label" for="pullrequest_desc">${_('Description')}:</label>
<div>
${h.textarea('pullrequest_desc',class_='form-control',placeholder=_('Write a short description on this pull request'))}
</div>
</div>
<div class="form-group">
<label class="control-label">${_('Changeset flow')}:</label>
<div class="clearfix">
##ORG
<div>
<div>
<div>
<b>${_('Origin repository')}:</b> <span id="org_repo_desc">${c.db_repo.description.split('\n')[0]}</span>
</div>
<div>
${h.select('org_repo','',c.cs_repos,class_='refs')}:${h.select('org_ref',c.default_cs_ref,c.cs_refs,class_='refs')}
</div>
<div>
<b>${_('Revision')}:</b> <span id="org_rev_span">-</span>
</div>
</div>
</div>
##OTHER, most Probably the PARENT OF THIS FORK
<div>
<div>
## filled with JS
<div>
<b>${_('Destination repository')}:</b> <span id="other_repo_desc">${c.a_repo.description.split('\n')[0]}</span>
</div>
<div>
${h.select('other_repo',c.a_repo.repo_name,c.a_repos,class_='refs')}:${h.select('other_ref',c.default_a_ref,c.a_refs,class_='refs')}
</div>
<div>
<b>${_('Revision')}:</b> <span id="other_rev_span">-</span>
</div>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="buttons">
${h.submit('save',_('Create Pull Request'),class_="btn btn-default")}
${h.reset('reset',_('Reset'),class_="btn btn-default")}
</div>
</div>
</div>
<div>
<h4>${_('Changesets')}</h4>
## overview pulled by ajax
<div id="pull_request_overview"></div>
</div>
</div>
${h.end_form()}
</div>
<script src="${h.url('/js/graph.js', ver=c.kallithea_version)}"></script>
<script>'use strict';
pyroutes.register('pullrequest_repo_info', ${h.js(url('pullrequest_repo_info',repo_name='%(repo_name)s'))}, ['repo_name']);
var pendingajax = undefined;
function otherrepoChanged(){
var $other_ref = $('#other_ref');
$other_ref.prop('disabled', true);
var repo_name = $('#other_repo').val();
if (pendingajax) {
pendingajax.abort();
pendingajax = undefined;
}
pendingajax = ajaxGET(pyroutes.url('pullrequest_repo_info', {"repo_name": repo_name}),
function(data){
pendingajax = undefined;
$('#other_repo_desc').html(data.description);
// replace options of other_ref with the ones for the current other_repo
$other_ref.empty();
for(var i = 0; i < data.refs.length; i++)
{
var $optgroup = $('<optgroup/>').prop('label', data.refs[i][1]);
var options = data.refs[i][0];
var length = options.length;
for(var j = 0; j < length; j++)
{
$optgroup.append($('<'+'option/>').text(options[j][1]).val(options[j][0]));
}
$other_ref.append($optgroup);
}
$other_ref.val(data.selected_ref);
// re-populate the select2 thingy
$("#other_ref").select2({
dropdownAutoWidth: true
});
$other_ref.prop('disabled', false);
loadPreview();
});
}
function loadPreview(){
//url template
var url = ${h.js(h.url('compare_url',
repo_name='__other_repo__',
org_ref_type='rev',
org_ref_name='__other_ref_name__',
other_repo='__org_repo__',
other_ref_type='rev',
other_ref_name='__org_ref_name__',
is_ajax_preview=True,
merge=True,
))};
var org_repo = $('#pull_request_form #org_repo').val();
var org_ref = $('#pull_request_form #org_ref').val().split(':');
## TODO: make nice link like link_to_ref() do
$('#org_rev_span').html(org_ref[2].substr(0,12));
var other_repo = $('#pull_request_form #other_repo').val();
var other_ref = $('#pull_request_form #other_ref').val().split(':');
$('#other_rev_span').html(other_ref[2].substr(0,12));
var rev_data = {
'__org_repo__': org_repo,
'__org_ref_name__': org_ref[2],
'__other_repo__': other_repo,
'__other_ref_name__': other_ref[2]
}; // gather the org/other ref and repo here
for (let k in rev_data){
url = url.replace(k,rev_data[k]);
}
if (pendingajax) {
pendingajax.abort();
pendingajax = undefined;
}
pendingajax = asynchtml(url, $('#pull_request_overview'), function(){
pendingajax = undefined;
});
}
$(document).ready(function(){
$("#org_repo").select2({
dropdownAutoWidth: true
});
## (org_repo can't change)
$("#org_ref").select2({
dropdownAutoWidth: true,
maxResults: 50,
sortResults: branchSort
});
$("#org_ref").on("change", function(){
loadPreview();
});
$("#other_repo").select2({
dropdownAutoWidth: true
});
$("#other_repo").on("change", function(){
otherrepoChanged();
});
$("#other_ref").select2({
dropdownAutoWidth: true,
maxResults: 50,
sortResults: branchSort
});
$("#other_ref").on("change", function(){
loadPreview();
});
//lazy load overview after 0.5s
setTimeout(loadPreview, 500);
});
</script>
</%def>
|