diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index 3a2f8a3db..b3f46e349 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -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 diff --git a/app/models/product.rb b/app/models/product.rb index 81d9f9b6b..7d0a59bcb 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -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 diff --git a/app/views/products/_form.html.haml b/app/views/products/_form.html.haml index c1adb5a64..dc339a1be 100644 --- a/app/views/products/_form.html.haml +++ b/app/views/products/_form.html.haml @@ -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"} diff --git a/app/views/products/show.html.haml b/app/views/products/show.html.haml index 240ad6500..e64fc6382 100644 --- a/app/views/products/show.html.haml +++ b/app/views/products/show.html.haml @@ -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" \ No newline at end of file + = 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" diff --git a/config/locales/ru.yml b/config/locales/ru.yml index db0ec1a3a..8d1e32347 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -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: diff --git a/config/routes.rb b/config/routes.rb index 0c3a57aaa..cada5fda7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,6 +10,7 @@ Rosa::Application.routes.draw do resources :products do member do get :clone + get :build end end