[refs #223] Add branch auto select

This commit is contained in:
konstantin.grabar 2012-04-16 20:06:34 +04:00
parent 40090f0903
commit d24422f757
1 changed files with 16 additions and 0 deletions

View File

@ -23,6 +23,8 @@ $(document).ready(function() {
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled').removeAttr('checked');
}
});
setBranchSelected();
});
$('#build_list_pl_id').trigger('change');
@ -47,3 +49,17 @@ function setPlChecked(pointer, checked) {
pl_cbx.removeAttr('checked');
}
}
function setBranchSelected() {
var pl_id = $('#build_list_pl_id').val();
// Checks if selected platform is main or not:
if ( $('.all_platforms').find('input[type="checkbox"][value=' + pl_id + '].build_bpl_ids').size() > 0 ) {
var pl_name = $('#build_list_pl_id option[value="' + pl_id + '"]').text().match(/([\w-]+)\/[\w-]+/)[1];
var branch_pl_opt = $('#build_list_project_version option[value="latest_' + pl_name + '"]');
// If there is branch we need - set it selected:
if ( branch_pl_opt.size() > 0 ) {
$('#build_list_project_version option[selected]').removeAttr('selected');
branch_pl_opt.attr('selected', 'selected');
}
}
}