diff options
author | Edmund von der Burg <evdb@mysociety.org> | 2011-03-21 17:35:15 +0000 |
---|---|---|
committer | Edmund von der Burg <evdb@mysociety.org> | 2011-03-21 17:35:15 +0000 |
commit | 7b599e515dad9f74c27779434d91f775f485d1f0 (patch) | |
tree | f2f2dbc6ac74b49cfd58f92cf4b46b116cc3e207 | |
parent | 52d0d881006191103bd4e35537110f36938da3aa (diff) |
Wording about councils
7 files changed, 110 insertions, 15 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports/New.pm b/perllib/FixMyStreet/App/Controller/Reports/New.pm index fc3a334e6..4c16916ea 100644 --- a/perllib/FixMyStreet/App/Controller/Reports/New.pm +++ b/perllib/FixMyStreet/App/Controller/Reports/New.pm @@ -81,9 +81,9 @@ sub report_new : Path : Args(0) { # create a problem from the submitted details $c->stash->{template} = "reports/new/fill_in_details.html"; + $c->forward('setup_categories_and_councils'); $c->forward('prepare_report'); $c->forward('generate_map'); - } =head2 determine_location @@ -287,6 +287,8 @@ sub check_councils : Private { # all good if we have some councils left $c->stash->{all_councils} = $all_councils; + $c->stash->{all_council_names} = + [ map { $_->{name} } values %$all_councils ]; return 1; } @@ -301,10 +303,10 @@ sub setup_categories_and_councils : Private { my @all_council_ids = keys %{ $c->stash->{all_councils} }; - my @contacts # - = $c # - ->model('DB::Contacts') # - ->not_deleted # + my @contacts # + = $c # + ->model('DB::Contact') # + ->not_deleted # ->search( { area_id => \@all_council_ids } ) # ->all; @@ -352,10 +354,18 @@ sub setup_categories_and_councils : Private { } # put results onto stash - $c->stash->{area_ids_to_list} = @area_ids_to_list; - $c->stash->{category_options} = @category_options; + $c->stash->{area_ids_to_list} = \@area_ids_to_list; + $c->stash->{category_options} = \@category_options; $c->stash->{category_label} = $category_label; + # add some conveniant things to the stash + my $all_councils = $c->stash->{all_councils}; + my %area_ids_to_list_hash = map { $_ => 1 } @area_ids_to_list; + my @missing = + grep { !$area_ids_to_list_hash{$_} } keys %$all_councils; + my @missing_names = map { $all_councils->{$_}->{name} } @missing; + $c->stash->{missing} = @missing; + $c->stash->{missing_names} = @missing_names; } =head2 prepare_report diff --git a/templates/web/default/reports/new/all_councils_text.html b/templates/web/default/reports/new/all_councils_text.html new file mode 100644 index 000000000..2cd90b213 --- /dev/null +++ b/templates/web/default/reports/new/all_councils_text.html @@ -0,0 +1,8 @@ +<p> +[% + tprintf( + loc('All the information you provide here will be sent to <strong>%s</strong>. The subject and details of the problem will be public, plus your name if you give us permission.'), + all_council_names.join( '</strong>' _ loc(' or ') _ '<strong>' ) + ); +%] +</p> diff --git a/templates/web/default/reports/new/fill_in_details.html b/templates/web/default/reports/new/fill_in_details.html index 5ac9944b0..a87de6640 100644 --- a/templates/web/default/reports/new/fill_in_details.html +++ b/templates/web/default/reports/new/fill_in_details.html @@ -1,14 +1,31 @@ -[% INCLUDE 'header.html', title => loc('Enter report details') %] - -<h1>[% loc('Enter report details') %]</h1> - - - -<hr> +[% INCLUDE 'header.html', title => loc('Reporting a problem') %] [% map_html %] -<hr> +<h1>[% loc('Reporting a problem') %]</h1> + + +<!-- my @councils = keys %council_ok; +my $details; +if (@councils == scalar keys %$all_councils) { + $details = 'all'; +} elsif (@councils == 0) { + $details = 'none'; +} else { + $details = 'some'; +} --> + +[% IF area_ids_to_list.size == 0 %] + [% INCLUDE 'reports/new/no_councils_text.html' %] + <input type="hidden" name="council" value="-1"> +[% ELSIF area_ids_to_list.size == all_councils.size %] + [% INCLUDE 'reports/new/all_councils_text.html' %] + <input type="hidden" name="council" value="[% all_councils.keys.join(',') %]"> +[% ELSE %] + [% INCLUDE 'reports/new/some_councils_text.html' %] + <input type="hidden" name="council" value="[% area_ids_to_list.join(',') %]|[% missing.join(',') %]">'; + +[% END %] <p>FORM</p> diff --git a/templates/web/default/reports/new/no_councils_text.html b/templates/web/default/reports/new/no_councils_text.html new file mode 100644 index 000000000..c3dade610 --- /dev/null +++ b/templates/web/default/reports/new/no_councils_text.html @@ -0,0 +1,20 @@ + + +<p>[% + + nget( + 'We do not yet have details for the council that covers this location.', + 'We do not yet have details for the councils that cover this location.', + all_councils.size + ); + + loc("If you submit a problem here the subject and details of the problem will be public, but the problem will <strong>not</strong> be reported to the council."); + + tprintf( + loc("You can help us by finding a contact email address for local problems for %s and emailing it to us at <a href='mailto:%s'>%s</a>."), + all_council_names.join( loc(' or ') ), + c.cobrand.contact_email, + c.cobrand.contact_email + ); + +%]</p> diff --git a/templates/web/default/reports/new/some_councils_text.html b/templates/web/default/reports/new/some_councils_text.html new file mode 100644 index 000000000..8bb764332 --- /dev/null +++ b/templates/web/default/reports/new/some_councils_text.html @@ -0,0 +1,26 @@ +<p> +[% loc('All the information you provide here will be sent to') %] + +[% FOREACH council IN all_council_names %] + [% loc( ' or ') IF ! loop.first %] + <strong>[% council %]</strong> + [%- '.' IF loop.last %] +[% END %] + +[% + loc('The subject and details of the problem will be public, plus your name if you give us permission.'); + + nget( + 'We do <strong>not</strong> yet have details for the other council that covers this location.', + 'We do <strong>not</strong> yet have details for the other councils that cover this location.', + missing.size + ); + + tprintf( + loc("You can help us by finding a contact email address for local problems for %s and emailing it to us at <a href='mailto:%s'>%s</a>."), + missing_names.join( loc(' or ') ), + c.cobrand.contact_email, + c.cobrand.contact_email + ); +%] + diff --git a/templates/web/emptyhomes/reports/new/all_councils_text.html b/templates/web/emptyhomes/reports/new/all_councils_text.html new file mode 100644 index 000000000..8bdad1c1f --- /dev/null +++ b/templates/web/emptyhomes/reports/new/all_councils_text.html @@ -0,0 +1,8 @@ +<p> +[% + tprintf( + loc('All the information you provide here will be sent to <strong>%s</strong>. On the site, we will show the subject and details of the problem, plus your name if you give us permission.'), + all_council_names.join( '</strong>' _ loc(' or ') _ '<strong>' ) + ); +%] +</p> diff --git a/templates/web/emptyhomes/reports/new/no_councils_text.html b/templates/web/emptyhomes/reports/new/no_councils_text.html new file mode 100644 index 000000000..7edb75852 --- /dev/null +++ b/templates/web/emptyhomes/reports/new/no_councils_text.html @@ -0,0 +1,6 @@ +<p> +[% + loc('We do not yet have details for the council that covers this location.'); + loc("If you submit a report here it will be left on the site, but not reported to the council – please still leave your report, so that we can show to the council the activity in their area."); +%] +</p> |