diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb index c55943b32..48485249d 100644 --- a/app/helpers/custom_fields_helper.rb +++ b/app/helpers/custom_fields_helper.rb @@ -20,16 +20,7 @@ module CustomFieldsHelper def custom_fields_tabs - tabs = [{:name => 'IssueCustomField', :partial => 'custom_fields/index', :label => :label_issue_plural}, - {:name => 'TimeEntryCustomField', :partial => 'custom_fields/index', :label => :label_spent_time}, - {:name => 'ProjectCustomField', :partial => 'custom_fields/index', :label => :label_project_plural}, - {:name => 'VersionCustomField', :partial => 'custom_fields/index', :label => :label_version_plural}, - {:name => 'UserCustomField', :partial => 'custom_fields/index', :label => :label_user_plural}, - {:name => 'GroupCustomField', :partial => 'custom_fields/index', :label => :label_group_plural}, - {:name => 'TimeEntryActivityCustomField', :partial => 'custom_fields/index', :label => TimeEntryActivity::OptionName}, - {:name => 'IssuePriorityCustomField', :partial => 'custom_fields/index', :label => IssuePriority::OptionName}, - {:name => 'DocumentCategoryCustomField', :partial => 'custom_fields/index', :label => DocumentCategory::OptionName} - ] + CustomField::CUSTOM_FIELDS_TABS end # Return custom field html tag corresponding to its format diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index 115333581..a934cc877 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -30,6 +30,27 @@ class CustomField < ActiveRecord::Base validate :validate_custom_field before_validation :set_searchable + CUSTOM_FIELDS_TABS = [ + {:name => 'IssueCustomField', :partial => 'custom_fields/index', + :label => :label_issue_plural}, + {:name => 'TimeEntryCustomField', :partial => 'custom_fields/index', + :label => :label_spent_time}, + {:name => 'ProjectCustomField', :partial => 'custom_fields/index', + :label => :label_project_plural}, + {:name => 'VersionCustomField', :partial => 'custom_fields/index', + :label => :label_version_plural}, + {:name => 'UserCustomField', :partial => 'custom_fields/index', + :label => :label_user_plural}, + {:name => 'GroupCustomField', :partial => 'custom_fields/index', + :label => :label_group_plural}, + {:name => 'TimeEntryActivityCustomField', :partial => 'custom_fields/index', + :label => TimeEntryActivity::OptionName}, + {:name => 'IssuePriorityCustomField', :partial => 'custom_fields/index', + :label => IssuePriority::OptionName}, + {:name => 'DocumentCategoryCustomField', :partial => 'custom_fields/index', + :label => DocumentCategory::OptionName} + ] + def set_searchable # make sure these fields are not searchable self.searchable = false if %w(int float date bool).include?(field_format)