diff --git a/app/assets/javascripts/extra/build_list.js b/app/assets/javascripts/extra/build_list.js index 2bba78d7c..39f62ec98 100644 --- a/app/assets/javascripts/extra/build_list.js +++ b/app/assets/javascripts/extra/build_list.js @@ -1,6 +1,6 @@ $(document).ready(function() { // TODO: Refactor this handler!! It's too complicated. - $('#build_list_save_to_repository_id').change(function() { + $('#build_list_save_to_repository_id').on("change", function() { var selected_option = $(this).find("option:selected"); var platform_id = selected_option.attr('platform_id'); @@ -40,8 +40,9 @@ $(document).ready(function() { } }); - $('#build_list_save_to_repository_id').trigger('change'); - + if($('#from_build_list_id').size() > 0) { + $('#build_list_save_to_repository_id').trigger('change'); + } var ownership_btn = $('.btn.ownership'); ownership_btn.click(function() { diff --git a/app/views/projects/build_lists/new.html.haml b/app/views/projects/build_lists/new.html.haml index 00efe7b6c..68e9f9965 100644 --- a/app/views/projects/build_lists/new.html.haml +++ b/app/views/projects/build_lists/new.html.haml @@ -16,7 +16,8 @@ %h3= t("activerecord.attributes.build_list.arch") - Arch.recent.each do |arch| .both - = check_box_tag "arches[]", arch.id, (params[:arches]||[]).include?(arch.id.to_s) || (controller.action_name == 'new' && Arch::DEFAULT.include?(arch.name)), :id => "arches_#{arch.id}" + - checked = (params[:arches]||[]).include?(arch.id.to_s) || (params[:arches].blank? && controller.action_name == 'new' && Arch::DEFAULT.include?(arch.name)) + = check_box_tag "arches[]", arch.id, checked, :id => "arches_#{arch.id}" = label_tag "arches_#{arch.id}", arch.name %h3= t('activerecord.attributes.build_list.update_type') - selected = params[:build_list].try(:fetch, :update_type) ? {:selected => params[:build_list][:update_version]} : {} @@ -43,6 +44,7 @@ = check_box_tag "build_list[#{kind}]", checked, checked = f.label kind %br + = hidden_field_tag :from_build_list_id, params[:build_list_id] = f.submit t('layout.projects.build_button'), :data => {'disable-with' => t('layout.processing')} .both %br