8 <& /util/import_javascript.mas, classes => [ 'CXGN.List' ] &>
13 # make a hash of relationship_type => {
14 # upstream => \@list_of_objects
15 # downstream => \@list_of_objects
18 push @{$rels{$_->[0]}{$_->[1]}}, $_->[2]
20 ( map [ $m->scomp('/chado/cvterm_link.mas', cvterm => $_->type, inflect => ( $_->type->name =~ /_of$/ ? 'PL_N' : 'PL_V' ) ), 'downstream', $_->subject ], $principle->search_related("${relationship_name}_objects",undef, { prefetch => ['type','subject'] }) ),
21 ( map [ $m->scomp('/chado/cvterm_link.mas', cvterm => $_->type ), 'upstream', $_->object ], $principle->search_related("${relationship_name}_subjects",undef,{ prefetch => ['type','object'] }) ),
24 my $type = $principle->type ? $m->scomp('/chado/cvterm_link.mas', cvterm => $principle->type) : 'dataset';
30 % my $item_list_menu_div;
33 % for my $reltype ( sort keys %rels ) {
34 % my $updown = $rels{$reltype};
35 % for my $direction ( 'upstream', 'downstream' ) {
36 % if( my $objects = $updown->{$direction} ) {
37 % $item_list_div = "item_list_".$unique_num;
38 % $item_list_menu_div = "item_list_menu_".$unique_num;
40 % my ($is,$are) = $reltype =~ /\w+[ _]of/i ? (' is a',' are') : ('','');
42 <&| /page/info_section.mas,
43 title => $direction eq 'upstream' ? qq|$object_type_text this $type$is $reltype| : qq|$object_type_text that$are $reltype this $type|,
46 <div class="row well well-sm">
52 <div class="row well well-sm">
53 <div id="<% $item_list_div %>"></div>
54 Add items to a list:<br/><br/>
55 <div id="<% $item_list_menu_div %>"></div>
62 % my @items = map { $_->uniquename() } @$objects;
64 % push @item_json, JSON::Any->new->encode(\@items);
66 % $unique_num = $unique_num + 1;
72 % my $item_json_array = JSON::Any->new->encode(\@item_json);
76 jQuery(document).ready( function() {
77 var items = eval(<% $item_json_array %>);
78 var arrayLength = items.length;
80 for (var i = 0; i < arrayLength; i++) {
81 var item_list = "item_list_"+i;
82 var item_list_div = "#"+item_list;
83 var item_list_menu = "item_list_menu_"+i;
84 var item_list_menu_div = "#"+item_list_menu;
85 if (jQuery.cookie("sgn_session_id") && items.length > 0) {
86 var current_item = eval(items[i]).join("\n");
87 jQuery(item_list_div).hide();
88 jQuery(item_list_div).html(current_item);
90 addToListMenu(item_list_menu, item_list, 'div');
93 jQuery(item_list_menu_div).html('Log in to use lists.');