[refs #223] Choosen rep auto set

This commit is contained in:
konstantin.grabar 2012-04-10 13:05:42 +04:00
parent 5b884e9d40
commit d6dc51ba93
2 changed files with 6 additions and 7 deletions

View File

@ -3,30 +3,29 @@ $(document).ready(function() {
var platform_id = $(this).val();
var base_platforms = $('.all_platforms input[type=checkbox].build_bpl_ids');
//$('#include_repos').html($('.preloaded_include_repos .include_repos_' + platform_id).html());
base_platforms.each(function(){
if ($.inArray(platform_id, base_platforms.map(function(){ return $(this).val() }).get()) >= 0) {
if ($(this).val() == platform_id) {
$(this).attr('checked', 'checked');
$(this).removeAttr('disabled');
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled');
if ($(this).parent().find('.offset25 label').text() == 'main') {
$(this).parent().find('.offset25 input[type="checkbox"]').attr('checked', 'checked');
var rep_name = $('#build_list_pl_id option[value="' + $(this).val() + '"]').text().match(/[\w-]+\/([\w-]+)/)[1];
if (rep_name != 'main') {
$(this).parent().find('.offset25 input[type="checkbox"][rep_name="' + rep_name + '"]').attr('checked', 'checked');
}
$(this).parent().find('.offset25 input[type="checkbox"][rep_name="main"]').attr('checked', 'checked');
} else {
$(this).removeAttr('checked');
$(this).attr('disabled', 'disabled');
$(this).parent().find('.offset25 input[type="checkbox"]').attr('disabled', 'disabled');
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('checked');
}
//$('.additional_pl').parent().find('.offset25 input[type="checkbox"]').attr('disabled', 'disabled');
} else {
$(this).removeAttr('disabled');
$(this).removeAttr('checked');
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled');
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('checked');
//$('.additional_pl').parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled');
}
});
});

View File

@ -1,4 +1,4 @@
- platform.repositories.each do |repo|
.both
= check_box_tag "build_list[include_repos][]", repo.id, repo.name == 'main' || @project.repositories.map(&:id).include?(repo.id), :id => "include_repos_#{repo.id}", :pl_id => platform.id
= check_box_tag "build_list[include_repos][]", repo.id, repo.name == 'main' || @project.repositories.map(&:id).include?(repo.id), :id => "include_repos_#{repo.id}", :pl_id => platform.id, :rep_name => repo.name
= label_tag "include_repos_#{repo.id}", repo.name