Minor product fixes

This commit is contained in:
Alexey Nayden 2011-04-15 13:23:12 +04:00
parent c039fbc8bc
commit 38cef4d887
6 changed files with 25 additions and 12 deletions

View File

@ -36,6 +36,11 @@ class ProductsController < ApplicationController
render :template => "products/new"
end
def build
flash[:notice] = t('flash.product.build_started')
redirect_to :action => :show
end
def edit
end

View File

@ -29,14 +29,15 @@ class Product < ActiveRecord::Base
end
def can_clone?
is_template?
is_template
end
def can_build?
!is_template?
!is_template
end
def clone_from!(template)
raise "Only templates can be cloned" unless template.can_clone?
attrs = ATTRS_TO_CLONE.inject({}) {|result, attr|
result[attr] = template.send(attr)
result

View File

@ -26,9 +26,10 @@
= f.label :is_template, :class => :label
= f.check_box :is_template, :class => 'check_box'
.group
= f.label :system_wide, :class => :label
= f.check_box :system_wide, :class => 'check_box'
- content_for :commented do
.group
= f.label :system_wide, :class => :label
= f.check_box :system_wide, :class => 'check_box'
.group.navform.wat-cf
%button.button{:type => "submit"}

View File

@ -18,14 +18,17 @@
\:
= t("layout.#{@product.is_template?}_")
%p
%b
= t("activerecord.attributes.product.system_wide")
\:
= t("layout.#{@product.system_wide?}_")
- content_for :commented do
%p
%b
= t("activerecord.attributes.product.system_wide")
\:
= t("layout.#{@product.system_wide?}_")
.wat-cf
= link_to image_tag("web-app-theme/icons/application_edit.png", :alt => t("layout.edit")) + " " + t("layout.edit"), edit_platform_product_path(@platform, @product), :class => "button"
= link_to image_tag("web-app-theme/icons/cross.png", :alt => t("layout.delete")) + " " + t("layout.delete"), platform_product_path(@platform, @product), :method => "delete", :class => "button", :confirm => t("layout.products.confirm_delete")
- if @product.can_clone?
= link_to t("layout.products.clone"), clone_platform_product_path(@platform, @product), :class => "button"
= link_to t("layout.products.clone"), clone_platform_product_path(@platform, @product), :class => "button"
- if @product.can_build?
= link_to t("layout.products.build"), build_platform_product_path(@platform, @product), :class => "button"

View File

@ -59,6 +59,7 @@ ru:
new: Новый продукт
list_header: Продукты
clone: Клонировать
build: Собрать
new_header: Новый продукт
edit_header: Редактирование продукта
confirm_delete: Вы уверены, что хотите удалить этот продукт?
@ -144,6 +145,7 @@ ru:
product:
saved: Продукт успешно сохранен
save_error: Не удалось сохранить изменения
build_started: Запущена сборка продукта
platform:
saved: Платформа успешно добавлена
saved_error: Не удалось создать платформу
@ -203,7 +205,7 @@ ru:
build: Содержимое build
menu: Содержимое .menu.xml
tar: Tar.gz файл
is_template: Темплейт
is_template: Шаблон
system_wide: Общесистемный
arch:

View File

@ -10,6 +10,7 @@ Rosa::Application.routes.draw do
resources :products do
member do
get :clone
get :build
end
end