diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-04-16 15:33:49 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-04-16 15:33:49 +0000 |
commit | 88db9d0bdc9b3b91766582e40c4b44627f594f07 (patch) | |
tree | 7cc01664f60d1771b9aa8b0c37fedccaf529d4b6 /app/models/custom_field.rb | |
parent | 0e1595ad561ab1d534f0d97f745ea555666abf21 (diff) | |
download | redmine-88db9d0bdc9b3b91766582e40c4b44627f594f07.tar.gz redmine-88db9d0bdc9b3b91766582e40c4b44627f594f07.zip |
Replace the hardcoded CustomField::FIELD_FORMATS with a class.
Custom Field Formats are now full objects and can be registered with
Redmine::CustomFieldFormat to add new formats.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3672 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/custom_field.rb')
-rw-r--r-- | app/models/custom_field.rb | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index c7031afea..7cc6e865d 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -20,20 +20,11 @@ class CustomField < ActiveRecord::Base acts_as_list :scope => 'type = \'#{self.class}\'' serialize :possible_values - FIELD_FORMATS = { "string" => { :name => :label_string, :order => 1 }, - "text" => { :name => :label_text, :order => 2 }, - "int" => { :name => :label_integer, :order => 3 }, - "float" => { :name => :label_float, :order => 4 }, - "list" => { :name => :label_list, :order => 5 }, - "date" => { :name => :label_date, :order => 6 }, - "bool" => { :name => :label_boolean, :order => 7 } - }.freeze - validates_presence_of :name, :field_format validates_uniqueness_of :name, :scope => :type validates_length_of :name, :maximum => 30 validates_format_of :name, :with => /^[\w\s\.\'\-]*$/i - validates_inclusion_of :field_format, :in => FIELD_FORMATS.keys + validates_inclusion_of :field_format, :in => Redmine::CustomFieldFormat.available_formats def initialize(attributes = nil) super |