Merge pull request #5205 from solgenomics/topic/generic_trial_upload
[sgn.git] / lib / SGN / Controller / SiteFeatures.pm
blob08c260a40db61287b84c5ede59fd11d2ff28f4fc
1 package SGN::Controller::SiteFeatures;
2 use Moose;
3 use namespace::autoclean;
5 use SGN::View::Mason::CrossReference 'resolve_xref_component';
7 BEGIN {extends 'Catalyst::Controller::REST'; }
9 __PACKAGE__->config(
10 default => 'text/html',
11 stash_key => 'rest',
12 map => {
13 'text/html' => [ 'View', 'BareMason' ],
17 =head1 NAME
19 SGN::Controller::SiteFeatures - Catalyst Controller
21 =head1 DESCRIPTION
23 Catalyst controller for web services involving site features and
24 xrefs.
26 =head1 PUBLIC ACTIONS
28 =head2 feature_xrefs
30 Public path: /api/v1/feature_xrefs
32 Web service interface to C<$c-E<gt>feature_xrefs>.
34 =cut
36 sub feature_xrefs :Path('/api/v1/feature_xrefs') :Args(0) {
37 my ( $self, $c ) = @_;
39 no warnings 'uninitialized';
41 my $type = $c->req->param('render_type') || 'link';
43 my $args = {};
44 if( my @exclude = split /,/, $c->req->param('exclude') ) {
45 $args->{exclude} = \@exclude;
48 my $xrefs = [ map $c->feature_xrefs( $_, $args ), grep /\S/, $c->req->param('q') ];
49 $c->stash(
50 template => "/sitefeatures/mixed/xref_set/$type.mas",
52 xrefs => $xrefs,
53 rest => $xrefs,
57 =head1 AUTHOR
59 Robert Buels
61 =head1 LICENSE
63 This library is free software. You can redistribute it and/or modify
64 it under the same terms as Perl itself.
66 =cut
68 __PACKAGE__->meta->make_immutable;