OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/app/models/attribute_help_text.rb

34 lines
696 B

class AttributeHelpText < ActiveRecord::Base
def self.available_types
subclasses.map { |child| child.name.demodulize }
end
def self.used_attributes(type)
where(type: type)
.select(:attribute_name)
.distinct
.pluck(:attribute_name)
end
def self.all_by_scope
all.group_by(&:attribute_scope)
end
validates_presence_of :help_text
validates_uniqueness_of :attribute_name, scope: :type
def attribute_caption
@caption ||= self.class.available_attributes[attribute_name]
end
def attribute_scope
raise 'not implemented'
end
def type_caption
raise 'not implemented'
end
end
require_dependency 'attribute_help_text/work_package'