#880: add option "Publish again" for build list

This commit is contained in:
Vokhmin Alexey V 2013-02-01 18:39:17 +04:00
parent 3f3edfe1d9
commit 973fabb31f
5 changed files with 21 additions and 9 deletions

View File

@ -82,7 +82,12 @@ class Ability
can([:create, :update], BuildList) {|build_list| build_list.project.is_package && can?(:write, build_list.project)}
can(:publish, BuildList) do |build_list|
build_list.save_to_repository.publish_without_qa ? can?(:write, build_list.project) : local_admin?(build_list.save_to_platform)
if build_list.build_published?
local_admin?(build_list.save_to_platform)
else
build_list.save_to_repository.publish_without_qa ?
can?(:write, build_list.project) : local_admin?(build_list.save_to_platform)
end
end
can([:reject_publish, :create_container], BuildList) do |build_list|
local_admin?(build_list.save_to_platform)

View File

@ -188,6 +188,7 @@ class BuildList < ActiveRecord::Base
event :publish do
transition [:success, :failed_publish] => :build_publish
transition [:success, :failed_publish] => :failed_publish
transition :published => :build_publish
end
event :reject_publish do

View File

@ -133,14 +133,16 @@
- if @build_list.build_started?
= render 'shared/log', { :build_started => true, :get_log_path => log_build_list_path(@build_list) }
- if (can_publish = @build_list.can_publish? && can?(:publish, @build_list))
.hr
= submit_tag t("layout.publish"), :confirm => t("layout.confirm"), :name => 'publish' if can_publish
- if @build_list.can_reject_publish? && can?(:reject_publish, @build_list)
= submit_tag t("layout.reject_publish"), :confirm => t("layout.confirm"), :name => 'reject_publish'
- if @build_list.can_create_container? && can?(:create_container, @build_list)
= link_to t("layout.build_lists.create_container"), create_container_build_list_path(@build_list),
:method => :put, :confirm => t("layout.confirm"), :class => 'button'
- if can?(:publish, @build_list)
- if @build_list.build_published?
= submit_tag t("layout.publish_again"), :confirm => t("layout.publish_again_warning"), :name => 'publish'
- elsif @build_list.can_publish?
= submit_tag t("layout.publish"), :confirm => t("layout.confirm"), :name => 'publish'
- if @build_list.can_reject_publish? && can?(:reject_publish, @build_list)
= submit_tag t("layout.reject_publish"), :confirm => t("layout.confirm"), :name => 'reject_publish'
- if @build_list.can_create_container? && can?(:create_container, @build_list)
= link_to t("layout.build_lists.create_container"), create_container_build_list_path(@build_list),
:method => :put, :confirm => t("layout.confirm"), :class => 'button'
.hr
%h3= t("layout.build_lists.items_header")

View File

@ -37,6 +37,8 @@ en:
true_: True
false_: False
publish: Publish
publish_again: Publish again
publish_again_warning: Secondary publication will be able to break relationships in the repository. Be careful!
reject_publish: Reject
add: Add
upload: Upload

View File

@ -37,6 +37,8 @@ ru:
true_: Да
false_: Нет
publish: Опубликовать
publish_again: Опубликовать снова
publish_again_warning: Повторная публикация может привести к нарушению зависимостей в репозитории. Будьте осторожны!
reject_publish: Отклонить
add: Добавить
upload: Загрузить