Merge pull request #222 from warpc/221-delete_product_build_list

[Refs #221] Delete product build lists (only in web)
This commit is contained in:
Pasha 2012-02-27 12:11:06 -08:00
commit ab2398de53
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]
@ -20,6 +20,12 @@ class ProductBuildListsController < ApplicationController
@product_build_list.save!
render :nothing => true
end
def destroy
@product_build_list.destroy
flash[:notice] = t('flash.product.build_list_delete')
redirect_to [@platform, @product]
end
protected

View File

@ -81,7 +81,8 @@ 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
can [:read, :create], PrivateUser, :platform => {:owner_type => 'User', :owner_id => user.id}

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

@ -43,7 +43,8 @@
%th.first= t("activerecord.attributes.product_build_list.id")
%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("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

@ -519,6 +519,8 @@ en:
project_versions: Versions
product_build_lists:
delete: Delete
action: Action
statuses:
'0': 'build'
'1': 'build error'
@ -662,6 +664,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

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

View File

@ -85,7 +85,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