diff options
author | Dave Arter <davea@mysociety.org> | 2016-04-13 10:35:56 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2016-07-08 15:28:22 +0100 |
commit | d2ef2aaa0155809b31ea577c8c26afeff5bec98b (patch) | |
tree | 902aa2db854fbf77caa85761d5eb02b03f84771b | |
parent | d6c1252f1ac1d802a63d7b719d8b676e89b40a06 (diff) |
Display link to FMS for Councils on reports
When viewing on FMS.com a report made via a council cobrand, this
adds a link to the FMS for Councils page for more info.
This works by breaking out the report meta line ('Reported in the
Street lighting category by Joe Bloggs at 09:51, Tuesday 1 March 2016')
into its own template which can be overridden for the fixmystreet.com cobrand.
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 20 | ||||
-rw-r--r-- | templates/web/base/report/_main.html | 3 | ||||
-rw-r--r-- | templates/web/base/report/_report_meta_info.html | 2 | ||||
-rw-r--r-- | templates/web/fixmystreet.com/report/_report_meta_info.html | 5 |
4 files changed, 28 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index a2167032a..d6bcea55c 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -868,4 +868,24 @@ sub get_time_spent { return $admin_logs ? $admin_logs->get_column('sum_time_spent') : 0; } +=head2 get_cobrand_logged + +Get a cobrand object for the cobrand the problem was logged for. + +e.g. if a problem was logged at www.fixmystreet.com, this will be a +FixMyStreet::Cobrand::FixMyStreet object. + +=cut + +has get_cobrand_logged => ( + is => 'ro', + lazy => 1, + default => sub { + my $self = shift; + my $cobrand_class = FixMyStreet::Cobrand->get_class_for_moniker( $self->cobrand ); + return $cobrand_class->new; + }, +); + + 1; diff --git a/templates/web/base/report/_main.html b/templates/web/base/report/_main.html index 4821b3fa0..1eb6f809e 100644 --- a/templates/web/base/report/_main.html +++ b/templates/web/base/report/_main.html @@ -32,8 +32,7 @@ </label> </div> <p class="report_meta_info"> - [% problem.meta_line(c) | html %] - [%- IF !problem.used_map %]; <strong>([% loc('there is no pin shown as the user did not use the map') %])</strong>[% END %] + [% INCLUDE 'report/_report_meta_info.html' %] </p> [% INCLUDE 'report/_main_sent_info.html' %] diff --git a/templates/web/base/report/_report_meta_info.html b/templates/web/base/report/_report_meta_info.html new file mode 100644 index 000000000..da7339c81 --- /dev/null +++ b/templates/web/base/report/_report_meta_info.html @@ -0,0 +1,2 @@ +[% problem.meta_line(c) | html %] +[%- IF !problem.used_map %]; <strong>([% loc('there is no pin shown as the user did not use the map') %])</strong>[% END %] diff --git a/templates/web/fixmystreet.com/report/_report_meta_info.html b/templates/web/fixmystreet.com/report/_report_meta_info.html new file mode 100644 index 000000000..da0912a3f --- /dev/null +++ b/templates/web/fixmystreet.com/report/_report_meta_info.html @@ -0,0 +1,5 @@ +[% problem.meta_line(c) | html %] +[% IF c.cobrand.moniker != problem.get_cobrand_logged.moniker AND problem.get_cobrand_logged.is_council %] + using <a href="https://www.fixmystreet.com/about/council">FixMyStreet for Councils</a> +[% END %] +[%- IF !problem.used_map %]; <strong>([% loc('there is no pin shown as the user did not use the map') %])</strong>[% END %] |