diff --git a/app/controllers/platforms/mass_builds_controller.rb b/app/controllers/platforms/mass_builds_controller.rb index 6ac94e578..e39fe770c 100644 --- a/app/controllers/platforms/mass_builds_controller.rb +++ b/app/controllers/platforms/mass_builds_controller.rb @@ -8,13 +8,19 @@ class Platforms::MassBuildsController < Platforms::BaseController def new + if params[:mass_build_id].present? + @mass_build = @platform.mass_builds.find(params[:mass_build_id]).dup + @mass_build.arches = Arch.where(name: @mass_build.arch_names.split(', ')).pluck(:id) + end + @mass_build.arches ||= @platform.platform_arch_settings.by_default.pluck(:arch_id) + @mass_build.arches.map!(&:to_s) end def show end def create - @mass_build.user, @mass_build.arches = current_user, params[:arches] + @mass_build.user, @mass_build.arches = current_user, params[:arches] || [] if @mass_build.save redirect_to(platform_mass_builds_path(@platform), notice: t("flash.platform.build_all_success")) diff --git a/app/views/platforms/mass_builds/new.html.haml b/app/views/platforms/mass_builds/new.html.haml index bf8b62bed..48583c23b 100644 --- a/app/views/platforms/mass_builds/new.html.haml +++ b/app/views/platforms/mass_builds/new.html.haml @@ -18,7 +18,7 @@ %h3= t("activerecord.attributes.build_list.arch") - Arch.recent.each do |arch| .lefter - = check_box_tag "arches[]", arch.id, (params[:arches]||[]).include?(arch.id.to_s), id: "arches_#{arch.id}" + = check_box_tag "arches[]", arch.id, @mass_build.arches.include?(arch.id.to_s), id: "arches_#{arch.id}" = label_tag "arches_#{arch.id}", arch.name .both - if @platform.personal? diff --git a/app/views/platforms/mass_builds/show.html.haml b/app/views/platforms/mass_builds/show.html.haml index bc04198e0..916ba4a02 100644 --- a/app/views/platforms/mass_builds/show.html.haml +++ b/app/views/platforms/mass_builds/show.html.haml @@ -61,3 +61,5 @@ cancel_platform_mass_build_path(@platform, @mass_build.id), method: :post, class: 'button', data: { confirm: t('layout.mass_builds.cancel_confirm') } + - if can? :create, @mass_build + = link_to t('layout.mass_builds.recreate'), new_platform_mass_build_path(@platform, mass_build_id: @mass_build.id), class: 'button' diff --git a/config/locales/models/mass_build.en.yml b/config/locales/models/mass_build.en.yml index 3701efc0d..6f86eb804 100644 --- a/config/locales/models/mass_build.en.yml +++ b/config/locales/models/mass_build.en.yml @@ -2,6 +2,7 @@ en: layout: mass_builds: new: New mass build + recreate: Recreate mass build publish_success: Publish success builds publish_test_failed: Publish test failed builds repositories: Repositories diff --git a/config/locales/models/mass_build.ru.yml b/config/locales/models/mass_build.ru.yml index 6f4b003ed..63d055bc1 100644 --- a/config/locales/models/mass_build.ru.yml +++ b/config/locales/models/mass_build.ru.yml @@ -2,6 +2,7 @@ ru: layout: mass_builds: new: Новая массовая сборка + recreate: Пересоздать массовую сборку publish_success: Опубликовать успешные сборки publish_test_failed: Опубликовать сборки с проваленными тестами repositories: Репозитории