#316: added chekbox into #new action for attaching testing subrepo

This commit is contained in:
Vokhmin Alexey V 2013-11-07 19:49:43 +04:00
parent 49ecbe9280
commit b3ba6555e2
8 changed files with 22 additions and 9 deletions

View File

@ -82,7 +82,7 @@ class Ability
can [:read, :log, :related, :everything], BuildList, :project => {:owner_type => 'Group', :owner_id => user.group_ids}
can([:read, :log, :everything, :list], BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project}
can(:publish_into_testing, BuildList) { |build_list| can?(:create, build_list) }
can(:publish_into_testing, BuildList) { |build_list| can?(:create, build_list) && build_list.save_to_platform.main? }
can(:create, BuildList) {|build_list|
build_list.project.is_package &&
can?(:write, build_list.project) &&

View File

@ -56,7 +56,8 @@ class BuildList < ActiveRecord::Base
attr_accessible :include_repos, :auto_publish, :build_for_platform_id, :commit_hash,
:arch_id, :project_id, :save_to_repository_id, :update_type,
:save_to_platform_id, :project_version, :auto_create_container,
:extra_repositories, :extra_build_lists, :extra_params, :external_nodes
:extra_repositories, :extra_build_lists, :extra_params, :external_nodes,
:include_testing_subrepository
LIVE_TIME = 4.week # for unpublished
MAX_LIVE_TIME = 3.month # for published
@ -449,6 +450,7 @@ class BuildList < ActiveRecord::Base
), "#{repo.platform.name}_#{repo.name}_"
h["#{prefix}release"] = insert_token_to_path(path + 'release', repo.platform)
h["#{prefix}updates"] = insert_token_to_path(path + 'updates', repo.platform) if repo.platform.main?
h["#{prefix}testing"] = insert_token_to_path(path + 'testing', repo.platform) if include_testing_subrepository?
end
end
host = EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host]

View File

@ -43,7 +43,7 @@
.both
%h3= t("activerecord.attributes.build_list.preferences")
- [:auto_publish, :auto_create_container].each do |kind|
- [:auto_publish, :auto_create_container, :include_testing_subrepository].each do |kind|
.both
- checked, field = params[:build_list].try(:[], kind), "build_list[#{kind}]"
= hidden_field_tag field, false, :id => nil

View File

@ -39,6 +39,9 @@
.rightlist
= link_to "#{@build_list.save_to_platform.name}/#{@build_list.save_to_repository.name}", [@build_list.save_to_platform, @build_list.save_to_repository]
.both
.leftlist= t("activerecord.attributes.build_list.include_testing_subrepository")
.rightlist= t("layout.#{@build_list.include_testing_subrepository?}_")
.both
.leftlist= t("activerecord.attributes.build_list.include_repos")
.rightlist= (@build_list.include_repos||[]).map{|r| Repository.find(r).name}.join(', ')
.both

View File

@ -21,6 +21,7 @@ en:
is_circle: Recurrent build
updated_at: Notified at
additional_repos: Additional repositories
include_testing_subrepository: "Include 'testing' subrepository"
include_repos: Included repositories
created_at: Created on
save_to_repository: Save to repository

View File

@ -21,6 +21,7 @@ ru:
is_circle: Циклическая сборка
updated_at: Информация получена
additional_repos: Дополнительные репозитории
include_testing_subrepository: "Подключить 'testing' подрепозиторий"
include_repos: Подключаемые репозитории
created_at: Создан
save_to_repository: Сохранить в репозиторий

View File

@ -0,0 +1,5 @@
class AddUseTestingRepoToBuildList < ActiveRecord::Migration
def change
add_column :build_lists, :include_testing_subrepository, :boolean
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20131022082416) do
ActiveRecord::Schema.define(:version => 20131107152408) do
create_table "activity_feeds", :force => true do |t|
t.integer "user_id", :null => false
@ -141,6 +141,7 @@ ActiveRecord::Schema.define(:version => 20131022082416) do
t.text "extra_params"
t.string "external_nodes"
t.integer "builder_id"
t.boolean "include_testing_subrepository"
end
add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id"