Clean up custom field format definition.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9570 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
1e3e23d756
commit
49b28fca68
|
@ -34,15 +34,15 @@ Redmine::Scm::Base.add "Git"
|
||||||
Redmine::Scm::Base.add "Filesystem"
|
Redmine::Scm::Base.add "Filesystem"
|
||||||
|
|
||||||
Redmine::CustomFieldFormat.map do |fields|
|
Redmine::CustomFieldFormat.map do |fields|
|
||||||
fields.register Redmine::CustomFieldFormat.new('string', :label => :label_string, :order => 1)
|
fields.register 'string'
|
||||||
fields.register Redmine::CustomFieldFormat.new('text', :label => :label_text, :order => 2)
|
fields.register 'text'
|
||||||
fields.register Redmine::CustomFieldFormat.new('int', :label => :label_integer, :order => 3)
|
fields.register 'int', :label => :label_integer
|
||||||
fields.register Redmine::CustomFieldFormat.new('float', :label => :label_float, :order => 4)
|
fields.register 'float'
|
||||||
fields.register Redmine::CustomFieldFormat.new('list', :label => :label_list, :order => 5)
|
fields.register 'list'
|
||||||
fields.register Redmine::CustomFieldFormat.new('date', :label => :label_date, :order => 6)
|
fields.register 'date'
|
||||||
fields.register Redmine::CustomFieldFormat.new('bool', :label => :label_boolean, :order => 7)
|
fields.register 'bool', :label => :label_boolean
|
||||||
fields.register Redmine::CustomFieldFormat.new('user', :label => :label_user, :only => %w(Issue TimeEntry Version Project), :edit_as => 'list', :order => 8)
|
fields.register 'user', :only => %w(Issue TimeEntry Version Project), :edit_as => 'list'
|
||||||
fields.register Redmine::CustomFieldFormat.new('version', :label => :label_version, :only => %w(Issue TimeEntry Version Project), :edit_as => 'list', :order => 9)
|
fields.register 'version', :only => %w(Issue TimeEntry Version Project), :edit_as => 'list'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Permissions
|
# Permissions
|
||||||
|
|
|
@ -26,8 +26,8 @@ module Redmine
|
||||||
|
|
||||||
def initialize(name, options={})
|
def initialize(name, options={})
|
||||||
self.name = name
|
self.name = name
|
||||||
self.label = options[:label]
|
self.label = options[:label] || "label_#{name}".to_sym
|
||||||
self.order = options[:order]
|
self.order = options[:order] || self.class.available_formats.size
|
||||||
self.edit_as = options[:edit_as] || name
|
self.edit_as = options[:edit_as] || name
|
||||||
self.class_names = options[:only]
|
self.class_names = options[:only]
|
||||||
end
|
end
|
||||||
|
@ -62,7 +62,11 @@ module Redmine
|
||||||
end
|
end
|
||||||
|
|
||||||
# Registers a custom field format
|
# 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)
|
@@available[custom_field_format.name] = custom_field_format unless @@available.keys.include?(custom_field_format.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue