can download plant phenotype data in the same way as plot phenotype data
[sgn.git] / lib / SGN / Controller / solGS / AJAX / solGS.pm
blobbff47c65eb35cc0ab04a4028b52b8872e2c6eece
2 =head1 NAME
4 SGN::Controller::solGS::AJAX::solGS - a REST controller class to provide the
5 backend for objects linked with solgs
7 =head1 AUTHOR
9 Isaak Yosief Tecle <iyt2@cornell.edu>
11 =cut
13 package SGN::Controller::solGS::AJAX::solGS;
15 use Moose;
18 BEGIN { extends 'Catalyst::Controller::REST' }
20 __PACKAGE__->config(
21 default => 'application/json',
22 stash_key => 'rest',
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;
36 $term =~ 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;
53 $term =~ s/\s+/ /g;
54 my @response_list;
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;
68 ###
70 ###