can download plant phenotype data in the same way as plot phenotype data
[sgn.git] / lib / SGN / Controller / Folder.pm
blobbb58bfa5d99591559932bb45c20698694c854f41
1 package SGN::Controller::Folder;
3 use Moose;
4 use Data::Dumper;
5 use Try::Tiny;
6 use SGN::Model::Cvterm;
7 use Data::Dumper;
8 use CXGN::Trial::Folder;
10 BEGIN { extends 'Catalyst::Controller'; }
12 has 'schema' => (
13 is => 'rw',
14 isa => 'DBIx::Class::Schema',
15 lazy_build => 1,
17 sub _build_schema {
18 shift->_app->dbic_schema( 'Bio::Chado::Schema', 'sgn_chado' )
21 sub folder_page :Path("/folder") Args(1) {
22 my $self = shift;
23 my $c = shift;
24 my $folder_id = shift;
26 #print STDERR Dumper $folder_id;
28 my $folder_project = $self->schema->resultset("Project::Project")->find( { project_id => $folder_id } );
29 my $folder = CXGN::Trial::Folder->new({ bcs_schema => $self->schema, folder_id => $folder_id });
31 $c->stash->{children} = $folder->children();
32 $c->stash->{project_parent} = $folder->project_parent();
33 $c->stash->{breeding_program} = $folder->breeding_program();
34 $c->stash->{folder_id} = $folder_id;
35 $c->stash->{folder_name} = $folder_project->name();
36 $c->stash->{folder_description} = $folder_project->description();
37 if (!$folder->breeding_program) {
38 $c->stash->{message} = "The requested folder does not exist or has been deleted.";
39 $c->stash->{template} = 'generic_message.mas';
40 return;
42 $c->stash->{template} = '/breeders_toolbox/folder/folder.mas';