Added distr_type to platform.

This commit is contained in:
George Vinogradov 2011-10-27 20:31:54 +04:00
parent 37c37f5cbd
commit 98f300302d
3 changed files with 8 additions and 0 deletions

View File

@ -15,6 +15,7 @@ class Platform < ActiveRecord::Base
validates :name, :presence => true, :uniqueness => true
validates :unixname, :uniqueness => true, :presence => true, :format => { :with => /^[a-zA-Z0-9_]+$/ }, :allow_nil => false, :allow_blank => false
validates :distrib_type, :presence => true, :allow_nil => :false, :allow_blank => false, :inclusion => {:in => APP_CONFIG['distr_types']}
#after_create :make_owner_rel
# before_save :create_directory

View File

@ -6,6 +6,10 @@
= f.label :unixname, :class => :label
= f.text_field :unixname, :class => 'text_field'
.group
= f.label :distrib_type, :class => :label
= f.select :distrib_type, options_for_select(APP_CONFIG['distr_types'])
.group
= f.label :parent, :class => :label
= f.select :parent_platform_id, @platforms.map { |p| [p.name, p.id] }, :include_blank => true

View File

@ -1,10 +1,13 @@
%table.table
%tr
%th.first= t("activerecord.attributes.platform.name")
%th.first= t("activerecord.attributes.platform.distrib_type")
%th.last &nbsp;
- @platforms.each do |platform|
%tr{:class => cycle("odd", "even")}
%td
= link_to platform.name, platform_path(platform)
%td
= platform.distrib_type
%td.last
#{link_to t("layout.show"), platform_path(platform)} | #{link_to t("layout.delete"), platform_path(platform), :method => :delete, :confirm => t("layout.platforms.confirm_delete")}