Merge pull request #403 from warpc/223-change_build_lists_new_js_handlers

[refs #223] Add platform branch auto select if this branch exist
This commit is contained in:
Vladimir Sharshov 2012-04-16 10:00:53 -07:00
commit c339f2aee0
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');
}
}
}