diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-04-28 16:19:32 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-04-28 16:19:32 +0000 |
commit | 49b28fca68209097d87021849347c52d97904dbb (patch) | |
tree | 7e71457380d34d0df9a43a750af8f4b9c852a19a /lib/redmine | |
parent | 1e3e23d756e0b365c42daa0c7d8a2a872db692e8 (diff) | |
download | redmine-49b28fca68209097d87021849347c52d97904dbb.tar.gz redmine-49b28fca68209097d87021849347c52d97904dbb.zip |
Clean up custom field format definition.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9570 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine')
-rw-r--r-- | lib/redmine/custom_field_format.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/redmine/custom_field_format.rb b/lib/redmine/custom_field_format.rb index c0f4dcbc6..cd5c58f12 100644 --- a/lib/redmine/custom_field_format.rb +++ b/lib/redmine/custom_field_format.rb @@ -26,8 +26,8 @@ module Redmine def initialize(name, options={}) self.name = name - self.label = options[:label] - self.order = options[:order] + self.label = options[:label] || "label_#{name}".to_sym + self.order = options[:order] || self.class.available_formats.size self.edit_as = options[:edit_as] || name self.class_names = options[:only] end @@ -62,7 +62,11 @@ module Redmine end # Registers a custom field format - def register(custom_field_format, options={}) + def register(*args) + custom_field_format = args.first + unless custom_field_format.is_a?(Redmine::CustomFieldFormat) + custom_field_format = Redmine::CustomFieldFormat.new(*args) + end @@available[custom_field_format.name] = custom_field_format unless @@available.keys.include?(custom_field_format.name) end |