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:
commit
c339f2aee0
|
@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue