Improved code layout.
This commit is contained in:
parent
c03d1580f0
commit
bf32f09208
1 changed files with 42 additions and 16 deletions
|
@ -68,19 +68,20 @@ list of all attributes
|
||||||
add a new activity entry for an object
|
add a new activity entry for an object
|
||||||
|
|
||||||
ObjectManager::Attribute.add(
|
ObjectManager::Attribute.add(
|
||||||
:object => 'Ticket',
|
:object => 'Ticket',
|
||||||
:name => 'group_id',
|
:name => 'group_id',
|
||||||
:frontend => 'Group',
|
:frontend => 'Group',
|
||||||
:data_type => 'select',
|
:data_type => 'select',
|
||||||
:data_option => {
|
:data_option => {
|
||||||
:relation => 'Group',
|
:relation => 'Group',
|
||||||
: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,
|
||||||
:screens => {
|
:screens => {
|
||||||
:create => {
|
:create => {
|
||||||
'-all-' => {
|
'-all-' => {
|
||||||
:required => true,
|
:required => true,
|
||||||
|
@ -92,12 +93,12 @@ add a new activity entry for an object
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
:pending_migration => false,
|
:pending_migration => false,
|
||||||
:position => 20,
|
:position => 20,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_at => '2014-06-04 10:00:00',
|
:created_at => '2014-06-04 10:00:00',
|
||||||
:updated_at => '2014-06-04 10:00:00',
|
:updated_at => '2014-06-04 10:00:00',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -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
|
Loading…
Reference in a new issue