Merge branch 'master' into 3.2-master

This commit is contained in:
Pavel Chipiga 2012-02-27 22:34:21 +02:00
commit 70963d0943
7 changed files with 21 additions and 6 deletions

View File

@ -1,9 +1,9 @@
# -*- encoding : utf-8 -*-
class ProductBuildListsController < ApplicationController
before_filter :authenticate_user!, :except => [:status_build]
load_and_authorize_resource :platform, :only => [:create]
load_and_authorize_resource :product, :through => :platform, :only => [:create]
load_and_authorize_resource :product_build_list, :through => :product, :only => [:create]
load_and_authorize_resource :platform, :only => [:create, :destroy]
load_and_authorize_resource :product, :through => :platform, :only => [:create, :destroy]
load_and_authorize_resource :product_build_list, :through => :product, :only => [:create, :destroy]
before_filter :authenticate_product_builder!, :only => [:status_build]
before_filter :find_product_build_list, :only => [:status_build]
@ -21,6 +21,12 @@ class ProductBuildListsController < ApplicationController
render :nothing => true
end
def destroy
@product_build_list.destroy
flash[:notice] = t('flash.product.build_list_delete')
redirect_to [@platform, @product]
end
protected
def find_product_build_list

View File

@ -81,6 +81,7 @@ class Ability
can :read, Product, :platform => {:owner_type => 'Group', :owner_id => user.group_ids}
can(:manage, Product, read_relations_for('products', 'platforms')) {|product| local_admin? product.platform}
can(:create, ProductBuildList) {|pbl| pbl.product.can_build? and can?(:update, pbl.product)}
can(:destroy, ProductBuildList) {|pbl| can?(:destroy, pbl.product)}
can [:read, :platforms], Category

View File

@ -3,4 +3,5 @@
%td= link_to product_build_list.product.name, [product_build_list.product.platform, product_build_list.product]
%td= link_to nil, product_build_list.container_path
%td= product_build_list.human_status
%td= link_to t("layout.product_build_lists.delete"), platform_product_product_build_list_path(product_build_list.product.platform, product_build_list.product, product_build_list), :method => "delete", :confirm => t("layout.confirm") if can? :delete, product_build_list
%td= product_build_list.notified_at

View File

@ -44,6 +44,7 @@
%th= t("activerecord.attributes.product_build_list.product")
%th= t("activerecord.attributes.product_build_list.container_path")
%th= t("activerecord.attributes.product_build_list.status")
%th= t("layout.product_build_lists.action")
%th.last= t("activerecord.attributes.product_build_list.notified_at")
= render @product.product_build_lists.default_order
/ = will_paginate build_lists

View File

@ -431,6 +431,8 @@ en:
project_versions: Versions
product_build_lists:
delete: Delete
action: Action
statuses:
'0': 'build'
'1': 'build error'
@ -574,6 +576,7 @@ en:
save_error: Product saves error
build_started: Product build started
destroyed: Product deleted
build_list_delete: Product build list deleted
platform:
saved: Platform saved

View File

@ -298,6 +298,8 @@ ru:
project_versions: Версии
product_build_lists:
delete: Удалить
action: Действие
statuses:
'0': 'собран'
'1': 'ошибка сборки'
@ -446,6 +448,7 @@ ru:
save_error: Не удалось сохранить изменения
build_started: Запущена сборка продукта
destroyed: Продукт удален
build_list_delete: Сборочный лист продукта удален
platform:
saved: Платформа успешно добавлена

View File

@ -86,7 +86,7 @@ Rosa::Application.routes.draw do
# get :clone
# get :build
# end
resources :product_build_lists, :only => [:create]
resources :product_build_lists, :only => [:create, :destroy]
end
resources :repositories