diff options
author | Hakim Cassimally <hakim@mysociety.org> | 2014-02-24 13:17:11 +0000 |
---|---|---|
committer | Hakim Cassimally <hakim@mysociety.org> | 2014-02-26 15:39:53 +0000 |
commit | 863f3655955d58b16c93f99404dff715ea213489 (patch) | |
tree | 98c5f163664058a29265adba6d624bf3df2e49f7 | |
parent | cebc2d4fe88228a9864e737c9cdbdf94629f1554 (diff) |
Explanatory text/link on /my with no reports
Usually you won't get to "Your Reports" page without any
content (reports or updates) but it's possible to do so,
as we just discovered in a client meeting, logging into
that page, and arriving on a screen of blank content with
no guidance. This patch shows some text and a link to
create a new report, if there aren't any problems/updates.
Fixes #671
-rw-r--r-- | perllib/FixMyStreet/App/Controller/My.pm | 3 | ||||
-rw-r--r-- | templates/web/default/my/my.html | 5 | ||||
-rw-r--r-- | templates/web/fixmystreet/my/my.html | 5 |
3 files changed, 13 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/My.pm b/perllib/FixMyStreet/App/Controller/My.pm index c00264315..bbef1f8d8 100644 --- a/perllib/FixMyStreet/App/Controller/My.pm +++ b/perllib/FixMyStreet/App/Controller/My.pm @@ -45,6 +45,7 @@ sub my : Path : Args(0) { } )->page( $p_page ); while ( my $problem = $rs->next ) { + $c->stash->{has_content}++; push @$pins, { latitude => $problem->latitude, longitude => $problem->longitude, @@ -64,7 +65,9 @@ sub my : Path : Args(0) { order_by => { -desc => 'confirmed' }, rows => 50 } )->page( $u_page ); + my @updates = $rs->all; + $c->stash->{has_content} += scalar @updates; $c->stash->{updates} = \@updates; $c->stash->{updates_pager} = $rs->pager; diff --git a/templates/web/default/my/my.html b/templates/web/default/my/my.html index a6e4000df..48a33a1d2 100644 --- a/templates/web/default/my/my.html +++ b/templates/web/default/my/my.html @@ -13,6 +13,11 @@ <h1>[% loc('Your Reports') %]</h1> +[% IF ! has_content %] +[% tprintf( loc('You haven’t created any reports yet. <a href="%s">Report a problem now.</a>'), + c.uri_for('/') ) %] +[% END %] + [% INCLUDE 'pagination.html', pager = problems_pager, param = 'p' diff --git a/templates/web/fixmystreet/my/my.html b/templates/web/fixmystreet/my/my.html index 12f68bd80..389e907a3 100644 --- a/templates/web/fixmystreet/my/my.html +++ b/templates/web/fixmystreet/my/my.html @@ -13,6 +13,11 @@ <h1>[% loc('Your Reports') %]</h1> +[% IF ! has_content %] +[% tprintf( loc('You haven’t created any reports yet. <a href="%s">Report a problem now.</a>'), + c.uri_for('/') ) %] +[% END %] + [% IF c.cobrand.moniker == 'fixmybarangay' %] [% INCLUDE '_barangay_buttons.html' %] [% END %] |