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 %] + +
+
+ [% IF my_projects.size > 0 %] +

My assigned samples

+ + [% FOR project IN my_projects.keys.sort %] + + + + + + + + + + + + + [% FOR project_sample IN my_projects.$project %] + + + + + + + + [% END %] + +
Sample NameSubjectSample TypeDate 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 %] +
+
+
+ [% END %] +
+ [% ELSE %] +

No assigned projects found

+ [% END %] +
+
diff --git a/root/ngtemplate/homepage/index.tt b/root/ngtemplate/homepage/index.tt index efa76aa..81c6d57 100644 --- a/root/ngtemplate/homepage/index.tt +++ b/root/ngtemplate/homepage/index.tt @@ -1,73 +1,65 @@ [%- page = { - title = "Viroverse", - } +title = "Viroverse: Start Page", +} -%]
[% IF nag %] - [% END %] - [% IF my_projects.size > 0 %] -

My assigned samples

- - [% FOR project IN my_projects.keys.sort %] - - - - - - - - - - - - - [% FOR project_sample IN my_projects.$project %] - - - - - - - - [% END %] - -
Sample NameSubjectSample TypeDate 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 %] -
-
-
- [% END %] -
- [% END %] -

Cohorts

-
-
+
+

Welcome to Viroverse

+ +

Projects and Cohorts

+ + +

Subjects

+ + +

PCR & Sequencing

+ -[% BLOCK 'input-progress-button' %] - - [% label %] - -[% END %] + [% IF scientist.is_admin OR scientist.is_supervisor %] +

Administration

+ + [% END %] +
+ \ No newline at end of file