Add BuildList status validation. Change publish logic and btn icon

This commit is contained in:
konstantin.grabar 2011-11-11 14:38:17 +04:00
parent 3a8f928efc
commit 8449b5b826
3 changed files with 9 additions and 2 deletions

View File

@ -16,12 +16,17 @@ class BuildList < ActiveRecord::Base
validate lambda {
errors.add(:bpl, I18n.t('flash.build_list.wrong_platform')) if pl.platform_type == 'main' && pl_id != bpl_id
}
validate lambda {
errors.add(:bpl, I18n.t('flash.build_list.can_not_published')) if status == BUILD_PUBLISHED && status_was != BuildServer::SUCCESS
}
BUILD_CANCELED = 5000
WAITING_FOR_RESPONSE = 4000
BUILD_PENDING = 2000
BUILD_STARTED = 3000
TEST_FAILD = 2
BUILD_PUBLISHED = 6000
STATUSES = [WAITING_FOR_RESPONSE,
BuildServer::SUCCESS,
@ -103,7 +108,8 @@ class BuildList < ActiveRecord::Base
return false unless can_published?
BuildServer.publish_container bs_id
self.destroy # self.delete
self.update_attribute(:status, BUILD_PUBLISHED)
#self.destroy # self.delete
end
def can_published?

View File

@ -77,7 +77,7 @@
- if @build_list.can_published?
.wat-cf
= link_to image_tag("web-app-theme/icons/cross.png", :alt => t("layout.publish")) + " " + t("layout.publish"), publish_project_build_list_path(@project, @build_list), :method => "post", :class => "button", :confirm => t("layout.build_lists.confirm_publish")
= link_to image_tag("web-app-theme/icons/tick.png", :alt => t("layout.publish")) + " " + t("layout.publish"), publish_project_build_list_path(@project, @build_list), :method => "post", :class => "button", :confirm => t("layout.build_lists.confirm_publish")
.block
.content

View File

@ -376,6 +376,7 @@ ru:
no_arch_selected: Выберите хотя бы одну ахритектуру
no_arch_found: Выбранные ахритектуры не найдены
wrong_platform: Для основного репозитория (main) может быть выбран только его же основная платформа!
can_not_published: Опубликовать сборку можно только со статусом "Собран"
attributes:
password: Пароль