diff --git a/lib/Viroverse/Controller/Homepage.pm b/lib/Viroverse/Controller/Homepage.pm index 77ed455..1749c7a 100644 --- a/lib/Viroverse/Controller/Homepage.pm +++ b/lib/Viroverse/Controller/Homepage.pm @@ -24,6 +24,18 @@ sub index : Chained('base') PathPart('') Args(0) { return RedirectToUrl($c, Viroverse::Config->conf->{redirect_root_to}); } + my $nag = !Viroverse::Config->conf->{registered}; + + $c->stash( + template => 'homepage/index.tt', + nag => $nag + ); + $c->detach( $c->view("NG") ); +} + +sub projects : Chained('base') PathPart('my_projects') Args(0) { + my ($self, $c) = @_; + # The extensive prefetching below bundles a bunch of relationships into a # single fairly efficient query without resorting to a database view to # power the homepage. @@ -48,13 +60,10 @@ sub index : Chained('base') PathPart('') Args(0) { reduce { push @{ $a->{ $b->project->name } ||= [] }, $b; $a } +{}, @assignments; - my $nag = !Viroverse::Config->conf->{registered}; $c->stash( - template => 'homepage/index.tt', + template => 'homepage/assigned-projects.tt', my_projects => $my_projects, - cohorts => [ $c->model("ViroDB::Cohort")->order_by('name')->all ], - nag => $nag, ); $c->detach( $c->view("NG") ); } diff --git a/root/ngtemplate/homepage/assigned-projects.tt b/root/ngtemplate/homepage/assigned-projects.tt new file mode 100644 index 0000000..71d5c1d --- /dev/null +++ b/root/ngtemplate/homepage/assigned-projects.tt @@ -0,0 +1,62 @@ +[%- page = { + title = "Viroverse: Projects and Cohorts", + } +-%] + +[% BLOCK 'input-progress-button' %] + + [% label %] + +[% END %] + +
Sample Name | +Subject | +Sample Type | +Date Collected | ++ |
---|---|---|---|---|
+ [% project_sample.sample.name || '#' _ project_sample.sample.id %] + + | ++ [% project_sample.sample.patient.name || "unnamed subject" %] + + | +[% project_sample.sample.tissue_type.name || "unknown tissue" %] | +[% project_sample.sample.date.strftime('%Y-%m-%d') || "unknown date" %] | +
+
+ [% INCLUDE 'input-progress-button', dest='/sample/new_extraction', label='Extraction', completed=$(project_sample.progress).has_extractions %]
+ [% INCLUDE 'input-progress-button', dest='/sample/new_rt_product', label='RT', completed=$(project_sample.progress).has_rt_products %]
+ [% INCLUDE 'input-progress-button', dest='/sample/new_pcr_product', label='PCR', completed=$(project_sample.progress).has_pcr_products %]
+ [% INCLUDE 'input-progress-button', dest='/sample/new_sequence', label='Sequence', completed=$(project_sample.progress).has_sequences %]
+
+ |
+
Please help us maintain funding for Viroverse development by +
Please help us maintain funding for Viroverse development by emailing - us and letting us know who you are and what you're using + us and letting us know who you are and what you're using Viroverse for!
-Sample Name | -Subject | -Sample Type | -Date Collected | -- |
---|---|---|---|---|
- [% project_sample.sample.name || '#' _ project_sample.sample.id %] - - | -- [% project_sample.sample.patient.name || "unnamed subject" %] - - | -[% project_sample.sample.tissue_type.name || "unknown tissue" %] | -[% project_sample.sample.date.strftime('%Y-%m-%d') || "unknown date" %] | -
-
- [% INCLUDE 'input-progress-button', dest='/sample/new_extraction', label='Extraction', completed=$(project_sample.progress).has_extractions %]
- [% INCLUDE 'input-progress-button', dest='/sample/new_rt_product', label='RT', completed=$(project_sample.progress).has_rt_products %]
- [% INCLUDE 'input-progress-button', dest='/sample/new_pcr_product', label='PCR', completed=$(project_sample.progress).has_pcr_products %]
- [% INCLUDE 'input-progress-button', dest='/sample/new_sequence', label='Sequence', completed=$(project_sample.progress).has_sequences %]
-
- |
-