From 54f5fbe4bf319e5c8fdb6377838afbc811431a90 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 27 Apr 2016 10:51:06 +0100 Subject: Allow change of email in admin to existing entry. --- perllib/FixMyStreet/App/Controller/Admin.pm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index f54a862ab..3e757f227 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -1135,9 +1135,21 @@ sub user_edit : Path('user_edit') : Args(1) { return; } - $user->update; - if ($edited) { - $c->forward( 'log_edit', [ $id, 'user', 'edit' ] ); + my $existing_user = $c->model('DB::User')->search({ email => $user->email, id => { '!=', $user->id } })->first; + if ($existing_user) { + foreach (qw(Problem Comment Alert)) { + $c->model("DB::$_") + ->search({ user_id => $user->id }) + ->update({ user_id => $existing_user->id }); + } + $user->delete; + $c->forward( 'log_edit', [ $id, 'user', 'merge' ] ); + $c->res->redirect( $c->uri_for( 'user_edit', $existing_user->id ) ); + } else { + $user->update; + if ($edited) { + $c->forward( 'log_edit', [ $id, 'user', 'edit' ] ); + } } $c->stash->{status_message} = -- cgit v1.2.3 From 8142ab98cb9e0c095f628e2d413fb0cc67753073 Mon Sep 17 00:00:00 2001 From: Zarino Zappia Date: Fri, 29 Apr 2016 17:36:26 +0100 Subject: [fixmystreet.com] Add standard mySociety footer. Like a number of recent council cobrands, we remove parts of the default desktop footer and append our own responsive one in `footer_extra.html`. This also updates the FixMyStreet app logos (for fixmystreet.com and any other cobrands that use them) to the most recent style of Apple / Google sanctioned badges. Fixes #1385. --- templates/web/base/footer.html | 3 - templates/web/bromley/footer.html | 3 - templates/web/fixmystreet.com/footer-nav.html | 24 --- templates/web/fixmystreet.com/footer_extra.html | 87 ++++++++ .../fixmystreet.com/front/footer-marketing.html | 15 -- templates/web/greenwich/footer.html | 3 - templates/web/harrogate/footer.html | 3 - web/cobrands/fixmystreet.com/_mysoc_footer.scss | 230 +++++++++++++++++++++ web/cobrands/fixmystreet.com/base.scss | 108 +++++++++- .../images/mysoc-footer/icon-facebook.png | Bin 0 -> 344 bytes .../images/mysoc-footer/icon-facebook.svg | 1 + .../images/mysoc-footer/icon-facebook@2x.png | Bin 0 -> 612 bytes .../images/mysoc-footer/icon-github.png | Bin 0 -> 526 bytes .../images/mysoc-footer/icon-github.svg | 1 + .../images/mysoc-footer/icon-github@2x.png | Bin 0 -> 994 bytes .../images/mysoc-footer/icon-twitter.png | Bin 0 -> 436 bytes .../images/mysoc-footer/icon-twitter.svg | 1 + .../images/mysoc-footer/icon-twitter@2x.png | Bin 0 -> 836 bytes .../images/mysoc-footer/logo-fms-platform.png | Bin 0 -> 2123 bytes .../images/mysoc-footer/logo-fms-platform.svg | 1 + .../images/mysoc-footer/logo-fms-platform@2x.png | Bin 0 -> 4787 bytes .../images/mysoc-footer/logo-mysociety.png | Bin 0 -> 2178 bytes .../images/mysoc-footer/logo-mysociety.svg | 1 + .../images/mysoc-footer/logo-mysociety@2x.png | Bin 0 -> 4340 bytes web/cobrands/fixmystreet.com/layout.scss | 75 +++---- .../fixmystreet/images/google_play_logo.png | Bin 4650 -> 3008 bytes .../fixmystreet/images/google_play_logo@2.png | Bin 0 -> 6575 bytes .../fixmystreet/images/itunes_store_logo.png | Bin 2123 -> 1793 bytes .../fixmystreet/images/itunes_store_logo@2.png | Bin 0 -> 3921 bytes 29 files changed, 459 insertions(+), 97 deletions(-) delete mode 100644 templates/web/fixmystreet.com/footer-nav.html create mode 100644 templates/web/fixmystreet.com/footer_extra.html create mode 100644 web/cobrands/fixmystreet.com/_mysoc_footer.scss create mode 100644 web/cobrands/fixmystreet.com/images/mysoc-footer/icon-facebook.png create mode 100644 web/cobrands/fixmystreet.com/images/mysoc-footer/icon-facebook.svg create mode 100644 web/cobrands/fixmystreet.com/images/mysoc-footer/icon-facebook@2x.png create mode 100644 web/cobrands/fixmystreet.com/images/mysoc-footer/icon-github.png create mode 100644 web/cobrands/fixmystreet.com/images/mysoc-footer/icon-github.svg create mode 100644 web/cobrands/fixmystreet.com/images/mysoc-footer/icon-github@2x.png create mode 100644 web/cobrands/fixmystreet.com/images/mysoc-footer/icon-twitter.png create mode 100644 web/cobrands/fixmystreet.com/images/mysoc-footer/icon-twitter.svg create mode 100644 web/cobrands/fixmystreet.com/images/mysoc-footer/icon-twitter@2x.png create mode 100644 web/cobrands/fixmystreet.com/images/mysoc-footer/logo-fms-platform.png create mode 100644 web/cobrands/fixmystreet.com/images/mysoc-footer/logo-fms-platform.svg create mode 100644 web/cobrands/fixmystreet.com/images/mysoc-footer/logo-fms-platform@2x.png create mode 100644 web/cobrands/fixmystreet.com/images/mysoc-footer/logo-mysociety.png create mode 100644 web/cobrands/fixmystreet.com/images/mysoc-footer/logo-mysociety.svg create mode 100644 web/cobrands/fixmystreet.com/images/mysoc-footer/logo-mysociety@2x.png create mode 100644 web/cobrands/fixmystreet/images/google_play_logo@2.png create mode 100644 web/cobrands/fixmystreet/images/itunes_store_logo@2.png diff --git a/templates/web/base/footer.html b/templates/web/base/footer.html index 7626736a0..c10d9c008 100644 --- a/templates/web/base/footer.html +++ b/templates/web/base/footer.html @@ -5,9 +5,6 @@ [% END %] - [% IF c.cobrand.moniker == 'fixmystreet' AND bodyclass != 'mappage' %] - [% INCLUDE 'footer-nav.html' %] - [% END %] - [% IF c.cobrand.moniker == 'fixmystreet' AND bodyclass != 'mappage' %] - [% INCLUDE 'footer-nav.html' %] - [% END %] - [% IF c.cobrand.moniker == 'fixmystreet' AND bodyclass != 'mappage' %] - [% INCLUDE 'footer-nav.html' %] - [% END %] -[% IF total_bodies == 0 %] +[% IF bodies.size == 0 %]

[% loc('Currently no bodies have been created.') %]
@@ -20,14 +20,31 @@ and to receive notices of updates.

[% END %] -[%- BLOCK states -%] -[%- FOREACH state IN list %] -[%- '" IF loop.last %] -[%- END %] -[% END -%] +
+

+ +

+ +
+

+ +

+ +
+ + + +
+

[% loc('Stats') %]

[% INCLUDE 'status/stats.html' admin_include_users=1 %] [% IF c.cobrand.admin_show_creation_graph -%] @@ -36,28 +53,4 @@ and to receive notices of updates.

[% END -%] -

[% loc('Problem breakdown by state') %]

-[% FOREACH group IN state_groups %] -[%- '" IF loop.last %] -[%- END %] - -

[% loc('Update breakdown by state') %]

-[% PROCESS states object=comments list=comments.keys.sort %] - -[% IF categories.size %] -

[% loc('Category fix rate for problems > 4 weeks old') %]

- - -[% FOREACH category IN categories %] - -[% END %] -
[% loc('Category') %][% loc('Total') %][% loc('Fixed') %]
[% category.key %][% category.value.total %][% category.value.fixed / category.value.total * 100 | format('%.1f') %]%
-[% ELSE %] -

[% loc('Category fix rate for problems > 4 weeks old') %]

-[% END %] - [% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/stats.html b/templates/web/base/admin/stats.html index d143d9f28..5aaf59068 100644 --- a/templates/web/base/admin/stats.html +++ b/templates/web/base/admin/stats.html @@ -51,6 +51,13 @@ [% loc( 'Note that when including unconfirmed reports we use the date the report was created which may not be in the same month the report was confirmed so the numbers may jump about a little' ) %]

[% END %] +[% ELSE %] + + [% END %] [% IF errors %] diff --git a/templates/web/base/admin/stats_by_state.html b/templates/web/base/admin/stats_by_state.html new file mode 100644 index 000000000..b003d934e --- /dev/null +++ b/templates/web/base/admin/stats_by_state.html @@ -0,0 +1,24 @@ +[% INCLUDE 'admin/header.html' title=loc('Stats') -%] +[% PROCESS 'admin/report_blocks.html' %] + +[%- BLOCK states -%] +[%- FOREACH state IN list %] +[%- '" IF loop.last %] +[%- END %] +[% END -%] + +

[% loc('Problem breakdown by state') %]

+[% FOREACH group IN state_groups %] +[%- '" IF loop.last %] +[%- END %] + +

[% loc('Update breakdown by state') %]

+[% PROCESS states object=comments list=comments.keys.sort %] + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/stats_fix_rate.html b/templates/web/base/admin/stats_fix_rate.html new file mode 100644 index 000000000..fb88a1c06 --- /dev/null +++ b/templates/web/base/admin/stats_fix_rate.html @@ -0,0 +1,10 @@ +[% INCLUDE 'admin/header.html' title=loc('Category fix rate for problems > 4 weeks old') -%] + + + +[% FOREACH category IN categories %] + +[% END %] +
[% loc('Category') %][% loc('Total') %][% loc('Fixed') %]
[% category.key %][% category.value.total %][% category.value.fixed / category.value.total * 100 | format('%.1f') %]%
+ +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/status/stats.html b/templates/web/base/status/stats.html index f847db2ef..0f201920d 100644 --- a/templates/web/base/status/stats.html +++ b/templates/web/base/status/stats.html @@ -8,7 +8,7 @@ alerts_0 = alerts.0 | format_number; questionnaires_total = questionnaires.total | format_number; questionnaires_1 = questionnaires.1 | format_number; - total_bodies = total_bodies | format_number; + total_bodies = bodies.size | format_number; contacts_total = contacts.total | format_number; contacts_1 = contacts.1 | format_number; contacts_0 = contacts.0 | format_number; -- cgit v1.2.3 From cc5613a4108615d7b066b9974038c04b4afbd9e2 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 24 May 2016 16:52:30 +0100 Subject: Move processed_summary_string function to template Fixes #694. --- perllib/FixMyStreet/DB/Result/Problem.pm | 30 ----------------------- templates/web/base/report/_council_sent_info.html | 14 ++++++++++- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 12dad073e..5b853134e 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -662,36 +662,6 @@ sub can_display_external_id { return 0; } -# TODO Some/much of this could be moved to the template - -# either: -# "sent to council 3 mins later" -# "[Council name] ref: XYZ" -# or -# "sent to council 3 mins later, their ref: XYZ" -# -# Note: some silliness with pronouns and the adjacent comma mean this is -# being presented as a single string rather than two -sub processed_summary_string { - my ( $problem, $c ) = @_; - my ($duration_clause, $external_ref_clause); - if ($problem->whensent) { - $duration_clause = $problem->duration_string($c); - } - if ($problem->can_display_external_id) { - if ($duration_clause) { - $external_ref_clause = '' . sprintf(_('Council ref: %s'), $problem->external_id) . '.'; - } else { - $external_ref_clause = '' . sprintf(_('%s ref: %s'), $problem->external_body, $problem->external_id) . '.'; - } - } - if ($duration_clause and $external_ref_clause) { - return "$duration_clause. $external_ref_clause" - } else { - return $duration_clause || $external_ref_clause - } -} - sub duration_string { my ( $problem, $c ) = @_; my $body = $problem->body( $c ); diff --git a/templates/web/base/report/_council_sent_info.html b/templates/web/base/report/_council_sent_info.html index 4496611e0..affc73414 100644 --- a/templates/web/base/report/_council_sent_info.html +++ b/templates/web/base/report/_council_sent_info.html @@ -1,5 +1,17 @@ [% IF problem.whensent || problem.can_display_external_id %]

- [% problem.processed_summary_string(c) %] + [% SET duration_clause = problem.duration_string(c) IF problem.whensent %] + [%- IF problem.can_display_external_id %] + [%- IF duration_clause %] + [%- external_ref_clause = tprintf(loc('Council ref: %s'), problem.external_id) %] + [%- ELSE %] + [%- external_ref_clause = tprintf(loc('%s ref: %s'), problem.external_body, problem.external_id) %] + [%- END %] + [%- END -%] + [% duration_clause %] + [%- IF external_ref_clause %] + [%- IF duration_clause %]. [% END %] + [% external_ref_clause %]. + [%- END %]

[% END %] -- cgit v1.2.3 From 872545f8a71a98a91951be04515ca491e3cfed1d Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 24 May 2016 16:54:31 +0100 Subject: Add a couple of template hooks to report/_main This removes the need for the Oxfordshire cobrand to override. --- templates/web/base/report/_main.html | 8 +- templates/web/base/report/_main_sent_info.html | 5 + templates/web/oxfordshire/report/_main.html | 101 --------------------- templates/web/oxfordshire/report/_main_after.html | 7 ++ .../web/oxfordshire/report/_main_sent_info.html | 3 + 5 files changed, 18 insertions(+), 106 deletions(-) create mode 100644 templates/web/base/report/_main_sent_info.html delete mode 100644 templates/web/oxfordshire/report/_main.html create mode 100644 templates/web/oxfordshire/report/_main_after.html create mode 100644 templates/web/oxfordshire/report/_main_sent_info.html diff --git a/templates/web/base/report/_main.html b/templates/web/base/report/_main.html index efff314f8..c079b9ebd 100644 --- a/templates/web/base/report/_main.html +++ b/templates/web/base/report/_main.html @@ -35,11 +35,7 @@ [%- IF !problem.used_map %]; ([% loc('there is no pin shown as the user did not use the map') %])[% END %]

- [% IF problem.bodies_str %] - [% INCLUDE 'report/_council_sent_info.html' %] - [% ELSE %] -

[% loc('Not reported to council') %]

- [% END %] + [% INCLUDE 'report/_main_sent_info.html' %] [% mlog = problem.latest_moderation_log_entry(); IF mlog %]

Moderated by [% mlog.user.from_body.name %] at [% prettify_dt(mlog.whenedited) %]

[% END %] @@ -92,4 +88,6 @@ [% END %] + + [% TRY %][% PROCESS 'report/_main_after.html' %][% CATCH file %][% END %] diff --git a/templates/web/base/report/_main_sent_info.html b/templates/web/base/report/_main_sent_info.html new file mode 100644 index 000000000..3e54ac8ed --- /dev/null +++ b/templates/web/base/report/_main_sent_info.html @@ -0,0 +1,5 @@ +[% IF problem.bodies_str %] + [% INCLUDE 'report/_council_sent_info.html' %] +[% ELSE %] +

[% loc('Not reported to council') %]

+[% END %] diff --git a/templates/web/oxfordshire/report/_main.html b/templates/web/oxfordshire/report/_main.html deleted file mode 100644 index 2ff193075..000000000 --- a/templates/web/oxfordshire/report/_main.html +++ /dev/null @@ -1,101 +0,0 @@ -[% moderating = c.user && c.user.has_permission_to('moderate', problem.bodies_str) %] - -
- - [% IF moderating %] - [% original = problem_original %] -
-

- -

- [% END %] - -

[% problem.title | html %]

- - [% IF moderating %] -
- [% IF problem.title != original.title %] - - [% END %] -

-
- [% END %] - -
- -
-

- [% problem.meta_line(c) | html %] - [%- IF !problem.used_map %]; ([% loc('there is no pin shown as the user did not use the map') %])[% END %] -

- - [% IF problem.whensent %] -

[% problem.duration_string(c) %]

- [% END %] - [% mlog = problem.latest_moderation_log_entry(); IF mlog %] -

Moderated by [% mlog.user.from_body.name %] at [% prettify_dt(mlog.whenedited) %]

- [% END %] - - [% INCLUDE 'report/_support.html' %] - - [% IF moderating %] - [% IF problem.photo or original.photo %] -

- -

- [% END %] - [% END %] - - [% INCLUDE 'report/photo.html' object=problem %] -
- [% add_links( problem.detail ) | html_para %] -
- - [% IF moderating %] -

- [% IF problem.detail != original.detail %] - - [% END %] - -

- -
-

- -

-

- - -

-

- - -

-
- -
- [% END %] - - [% IF problem.bodies_str %] - [% INCLUDE 'report/_council_sent_info.html' %] - [% ELSE %] -
-

[% loc('Not reported to council') %]

-
- [% END %] -
diff --git a/templates/web/oxfordshire/report/_main_after.html b/templates/web/oxfordshire/report/_main_after.html new file mode 100644 index 000000000..16491a556 --- /dev/null +++ b/templates/web/oxfordshire/report/_main_after.html @@ -0,0 +1,7 @@ +[% IF problem.bodies_str %] + [% INCLUDE 'report/_council_sent_info.html' %] +[% ELSE %] +
+

[% loc('Not reported to council') %]

+
+[% END %] diff --git a/templates/web/oxfordshire/report/_main_sent_info.html b/templates/web/oxfordshire/report/_main_sent_info.html new file mode 100644 index 000000000..c955a5fae --- /dev/null +++ b/templates/web/oxfordshire/report/_main_sent_info.html @@ -0,0 +1,3 @@ +[% IF problem.whensent %] +

[% problem.duration_string(c) %]

+[% END %] -- cgit v1.2.3 From f10acf678577e3e5a691c8385a5c67944cd1ca2f Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 24 May 2016 16:59:56 +0100 Subject: [fixmystreet.com] Only output experiment on live. --- templates/web/fixmystreet.com/header_extra.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/web/fixmystreet.com/header_extra.html b/templates/web/fixmystreet.com/header_extra.html index e05bc31d2..0d53550eb 100644 --- a/templates/web/fixmystreet.com/header_extra.html +++ b/templates/web/fixmystreet.com/header_extra.html @@ -4,6 +4,7 @@ [%# We are conducting an A/B experiment %] +[% IF c.config.BASE_URL == "https://www.fixmystreet.com" %] +[% END %]