aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/update-schema1
-rw-r--r--db/schema.sql1
-rw-r--r--db/schema_0031-add_url_to_body.sql9
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm1
-rw-r--r--perllib/FixMyStreet/DB/Result/Body.pm2
-rw-r--r--templates/web/default/report/new/councils_text_none.html11
-rw-r--r--templates/web/fixamingata/report/new/notes.html5
7 files changed, 29 insertions, 1 deletions
diff --git a/bin/update-schema b/bin/update-schema
index f728f8c56..198fa6b8d 100644
--- a/bin/update-schema
+++ b/bin/update-schema
@@ -84,6 +84,7 @@ print "Nothing to do\n" if $nothing;
# By querying the database schema, we can see where we're currently at
# (assuming schema change files are never half-applied, which should be the case)
sub get_db_version {
+ return '0031' if column_exists('body', 'external_url');
return '0028' if table_exists('body');
return '0027' if column_exists('problem', 'subcategory');
return '0026' if column_exists('open311conf', 'send_extended_statuses');
diff --git a/db/schema.sql b/db/schema.sql
index 5e4bc4a3e..f221825f2 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -55,6 +55,7 @@ create table users (
create table body (
id serial primary key,
name text not null,
+ external_url text,
parent integer references body(id),
endpoint text,
jurisdiction text,
diff --git a/db/schema_0031-add_url_to_body.sql b/db/schema_0031-add_url_to_body.sql
new file mode 100644
index 000000000..7aaa78c64
--- /dev/null
+++ b/db/schema_0031-add_url_to_body.sql
@@ -0,0 +1,9 @@
+BEGIN;
+
+-- `external_url' includes an URL for reporting problems to the body directly.
+-- It can be displayed in the new report form when no contacts are set; see
+-- templates/web/fixamingata/report/new/councils_text_none.html for an example.
+
+ALTER TABLE body ADD external_url TEXT;
+
+COMMIT;
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 3d3ddce1e..128ef2790 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -669,6 +669,7 @@ sub setup_categories_and_bodies : Private {
# put results onto stash for display
$c->stash->{bodies} = \%bodies;
$c->stash->{all_body_names} = [ map { $_->name } values %bodies ];
+ $c->stash->{all_body_urls} = [ map { $_->external_url } values %bodies ];
$c->stash->{bodies_to_list} = [ keys %bodies_to_list ];
$c->stash->{category_options} = \@category_options;
$c->stash->{category_extras} = \%category_extras;
diff --git a/perllib/FixMyStreet/DB/Result/Body.pm b/perllib/FixMyStreet/DB/Result/Body.pm
index 83704563a..bab16061b 100644
--- a/perllib/FixMyStreet/DB/Result/Body.pm
+++ b/perllib/FixMyStreet/DB/Result/Body.pm
@@ -40,6 +40,8 @@ __PACKAGE__->add_columns(
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
"parent",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
+ "external_url",
+ { data_type => "text", is_nullable => 0 },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->has_many(
diff --git a/templates/web/default/report/new/councils_text_none.html b/templates/web/default/report/new/councils_text_none.html
index 3c445b085..9293c03a7 100644
--- a/templates/web/default/report/new/councils_text_none.html
+++ b/templates/web/default/report/new/councils_text_none.html
@@ -8,6 +8,13 @@
[%
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.");
%]
+[% IF c.cobrand.moniker == 'fixamingata' AND all_body_names.size == 1 %]
+[%
+ tprintf(
+ "Du kan istället kontakta %s via <a href='%s'>deras webbsida</a>.",
+ all_body_names.first, all_body_urls.first);
+%]
+[% ELSE %]
[%
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>."),
@@ -16,4 +23,6 @@
c.cobrand.contact_email
);
-%]</p>
+%]
+[% END %]
+</p>
diff --git a/templates/web/fixamingata/report/new/notes.html b/templates/web/fixamingata/report/new/notes.html
index d508b1929..8f081f637 100644
--- a/templates/web/fixamingata/report/new/notes.html
+++ b/templates/web/fixamingata/report/new/notes.html
@@ -5,5 +5,10 @@
<li>[% loc("Please be polite, concise and to the point.") %]</li>
<li>[% loc("Please do not be abusive&nbsp;&mdash; abusing your council devalues the service for all users.") %]</li>
<li>[% loc("Writing your message entirely in block capitals makes it hard to read, as does a lack of punctuation.") %]</li>
+[% IF all_councils.items.first > 0 %]
+ <li>[% id = all_councils.items.first;
+ tprintf("Kom ihåg att FixaMinGata primärt är avsett för att rapportera fysiska problem som kan åtgärdas. Om ditt problem inte lämpar sig för att rapportera via den här webbsidan kan du kontakta din kommun direkt via <a href='%s'>deras webbsida</a>.", all_body_urls.$id); %]</li>
+[% ELSE %]
<li>[% loc("Remember that FixMyStreet is primarily for reporting physical problems that can be fixed. If your problem is not appropriate for submission via this site remember that you can contact your council directly using their own website.") %]</li>
+[% END %]
</ul>