aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-06-29 09:40:32 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-06-29 09:40:32 +0100
commitb6adc31fffa73d90ad948e5b24ce31d69803d83e (patch)
tree244e11120ffab4e7ca242574cba96503d2a1a0a0
parent4ac342ac28605c89ec0cb5b25e4f99ec42a77e28 (diff)
parent5cf9a812ada261389e9e9d67d20553fe72ea472f (diff)
Merge branch '1347-fold-back-zurich'
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm100
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm13
-rw-r--r--perllib/FixMyStreet/Script/Reports.pm16
-rw-r--r--perllib/Open311.pm2
-rw-r--r--t/app/controller/admin.t32
-rw-r--r--t/app/model/problem.t12
-rw-r--r--t/open311.t2
-rw-r--r--templates/email/default/submit.txt2
-rw-r--r--templates/email/fiksgatami/nn/submit.txt2
-rw-r--r--templates/email/fiksgatami/submit.txt2
-rw-r--r--templates/email/fixamingata/submit.txt2
-rw-r--r--templates/email/fixmystreet.com/submit-oxfordshire.txt4
-rw-r--r--templates/email/fixmystreet.com/submit.txt6
-rw-r--r--templates/email/harrogate/submit.txt4
-rw-r--r--templates/email/oxfordshire/submit.txt4
-rw-r--r--templates/email/seesomething/submit.txt4
-rw-r--r--templates/web/base/admin/header.html14
-rw-r--r--templates/web/base/admin/navigation.html11
-rw-r--r--templates/web/base/admin/report_edit.html140
-rw-r--r--templates/web/fixmystreet.com/report/new/extra_name.html8
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js12
-rw-r--r--web/cobrands/sass/_admin.scss5
-rw-r--r--web/cobrands/sass/_base.scss22
-rw-r--r--web/cobrands/sass/_layout.scss21
24 files changed, 256 insertions, 184 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 27b434f06..50b4360eb 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -652,23 +652,21 @@ sub report_edit : Path('report_edit') : Args(1) {
$c->forward('/auth/get_csrf_token');
- if ( $c->cobrand->moniker eq 'zurich' ) {
- $c->stash->{page} = 'admin';
- FixMyStreet::Map::display_map(
- $c,
+ $c->stash->{page} = 'admin';
+ FixMyStreet::Map::display_map(
+ $c,
+ latitude => $problem->latitude,
+ longitude => $problem->longitude,
+ pins => $problem->used_map
+ ? [ {
latitude => $problem->latitude,
longitude => $problem->longitude,
- pins => $problem->used_map
- ? [ {
- latitude => $problem->latitude,
- longitude => $problem->longitude,
- colour => $c->cobrand->pin_colour($problem),
- type => 'big',
- } ]
- : [],
- print_report => 1,
- );
- }
+ colour => $c->cobrand->pin_colour($problem, 'admin'),
+ type => 'big',
+ } ]
+ : [],
+ print_report => 1,
+ );
if (my $rotate_photo_param = $self->_get_rotate_photo_param($c)) {
$self->rotate_photo($c, $problem, @$rotate_photo_param);
@@ -707,8 +705,7 @@ sub report_edit : Path('report_edit') : Args(1) {
}
elsif ( $c->get_param('mark_sent') ) {
$c->forward('/auth/check_csrf_token');
- $problem->whensent(\'current_timestamp');
- $problem->update();
+ $problem->update({ whensent => \'current_timestamp' })->discard_changes;
$c->stash->{status_message} = '<p><em>' . _('That problem has been marked as sent.') . '</em></p>';
$c->forward( 'log_edit', [ $id, 'problem', 'marked sent' ] );
}
@@ -726,37 +723,17 @@ sub report_edit : Path('report_edit') : Args(1) {
elsif ( $c->get_param('submit') ) {
$c->forward('/auth/check_csrf_token');
- my $done = 0;
- my $edited = 0;
-
- my $new_state = $c->get_param('state');
my $old_state = $problem->state;
- my $flagged = $c->get_param('flagged') ? 1 : 0;
- my $non_public = $c->get_param('non_public') ? 1 : 0;
-
- # do this here so before we update the values in problem
- if ( $c->get_param('anonymous') ne $problem->anonymous
- || $c->get_param('name') ne $problem->name
- || $c->get_param('email') ne $problem->user->email
- || $c->get_param('title') ne $problem->title
- || $c->get_param('detail') ne $problem->detail
- || ($c->get_param('body') && $c->get_param('body') ne $problem->bodies_str)
- || $flagged != $problem->flagged
- || $non_public != $problem->non_public )
- {
- $edited = 1;
+ my %columns = (
+ flagged => $c->get_param('flagged') ? 1 : 0,
+ non_public => $c->get_param('non_public') ? 1 : 0,
+ );
+ $columns{bodies_str} = $c->get_param('body') if $c->get_param('body');
+ foreach (qw/state anonymous title detail name external_id external_body external_team/) {
+ $columns{$_} = $c->get_param($_);
}
-
- $problem->anonymous( $c->get_param('anonymous') );
- $problem->title( $c->get_param('title') );
- $problem->detail( $c->get_param('detail') );
- $problem->state( $new_state );
- $problem->name( $c->get_param('name') );
- $problem->bodies_str( $c->get_param('body') ) if $c->get_param('body');
-
- $problem->flagged( $flagged );
- $problem->non_public( $non_public );
+ $problem->set_inflated_columns(\%columns);
if ( $c->get_param('email') ne $problem->user->email ) {
my $user = $c->model('DB::User')->find_or_create(
@@ -773,7 +750,7 @@ sub report_edit : Path('report_edit') : Args(1) {
$self->remove_photo($c, $problem, $remove_photo_param);
}
- if ( $remove_photo_param || $new_state eq 'hidden' ) {
+ if ( $remove_photo_param || $problem->state eq 'hidden' ) {
$problem->get_photoset->delete_cached;
}
@@ -781,27 +758,20 @@ sub report_edit : Path('report_edit') : Args(1) {
$problem->confirmed( \'current_timestamp' );
}
- if ($done) {
- $problem->discard_changes;
- }
- else {
- $problem->lastupdate( \'current_timestamp' ) if $edited || $new_state ne $old_state;
- $problem->update;
+ $problem->lastupdate( \'current_timestamp' );
+ $problem->update;
- if ( $new_state ne $old_state ) {
- $c->forward( 'log_edit', [ $id, 'problem', 'state_change' ] );
- }
- if ($edited) {
- $c->forward( 'log_edit', [ $id, 'problem', 'edit' ] );
- }
+ if ( $problem->state ne $old_state ) {
+ $c->forward( 'log_edit', [ $id, 'problem', 'state_change' ] );
+ }
+ $c->forward( 'log_edit', [ $id, 'problem', 'edit' ] );
- $c->stash->{status_message} =
- '<p><em>' . _('Updated!') . '</em></p>';
+ $c->stash->{status_message} =
+ '<p><em>' . _('Updated!') . '</em></p>';
- # do this here otherwise lastupdate and confirmed times
- # do not display correctly
- $problem->discard_changes;
- }
+ # do this here otherwise lastupdate and confirmed times
+ # do not display correctly
+ $problem->discard_changes;
}
return 1;
@@ -1106,7 +1076,7 @@ sub user_edit : Path('user_edit') : Args(1) {
if ( $user->email ne $c->get_param('email') ||
$user->name ne $c->get_param('name') ||
- $user->phone ne $c->get_param('phone') ||
+ ($user->phone || "") ne $c->get_param('phone') ||
($user->from_body && $user->from_body->id ne $c->get_param('body')) ||
(!$user->from_body && $c->get_param('body'))
) {
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 5b853134e..628497233 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -160,6 +160,7 @@ __PACKAGE__->rabx_column('geocode');
use Moo;
use namespace::clean -except => [ 'meta' ];
use Utils;
+use FixMyStreet::Map::FMS;
with 'FixMyStreet::Roles::Abuser',
'FixMyStreet::Roles::Extra';
@@ -672,13 +673,15 @@ sub duration_string {
sub local_coords {
my $self = shift;
- if ($self->cobrand eq 'zurich') {
+ my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($self->cobrand)->new;
+ if ($cobrand->moniker eq 'zurich') {
my ($x, $y) = Geo::Coordinates::CH1903::from_latlon($self->latitude, $self->longitude);
return ( int($x+0.5), int($y+0.5) );
- }
- else {
- # return a dummy value until this function is implemented. useful for testing.
- return (0, 0);
+ } elsif ($cobrand->country eq 'GB') {
+ my $coordsyst = 'G';
+ $coordsyst = 'I' if FixMyStreet::Map::FMS::in_northern_ireland_box($self->latitude, $self->longitude);
+ my ($x, $y) = Utils::convert_latlon_to_en( $self->latitude, $self->longitude, $coordsyst );
+ return ($x, $y, $coordsyst);
}
}
diff --git a/perllib/FixMyStreet/Script/Reports.pm b/perllib/FixMyStreet/Script/Reports.pm
index 278c58af1..30d24f640 100644
--- a/perllib/FixMyStreet/Script/Reports.pm
+++ b/perllib/FixMyStreet/Script/Reports.pm
@@ -108,8 +108,6 @@ sub send(;$) {
$h{user_details} .= sprintf(_('Email: %s'), $row->user->email) . "\n\n";
}
- $h{easting_northing} = '';
-
if ($cobrand->can('process_additional_metadata_for_email')) {
$cobrand->process_additional_metadata_for_email($row, \%h);
}
@@ -150,19 +148,9 @@ sub send(;$) {
$reporters{ $sender }->add_body( $body, $sender_info->{config} );
}
- # If we are in the UK include eastings and northings, and nearest stuff
+ # If we are in the UK include eastings and northings
if ( $cobrand->country eq 'GB' && !$h{easting} ) {
- my $coordsyst = 'G';
- my $first_area = $body->body_areas->first->area_id;
- my $area_info = mySociety::MaPit::call('area', $first_area);
- $coordsyst = 'I' if $area_info->{type} eq 'LGD';
-
- ( $h{easting}, $h{northing} ) = Utils::convert_latlon_to_en( $h{latitude}, $h{longitude}, $coordsyst );
-
- # email templates don't have conditionals so we need to format this here
- $h{easting_northing} = "Easting/Northing";
- $h{easting_northing} .= " (IE)" if $coordsyst eq 'I';
- $h{easting_northing} .= ": $h{easting}/$h{northing}\n\n";
+ ( $h{easting}, $h{northing}, $h{coordsyst} ) = $row->local_coords;
}
}
diff --git a/perllib/Open311.pm b/perllib/Open311.pm
index 6434be1fb..69c946004 100644
--- a/perllib/Open311.pm
+++ b/perllib/Open311.pm
@@ -166,7 +166,7 @@ sub _generate_service_request_description {
my $extra = shift;
my $description = "";
- if ($extra->{easting_northing}) { # Proxy for cobrand being in the UK
+ if ($extra->{easting}) { # Proxy for cobrand being in the UK
$description .= "detail: " . $problem->detail . "\n\n";
$description .= "url: " . $extra->{url} . "\n\n";
$description .= "Submitted via FixMyStreet\n";
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t
index dc7aed341..f8f280d63 100644
--- a/t/app/controller/admin.t
+++ b/t/app/controller/admin.t
@@ -327,7 +327,6 @@ foreach my $test (
non_public => undef,
},
changes => { title => 'Edited Report', },
- log_count => 1,
log_entries => [qw/edit/],
resend => 0,
},
@@ -344,7 +343,6 @@ foreach my $test (
non_public => undef,
},
changes => { detail => 'Edited Detail', },
- log_count => 2,
log_entries => [qw/edit edit/],
resend => 0,
},
@@ -361,7 +359,6 @@ foreach my $test (
non_public => undef,
},
changes => { name => 'Edited User', },
- log_count => 3,
log_entries => [qw/edit edit edit/],
resend => 0,
user => $user,
@@ -381,7 +378,6 @@ foreach my $test (
changes => {
flagged => 'on',
},
- log_count => 4,
log_entries => [qw/edit edit edit edit/],
resend => 0,
user => $user,
@@ -399,7 +395,6 @@ foreach my $test (
non_public => undef,
},
changes => { email => $user2->email, },
- log_count => 5,
log_entries => [qw/edit edit edit edit edit/],
resend => 0,
user => $user2,
@@ -417,8 +412,7 @@ foreach my $test (
non_public => undef,
},
changes => { state => 'unconfirmed' },
- log_count => 6,
- log_entries => [qw/state_change edit edit edit edit edit/],
+ log_entries => [qw/edit state_change edit edit edit edit edit/],
resend => 0,
},
{
@@ -434,8 +428,7 @@ foreach my $test (
non_public => undef,
},
changes => { state => 'confirmed' },
- log_count => 7,
- log_entries => [qw/state_change state_change edit edit edit edit edit/],
+ log_entries => [qw/edit state_change edit state_change edit edit edit edit edit/],
resend => 0,
},
{
@@ -451,9 +444,8 @@ foreach my $test (
non_public => undef,
},
changes => { state => 'fixed' },
- log_count => 8,
log_entries =>
- [qw/state_change state_change state_change edit edit edit edit edit/],
+ [qw/edit state_change edit state_change edit state_change edit edit edit edit edit/],
resend => 0,
},
{
@@ -469,9 +461,8 @@ foreach my $test (
non_public => undef,
},
changes => { state => 'hidden' },
- log_count => 9,
log_entries => [
- qw/state_change state_change state_change state_change edit edit edit edit edit/
+ qw/edit state_change edit state_change edit state_change edit state_change edit edit edit edit edit/
],
resend => 0,
},
@@ -491,9 +482,8 @@ foreach my $test (
state => 'confirmed',
anonymous => 1,
},
- log_count => 11,
log_entries => [
- qw/edit state_change state_change state_change state_change state_change edit edit edit edit edit/
+ qw/edit state_change edit state_change edit state_change edit state_change edit state_change edit edit edit edit edit/
],
resend => 0,
},
@@ -510,9 +500,8 @@ foreach my $test (
non_public => undef,
},
changes => {},
- log_count => 12,
log_entries => [
- qw/resend edit state_change state_change state_change state_change state_change edit edit edit edit edit/
+ qw/resend edit state_change edit state_change edit state_change edit state_change edit state_change edit edit edit edit edit/
],
resend => 1,
},
@@ -531,9 +520,8 @@ foreach my $test (
changes => {
non_public => 'on',
},
- log_count => 13,
log_entries => [
- qw/edit resend edit state_change state_change state_change state_change state_change edit edit edit edit edit/
+ qw/edit resend edit state_change edit state_change edit state_change edit state_change edit state_change edit edit edit edit edit/
],
resend => 0,
},
@@ -543,6 +531,7 @@ foreach my $test (
$log_entries->reset;
$mech->get_ok("/admin/report_edit/$report_id");
+ @{$test->{fields}}{'external_id', 'external_body', 'external_team'} = (13, "", "");
is_deeply( $mech->visible_form_values(), $test->{fields}, 'initial form values' );
my $new_fields = {
@@ -557,7 +546,7 @@ foreach my $test (
}
is_deeply( $mech->visible_form_values(), $new_fields, 'changed form values' );
- is $log_entries->count, $test->{log_count}, 'log entry count';
+ is $log_entries->count, scalar @{$test->{log_entries}}, 'log entry count';
is $log_entries->next->action, $_, 'log entry added' for @{ $test->{log_entries} };
$report->discard_changes;
@@ -596,6 +585,9 @@ subtest 'change email to new user' => sub {
anonymous => 1,
flagged => 'on',
non_public => 'on',
+ external_id => '13',
+ external_body => '',
+ external_team => '',
};
is_deeply( $mech->visible_form_values(), $fields, 'initial form values' );
diff --git a/t/app/model/problem.t b/t/app/model/problem.t
index 4e4a098d7..ea45f7356 100644
--- a/t/app/model/problem.t
+++ b/t/app/model/problem.t
@@ -16,8 +16,8 @@ my $problem_rs = FixMyStreet::DB->resultset('Problem');
my $problem = $problem_rs->new(
{
postcode => 'EH99 1SP',
- latitude => '51.5',
- longitude => '-0.1',
+ latitude => '54.5',
+ longitude => '-1.5',
areas => 1,
title => '',
detail => '',
@@ -487,7 +487,7 @@ foreach my $test ( {
to => qr'Ballymoney Borough Council',
body => $body_ids{14279}[0],
category => 'Graffiti',
- longitude => -9.5,
+ longitude => -6.5,
}, {
%common,
desc => 'directs NI correctly, 2',
@@ -497,7 +497,7 @@ foreach my $test ( {
to => qr'TransportNI \(Western\)" <roads',
body => $body_ids{14279}[1],
category => 'Street lighting',
- longitude => -9.5,
+ longitude => -6.5,
}, {
%common,
desc => 'does not send to unconfirmed contact',
@@ -535,7 +535,7 @@ foreach my $test ( {
category => $test->{ category } || 'potholes',
name => $test->{ name },
cobrand => $test->{ cobrand } || 'fixmystreet',
- longitude => $test->{longitude} || '-0.1',
+ longitude => $test->{longitude} || '-1.5',
} );
FixMyStreet::override_config $override, sub {
@@ -552,7 +552,7 @@ foreach my $test ( {
like $email->body, qr/Subject: A Title/, 'more email body checking';
like $email->body, $test->{ dear }, 'Salutation looks correct';
if ($test->{longitude}) {
- like $email->body, qr{Easting/Northing \(IE\): 95938/28531};
+ like $email->body, qr{Easting/Northing \(IE\): 297279/362371};
} else {
like $email->body, qr{Easting/Northing: };
}
diff --git a/t/open311.t b/t/open311.t
index 42d09b29c..cbf305a36 100644
--- a/t/open311.t
+++ b/t/open311.t
@@ -69,7 +69,7 @@ my $problem = FixMyStreet::DB->resultset('Problem')->new( {
subtest 'posting service request' => sub {
my $extra = {
url => 'http://example.com/report/1',
- easting_northing => 'SET',
+ easting => 'SET',
};
my $results = make_service_req( $problem, $extra, $problem->category, '<?xml version="1.0" encoding="utf-8"?><service_requests><request><service_request_id>248</service_request_id></request></service_requests>' );
diff --git a/templates/email/default/submit.txt b/templates/email/default/submit.txt
index 3b6549d8e..5d79f3b41 100644
--- a/templates/email/default/submit.txt
+++ b/templates/email/default/submit.txt
@@ -21,7 +21,7 @@ Email: [% email %]
Details: [% detail %]
-[% easting_northing %]Latitude: [% latitude %]
+Latitude: [% latitude %]
Longitude: [% longitude %]
diff --git a/templates/email/fiksgatami/nn/submit.txt b/templates/email/fiksgatami/nn/submit.txt
index c3468a085..32a895632 100644
--- a/templates/email/fiksgatami/nn/submit.txt
+++ b/templates/email/fiksgatami/nn/submit.txt
@@ -21,7 +21,7 @@ E-post: [% email %]
Detaljer: [% detail %]
-[% easting_northing %]Breiddegrad: [% latitude %]
+Breiddegrad: [% latitude %]
Lengdegrad: [% longitude %]
diff --git a/templates/email/fiksgatami/submit.txt b/templates/email/fiksgatami/submit.txt
index d149f7f04..a0e0687eb 100644
--- a/templates/email/fiksgatami/submit.txt
+++ b/templates/email/fiksgatami/submit.txt
@@ -21,7 +21,7 @@ E-post: [% email %]
Detajer: [% detail %]
-[% easting_northing %]Breddegrad: [% latitude %]
+Breddegrad: [% latitude %]
Lengegrad: [% longitude %]
diff --git a/templates/email/fixamingata/submit.txt b/templates/email/fixamingata/submit.txt
index 4704cbd56..009ac9c6a 100644
--- a/templates/email/fixamingata/submit.txt
+++ b/templates/email/fixamingata/submit.txt
@@ -28,7 +28,7 @@ ID: [% id %]
** Geografisk position
-[% easting_northing %]Latitude: [% latitude %]
+Latitude: [% latitude %]
Longitude: [% longitude %]
diff --git a/templates/email/fixmystreet.com/submit-oxfordshire.txt b/templates/email/fixmystreet.com/submit-oxfordshire.txt
index f0fc5e9b7..547f7ce7f 100644
--- a/templates/email/fixmystreet.com/submit-oxfordshire.txt
+++ b/templates/email/fixmystreet.com/submit-oxfordshire.txt
@@ -21,7 +21,9 @@ Email: [% email %]
Details: [% detail %]
-[% easting_northing %]Latitude: [% latitude %]
+Easting/Northing: [% easting %]/[% northing %]
+
+Latitude: [% latitude %]
Longitude: [% longitude %]
diff --git a/templates/email/fixmystreet.com/submit.txt b/templates/email/fixmystreet.com/submit.txt
index 17642e645..735fdf37d 100644
--- a/templates/email/fixmystreet.com/submit.txt
+++ b/templates/email/fixmystreet.com/submit.txt
@@ -21,7 +21,11 @@ Email: [% email %]
Details: [% detail %]
-[% easting_northing %]Latitude: [% latitude %]
+Easting/Northing
+[%- " (IE)" IF coordsyst == "I" -%]
+: [% easting %]/[% northing %]
+
+Latitude: [% latitude %]
Longitude: [% longitude %]
diff --git a/templates/email/harrogate/submit.txt b/templates/email/harrogate/submit.txt
index 7f9357cf8..a4dcd5220 100644
--- a/templates/email/harrogate/submit.txt
+++ b/templates/email/harrogate/submit.txt
@@ -21,7 +21,9 @@ Email: [% email %]
[% detail %] [% additional_information %]
-[% easting_northing %]Latitude: [% latitude %]
+Easting/Northing: [% easting %]/[% northing %]
+
+Latitude: [% latitude %]
Longitude: [% longitude %]
diff --git a/templates/email/oxfordshire/submit.txt b/templates/email/oxfordshire/submit.txt
index f0fc5e9b7..547f7ce7f 100644
--- a/templates/email/oxfordshire/submit.txt
+++ b/templates/email/oxfordshire/submit.txt
@@ -21,7 +21,9 @@ Email: [% email %]
Details: [% detail %]
-[% easting_northing %]Latitude: [% latitude %]
+Easting/Northing: [% easting %]/[% northing %]
+
+Latitude: [% latitude %]
Longitude: [% longitude %]
diff --git a/templates/email/seesomething/submit.txt b/templates/email/seesomething/submit.txt
index e1c048e15..1f2adc11d 100644
--- a/templates/email/seesomething/submit.txt
+++ b/templates/email/seesomething/submit.txt
@@ -13,7 +13,9 @@ of a problem that they believe might require your attention.
Details: [% detail %]
-[% easting_northing %]Latitude: [% latitude %]
+Easting/Northing: [% easting %]/[% northing %]
+
+Latitude: [% latitude %]
Longitude: [% longitude %]
diff --git a/templates/web/base/admin/header.html b/templates/web/base/admin/header.html
index 145bb986d..ddaa4aa44 100644
--- a/templates/web/base/admin/header.html
+++ b/templates/web/base/admin/header.html
@@ -1,16 +1,14 @@
-[% INCLUDE 'header.html' admin = 1, bodyclass = 'fullwidthpage admin' %]
+[%
+ SET bodyclass = bodyclass || 'fullwidthpage';
+ INCLUDE 'header.html' admin = 1, bodyclass = bodyclass _ ' admin';
+%]
<style type="text/css">
dt { clear: left; float: left; font-weight: bold; }
dd { margin-left: 8em; }
.adminhidden { color: #666666; }
.error { color: red; }
select { width: auto; }
+.sm { font-size: smaller; }
</style>
- <p><strong>[% tprintf(loc('%s admin:', "%s here is the site name"), site_name) %]</strong>
- [%- FOREACH link IN allowed_links %]
- <a href="[% c.uri_for( link ) %]">[% allowed_pages.$link.0 %]</a>
- [% IF NOT loop.last %]|[% END %]
- [% END %]</p>
-
- <h1>[% title %]</h1>
+[% INCLUDE 'admin/navigation.html' UNLESS bodyclass.match('mappage') %]
diff --git a/templates/web/base/admin/navigation.html b/templates/web/base/admin/navigation.html
new file mode 100644
index 000000000..895589822
--- /dev/null
+++ b/templates/web/base/admin/navigation.html
@@ -0,0 +1,11 @@
+<div class="full-width full-width--top">
+ <p>
+ <strong>[% tprintf(loc('%s admin:', "%s here is the site name"), site_name) %]</strong>
+ [%- FOREACH link IN allowed_links %]
+ <a href="[% c.uri_for( link ) %]">[% allowed_pages.$link.0 %]</a>
+ [% IF NOT loop.last %]|[% END %]
+ [% END %]
+ </p>
+</div>
+
+<h1>[% title %]</h1>
diff --git a/templates/web/base/admin/report_edit.html b/templates/web/base/admin/report_edit.html
index 065c6c2ce..677c2a171 100644
--- a/templates/web/base/admin/report_edit.html
+++ b/templates/web/base/admin/report_edit.html
@@ -1,12 +1,29 @@
-[% INCLUDE 'admin/header.html' title=tprintf(loc('Editing problem %d'), problem.id ) -%]
-[% PROCESS 'admin/report_blocks.html' %]
+[%
+ PROCESS "maps/${map.type}.html";
+ INCLUDE 'admin/header.html'
+ title = tprintf(loc('Editing problem %d'), problem.id ),
+ bodyclass = 'mappage with-notes';
+ PROCESS 'admin/report_blocks.html'
+-%]
-[% status_message %]
+[% map_html %]
+</div>
+
+<div id="map_sidebar">
+
+[% INCLUDE 'admin/navigation.html' title = tprintf(loc('Editing problem %d'), problem.id ) %]
+
+<div id="side">
<form method="post" action="[% c.uri_for( 'report_edit', problem.id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8">
<input type="hidden" name="token" value="[% csrf_token %]" >
<input type="hidden" name="submit" value="1" >
-<ul>
+
+<div class="sidebar">
+
+ <p align="center"><input type="submit" name="Submit changes" value="[% loc('Submit changes') %]"></p>
+
+ <ul>
[%- cobrand_data = problem.cobrand_data;
cobrand_data = c.data_for_generic_problem IF !problem.cobrand;
IF cobrand_data;
@@ -15,36 +32,88 @@
uri = c.uri_for_email( '/report', problem.id );
END;
%]
-<li><a href="[% uri %]" class="admin-offsite-link">[% loc('View report on site' )%]</a></li>
-<li><label for='title'>[% loc('Subject:') %]</label> <input size=60 type='text' id='title' name='title' value='[% problem.title | html %]'></li>
-<li><label for='detail'>[% loc('Details:') %]</label>
-<textarea name='detail' id='detail' cols=60 rows=10>[% problem.detail | html %]</textarea></li>
+ <li><a href="[% uri %]" class="admin-offsite-link">[% loc('View report on site' )%]</a></li>
<li>[% loc('Co-ordinates:') %]
<a href="[% c.config.MAPIT_URL %][%
'/' UNLESS c.config.MAPIT_URL.search('/$')
%]point/4326/[% problem.longitude %],[% problem.latitude %].html"
class="admin-offsite-link">[% problem.latitude %], [% problem.longitude %]</a>
-( [%
+
+[% SET local_coords = problem.local_coords;
+ IF local_coords %]
+ ([% local_coords.0 %], [% local_coords.1 %])
+[% END %]
+
+<small>([%
SET postcode_safe = problem.postcode | html;
tprintf( loc('originally entered: &ldquo;%s&rdquo;'), postcode_safe )
%],
-[% IF problem.used_map %][% loc('used map') %][% ELSE %][% loc("didn't use map") %][% END %])</li>
+[% IF problem.used_map %][% loc('used map') %][% ELSE %][% loc("didn't use map") %][% END %])</small>
+</li>
-<li>[% loc('Body:') %]
+<li>[% loc('Bodies') %]:
[% IF problem.bodies_str %]
[% FOREACH body IN problem.bodies.values %]
+ [% SET body_printed = 1 %]
<a href="[% c.uri_for('body', body.id) %]">[% body.name | html %]</a>
[%- ',' IF NOT loop.last %]
[% END %]
+ [% IF NOT body_printed %]
+ <em>[% problem.bodies_str %]</em>
+ [% END %]
[% ELSE %]
<em>[% loc('None' ) %]</em>
[% END %]
- ([% loc('other areas:') %] [% problem.areas | remove('^,') | remove( ',$' ) %])</li>
+ <small>([% loc('other areas:') %] [% problem.areas | remove('^,') | remove( ',$' ) | replace(',', ', ') %])</small>
+</li>
+[% IF problem.bodies_missing %]
+<li>[% loc('Missing bodies:') %] [% problem.bodies_missing | html %]</li>
+[% END %]
[% IF problem.extra.address %]
<li>[% loc('Property address:') %] [% problem.extra.address | html %]</li>
[% END %]
-<li><label class="inline" for="state">[% loc('State:') %]</label> <select name="state" id="state">
+
+<li class="sm">[% loc('Created:') %] [% PROCESS format_time time=problem.created %]</li>
+<li class="sm">[% loc('Confirmed:') %] [% PROCESS format_time time=problem.confirmed no_time='-' %]</li>
+<li class="sm">[% loc('Sent:') %] [% PROCESS format_time time=problem.whensent %]
+ [% IF problem.send_method_used %]
+ ([% problem.send_method_used %])
+ [% END %]
+ [% IF problem.state == 'confirmed' AND problem.whensent %]
+ <input onclick="return confirm('[% loc('You really want to resend?') %]')" type="submit" name="resend" value="[% loc('Resend report') %]">
+ [% ELSIF NOT problem.whensent %]
+ <input type="submit" name="mark_sent" value="[% loc('Mark as sent') %]">
+ [% END %]
+</li>
+<li class="sm">[% loc('Last update:') %] [% PROCESS format_time time=problem.lastupdate %]</li>
+<li>[% loc('Service:') %] [% problem.service OR '<em>' _ loc('None') _ '</em>' %]</li>
+<li>[% loc('Cobrand:') %] [% problem.cobrand %]
+<br><small>[% loc('Cobrand data:') %] [% cobrand_data OR '<em>' _ loc('None') _ '</em>' %]</small>
+</li>
+<li>[% loc('Extra data:') %] [% problem.extra ? 'Yes' : 'No' %]</li>
+<li>[% loc('Going to send questionnaire?') %] [% IF problem.send_questionnaire %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</li>
+
+<li><label for="external_id">[% loc('External ID') %]:</label>
+ <input type="text" name="external_id" id="external_id" value="[% problem.external_id | html %]">
+<li><label for="external_body">[% loc('External body') %]:</label>
+ <input type="text" name="external_body" body="external_body" value="[% problem.external_body | html %]">
+<li><label for="external_team">[% loc('External team') %]:</label>
+ <input type="text" name="external_team" team="external_team" value="[% problem.external_team | html %]">
+
+</ul>
+</div>
+
+[% status_message %]
+
+<ul class="plain-list">
+<li><label for='title'>[% loc('Subject:') %]</label>
+ <input size=60 type='text' id='title' name='title' value='[% problem.title | html %]'></li>
+<li><label for='detail'>[% loc('Details:') %]</label>
+<textarea name='detail' id='detail' cols=60 rows=10>[% problem.detail | html %]</textarea></li>
+
+<li><label class="inline-text" for="state">[% loc('State:') %]</label>
+<select name="state" id="state">
[% FOREACH group IN state_groups %]
<optgroup label="[% group.0 %]">
[% FOREACH state IN group.1 %]
@@ -53,28 +122,26 @@ class="admin-offsite-link">[% problem.latitude %], [% problem.longitude %]</a>
</optgroup>
[% END %]
</select></li>
-<li>[% loc('Category:') %] [% problem.category | html %] </li>
-<li><label class="inline" for="anonymous">[% loc('Anonymous:') %]</label> <select name="anonymous" id="anonymous">
+<li><label class="inline-text" for="category">[% loc('Category:') %]</label>
+ [% problem.category | html %]
+</li>
+<li><label class="inline-text" for="anonymous">[% loc('Anonymous:') %]</label>
+<select name="anonymous" id="anonymous">
<option [% 'selected ' IF problem.anonymous %]value="1">[% loc('Yes') %]</option>
<option [% 'selected ' IF !problem.anonymous %]value="0">[% loc('No') %]</option>
</select></li>
-<li>[% loc('Name:') %] <input type='text' name='name' id='name' value='[% problem.name | html %]'></li>
-<li>[% loc('Email:') %] <input type='text' id='email' name='email' value='[% problem.user.email | html %]'> [% PROCESS abuse_button %] [% PROCESS flag_button user=problem.user %]</li>
-<li>[% loc('Phone:') %] [% problem.user.phone | html %]</li>
-<li>[% loc('Created:') %] [% PROCESS format_time time=problem.created %]</li>
-<li>[% loc('Confirmed:') %] [% PROCESS format_time time=problem.confirmed no_time='-' %]</li>
-<li>[% loc('Sent:') %] [% PROCESS format_time time=problem.whensent %]
-[% IF problem.state == 'confirmed' AND problem.whensent %]<input onclick="return confirm('[% loc('You really want to resend?') %]')" type="submit" name="resend" value="[% loc('Resend report') %]">[% END %]
-[% IF NOT problem.whensent %]<input type="submit" name="mark_sent" value="[% loc('Mark as sent') %]">[% END %]
+<li><label for="name">[% loc('Name:') %]</label>
+ <input type='text' name='name' id='name' value='[% problem.name | html %]'></li>
+<li><label for="email">[% loc('Email:') %]</label>
+ <input type='text' id='email' name='email' value='[% problem.user.email | html %]'>
+ [% PROCESS abuse_button %]
+ [% PROCESS flag_button user=problem.user %]
</li>
-<li>[% loc('Last update:') %] [% PROCESS format_time time=problem.lastupdate %]</li>
-<li>[% loc('Service:') %] [% problem.service %]</li>
-<li>[% loc('Cobrand:') %] [% problem.cobrand %]</li>
-<li>[% loc('Cobrand data:') %] [% problem.cobrand_data %]</li>
-<li>[% loc('Extra data:') %] [% problem.extra ? 'Yes' : 'No' %]</li>
-<li>[% loc('Going to send questionnaire?') %] [% IF problem.send_questionnaire %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</li>
-<li><label class="inline" for="flagged">[% loc('Flagged:') %]</label> <input type="checkbox" name="flagged"[% ' checked' IF problem.flagged %]></li>
-<li><label class="inline" for="non_public">[% loc('Private') %]:</label> <input type="checkbox" name="non_public"[% ' checked' IF problem.non_public %]></li>
+<li>[% loc('Phone:') %] [% problem.user.phone | html %]</li>
+<li><label class="inline-text" for="flagged">[% loc('Flagged:') %]</label>
+ <input type="checkbox" id="flagged" name="flagged"[% ' checked' IF problem.flagged %]></li>
+<li><label class="inline-text" for="non_public">[% loc('Private') %]:</label>
+ <input type="checkbox" id="non_public" name="non_public"[% ' checked' IF problem.non_public %]></li>
[% IF problem.photo %]
<li>
@@ -89,7 +156,7 @@ class="admin-offsite-link">[% problem.latitude %], [% problem.longitude %]</a>
</div>
<input type="submit" name="rotate_photo_[% loop.index %]" value="[% loc('Rotate Left') %]">
<input type="submit" name="rotate_photo_[% loop.index %]" value="[% loc('Rotate Right') %]">
- <input type="checkbox" id="remove_photo_[% loop.index %]" name="remove_photo_[% loop.index %]" value="1">
+ <br><input type="checkbox" id="remove_photo_[% loop.index %]" name="remove_photo_[% loop.index %]" value="1">
<label class="inline" for="remove_photo_[% loop.index %]">[% loc("Remove photo (can't be undone!)") %]</label></li>
</li>
[% END %]
@@ -98,8 +165,15 @@ class="admin-offsite-link">[% problem.latitude %], [% problem.longitude %]</a>
[% END %]
</ul>
-<input type="submit" name="Submit changes" value="[% loc('Submit changes') %]" ></form>
+<input type="submit" name="Submit changes" value="[% loc('Submit changes') %]">
+</form>
+</div>
+
+<div class="full-width full-width--bottom">
[% INCLUDE 'admin/list_updates.html' %]
+</div>
+
+</div>
[% INCLUDE 'admin/footer.html' %]
diff --git a/templates/web/fixmystreet.com/report/new/extra_name.html b/templates/web/fixmystreet.com/report/new/extra_name.html
index d1eec5fa3..4663c025d 100644
--- a/templates/web/fixmystreet.com/report/new/extra_name.html
+++ b/templates/web/fixmystreet.com/report/new/extra_name.html
@@ -10,13 +10,13 @@ shared with the council or displayed publicly.</em>
[% SET gender = report.get_extra_metadata('gender') %]
<p class="radio-segmented-control" style="font-size: 80%">
<input type="radio" name="gender" id="gender_female" value="female"[% ' checked' IF gender == 'female' %]>
- <label class="inline" for="gender_female">Female</label>
+ <label for="gender_female">Female</label>
<input type="radio" name="gender" id="gender_male" value="male"[% ' checked' IF gender == 'male' %]>
- <label class="inline" for="gender_male">Male</label>
+ <label for="gender_male">Male</label>
<input type="radio" name="gender" id="gender_other" value="other"[% ' checked' IF gender == 'other' %]>
- <label class="inline" for="gender_other">Other</label>
+ <label for="gender_other">Other</label>
<input type="radio" name="gender" id="gender_unknown" value="unknown"[% ' checked' IF gender == 'unknown' %]>
- <label class="inline" for="gender_unknown">Prefer not to say</label>
+ <label for="gender_unknown">Prefer not to say</label>
</p>
[% END %]
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index 43e47e099..38bbf4ea0 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -307,10 +307,6 @@ $(function(){
/*
* Map controls prettiness
*/
- //add links container (if its not there)
- if($('#sub_map_links').length === 0){
- $('<p id="sub_map_links" />').insertAfter($('#map'));
- }
// A sliding drawer from the bottom of the page, small version
// that doesn't change the main content at all.
@@ -446,11 +442,15 @@ $.fn.drawer = function(id, ajax) {
});
//add permalink on desktop, force hide on mobile
- if (cobrand != 'zurich') {
+ //add links container (if its not there)
+ if (cobrand != 'zurich' && !$('.mobile').length) {
+ if ($('#sub_map_links').length === 0) {
+ $('<p id="sub_map_links" />').insertAfter($('#map'));
+ }
$('#sub_map_links').append('<a href="#" id="map_permalink">' + translation_strings.permalink + '</a>');
}
- if($('.mobile').length){
+ if ($('.mobile').length) {
$('#map_permalink').hide();
$('#key-tools a.feed').appendTo('#sub_map_links');
$('#key-tools li:empty').remove();
diff --git a/web/cobrands/sass/_admin.scss b/web/cobrands/sass/_admin.scss
index 36323f295..a53f9f60a 100644
--- a/web/cobrands/sass/_admin.scss
+++ b/web/cobrands/sass/_admin.scss
@@ -9,6 +9,11 @@ $button_col: #fff;
$button_bg_col: #a1a1a1; // also search bar (tables)
.admin {
+ .full-width {
+ padding: 0 1em;
+ background-color: #fff;
+ }
+
table {
width: 100%;
font-size: 0.9em;
diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss
index 0a333773b..3048ae300 100644
--- a/web/cobrands/sass/_base.scss
+++ b/web/cobrands/sass/_base.scss
@@ -301,11 +301,15 @@ label{
margin-top: 1.25em;
margin-bottom: 0.25em;
font-weight: bold;
- &.inline{
+ &.inline {
display: inline;
padding: flip(0 2em 0 1em, 0 1em 0 2em);
font-weight: normal;
}
+ &.inline-text {
+ display: inline;
+ font-weight: normal;
+ }
}
// grey background, full width box
@@ -556,10 +560,9 @@ body.mappage .wrapper {
position: static;
}
-
// #key-tools is the list that's pulled out an stick to the bottom of the page of desktop, below is mostly just aesthetic
.shadow-wrap {
- @extend .full-width;
+ margin: 0 -1em;
ul#key-tools{
@include list-reset-soft;
margin-bottom: 1em;
@@ -658,7 +661,7 @@ footer {
}
#footer-mobileapps {
- @extend .full-width;
+ margin: 0 -1em;
padding: 1em 1em 0;
h4 {
margin:0;
@@ -1012,10 +1015,9 @@ input.final-submit {
// map stuff
#map_box {
- @extend .full-width;
+ margin: 0 -1em 1em;
background: #333;
height: 29em;
- margin-bottom: 1em;
overflow: hidden;
position: relative;
@@ -1362,11 +1364,10 @@ table.nicetable {
}
.promo {
- @extend .full-width;
+ margin: 0 -1em 1em;
color: $primary_text;
background: $primary;
padding:1em;
- margin-bottom:1em;
overflow:hidden;
position: relative;
.close-promo {
@@ -1386,10 +1387,9 @@ table.nicetable {
}
.alert {
- @extend .full-width;
+ margin: 0 -1em 1em;
background:#ff0000;
padding:1em;
- margin-bottom:1em;
color:#fff;
a, a:hover {
color:$primary;
@@ -1456,7 +1456,7 @@ table.nicetable {
margin: 0.5em 0 0;
}
#postcodeForm {
- @extend .full-width;
+ margin: 0 -1em;
padding:1em;
color: $primary_text;
background: $primary;
diff --git a/web/cobrands/sass/_layout.scss b/web/cobrands/sass/_layout.scss
index 2b594e5cc..51d32828f 100644
--- a/web/cobrands/sass/_layout.scss
+++ b/web/cobrands/sass/_layout.scss
@@ -321,6 +321,18 @@ body.mappage {
}
}
+// Want to cover over the blue sidebar
+body.mappage.admin {
+ .full-width--top {
+ margin-top: -1em;
+ padding-top: 1em;
+ }
+ .full-width--bottom {
+ padding-bottom: 1em;
+ margin-bottom: -4em;
+ }
+}
+
#map_box {
position: absolute;
z-index: auto;
@@ -828,7 +840,7 @@ textarea.form-error {
}
// Notes presented alongside the reporting form
-#report-a-problem-sidebar {
+.sidebar, #report-a-problem-sidebar {
margin-bottom: 2em;
// If the parent is .with-notes we know we have space to
@@ -843,6 +855,13 @@ textarea.form-error {
font-size: 0.75em;
}
+ ul {
+ @include list-reset-soft;
+ li {
+ margin-bottom: 0.5em;
+ }
+ }
+
.sidebar-notes {
color: #666;
}