From 02a9a46b603b5400dde241351bb39d7c802bc369 Mon Sep 17 00:00:00 2001 From: Vladimir Sharshov Date: Thu, 15 Sep 2011 21:56:20 +0400 Subject: [PATCH] Add publish function for BuildList --- app/controllers/build_lists_controller.rb | 13 ++++++++++--- app/controllers/platforms_controller.rb | 1 + app/mailers/user_mailer.rb | 2 ++ app/models/build_list.rb | 5 +++++ app/models/platform.rb | 2 +- app/views/build_lists/show.html.haml | 2 ++ config/locales/ru.yml | 2 ++ config/routes.rb | 3 +++ 8 files changed, 26 insertions(+), 4 deletions(-) diff --git a/app/controllers/build_lists_controller.rb b/app/controllers/build_lists_controller.rb index 428b5ccc8..2fcd2b272 100644 --- a/app/controllers/build_lists_controller.rb +++ b/app/controllers/build_lists_controller.rb @@ -1,9 +1,9 @@ class BuildListsController < ApplicationController before_filter :authenticate_user!, :except => [:status_build, :pre_build, :post_build, :circle_build, :new_bbdt] before_filter :authenticate_build_service!, :only => [:status_build, :pre_build, :post_build, :circle_build, :new_bbdt] - before_filter :find_platform, :only => [:index, :filter, :show] - before_filter :find_repository, :only => [:index, :filter, :show] - before_filter :find_project, :only => [:index, :filter, :show] + before_filter :find_platform, :only => [:index, :filter, :show, :publish] + before_filter :find_repository, :only => [:index, :filter, :show, :publish] + before_filter :find_project, :only => [:index, :filter, :show, :publish] before_filter :find_arches, :only => [:index, :filter] before_filter :find_branches, :only => [:index, :filter] @@ -25,6 +25,13 @@ class BuildListsController < ApplicationController @build_list = @project.build_lists.find(params[:id]) @item_groups = @build_list.items.group_by_level end + + def publish + @build_list = @project.build_lists.find(params[:id]) + @build_list.publish + + redirect_to platform_repository_project_build_lists_path(@platform, @repository, @project) + end def status_build @item = @build_list.items.find_by_name!(params[:package_name]) diff --git a/app/controllers/platforms_controller.rb b/app/controllers/platforms_controller.rb index be02bd95a..fb508a727 100644 --- a/app/controllers/platforms_controller.rb +++ b/app/controllers/platforms_controller.rb @@ -1,3 +1,4 @@ +# coding: UTF-8 class PlatformsController < ApplicationController before_filter :authenticate_user! diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 5bc3173cb..3137b0dff 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -1,3 +1,5 @@ +# coding: UTF-8 + class UserMailer < ActionMailer::Base default :from => APP_CONFIG['no-reply-email'] diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 9803acd88..c119aa659 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -81,6 +81,11 @@ class BuildList < ActiveRecord::Base end end end + + def publish + BuildServer.publish_container bs_id + self.delete + end private def set_default_status diff --git a/app/models/platform.rb b/app/models/platform.rb index 65cca82a3..a0a6bf8ca 100644 --- a/app/models/platform.rb +++ b/app/models/platform.rb @@ -1,4 +1,4 @@ -require 'lib/build_server.rb' +#require 'lib/build_server.rb' class Platform < ActiveRecord::Base belongs_to :parent, :class_name => 'Platform', :foreign_key => 'parent_platform_id' has_many :repositories, :dependent => :destroy diff --git a/app/views/build_lists/show.html.haml b/app/views/build_lists/show.html.haml index 5e6b6fc2c..1f0c18c26 100644 --- a/app/views/build_lists/show.html.haml +++ b/app/views/build_lists/show.html.haml @@ -58,6 +58,8 @@ = t("activerecord.attributes.build_list.additional_repos") \: = @build_list.additional_repos + .wat-cf + = link_to image_tag("web-app-theme/icons/cross.png", :alt => t("layout.publish")) + " " + t("layout.publish"), publish_platform_repository_project_build_list(@platform, @repository, @project, @build_list), :method => "post", :class => "button", :confirm => t("layout.build_lists.confirm_publish") .block .content diff --git a/config/locales/ru.yml b/config/locales/ru.yml index da2422d12..69248a18c 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -19,6 +19,7 @@ ru: no_: Нет true_: Да false_: Нет + publish: Опубликовать weekdays: Monday: Понедельник @@ -143,6 +144,7 @@ ru: items_header: Элементы сборки no_items_data: Данных нет show: Просмотр + confirm_publish: Вы уверены, что хотите опубликовать контейнер? items: statuses: diff --git a/config/routes.rb b/config/routes.rb index 1ffa8919e..151faf1b1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -23,6 +23,9 @@ Rosa::Application.routes.draw do get :recent post :filter end + member do + post :publish + end end member do