aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App.pm6
-rw-r--r--perllib/FixMyStreet/App/Controller/Alert.pm10
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm16
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/Update.pm6
-rwxr-xr-xt/Page.t31
-rw-r--r--t/app/helpers/send_email.t19
-rw-r--r--t/templates/mysite/test-header1
-rw-r--r--templates/web/barnet/footer.html2
-rw-r--r--templates/web/default/common_header_tags.html9
-rw-r--r--templates/web/default/email_sent.html13
-rw-r--r--templates/web/default/footer.html8
-rw-r--r--templates/web/default/header.html6
-rw-r--r--templates/web/emptyhomes/header.html26
-rw-r--r--templates/web/fiksgatami/footer.html10
14 files changed, 61 insertions, 102 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index 10e0dbb28..ec7ec3ff0 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -275,9 +275,13 @@ sub send_email {
my $template = shift;
my $extra_stash_values = shift || {};
+ my $sender = $c->cobrand->contact_email;
+ my $sender_name = $c->cobrand->contact_name;
+ $sender =~ s/team/fms-DO-NOT-REPLY/;
+
# create the vars to pass to the email template
my $vars = {
- from => FixMyStreet->config('CONTACT_EMAIL'),
+ from => [ $sender, _($sender_name) ],
%{ $c->stash },
%$extra_stash_values,
additional_template_paths => [
diff --git a/perllib/FixMyStreet/App/Controller/Alert.pm b/perllib/FixMyStreet/App/Controller/Alert.pm
index b5258ae79..e7eab09b8 100644
--- a/perllib/FixMyStreet/App/Controller/Alert.pm
+++ b/perllib/FixMyStreet/App/Controller/Alert.pm
@@ -301,15 +301,7 @@ sub send_confirmation_email : Private {
$c->stash->{token_url} = $c->uri_for_email( '/A', $token->token );
- my $sender = mySociety::Config::get('CONTACT_EMAIL');
-
- $c->send_email(
- 'alert-confirm.txt',
- {
- to => $c->stash->{alert}->user->email,
- from => $sender
- }
- );
+ $c->send_email( 'alert-confirm.txt', { to => $c->stash->{alert}->user->email } );
$c->stash->{template} = 'email_sent.html';
}
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 1d08de29d..3e71cb0bd 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -251,17 +251,7 @@ sub report_import : Path('/import') {
$c->stash->{report} = $report;
$c->stash->{token_url} = $c->uri_for_email( '/L', $token->token );
- my $sender = mySociety::Config::get('CONTACT_EMAIL');
- $sender =~ s/team/fms-DO-NOT-REPLY/;
-
- # TODO - used to be sent using EvEl
- $c->send_email(
- 'partial.txt',
- {
- to => $report->user->email,
- from => $sender
- }
- );
+ $c->send_email( 'partial.txt', { to => $report->user->email, } );
$c->res->body('SUCCESS');
return 1;
@@ -945,7 +935,9 @@ sub redirect_or_confirm_creation : Private {
$c->model("DB::Token")
->create( { scope => 'problem', data => $report->id } );
$c->stash->{token_url} = $c->uri_for_email( '/P', $token->token );
- $c->send_email( 'problem-confirm.txt', { to => $report->user->email } );
+ $c->send_email( 'problem-confirm.txt', {
+ to => [ [ $report->user->email, $report->name ] ],
+ } );
# tell user that they've been sent an email
$c->stash->{template} = 'email_sent.html';
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm
index e0a7033b9..fe512d03c 100644
--- a/perllib/FixMyStreet/App/Controller/Report/Update.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm
@@ -292,7 +292,11 @@ sub redirect_or_confirm_creation : Private {
}
);
$c->stash->{token_url} = $c->uri_for_email( '/C', $token->token );
- $c->send_email( 'update-confirm.txt', { to => $update->user->email } );
+ $c->send_email( 'update-confirm.txt', {
+ to => $update->name
+ ? [ [ $update->user->email, $update->name ] ]
+ : $update->user->email,
+ } );
# tell user that they've been sent an email
$c->stash->{template} = 'email_sent.html';
diff --git a/t/Page.t b/t/Page.t
index 5e55b8e1f..9331d4ef9 100755
--- a/t/Page.t
+++ b/t/Page.t
@@ -11,7 +11,7 @@
use strict;
use warnings;
-use Test::More tests => 8;
+use Test::More tests => 4;
use Test::Exception;
use FindBin;
@@ -36,33 +36,6 @@ sub set_lang($) {
mySociety::Locale::change();
}
-sub test_header() {
- my $q = mock_query();
- my $html;
- my %params = (title => 'test title');
- set_lang('en-gb,English,en_GB');
-
- # Test that param that isn't explicitly allowed raises error
- $params{'test-param'} = 'test';
- throws_ok { Page::header($q, %params); } qr/bad parameter/, 'bad parameter caught ok';
- delete $params{'test-param'};
-
- # Test that template passed is rendered
- $params{'template'} = 'test';
- $html = Page::template_include('test-header', $q,
- '/../t/templates/' . $q->{site} . '/',
- title => 'My test title', lang => 'en-gb'
- );
-
- like ($html, qr/My test header template/, 'named template rendered ok');
-
- return 1;
-}
-
-sub test_footer(){
- return 1;
-}
-
sub test_base_url_with_lang {
set_lang('en-gb,English,en_GB');
my $q = mock_query();
@@ -80,5 +53,3 @@ sub test_base_url_with_lang {
ok(test_base_url_with_lang() == 1, 'Ran all tests for base_url_with_lang');
-ok(test_footer() == 1, 'Ran all tests for the footer function');
-ok(test_header() == 1, 'Ran all tests for the header function');
diff --git a/t/app/helpers/send_email.t b/t/app/helpers/send_email.t
index 2e90b9f1a..5ab84e017 100644
--- a/t/app/helpers/send_email.t
+++ b/t/app/helpers/send_email.t
@@ -15,11 +15,17 @@ use Email::Send::Test;
use Path::Class;
use_ok 'FixMyStreet::App';
-my $c = FixMyStreet::App->new;
-
-# fake up the request a little
-$c->req->uri( URI->new('http://localhost/') );
-$c->req->base( $c->req->uri );
+my $c = FixMyStreet::App->new(
+ {
+ request => Catalyst::Request->new(
+ {
+ base => URI->new('http://fixmystreet.com/'),
+ uri => URI->new('http://fixmystreet.com/')
+ }
+ ),
+ }
+);
+$c->setup_request();
# set some values in the stash
$c->stash->{foo} = 'bar';
@@ -40,7 +46,8 @@ my $email_as_string = $emails[0]->as_string;
ok $email_as_string =~ s{\s+Date:\s+\S.*?$}{}xms, "Found and stripped out date";
my $expected_email_content = file(__FILE__)->dir->file('send_email_sample.txt')->slurp;
-$expected_email_content =~ s{CONTACT_EMAIL}{ FixMyStreet->config('CONTACT_EMAIL') }e;
+my $sender = '"' . FixMyStreet->config('CONTACT_NAME') . '" <' . FixMyStreet->config('CONTACT_EMAIL') . '>';
+$expected_email_content =~ s{CONTACT_EMAIL}{$sender};
is $email_as_string,
$expected_email_content,
diff --git a/t/templates/mysite/test-header b/t/templates/mysite/test-header
deleted file mode 100644
index 83d959d3d..000000000
--- a/t/templates/mysite/test-header
+++ /dev/null
@@ -1 +0,0 @@
-My test header template
diff --git a/templates/web/barnet/footer.html b/templates/web/barnet/footer.html
index 93172f2b9..9bbeaa7e9 100644
--- a/templates/web/barnet/footer.html
+++ b/templates/web/barnet/footer.html
@@ -10,7 +10,7 @@
<ul>
<li class="section"><a href="/">FixMyStreet</a>
<ul>
- <li class="section">[% c.req.uri.path == '/report/new' ? '<strong>Report a problem</strong>' : '<a href="/report/new">Report a problem</a>' %]</li>
+ <li class="section">[% c.req.uri.path == '/' ? '<strong>Report a problem</strong>' : '<a href="/">Report a problem</a>' %]</li>
<li class="section">[% c.req.uri.path == '/reports/Barnet' ? '<strong>All reports</strong>' : '<a href="/reports/Barnet">All reports</a>' %]</li>
<li class="section">[% c.req.uri.path == '/alert' ? '<strong>Local alerts</strong>' : '<a href="/alert">Local alerts</a>' %]</li>
<li class="section">[% c.req.uri.path == '/faq' ? '<strong>Help</strong>' : '<a href="/faq">Help</a>' %]</li>
diff --git a/templates/web/default/common_header_tags.html b/templates/web/default/common_header_tags.html
index 7018ecdac..e69dac27d 100644
--- a/templates/web/default/common_header_tags.html
+++ b/templates/web/default/common_header_tags.html
@@ -11,13 +11,8 @@
[% IF rss %]
<link rel="alternate" type="application/rss+xml" title="[% rss.0 %]" href="[% rss.1 %]">
[% END %]
-[% legacy_rss %]
<title>
- [% IF legacy_title %]
- [% legacy_title %]
- [% ELSE %]
- [% "$title :: " | html IF title %]
- [% c.cobrand.site_title %]
- [% END %]
+ [% "$title :: " | html IF title %]
+ [% c.cobrand.site_title %]
</title>
diff --git a/templates/web/default/email_sent.html b/templates/web/default/email_sent.html
index a20900524..47a6f82cf 100644
--- a/templates/web/default/email_sent.html
+++ b/templates/web/default/email_sent.html
@@ -21,15 +21,14 @@
}
%]
-<h1>Nearly Done! Now check your email...</h1>
+<h1>[% loc("Nearly Done! Now check your email...") %]</h1>
-<p>The confirmation email <strong>may</strong> take a few minutes to arrive &mdash; <em>please</em> be patient.</p>
+<p>[% loc("The confirmation email <strong>may</strong> take a few minutes to arrive &mdash; <em>please</em> be patient.") %]</p>
-<p>If you use web-based email or have 'junk mail' filters, you may wish to check your bulk/spam mail folders: sometimes, our messages are marked that way.</p>
+<p>[% loc("If you use web-based email or have 'junk mail' filters, you may wish to check your bulk/spam mail folders: sometimes, our messages are marked that way.") %]</p>
-<p>You must now click the link in the email we've just sent you &mdash; if you do not, [% messages.$email_type.action %].</p>
+<p>[% tprintf( loc("You must now click the link in the email we've just sent you &mdash; if you do not, %s."), messages.$email_type.action ) %].</p>
-<p>(Don't worry &mdash; [% messages.$email_type.worry %])</p>
+<p>[% tprintf( loc("(Don't worry &mdash; %s)"), messages.$email_type.worry ) %]</p>
-
-[% INCLUDE 'footer.html' %] \ No newline at end of file
+[% INCLUDE 'footer.html' %]
diff --git a/templates/web/default/footer.html b/templates/web/default/footer.html
index 19af59198..9222436e2 100644
--- a/templates/web/default/footer.html
+++ b/templates/web/default/footer.html
@@ -4,10 +4,10 @@
<h2 class="v">[% loc('Navigation') %]</h2>
<ul id="navigation">
<li><a href="/">[% loc("Report a problem") %]</a></li>
-<li><a href="/reports">[% loc("All reports") %]</a></li>
-<li><a href="/alert[% pc ? '/list?pc=' : '' %][% pc | uri %]">[% loc("Local alerts") %]</a></li>
-<li><a href="/faq">[% loc("Help") %]</a></li>
-<li><a href="/contact">[% loc("Contact") %]</a></li>
+<li><a href="/reports">[% loc("All reports") %]</a></li>
+<li><a href="/alert[% pc ? '/list?pc=' : '' %][% pc | uri %]">[% loc("Local alerts") %]</a></li>
+<li><a href="/faq">[% loc("Help") %]</a></li>
+<li><a href="/contact">[% loc("Contact") %]</a></li>
</ul>
[% loc('<a href="http://www.mysociety.org/"><img id="logo" width="133" height="26" src="/i/mysociety-dark.png" alt="View mySociety.org"><span id="logoie"></span></a>') %]
diff --git a/templates/web/default/header.html b/templates/web/default/header.html
index 491329c5d..52f066663 100644
--- a/templates/web/default/header.html
+++ b/templates/web/default/header.html
@@ -12,9 +12,9 @@
</head>
<body>
- <div id="header">
- <a href="/">[% loc('Fix<span id="my">My</span>Street') %]</a>
- </div>
+ [% IF NOT title AND NOT c.req.path %]<h1 id="header">[% ELSE %]<div id="header"><a href="/">[% END %]
+ [%- loc('Fix<span id="my">My</span>Street') %]
+ [%- IF NOT title AND NOT c.req.path %]</h1>[% ELSE %]</a></div>[% END %]
<div id="wrapper"><div id="mysociety">
diff --git a/templates/web/emptyhomes/header.html b/templates/web/emptyhomes/header.html
index 3a42ee208..08d1b1a05 100644
--- a/templates/web/emptyhomes/header.html
+++ b/templates/web/emptyhomes/header.html
@@ -26,21 +26,17 @@
</div>
<div id="navigation">
- <ul>
- <li><a href="/report/new" >[% loc("Report a problem") %]</a></li>
- <li><a href="/reports" >[% loc("All reports") %]</a></li>
- <li><a href="/alert" >[% loc("Local alerts") %]</a></li>
- <li><a href="/faq" >[% loc("Help") %]</a></li>
- <li><a href="/about" >[% loc('About us') %]</a></li>
- [% IF lang_url # old Page.pm code %]
- <li><a href="[% lang_url %]">[% lang %]</a></li>
- [% ELSE # new Catalyst code %]
- [% IF lang_code == 'en-gb' %]
- <li><a href="http://cy.[% c.cobrand.base_host %]">Cymraeg</a></li>
- [% ELSE %]
- <li><a href="http://en.[% c.cobrand.base_host %]">English</a></li>
- [% END %]
- [% END %]
+ <ul>
+ <li><a href="/">[% loc("Report a problem") %]</a></li>
+ <li><a href="/reports">[% loc("All reports") %]</a></li>
+ <li><a href="/alert">[% loc("Local alerts") %]</a></li>
+ <li><a href="/faq">[% loc("Help") %]</a></li>
+ <li><a href="/about">[% loc('About us') %]</a></li>
+ [% IF lang_code == 'en-gb' %]
+ <li><a href="http://cy.[% c.cobrand.base_host %][% c.req.uri.path_query %]">Cymraeg</a></li>
+ [% ELSE %]
+ <li><a href="http://en.[% c.cobrand.base_host %][% c.req.uri.path_query %]">English</a></li>
+ [% END %]
</ul>
</div>
diff --git a/templates/web/fiksgatami/footer.html b/templates/web/fiksgatami/footer.html
index 8b3038e71..a7f899af4 100644
--- a/templates/web/fiksgatami/footer.html
+++ b/templates/web/fiksgatami/footer.html
@@ -2,11 +2,11 @@
<h2 class="v">[% loc('Navigation') %]</h2>
<ul id="navigation">
-<li><a href="/report/new" >[% loc("Report a problem") %]</a></li>
-<li><a href="/reports" >[% loc("All reports") %]</a></li>
-<li><a href="[% c.uri_for('/alert', {pc => pc}) | html %]">[% loc("Local alerts") %]</a></li>
-<li><a href="/faq" >[% loc("Help") %]</a></li>
-<li><a href="/contact" >[% loc("Contact") %]</a></li>
+<li><a href="/">[% loc("Report a problem") %]</a></li>
+<li><a href="/reports">[% loc("All reports") %]</a></li>
+<li><a href="[% c.uri_for('/alert', {pc => pc}) | html %]">[% loc("Local alerts") %]</a></li>
+<li><a href="/faq">[% loc("Help") %]</a></li>
+<li><a href="/contact">[% loc("Contact") %]</a></li>
</ul>
<div id="logo" align="center"><a href="http://www.nuug.no/">Foreningen NUUG</a></div>