Improved code layout.

This commit is contained in:
Martin Edenhofer 2015-01-04 13:49:04 +01:00
parent c03d1580f0
commit bf32f09208

View file

@ -77,6 +77,7 @@ add a new activity entry for an object
:relation_condition => { :access => 'rw' }, :relation_condition => { :access => 'rw' },
:multiple => false, :multiple => false,
:null => true, :null => true,
:translate => false,
}, },
:editable => false, :editable => false,
:active => true, :active => true,
@ -183,4 +184,29 @@ returns:
attributes attributes
end end
=begin
get user based list of object attributes as hash
attribute_list = ObjectManager::Attribute.by_object_as_hash('Ticket', user)
returns:
{
'api_key' => { :name => 'api_key', :display => 'API KEY', :tag => 'input', :null => true, :edit => true, :maxlength => 32 },
'api_ip_regexp' => { :name => 'api_ip_regexp', :display => 'API IP RegExp', :tag => 'input', :null => true, :edit => true },
'api_ip_max' => { :name => 'api_ip_max', :display => 'API IP Max', :tag => 'input', :null => true, :edit => true },
}
=end
def self.by_object_as_hash(object, user)
list = self.by_object(object, user)
hash = {}
list.each {|item|
hash[ item[:name] ] = item
}
hash
end
end end