diff --git a/app/models/product.rb b/app/models/product.rb index b7e7f8067..0f5d5eca3 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -20,7 +20,8 @@ class Product < ActiveRecord::Base validates :name, :presence => true, :uniqueness => {:scope => :platform_id} validates :project_id, :presence => true validates :main_script, :params, :length => { :maximum => 255 } - validates :autostart, :numericality => true, :inclusion => {:in => AUTOSTART_STATUSES}, :allow_blank => true + validates :autostart_status, :numericality => true, + :inclusion => {:in => AUTOSTART_STATUSES}, :allow_blank => true scope :recent, order("#{table_name}.name ASC") @@ -30,7 +31,7 @@ class Product < ActiveRecord::Base :main_script, :params, :platform_id, - :autostart + :autostart_status attr_readonly :platform_id def full_clone(attrs = {}) @@ -43,12 +44,16 @@ class Product < ActiveRecord::Base end end - def human_status - self.class.human_status(status) + def human_autostart_status + self.class.human_autostart_status(autostart_status) end - def self.human_status(status) - I18n.t("layout.products.autostart_statuses.#{HUMAN_AUTOSTART_STATUSES[status]}") + def self.human_autostart_status(autostart_status) + I18n.t("layout.products.autostart_statuses.#{HUMAN_AUTOSTART_STATUSES[autostart_status]}") end + # def self.autostart_iso_builds(autostart_status) + # Product.where(:autostart_status => autostart_status) + # end + end diff --git a/app/views/platforms/products/_form.html.haml b/app/views/platforms/products/_form.html.haml index 228d249f2..e1759d958 100644 --- a/app/views/platforms/products/_form.html.haml +++ b/app/views/platforms/products/_form.html.haml @@ -12,8 +12,8 @@ = render 'def_fields', :f => f -.leftlist= f.label :autostart -.rightlist= f.select :autostart, Product::AUTOSTART_STATUSES.collect{|status| [Product.human_status(status), status]}, {:include_blank => true, :selected => @product.autostart} +.leftlist= f.label :autostart_status +.rightlist= f.select :autostart_status, Product::AUTOSTART_STATUSES.collect{|status| [Product.human_autostart_status(status), status]}, {:include_blank => true, :selected => @product.autostart_status} .both .button_block diff --git a/config/locales/models/product.en.yml b/config/locales/models/product.en.yml index cb7889a7e..df3d3f26d 100644 --- a/config/locales/models/product.en.yml +++ b/config/locales/models/product.en.yml @@ -29,7 +29,7 @@ en: product: Product attributes: product: - autostart: Autostart + autostart_status: Autostart name: Name description: Description platform_id: Platform diff --git a/config/locales/models/product.ru.yml b/config/locales/models/product.ru.yml index ed41793dc..a96929744 100644 --- a/config/locales/models/product.ru.yml +++ b/config/locales/models/product.ru.yml @@ -29,7 +29,7 @@ ru: product: Продукт attributes: product: - autostart: Автостарт + autostart_status: Автостарт name: Название description: Описание platform_id: Платформа diff --git a/db/migrate/20130322132919_autostart_iso_build_on_regular_basis.rb b/db/migrate/20130322132919_autostart_iso_build_on_regular_basis.rb index a52c4877b..e60b17fe5 100644 --- a/db/migrate/20130322132919_autostart_iso_build_on_regular_basis.rb +++ b/db/migrate/20130322132919_autostart_iso_build_on_regular_basis.rb @@ -1,6 +1,6 @@ class AutostartIsoBuildOnRegularBasis < ActiveRecord::Migration def change - add_column :products, :autostart, :integer, :default => nil + add_column :products, :autostart_status, :integer, :default => nil add_column :product_build_lists, :not_delete, :boolean, :default => false add_column :product_build_lists, :autostarted, :boolean, :default => false end diff --git a/db/schema.rb b/db/schema.rb index 355e77730..ce331079b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -321,8 +321,8 @@ ActiveRecord::Schema.define(:version => 20130322132919) do add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id" create_table "products", :force => true do |t| - t.string "name", :null => false - t.integer "platform_id", :null => false + t.string "name", :null => false + t.integer "platform_id", :null => false t.datetime "created_at" t.datetime "updated_at" t.text "description" @@ -330,7 +330,7 @@ ActiveRecord::Schema.define(:version => 20130322132919) do t.string "params" t.string "main_script" t.integer "time_living" - t.integer "autostart" + t.integer "autostart_status" end create_table "project_imports", :force => true do |t|