Product deletion

This commit is contained in:
Alexey Nayden 2011-04-28 14:23:52 +04:00
parent 8df5bdda14
commit babed29a53
2 changed files with 9 additions and 2 deletions

View File

@ -1,7 +1,7 @@
class ProductsController < ApplicationController
before_filter :authenticate_user!, :except => [:product_status]
before_filter :find_product, :only => [:show, :edit, :update, :build, :product_status]
before_filter :find_platform, :except => [:product_status, :build]
before_filter :find_product, :only => [:show, :edit, :update, :build, :product_status, :destroy]
before_filter :find_platform, :except => [:product_status, :build, :destroy]
def product_status
@product.build_status = params[:status] == "0" ? Product::BUILD_COMPLETED : Product::BUILD_FAILED
@ -59,6 +59,12 @@ class ProductsController < ApplicationController
def show
end
def destroy
@product.destroy
flash[:notice] = t("flash.product.destroyed")
redirect_to @platform
end
protected
def find_product_by_name

View File

@ -147,6 +147,7 @@ ru:
saved: Продукт успешно сохранен
save_error: Не удалось сохранить изменения
build_started: Запущена сборка продукта
destroyed: Продукт удален
platform:
saved: Платформа успешно добавлена
saved_error: Не удалось создать платформу