- items = []
- items.append({name: attrvalue, uuid: attrvalue, type: dataclass.to_s})
- #dataclass.where(uuid: attrvalue).each do |item|
- # items.append({name: item.uuid, uuid: item.uuid, type: dataclass.to_s})
- #end
- dataclass.limit(10).each do |item|
- items.append({name: item.uuid, uuid: item.uuid, type: dataclass.to_s})
+ objects = get_n_objects_of_class dataclass, 10
+ objects.each do |item|
+ items << item
+ preload_uuids << item.uuid
+ end
+ if attrvalue and !attrvalue.empty?
+ preload_uuids << attrvalue
+ end
+ preload_links_for_objects preload_uuids
+
+ if attrvalue and !attrvalue.empty?
+ links_for_object(attrvalue).each do |link|
+ if link.link_class.in? ["tag", "identifier"]
+ attrtext += " [#{tag.name}]"
+ end
+ end
+ selectables.append({name: attrtext, uuid: attrvalue, type: dataclass.to_s})
+ end
+ itemuuids = []
+ items.each do |item|
+ itemuuids << item.uuid
+ selectables.append({name: item.uuid, uuid: item.uuid, type: dataclass.to_s})
+ end
+
+ itemuuids.each do |itemuuid|
+ links_for_object(itemuuid).each do |link|
+ if link.link_class.in? ["tag", "identifier"]
+ selectables.each do |selectable|
+ if selectable['uuid'] == tag.head_uuid
+ selectable['name'] += ' [' + tag.name + ']'
+ end
+ end
+ end
+ end