4 SGN::Controller::solGS::AJAX::solGS - a REST controller class to provide the
5 backend for objects linked with solgs
9 Isaak Yosief Tecle <iyt2@cornell.edu>
13 package SGN
::Controller
::solGS
::AJAX
::solGS
;
18 BEGIN { extends
'Catalyst::Controller::REST' }
21 default => 'application/json',
23 map => { 'application/json' => 'JSON', 'text/html' => 'JSON' },
28 sub solgs_trait_search_autocomplete
: Path
('/solgs/ajax/trait/search') : ActionClass
('REST') { }
30 sub solgs_trait_search_autocomplete_GET
:Args
(0) {
31 my ( $self, $c ) = @_;
33 my $term = $c->req->param('term');
35 $term =~ s/(^\s+|\s+)$//g;
38 my $traits = $c->model("solGS::solGS")->search_trait($term);
40 $c->{stash
}->{rest
} = $traits;
45 sub solgs_population_search_autocomplete
: Path
('/solgs/ajax/population/search') : ActionClass
('REST') { }
47 sub solgs_population_search_autocomplete_GET
:Args
(0) {
48 my ( $self, $c ) = @_;
50 my $term = $c->req->param('term');
52 $term =~ s/(^\s+|\s+)$//g;
56 my $rs = $c->model("solGS::solGS")->project_details_by_name($term);
58 while (my $row = $rs->next) {
59 push @response_list, $row->name;
62 $c->{stash
}->{rest
} = \
@response_list;