show update pull request button when change branch refs

This commit is contained in:
Alexander Machehin 2013-10-22 16:02:02 +06:00
parent 82e285023e
commit 39c8ea7854
1 changed files with 9 additions and 6 deletions

View File

@ -2,17 +2,20 @@ $(document).ready(function() {
var upd_action = $('#update_action').val(); var upd_action = $('#update_action').val();
var form = $('#new_pull_request'); var form = $('#new_pull_request');
function updatePull(event, data) {
form.attr('action', upd_action)
.attr('method', 'get');
$('#update_pull').fadeIn('fast');
$('#create_pull').fadeOut('fast');
};
$('#pull_request_to_project').on('autocompleteselect', function(event, data){ $('#pull_request_to_project').on('autocompleteselect', function(event, data){
var ref = $('#to_ref'); var ref = $('#to_ref');
ref.parent().load(data.item.get_refs_url+' #to_ref', {"selected": ref.val()}); ref.parent().load(data.item.get_refs_url+' #to_ref', {"selected": ref.val()});
}); });
$('#pull_request_to_project, input#to_refs, input#from_refs').on('autocompleteselect', function(event, data){ $('#pull_request_to_project').on('autocompleteselect', updatePull);
form.attr('action', upd_action) $('select#to_ref, select#from_ref').on('change', updatePull);
.attr('method', 'get');
$('#update_pull').fadeIn('fast');
$('#create_pull').fadeOut('fast');
});
$('#pull_tabs a').on('click', function (e) { $('#pull_tabs a').on('click', function (e) {
var href = $(this).attr("href"); var href = $(this).attr("href");