aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml4
-rwxr-xr-xbin/zurich/convert_internal_notes_to_comments1
-rwxr-xr-xconf/Vagrantfile.example4
-rw-r--r--perllib/FixMyStreet.pm3
-rw-r--r--perllib/FixMyStreet/App.pm8
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm6
-rw-r--r--t/app/controller/about.t9
-rw-r--r--t/app/controller/admin.t38
-rw-r--r--t/app/controller/alert.t85
-rw-r--r--t/app/controller/alert_new.t59
-rw-r--r--t/app/controller/around.t24
-rw-r--r--t/app/controller/index.t6
-rw-r--r--t/app/controller/questionnaire.t18
-rw-r--r--t/app/controller/report_display.t26
-rw-r--r--t/app/controller/report_import.t236
-rw-r--r--t/app/controller/report_interest_count.t7
-rw-r--r--t/app/controller/report_new.t524
-rw-r--r--t/app/controller/report_new_open311.t34
-rw-r--r--t/app/controller/reports.t56
-rw-r--r--t/app/controller/rss.t30
-rw-r--r--t/app/model/alert_type.t18
-rw-r--r--t/app/model/problem.t18
-rw-r--r--t/app/uri_for.t20
-rw-r--r--t/cobrand/bromley.t3
-rw-r--r--t/cobrand/councils.t10
-rw-r--r--t/cobrand/fixmybarangay.t15
-rw-r--r--t/cobrand/get_body_sender.t13
-rw-r--r--t/cobrand/zurich.t300
-rw-r--r--templates/web/default/admin/body-form.html3
-rw-r--r--templates/web/zurich/admin/body-form.html3
-rw-r--r--web/cobrands/barnet/_colours.scss7
-rw-r--r--web/cobrands/bromley/_colours.scss8
-rw-r--r--web/cobrands/bromley/layout.scss3
-rw-r--r--web/cobrands/default/_colours.scss7
-rw-r--r--web/cobrands/default/layout.scss37
-rw-r--r--web/cobrands/fixmindelo/_colours.scss7
-rw-r--r--web/cobrands/fixmindelo/layout.scss23
-rw-r--r--web/cobrands/fixmybarangay/_colours.scss9
-rw-r--r--web/cobrands/fixmybarangay/base.scss5
-rw-r--r--web/cobrands/fixmybarangay/layout.scss20
-rw-r--r--web/cobrands/fixmystreet/_colours.scss8
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js6
-rw-r--r--web/cobrands/fixmystreet/layout.scss21
-rw-r--r--web/cobrands/oxfordshire/_colours.scss8
-rw-r--r--web/cobrands/oxfordshire/layout.scss5
-rw-r--r--web/cobrands/sass/_base.scss3
-rw-r--r--web/cobrands/sass/_layout.scss71
-rw-r--r--web/cobrands/stevenage/_colours.scss7
-rw-r--r--web/cobrands/stevenage/layout.scss9
-rw-r--r--web/cobrands/zurich/_colours.scss9
-rw-r--r--web/cobrands/zurich/layout.scss19
-rw-r--r--web/js/map-OpenLayers.js9
53 files changed, 1089 insertions, 795 deletions
diff --git a/.travis.yml b/.travis.yml
index 944931667..9ce5dbc86 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -34,10 +34,6 @@ before_script:
- psql fms postgres < db/generate_secret.sql
- >
sed -r -e "s,(FMS_DB_USER:) 'fms',\\1 'postgres',"
- -e "s,cobrand_one,barnet\\n - bromley\\n - emptyhomes\\n - fiksgatami\\n - fixmybarangay\\n - lichfielddc\\n - reading\\n - seesomething\\n - southampton\\n - zurich,"
- -e "s,cobrand_two: 'hostname_substring2',fixmystreet: '.',"
- -e "s,(BASE_URL:) 'http://www.example.org',\\1 'http://localhost',"
- -e "s,(MAPIT_URL:) '',\\1 'http://mapit.mysociety.org/',"
conf/general.yml-example > conf/general.yml
- ./bin/cron-wrapper ./bin/make_po FixMyStreet-EmptyHomes
- ./bin/cron-wrapper ./bin/make_emptyhomes_welsh_po
diff --git a/bin/zurich/convert_internal_notes_to_comments b/bin/zurich/convert_internal_notes_to_comments
index e92be40b3..ddf74851f 100755
--- a/bin/zurich/convert_internal_notes_to_comments
+++ b/bin/zurich/convert_internal_notes_to_comments
@@ -60,7 +60,6 @@ while ( my $problem = $problems->next() ) {
user => $comment_user,
state => $comment_state,
mark_fixed => 0,
- problem_state => $problem->state,
anonymous => 1,
extra => { is_internal_note => 1 },
}
diff --git a/conf/Vagrantfile.example b/conf/Vagrantfile.example
index fbc647746..8c2a32c47 100755
--- a/conf/Vagrantfile.example
+++ b/conf/Vagrantfile.example
@@ -36,8 +36,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# We need curl to fetch the install script
apt-get update -qq
apt-get install -qq -y curl >/dev/null
- curl -s https://raw.github.com/mysociety/commonlib/master/bin/install-site.sh | \
- sh -s -- --dev fixmystreet vagrant 127.0.0.1.xip.io
+ curl -s -O https://raw.github.com/mysociety/commonlib/master/bin/install-site.sh
+ sh install-site.sh --dev fixmystreet vagrant 127.0.0.1.xip.io
# Assume a developer will want to run the tests.
# TODO The tests should be further altered to work regardless of
# configuration file settings
diff --git a/perllib/FixMyStreet.pm b/perllib/FixMyStreet.pm
index 6c664f1d1..cc5286bbb 100644
--- a/perllib/FixMyStreet.pm
+++ b/perllib/FixMyStreet.pm
@@ -92,12 +92,13 @@ sub override_config($&) {
mySociety::MaPit::configure($config->{MAPIT_URL}) if $config->{MAPIT_URL};
- # For historical reasons, we have two ways of askig for config variables.
+ # For historical reasons, we have two ways of asking for config variables.
# Override them both, I'm sure we'll find time to get rid of one eventually.
my $override_guard1 = Sub::Override->new(
"FixMyStreet::config",
sub {
my ($class, $key) = @_;
+ return { %CONFIG, %$config } unless $key;
return $config->{$key} if exists $config->{$key};
my $orig_config = mySociety::Config::load_default();
return $orig_config->{$key} if exists $orig_config->{$key};
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index cf766348f..4f70d2c68 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -208,6 +208,14 @@ sub setup_request {
DateTime->DefaultLocale( 'en_US' );
}
+ if (FixMyStreet->test_mode) {
+ # Is there a better way of altering $c->config that may have
+ # override_config involved?
+ $c->setup_finished(0);
+ $c->config( %{ FixMyStreet->config() } );
+ $c->setup_finished(1);
+ }
+
return $c;
}
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 822860487..07bd61cbb 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -765,7 +765,7 @@ sub report_edit : Path('report_edit') : Args(1) {
$problem->photo(undef);
}
- if ( $new_state eq 'confirmed' and $old_state eq 'unconfirmed' ) {
+ if ( $problem->is_visible() and $old_state eq 'unconfirmed' ) {
$problem->confirmed( \'ms_current_timestamp()' );
}
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 6018dfa80..59d38a6cf 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -956,7 +956,11 @@ sub check_for_errors : Private {
delete $field_errors{name};
my $report = $c->stash->{report};
$report->title( Utils::cleanup_text( substr($report->detail, 0, 25) ) );
- if ( ! $c->req->param('phone') ) {
+
+ # We only want to validate the phone number web requests (where the
+ # service parameter is blank) because previous versions of the mobile
+ # apps don't validate the presence of a phone number.
+ if ( ! $c->req->param('phone') and ! $c->req->param('service') ) {
$field_errors{phone} = _("This information is required");
}
}
diff --git a/t/app/controller/about.t b/t/app/controller/about.t
index ed28eb584..b3562ea04 100644
--- a/t/app/controller/about.t
+++ b/t/app/controller/about.t
@@ -11,10 +11,9 @@ $mech->get_ok('/about');
$mech->content_like(qr{About us ::\s+FixMyStreet});
$mech->content_contains('html class="no-js" lang="en-gb"');
-SKIP: {
- skip( "Need 'emptyhomes' in ALLOWED_COBRANDS config", 8 )
- unless FixMyStreet::Cobrand->exists('emptyhomes');
-
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'emptyhomes' ],
+}, sub {
# check that geting the page as EHA produces a different page
ok $mech->host("reportemptyhomes.co.uk"), 'change host to reportemptyhomes';
$mech->get_ok('/about');
@@ -26,6 +25,6 @@ SKIP: {
$mech->get_ok('/about');
$mech->content_like(qr{Amdanom ni ::\s+Rhoi gwybod am eiddo gwag});
$mech->content_contains('html lang="cy"');
-}
+};
done_testing();
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t
index 3633286ff..a48e2e919 100644
--- a/t/app/controller/admin.t
+++ b/t/app/controller/admin.t
@@ -94,7 +94,11 @@ subtest 'check summary counts' => sub {
my $alerts = FixMyStreet::App->model('DB::Alert')->search( { confirmed => { '>' => 0 } } );
my $a_count = $alerts->count;
- $mech->get_ok('/admin');
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fixmystreet' ],
+ }, sub {
+ $mech->get_ok('/admin');
+ };
$mech->title_like(qr/Summary/);
@@ -106,10 +110,9 @@ subtest 'check summary counts' => sub {
$mech->content_contains( "$q_count questionnaires sent" );
- SKIP: {
- skip( "Need 'barnet' in ALLOWED_COBRANDS config", 7 )
- unless FixMyStreet::Cobrand->exists('barnet');
-
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'barnet' ],
+ }, sub {
ok $mech->host('barnet.fixmystreet.com');
$mech->get_ok('/admin');
@@ -138,19 +141,23 @@ subtest 'check summary counts' => sub {
$alert->cobrand('');
$alert->update;
- }
+ };
FixMyStreet::App->model('DB::Problem')->search( { bodies_str => 1 } )->update( { bodies_str => 2489 } );
ok $mech->host('fixmystreet.com');
};
-my $host = FixMyStreet->config('BASE_URL');
-
my $body = $mech->create_body_ok(2650, 'Aberdeen City Council');
-$mech->get_ok('/admin/body/2650');
+FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ MAPIT_TYPES => [ 'UTA' ],
+ BASE_URL => 'http://www.example.org',
+}, sub {
+ $mech->get_ok('/admin/body/2650');
+};
$mech->content_contains('Aberdeen City Council');
$mech->content_like(qr{AB\d\d});
-$mech->content_contains("$host/around");
+$mech->content_contains("http://www.example.org/around");
subtest 'check contact creation' => sub {
my $contact = FixMyStreet::App->model('DB::Contact')->search(
@@ -556,7 +563,7 @@ foreach my $test (
$report->discard_changes;
if ( $report->state eq 'confirmed' ) {
- $mech->content_contains( 'type="submit" name="resend"', 'no resend button' );
+ $mech->content_contains( 'type="submit" name="resend"', 'resend button' );
} else {
$mech->content_lacks( 'type="submit" name="resend"', 'no resend button' );
}
@@ -1212,6 +1219,15 @@ for my $test (
};
}
+subtest "Test setting a report from unconfirmed to something else doesn't cause a front end error" => sub {
+ $report->update( { confirmed => undef, state => 'unconfirmed', non_public => 0 } );
+ $mech->get_ok("/admin/report_edit/$report_id");
+ $mech->submit_form_ok( { with_fields => { state => 'investigating' } } );
+ $report->discard_changes;
+ ok( $report->confirmed, 'report has a confirmed timestamp' );
+ $mech->get_ok("/report/$report_id");
+};
+
$mech->delete_user( $user );
$mech->delete_user( $user2 );
$mech->delete_user( $user3 );
diff --git a/t/app/controller/alert.t b/t/app/controller/alert.t
index 847aa1a17..6fab4d3e3 100644
--- a/t/app/controller/alert.t
+++ b/t/app/controller/alert.t
@@ -12,56 +12,61 @@ $mech->content_contains('Local RSS feeds and email alerts');
$mech->content_contains('html class="no-js" lang="en-gb"');
# check that we can get list page
-$mech->get_ok('/alert/list');
-$mech->title_like(qr/^Local RSS feeds and email alerts/);
-$mech->content_contains('Local RSS feeds and email alerts');
-$mech->content_contains('html class="no-js" lang="en-gb"');
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+}, sub {
+ $mech->get_ok('/alert/list');
+ $mech->title_like(qr/^Local RSS feeds and email alerts/);
+ $mech->content_contains('Local RSS feeds and email alerts');
+ $mech->content_contains('html class="no-js" lang="en-gb"');
-$mech->get_ok('/alert/list?pc=EH99 1SP');
-$mech->title_like(qr/^Local RSS feeds and email alerts/);
-$mech->content_contains('Here are the types of local problem alerts for &lsquo;EH99&nbsp;1SP&rsquo;');
-$mech->content_contains('html class="no-js" lang="en-gb"');
-$mech->content_contains('Problems within 8.5km');
-$mech->content_contains('rss/pc/EH991SP/2');
-$mech->content_contains('rss/pc/EH991SP/5');
-$mech->content_contains('rss/pc/EH991SP/10');
-$mech->content_contains('rss/pc/EH991SP/20');
-$mech->content_contains('Problems within City of Edinburgh');
-$mech->content_contains('Problems within City Centre ward');
-$mech->content_contains('/rss/reports/City+of+Edinburgh');
-$mech->content_contains('/rss/reports/City+of+Edinburgh/City+Centre');
-$mech->content_contains('council:2651:City_of_Edinburgh');
-$mech->content_contains('ward:2651:20728:City_of_Edinburgh:City_Centre');
+ $mech->get_ok('/alert/list?pc=EH99 1SP');
+ $mech->title_like(qr/^Local RSS feeds and email alerts/);
+ $mech->content_contains('Here are the types of local problem alerts for &lsquo;EH99&nbsp;1SP&rsquo;');
+ $mech->content_contains('html class="no-js" lang="en-gb"');
+ $mech->content_contains('Problems within 8.5km');
+ $mech->content_contains('rss/pc/EH991SP/2');
+ $mech->content_contains('rss/pc/EH991SP/5');
+ $mech->content_contains('rss/pc/EH991SP/10');
+ $mech->content_contains('rss/pc/EH991SP/20');
+ $mech->content_contains('Problems within City of Edinburgh');
+ $mech->content_contains('Problems within City Centre ward');
+ $mech->content_contains('/rss/reports/City+of+Edinburgh');
+ $mech->content_contains('/rss/reports/City+of+Edinburgh/City+Centre');
+ $mech->content_contains('council:2651:City_of_Edinburgh');
+ $mech->content_contains('ward:2651:20728:City_of_Edinburgh:City_Centre');
-$mech->get_ok('/alert/list?pc=High Street');
-$mech->content_contains('We found more than one match for that location');
+ $mech->get_ok('/alert/list?pc=High Street');
+ $mech->content_contains('We found more than one match for that location');
-$mech->get_ok('/alert/list?pc=');
-$mech->content_contains('To find out what local alerts we have for you');
+ $mech->get_ok('/alert/list?pc=');
+ $mech->content_contains('To find out what local alerts we have for you');
-$mech->get_ok('/alert/list?pc=GL502PR');
-$mech->content_contains('Problems within the boundary of');
+ $mech->get_ok('/alert/list?pc=GL502PR');
+ $mech->content_contains('Problems within the boundary of');
-$mech->get_ok('/alert/subscribe?rss=1&type=local&pc=ky16+8yg&rss=Give+me+an+RSS+feed&rznvy=' );
-$mech->content_contains('Please select the feed you want');
+ $mech->get_ok('/alert/subscribe?rss=1&type=local&pc=ky16+8yg&rss=Give+me+an+RSS+feed&rznvy=' );
+ $mech->content_contains('Please select the feed you want');
-$mech->get_ok('/alert/subscribe?rss=1&feed=invalid:1000:A_Locationtype=local&pc=ky16+8yg&rss=Give+me+an+RSS+feed&rznvy=');
-$mech->content_contains('Illegal feed selection');
+ $mech->get_ok('/alert/subscribe?rss=1&feed=invalid:1000:A_Locationtype=local&pc=ky16+8yg&rss=Give+me+an+RSS+feed&rznvy=');
+ $mech->content_contains('Illegal feed selection');
-$mech->create_body_ok(2504, 'Birmingham City Council');
-$mech->create_body_ok(2226, 'Gloucestershire County Council');
-$mech->create_body_ok(2326, 'Cheltenham Borough Council');
+ $mech->create_body_ok(2504, 'Birmingham City Council');
+ $mech->create_body_ok(2226, 'Gloucestershire County Council');
+ $mech->create_body_ok(2326, 'Cheltenham Borough Council');
-$mech->get_ok('/alert/subscribe?rss=1&feed=area:1000:Birmingham');
-is $mech->uri->path, '/rss/reports/Birmingham';
+ $mech->get_ok('/alert/subscribe?rss=1&feed=area:1000:Birmingham');
+ is $mech->uri->path, '/rss/reports/Birmingham';
-$mech->get_ok('/alert/subscribe?rss=1&feed=area:1000:1001:Cheltenham:Lansdown');
-is $mech->uri->path, '/rss/area/Cheltenham/Lansdown';
+ $mech->get_ok('/alert/subscribe?rss=1&feed=area:1000:1001:Cheltenham:Lansdown');
+ is $mech->uri->path, '/rss/area/Cheltenham/Lansdown';
-$mech->get_ok('/alert/subscribe?rss=1&feed=council:1000:Gloucestershire');
-is $mech->uri->path, '/rss/reports/Gloucestershire';
+ $mech->get_ok('/alert/subscribe?rss=1&feed=council:1000:Gloucestershire');
+ is $mech->uri->path, '/rss/reports/Gloucestershire';
-$mech->get_ok('/alert/subscribe?rss=1&feed=ward:1000:1001:Cheltenham:Lansdown');
-is $mech->uri->path, '/rss/reports/Cheltenham/Lansdown';
+ $mech->get_ok('/alert/subscribe?rss=1&feed=ward:1000:1001:Cheltenham:Lansdown');
+ is $mech->uri->path, '/rss/reports/Cheltenham/Lansdown';
+};
done_testing();
diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t
index 23240c3b9..1804da32e 100644
--- a/t/app/controller/alert_new.t
+++ b/t/app/controller/alert_new.t
@@ -207,7 +207,12 @@ foreach my $test (
$mech->log_in_ok( $test->{email} );
$mech->clear_emails_ok;
- $mech->get_ok('/alert/list?pc=EH991SP');
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->get_ok('/alert/list?pc=EH991SP');
+ };
$mech->set_visible( [ radio => 'council:2651:City_of_Edinburgh' ] );
$mech->click('alert');
@@ -306,13 +311,18 @@ subtest "Test two-tier council alerts" => sub {
result => '/rss/reports/Gloucestershire/Lansdown+and+Park'
},
) {
- $mech->get_ok( '/alert/list?pc=GL502PR' );
- $mech->submit_form_ok( {
- button => 'rss',
- with_fields => {
- feed => $alert->{feed},
- }
- } );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->get_ok( '/alert/list?pc=GL502PR' );
+ $mech->submit_form_ok( {
+ button => 'rss',
+ with_fields => {
+ feed => $alert->{feed},
+ }
+ } );
+ };
is $mech->uri->path, $alert->{result}, 'Redirected to right RSS feed';
}
};
@@ -344,11 +354,16 @@ subtest "Test normal alert signups and that alerts are sent" => sub {
},
) {
$mech->get_ok( '/alert' );
- $mech->submit_form_ok( { with_fields => { pc => 'EH11BB' } } );
- $mech->submit_form_ok( {
- button => 'alert',
- with_fields => $alert->{fields},
- } );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok( { with_fields => { pc => 'EH11BB' } } );
+ $mech->submit_form_ok( {
+ button => 'alert',
+ with_fields => $alert->{fields},
+ } );
+ };
if ( $alert->{email_confirm} ) {
my $email = $mech->get_email;
$mech->clear_emails_ok;
@@ -425,7 +440,11 @@ subtest "Test normal alert signups and that alerts are sent" => sub {
$update_id = $update->id;
ok $update, "created test update - $update_id";
- FixMyStreet::App->model('DB::AlertType')->email_alerts();
+ FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ FixMyStreet::App->model('DB::AlertType')->email_alerts();
+ };
# TODO Note the below will fail if the db has an existing alert that matches
$mech->email_count_is(3);
my @emails = $mech->get_email;
@@ -545,11 +564,19 @@ for my $test (
} );
$mech->clear_emails_ok;
- FixMyStreet::App->model('DB::AlertType')->email_alerts();
+ FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ FixMyStreet::App->model('DB::AlertType')->email_alerts();
+ };
$mech->email_count_is(0);
$report->update( { non_public => 0 } );
- FixMyStreet::App->model('DB::AlertType')->email_alerts();
+ FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ FixMyStreet::App->model('DB::AlertType')->email_alerts();
+ };
$mech->email_count_is(1);
my $email = $mech->get_email;
like $email->body, qr/Alert\s+test\s+for\s+non\s+public\s+reports/, 'alert contains public report';
diff --git a/t/app/controller/around.t b/t/app/controller/around.t
index fa2d94aed..cbb110a1a 100644
--- a/t/app/controller/around.t
+++ b/t/app/controller/around.t
@@ -14,7 +14,11 @@ subtest "check that if no query we get sent back to the homepage" => sub {
# historic links
subtest "redirect x,y requests to lat/lon (301 - permanent)" => sub {
- $mech->get_ok('/around?x=3281&y=1113');
+ FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->get_ok('/around?x=3281&y=1113');
+ };
# did we redirect to lat,lon?
is $mech->uri->path, '/around', "still on /around";
@@ -75,8 +79,13 @@ foreach my $test (
{
subtest "check lat/lng for '$test->{pc}'" => sub {
$mech->get_ok('/');
- $mech->submit_form_ok( { with_fields => { pc => $test->{pc} } },
- "good location" );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok( { with_fields => { pc => $test->{pc} } },
+ "good location" );
+ };
is_deeply $mech->page_errors, [], "no errors for pc '$test->{pc}'";
is_deeply $mech->extract_location, $test,
"got expected location for pc '$test->{pc}'";
@@ -93,8 +102,13 @@ subtest 'check non public reports are not displayed on around page' => sub {
$mech->create_problems_for_body( 5, 2651, 'Around page', $params );
$mech->get_ok('/');
- $mech->submit_form_ok( { with_fields => { pc => 'EH99 1SP' } },
- "good location" );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok( { with_fields => { pc => 'EH99 1SP' } },
+ "good location" );
+ };
$mech->content_contains( 'Around page Test 3 for 2651',
'problem to be marked non public visible' );
diff --git a/t/app/controller/index.t b/t/app/controller/index.t
index 47c08291f..7fc15ab4b 100644
--- a/t/app/controller/index.t
+++ b/t/app/controller/index.t
@@ -47,7 +47,11 @@ subtest "does pc, (x,y), (e,n) or (lat,lon) go to /around" => sub {
$uri->query_form( $test->{in} );
# get the uri and check for 302
- $mech->get_ok($uri);
+ FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->get_ok($uri);
+ };
# check that we are at /around
is $mech->uri->path, '/around', "Got to /around";
diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t
index 5c81a43d1..8e553a1a5 100644
--- a/t/app/controller/questionnaire.t
+++ b/t/app/controller/questionnaire.t
@@ -383,10 +383,9 @@ for my $test (
};
}
-SKIP: {
- skip( "Need 'emptyhomes' in ALLOWED_COBRANDS config", 18 )
- unless FixMyStreet::Cobrand->exists('emptyhomes');
-
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'emptyhomes' ],
+}, sub {
# EHA extra checking
ok $mech->host("reportemptyhomes.com"), 'change host to reportemptyhomes';
@@ -436,12 +435,11 @@ SKIP: {
ok $questionnaire, 'found questionnaire';
$questionnaire2->delete;
-}
-
-SKIP: {
- skip( "Need 'fiksgatami' in ALLOWED_COBRANDS config", 5 )
- unless FixMyStreet::Cobrand->exists('fiksgatami');
+};
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fiksgatami' ],
+}, sub {
# I18N Unicode extra testing using FiksGataMi
$report->send_questionnaire( 1 );
$report->cobrand( 'fiksgatami' );
@@ -455,7 +453,7 @@ SKIP: {
like $email->body, qr/Testing =96 Detail/, 'email contains encoded character from user';
like $email->body, qr/sak p=E5 FiksGataMi/, 'email contains encoded character from template';
is $email->header('Content-Type'), 'text/plain; charset="windows-1252"', 'email is in right encoding';
-}
+};
$mech->delete_user('test@example.com');
done_testing();
diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t
index c17ee70ea..07e8caa9b 100644
--- a/t/app/controller/report_display.t
+++ b/t/app/controller/report_display.t
@@ -97,15 +97,16 @@ subtest "change report to unconfirmed and check for 404 status" => sub {
subtest "Zurich unconfirmeds are 200" => sub {
- if ( !FixMyStreet::Cobrand->exists('zurich') ) {
- plan skip_all => 'Skipping Zurich test without Zurich cobrand';
- }
- $mech->host( 'zurich.example.com' );
- ok $report->update( { state => 'unconfirmed' } ), 'unconfirm report';
- $mech->get_ok("/report/$report_id");
- $mech->content_contains( '&Uuml;berpr&uuml;fung ausstehend' );
- ok $report->update( { state => 'confirmed' } ), 'confirm report again';
- $mech->host( 'www.fixmystreet.com' );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+ }, sub {
+ $mech->host( 'zurich.example.com' );
+ ok $report->update( { state => 'unconfirmed' } ), 'unconfirm report';
+ $mech->get_ok("/report/$report_id");
+ $mech->content_contains( '&Uuml;berpr&uuml;fung ausstehend' );
+ ok $report->update( { state => 'confirmed' } ), 'confirm report again';
+ $mech->host( 'www.fixmystreet.com' );
+ };
};
subtest "change report to hidden and check for 410 status" => sub {
@@ -400,9 +401,9 @@ for my $test (
}
subtest "Zurich banners are displayed correctly" => sub {
- if ( !FixMyStreet::Cobrand->exists('zurich') ) {
- plan skip_all => 'Skipping Zurich test without Zurich cobrand';
- }
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+ }, sub {
$mech->host( 'zurich.example.com' );
for my $test (
@@ -466,6 +467,7 @@ subtest "Zurich banners are displayed correctly" => sub {
}
$mech->host( 'www.fixmystreet.com' );
+ };
};
$mech->create_body_ok(2504, 'Westminster City Council');
diff --git a/t/app/controller/report_import.t b/t/app/controller/report_import.t
index e25764c4b..a6ccc9604 100644
--- a/t/app/controller/report_import.t
+++ b/t/app/controller/report_import.t
@@ -63,10 +63,14 @@ subtest "Test creating bad partial entries" => sub {
{
$mech->get_ok('/import');
- $mech->submit_form_ok( #
- { with_fields => $test->{fields} },
- "fill in form"
- );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
+ }, sub {
+ $mech->submit_form_ok( #
+ { with_fields => $test->{fields} },
+ "fill in form"
+ );
+ };
is_deeply( $mech->import_errors, $test->{errors}, "expected errors" );
}
@@ -103,7 +107,11 @@ subtest "Submit a correct entry" => sub {
ok $token_url, "Found a token url $token_url";
# go to the token url
- $mech->get_ok($token_url);
+ FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->get_ok($token_url);
+ };
# check that we are on '/around'
is $mech->uri->path, '/around', "sent to /around";
@@ -112,10 +120,15 @@ subtest "Submit a correct entry" => sub {
is_deeply $mech->visible_form_values, { pc => '' },
"check only pc field is shown";
- $mech->submit_form_ok( #
- { with_fields => { pc => 'SW1A 1AA' } },
- "fill in postcode"
- );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok(
+ { with_fields => { pc => 'SW1A 1AA' } },
+ "fill in postcode"
+ );
+ };
is $mech->uri->path, '/report/new', "sent to report page";
@@ -136,14 +149,19 @@ subtest "Submit a correct entry" => sub {
$mech->content_contains( '<img align="right" src="/photo/' );
$mech->content_contains('latitude" value="51.50101"', 'Check latitude');
$mech->content_contains('longitude" value="-0.141587"', 'Check longitude');
- $mech->submit_form_ok(
- {
- button => 'tile_32742.21793',
- x => 10,
- y => 10,
- },
- "New map location"
- );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok(
+ {
+ button => 'tile_32742.21793',
+ x => 10,
+ y => 10,
+ },
+ "New map location"
+ );
+ };
$mech->content_contains( '<img align="right" src="/photo/' );
$mech->content_contains('latitude" value="51.50519"', 'Check latitude');
$mech->content_contains('longitude" value="-0.142608"', 'Check longitude');
@@ -162,19 +180,24 @@ subtest "Submit a correct entry" => sub {
"check imported fields are shown";
# change the details
- $mech->submit_form_ok( #
- {
- with_fields => {
- name => 'New Test User',
- title => 'New Test report',
- detail => 'This is a test report',
- phone => '01234 567 890',
- may_show_name => '1',
- category => 'Street lighting',
- }
- },
- "Update details and save"
- );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok(
+ {
+ with_fields => {
+ name => 'New Test User',
+ title => 'New Test report',
+ detail => 'This is a test report',
+ phone => '01234 567 890',
+ may_show_name => '1',
+ category => 'Street lighting',
+ }
+ },
+ "Update details and save"
+ );
+ };
# check that report has been created
my $user =
@@ -221,7 +244,12 @@ subtest "Submit a correct entry (with location)" => sub {
ok $token_url, "Found a token url $token_url";
# go to the token url
- $mech->get_ok($token_url);
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->get_ok($token_url);
+ };
# check that we are on '/report/new'
is $mech->uri->path, '/report/new', "sent to /report/new";
@@ -240,19 +268,24 @@ subtest "Submit a correct entry (with location)" => sub {
"check imported fields are shown";
# change the details
- $mech->submit_form_ok( #
- {
- with_fields => {
- name => 'New Test User ll',
- title => 'New Test report ll',
- detail => 'This is a test report ll',
- phone => '01234 567 890',
- may_show_name => '1',
- category => 'Street lighting',
- }
- },
- "Update details and save"
- );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok( #
+ {
+ with_fields => {
+ name => 'New Test User ll',
+ title => 'New Test report ll',
+ detail => 'This is a test report ll',
+ phone => '01234 567 890',
+ may_show_name => '1',
+ category => 'Street lighting',
+ }
+ },
+ "Update details and save"
+ );
+ };
# check that report has been created
my $user =
@@ -268,72 +301,71 @@ subtest "Submit a correct entry (with location)" => sub {
};
subtest "Submit a correct entry (with location) to cobrand" => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fiksgatami' ],
+ MAPIT_URL => 'http://mapit.nuug.no/',
+ }, sub {
+ ok $mech->host("fiksgatami.no"), 'change host to fiksgatami';
- SKIP: {
- skip( "Need 'fiksgatami' in ALLOWED_COBRANDS config", 20 )
- unless FixMyStreet::Cobrand->exists('fiksgatami');
- mySociety::MaPit::configure('http://mapit.nuug.no/');
- ok $mech->host("fiksgatami.no"), 'change host to fiksgatami';
+ $mech->get_ok('/import');
- $mech->get_ok('/import');
+ $mech->submit_form_ok( #
+ {
+ with_fields => {
+ service => 'test-script',
+ lat => '59',
+ lon => '10',
+ name => 'Test User ll',
+ email => 'test-ll@example.com',
+ subject => 'Test report ll',
+ detail => 'This is a test report ll',
+ photo => $sample_file,
+ }
+ },
+ "fill in form"
+ );
- $mech->submit_form_ok( #
- {
- with_fields => {
- service => 'test-script',
- lat => '59',
- lon => '10',
- name => 'Test User ll',
- email => 'test-ll@example.com',
- subject => 'Test report ll',
- detail => 'This is a test report ll',
- photo => $sample_file,
- }
- },
- "fill in form"
- );
+ is_deeply( $mech->import_errors, [], "got no errors" );
+ is $mech->content, 'SUCCESS', "Got success response";
- is_deeply( $mech->import_errors, [], "got no errors" );
- is $mech->content, 'SUCCESS', "Got success response";
+ # check that we have received the email
+ $mech->email_count_is(1);
+ my $email = $mech->get_email;
+ $mech->clear_emails_ok;
- # check that we have received the email
- $mech->email_count_is(1);
- my $email = $mech->get_email;
- $mech->clear_emails_ok;
+ my ($token_url) = $email->body =~ m{(http://\S+)};
+ ok $token_url, "Found a token url $token_url";
- my ($token_url) = $email->body =~ m{(http://\S+)};
- ok $token_url, "Found a token url $token_url";
+ # go to the token url
+ $mech->get_ok($token_url);
- # go to the token url
- $mech->get_ok($token_url);
+ # check that we are on '/report/new'
+ is $mech->uri->path, '/report/new', "sent to /report/new";
- # check that we are on '/report/new'
- is $mech->uri->path, '/report/new', "sent to /report/new";
-
- # check that fields are prefilled for us
- is_deeply $mech->visible_form_values,
- {
- name => 'Test User ll',
- title => 'Test report ll',
- detail => 'This is a test report ll',
- photo => '',
- phone => '',
- may_show_name => '1',
- },
- "check imported fields are shown";
-
- my $user =
- FixMyStreet::App->model('DB::User')
- ->find( { email => 'test-ll@example.com' } );
- ok $user, "Found a user";
-
- my $report = $user->problems->first;
- is $report->state, 'partial', 'is still partial';
- is $report->title, 'Test report ll', 'title is correct';
- is $report->lang, 'nb', 'language is correct';
-
- $mech->delete_user($user);
- }
+ # check that fields are prefilled for us
+ is_deeply $mech->visible_form_values,
+ {
+ name => 'Test User ll',
+ title => 'Test report ll',
+ detail => 'This is a test report ll',
+ photo => '',
+ phone => '',
+ may_show_name => '1',
+ },
+ "check imported fields are shown";
+
+ my $user =
+ FixMyStreet::App->model('DB::User')
+ ->find( { email => 'test-ll@example.com' } );
+ ok $user, "Found a user";
+
+ my $report = $user->problems->first;
+ is $report->state, 'partial', 'is still partial';
+ is $report->title, 'Test report ll', 'title is correct';
+ is $report->lang, 'nb', 'language is correct';
+
+ $mech->delete_user($user);
+ };
};
done_testing();
diff --git a/t/app/controller/report_interest_count.t b/t/app/controller/report_interest_count.t
index bfd1a8d1f..3de931c74 100644
--- a/t/app/controller/report_interest_count.t
+++ b/t/app/controller/report_interest_count.t
@@ -51,10 +51,9 @@ my $report = FixMyStreet::App->model('DB::Problem')->find_or_create(
my $report_id = $report->id;
ok $report, "created test report - $report_id";
-SKIP: {
- skip( "Need 'fixmybarangay' in ALLOWED_COBRANDS config", 29 )
- unless FixMyStreet::Cobrand->exists('fixmybarangay');
-
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fixmybarangay' ],
+}, sub {
$mech->create_body_ok(2504, 'Westminster City Council');
for my $test (
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index d1f246e95..4a6ba9bac 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -454,17 +454,22 @@ foreach my $test (
$mech->get_ok('/around');
# submit initial pc form
- $mech->submit_form_ok( { with_fields => { pc => $test->{pc} } },
- "submit location" );
- is_deeply $mech->page_errors, [], "no errors for pc '$test->{pc}'";
-
- # click through to the report page
- $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
- "follow 'skip this step' link" );
-
- # submit the main form
- $mech->submit_form_ok( { with_fields => $test->{fields} },
- "submit form" );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok( { with_fields => { pc => $test->{pc} } },
+ "submit location" );
+ is_deeply $mech->page_errors, [], "no errors for pc '$test->{pc}'";
+
+ # click through to the report page
+ $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
+ "follow 'skip this step' link" );
+
+ # submit the main form
+ $mech->submit_form_ok( { with_fields => $test->{fields} },
+ "submit form" );
+ };
# check that we got the errors expected
is_deeply $mech->page_errors, $test->{errors}, "check errors";
@@ -522,30 +527,35 @@ foreach my $test (
# submit initial pc form
$mech->get_ok('/around');
- $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } },
- "submit location" );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } },
+ "submit location" );
- # click through to the report page
- $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
- "follow 'skip this step' link" );
+ # click through to the report page
+ $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
+ "follow 'skip this step' link" );
- $mech->submit_form_ok(
- {
- button => 'submit_register',
- with_fields => {
- title => 'Test Report',
- detail => 'Test report details.',
- photo => '',
- name => 'Joe Bloggs',
- may_show_name => '1',
- email => 'test-1@example.com',
- phone => '07903 123 456',
- category => 'Street lighting',
- password_register => $test->{password} ? 'secret' : '',
- }
- },
- "submit good details"
- );
+ $mech->submit_form_ok(
+ {
+ button => 'submit_register',
+ with_fields => {
+ title => 'Test Report',
+ detail => 'Test report details.',
+ photo => '',
+ name => 'Joe Bloggs',
+ may_show_name => '1',
+ email => 'test-1@example.com',
+ phone => '07903 123 456',
+ category => 'Street lighting',
+ password_register => $test->{password} ? 'secret' : '',
+ }
+ },
+ "submit good details"
+ );
+ };
# check that we got the errors expected
is_deeply $mech->page_errors, [], "check there were no errors";
@@ -635,27 +645,32 @@ subtest "test password errors for a user who is signing in as they report" => su
# submit initial pc form
$mech->get_ok('/around');
- $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } },
- "submit location" );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } },
+ "submit location" );
- # click through to the report page
- $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
- "follow 'skip this step' link" );
+ # click through to the report page
+ $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
+ "follow 'skip this step' link" );
- $mech->submit_form_ok(
- {
- button => 'submit_sign_in',
- with_fields => {
- title => 'Test Report',
- detail => 'Test report details.',
- photo => '',
- email => 'test-2@example.com',
- password_sign_in => 'secret1',
- category => 'Street lighting',
- }
- },
- "submit with wrong password"
- );
+ $mech->submit_form_ok(
+ {
+ button => 'submit_sign_in',
+ with_fields => {
+ title => 'Test Report',
+ detail => 'Test report details.',
+ photo => '',
+ email => 'test-2@example.com',
+ password_sign_in => 'secret1',
+ category => 'Street lighting',
+ }
+ },
+ "submit with wrong password"
+ );
+ };
# check that we got the errors expected
is_deeply $mech->page_errors, [
@@ -682,42 +697,47 @@ subtest "test report creation for a user who is signing in as they report" => su
# submit initial pc form
$mech->get_ok('/around');
- $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } },
- "submit location" );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } },
+ "submit location" );
- # click through to the report page
- $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
- "follow 'skip this step' link" );
+ # click through to the report page
+ $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
+ "follow 'skip this step' link" );
- $mech->submit_form_ok(
- {
- button => 'submit_sign_in',
- with_fields => {
- title => 'Test Report',
- detail => 'Test report details.',
- photo => '',
- email => 'test-2@example.com',
- password_sign_in => 'secret2',
- category => 'Street lighting',
- }
- },
- "submit good details"
- );
+ $mech->submit_form_ok(
+ {
+ button => 'submit_sign_in',
+ with_fields => {
+ title => 'Test Report',
+ detail => 'Test report details.',
+ photo => '',
+ email => 'test-2@example.com',
+ password_sign_in => 'secret2',
+ category => 'Street lighting',
+ }
+ },
+ "submit good details"
+ );
- # check that we got the errors expected
- is_deeply $mech->page_errors, [
- 'You have successfully signed in; please check and confirm your details are accurate:',
- ], "check there were errors";
+ # check that we got the errors expected
+ is_deeply $mech->page_errors, [
+ 'You have successfully signed in; please check and confirm your details are accurate:',
+ ], "check there were errors";
- # Now submit with a name
- $mech->submit_form_ok(
- {
- with_fields => {
- name => 'Joe Bloggs',
- }
- },
- "submit good details"
- );
+ # Now submit with a name
+ $mech->submit_form_ok(
+ {
+ with_fields => {
+ name => 'Joe Bloggs',
+ }
+ },
+ "submit good details"
+ );
+ };
# find the report
my $report = $user->problems->first;
@@ -776,42 +796,47 @@ foreach my $test (
# submit initial pc form
$mech->get_ok('/around');
- $mech->submit_form_ok( { with_fields => { pc => 'GL50 2PR', } },
- "submit location" );
-
- # click through to the report page
- $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
- "follow 'skip this step' link" );
-
- # check that the fields are correctly prefilled
- is_deeply(
- $mech->visible_form_values,
- {
- title => '',
- detail => '',
- may_show_name => '1',
- name => 'Test User',
- phone => '01234 567 890',
- photo => '',
- category => '-- Pick a category --',
- },
- "user's details prefilled"
- );
-
- $mech->submit_form_ok(
- {
- with_fields => {
- title => "Test Report at café",
- detail => 'Test report details.',
- photo => '',
- name => 'Joe Bloggs',
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok( { with_fields => { pc => 'GL50 2PR', } },
+ "submit location" );
+
+ # click through to the report page
+ $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
+ "follow 'skip this step' link" );
+
+ # check that the fields are correctly prefilled
+ is_deeply(
+ $mech->visible_form_values,
+ {
+ title => '',
+ detail => '',
may_show_name => '1',
- phone => '07903 123 456',
- category => $test->{category},
- }
- },
- "submit good details"
- );
+ name => 'Test User',
+ phone => '01234 567 890',
+ photo => '',
+ category => '-- Pick a category --',
+ },
+ "user's details prefilled"
+ );
+
+ $mech->submit_form_ok(
+ {
+ with_fields => {
+ title => "Test Report at café",
+ detail => 'Test report details.',
+ photo => '',
+ name => 'Joe Bloggs',
+ may_show_name => '1',
+ phone => '07903 123 456',
+ category => $test->{category},
+ }
+ },
+ "submit good details"
+ );
+ };
# find the report
my $report = $user->problems->first;
@@ -870,27 +895,32 @@ subtest "test report creation for a category that is non public" => sub {
# submit initial pc form
$mech->get_ok('/around');
- $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } },
- "submit location" );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } },
+ "submit location" );
- # click through to the report page
- $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
- "follow 'skip this step' link" );
+ # click through to the report page
+ $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
+ "follow 'skip this step' link" );
- $mech->submit_form_ok(
- {
- button => 'submit_register',
- with_fields => {
- title => 'Test Report',
- detail => 'Test report details.',
- photo => '',
- email => 'test-2@example.com',
- name => 'Joe Bloggs',
- category => 'Street lighting',
- }
- },
- "submit good details"
- );
+ $mech->submit_form_ok(
+ {
+ button => 'submit_register',
+ with_fields => {
+ title => 'Test Report',
+ detail => 'Test report details.',
+ photo => '',
+ email => 'test-2@example.com',
+ name => 'Joe Bloggs',
+ category => 'Street lighting',
+ }
+ },
+ "submit good details"
+ );
+ };
# find the report
my $report = $user->problems->first;
@@ -927,11 +957,22 @@ subtest "test report creation for a category that is non public" => sub {
$contact2->category( "Pothol\xc3\xa9s" );
$contact2->update;
-my $extra_details = $mech->get_ok_json( '/report/new/ajax?latitude=' . $saved_lat . '&longitude=' . $saved_lon );
+my $extra_details;
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+}, sub {
+ $extra_details = $mech->get_ok_json( '/report/new/ajax?latitude=' . $saved_lat . '&longitude=' . $saved_lon );
+};
$mech->content_contains( "Pothol\xc3\xa9s" );
ok !$extra_details->{titles_list}, 'Non Bromley does not send back list of titles';
-$extra_details = $mech->get_ok_json( '/report/new/ajax?latitude=51.4021&longitude=0.01578');
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+}, sub {
+ $extra_details = $mech->get_ok_json( '/report/new/ajax?latitude=51.4021&longitude=0.01578');
+};
ok $extra_details->{titles_list}, 'Bromley sends back list of titles';
#### test uploading an image
@@ -940,18 +981,22 @@ ok $extra_details->{titles_list}, 'Bromley sends back list of titles';
#### possibly manual testing
# create report without using map
-# create report by clicking on may with javascript off
+# create report by clicking on map with javascript off
# create report with images off
subtest "check that a lat/lon off coast leads to /around" => sub {
my $off_coast_latitude = 50.78301;
my $off_coast_longitude = -0.646929;
- $mech->get_ok( #
- "/report/new"
- . "?latitude=$off_coast_latitude"
- . "&longitude=$off_coast_longitude"
- );
+ FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->get_ok( #
+ "/report/new"
+ . "?latitude=$off_coast_latitude"
+ . "&longitude=$off_coast_longitude"
+ );
+ };
is $mech->uri->path, '/around', "redirected to '/around'";
@@ -1015,9 +1060,10 @@ for my $test (
)
{
subtest $test->{desc} => sub {
- if ( $test->{host} =~ /bromley/ && !FixMyStreet::Cobrand->exists('bromley') ) {
- plan skip_all => 'Skipping Bromley tests without Bromley cobrand';
- }
+ my $override = {
+ ALLOWED_COBRANDS => [ $test->{host} =~ /bromley/ ? 'bromley' : 'fixmystreet' ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ };
$mech->host( $test->{host} );
@@ -1025,12 +1071,14 @@ for my $test (
$mech->clear_emails_ok;
$mech->get_ok('/');
- $mech->submit_form_ok( { with_fields => { pc => $test->{postcode}, } },
- "submit location" );
- $mech->follow_link_ok(
- { text_regex => qr/skip this step/i, },
- "follow 'skip this step' link"
- );
+ FixMyStreet::override_config $override, sub {
+ $mech->submit_form_ok( { with_fields => { pc => $test->{postcode}, } },
+ "submit location" );
+ $mech->follow_link_ok(
+ { text_regex => qr/skip this step/i, },
+ "follow 'skip this step' link"
+ );
+ };
my $fields = $mech->visible_form_values('mapSkippedForm');
if ( $test->{fms_extra_title} ) {
@@ -1072,8 +1120,10 @@ for my $test (
$submission_fields->{name} = 'Test User';
}
- $mech->submit_form_ok( { with_fields => $submission_fields },
- "submit good details" );
+ FixMyStreet::override_config $override, sub {
+ $mech->submit_form_ok( { with_fields => $submission_fields },
+ "submit good details" );
+ };
my $email = $mech->get_email;
ok $email, "got an email";
@@ -1128,18 +1178,23 @@ subtest 'user title not reset if no user title in submission' => sub {
};
$mech->get_ok('/');
- $mech->submit_form_ok( { with_fields => { pc => 'EH99 1SP', } },
- "submit location" );
- $mech->follow_link_ok(
- { text_regex => qr/skip this step/i, },
- "follow 'skip this step' link"
- );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok( { with_fields => { pc => 'EH99 1SP', } },
+ "submit location" );
+ $mech->follow_link_ok(
+ { text_regex => qr/skip this step/i, },
+ "follow 'skip this step' link"
+ );
- my $fields = $mech->visible_form_values('mapSkippedForm');
- ok !exists( $fields->{fms_extra_title} ), 'user title field not displayed';
+ my $fields = $mech->visible_form_values('mapSkippedForm');
+ ok !exists( $fields->{fms_extra_title} ), 'user title field not displayed';
- $mech->submit_form_ok( { with_fields => $submission_fields },
- "submit good details" );
+ $mech->submit_form_ok( { with_fields => $submission_fields },
+ "submit good details" );
+ };
$user->discard_changes;
my $report = $user->problems->first;
@@ -1148,10 +1203,7 @@ subtest 'user title not reset if no user title in submission' => sub {
is $user->title, 'MR', 'User title unchanged';
};
-SKIP: {
- skip( "Need 'lichfielddc' in ALLOWED_COBRANDS config", 100 )
- unless FixMyStreet::Cobrand->exists('lichfielddc');
-
+subtest "test Lichfield" => sub {
for my $test (
{
desc => 'confirm link for cobrand council in two tier cobrand links to cobrand site',
@@ -1190,32 +1242,38 @@ SKIP: {
my $user = $mech->log_in_ok($test_email) if $test->{redirect};
- $mech->get_ok('/around');
- $mech->content_contains( "Lichfield District Council FixMyStreet" );
- $mech->submit_form_ok( { with_fields => { pc => 'WS13 7RD' } }, "submit location" );
- $mech->follow_link_ok( { text_regex => qr/skip this step/i, }, "follow 'skip this step' link" );
- my %optional_fields = $test->{redirect} ? () :
- ( email => $test_email, phone => '07903 123 456' );
-
- # we do this as otherwise test::www::mechanize::catalyst
- # goes to the value set in ->host above irregardless and
- # that is a 404. It works but it is not pleasant.
- $mech->clear_host if $test->{redirect} && $test->{national};
- $mech->submit_form_ok(
- {
- button => $test->{button},
- with_fields => {
- title => 'Test Report',
- detail => 'Test report details.',
- photo => '',
- name => 'Joe Bloggs',
- may_show_name => '1',
- category => $test->{category},
- %optional_fields
- }
- },
- "submit good details"
- );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'lichfielddc', 'fixmystreet' ],
+ BASE_URL => 'http://www.fixmystreet.com',
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->get_ok('/around');
+ $mech->content_contains( "Lichfield District Council FixMyStreet" );
+ $mech->submit_form_ok( { with_fields => { pc => 'WS13 7RD' } }, "submit location" );
+ $mech->follow_link_ok( { text_regex => qr/skip this step/i, }, "follow 'skip this step' link" );
+ my %optional_fields = $test->{redirect} ? () :
+ ( email => $test_email, phone => '07903 123 456' );
+
+ # we do this as otherwise test::www::mechanize::catalyst
+ # goes to the value set in ->host above irregardless and
+ # that is a 404. It works but it is not pleasant.
+ $mech->clear_host if $test->{redirect} && $test->{national};
+ $mech->submit_form_ok(
+ {
+ button => $test->{button},
+ with_fields => {
+ title => 'Test Report',
+ detail => 'Test report details.',
+ photo => '',
+ name => 'Joe Bloggs',
+ may_show_name => '1',
+ category => $test->{category},
+ %optional_fields
+ }
+ },
+ "submit good details"
+ );
+ };
is_deeply $mech->page_errors, [], "check there were no errors";
# check that the user has been created/ not changed
@@ -1232,9 +1290,8 @@ SKIP: {
if ( $test->{redirect} ) {
is $mech->uri->path, "/report/" . $report->id, "redirected to report page";
- my $base = FixMyStreet->config('BASE_URL');
- $base =~ s{http://}{};
- $base = "lichfielddc.$base" unless $test->{national};
+ my $base = 'www.fixmystreet.com';
+ $base = "lichfielddc.fixmystreet.com" unless $test->{national};
is $mech->uri->host, $base, 'redirected to correct site';
} else {
# receive token
@@ -1246,21 +1303,34 @@ SKIP: {
ok $url, "extracted confirm url '$url'";
# confirm token
- $mech->get_ok($url);
-
- my $base = FixMyStreet->config('BASE_URL');
- $base =~ s{http://}{http://lichfielddc.} unless $test->{national};
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'lichfielddc', 'fixmystreet' ],
+ BASE_URL => 'http://www.fixmystreet.com',
+ }, sub {
+ $mech->get_ok($url);
+ };
+
+ my $base = 'www.fixmystreet.com';
+ $base = 'lichfielddc.fixmystreet.com' unless $test->{national};
$mech->content_contains( $base . '/report/' .
$report->id, 'confirm page links to correct site' );
if ( $test->{national} ) {
# Shouldn't be found, as it was a county problem
- is $mech->get( '/report/' . $report->id )->code, 404, "report not found";
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'lichfielddc', 'fixmystreet' ],
+ }, sub {
+ is $mech->get( '/report/' . $report->id )->code, 404, "report not found";
+ };
# But should be on the main site
$mech->host( 'www.fixmystreet.com' );
}
- $mech->get_ok( '/report/' . $report->id );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'lichfielddc', 'fixmystreet' ],
+ }, sub {
+ $mech->get_ok( '/report/' . $report->id );
+ };
}
$report->discard_changes;
@@ -1271,12 +1341,9 @@ SKIP: {
$mech->delete_user($user);
};
}
-}
-
-SKIP: {
- skip( "Need 'seesomething' in ALLOWED_COBRANDS config", 100 )
- unless FixMyStreet::Cobrand->exists('seesomething');
+};
+subtest "test SeeSomething" => sub {
$mech->host('seesomething.fixmystreet.com');
$mech->clear_emails_ok;
$mech->log_out_ok;
@@ -1346,22 +1413,27 @@ SKIP: {
}
$mech->get_ok( '/around' );
- $mech->submit_form_ok(
- {
- with_fields => {
- pc => $test->{pc},
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'seesomething' ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok(
+ {
+ with_fields => {
+ pc => $test->{pc},
+ },
},
- },
- 'submit around form',
- );
- $mech->follow_link_ok( { text_regex => qr/skip this step/i, }, "follow 'skip this step' link" );
+ 'submit around form',
+ );
+ $mech->follow_link_ok( { text_regex => qr/skip this step/i, }, "follow 'skip this step' link" );
- $mech->submit_form_ok(
- {
- with_fields => $test->{fields},
- },
- 'Submit form details with no user details',
- );
+ $mech->submit_form_ok(
+ {
+ with_fields => $test->{fields},
+ },
+ 'Submit form details with no user details',
+ );
+ };
is_deeply $mech->page_errors, [], "check there were no errors";
$user =
@@ -1385,7 +1457,7 @@ SKIP: {
}
$bus_contact->delete;
-}
+};
$contact1->delete;
$contact2->delete;
diff --git a/t/app/controller/report_new_open311.t b/t/app/controller/report_new_open311.t
index ed26d58d5..4745d92cd 100644
--- a/t/app/controller/report_new_open311.t
+++ b/t/app/controller/report_new_open311.t
@@ -116,17 +116,22 @@ foreach my $test (
$mech->get_ok('/around');
# submit initial pc form
- $mech->submit_form_ok( { with_fields => { pc => $test->{pc} } },
- "submit location" );
- is_deeply $mech->page_errors, [], "no errors for pc '$test->{pc}'";
-
- # click through to the report page
- $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
- "follow 'skip this step' link" );
-
- # submit the main form
- $mech->submit_form_ok( { with_fields => $test->{fields} },
- "submit form" );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok( { with_fields => { pc => $test->{pc} } },
+ "submit location" );
+ is_deeply $mech->page_errors, [], "no errors for pc '$test->{pc}'";
+
+ # click through to the report page
+ $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
+ "follow 'skip this step' link" );
+
+ # submit the main form
+ $mech->submit_form_ok( { with_fields => $test->{fields} },
+ "submit form" );
+ };
# check that we got the errors expected
is_deeply $mech->page_errors, $test->{errors}, "check errors";
@@ -152,7 +157,12 @@ foreach my $test (
%{ $test->{fields} },
%{ $test->{submit_with} },
};
- $mech->submit_form_ok( { with_fields => $new_values } );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->submit_form_ok( { with_fields => $new_values } );
+ };
$user = FixMyStreet::App->model('DB::User')->find( { email => $test_email } );
ok $user, 'created user';
diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t
index 14a4b2150..42e69fd03 100644
--- a/t/app/controller/reports.t
+++ b/t/app/controller/reports.t
@@ -42,9 +42,13 @@ is $stats->{'City of Edinburgh Council'}->[2], 1, 'correct number of older repor
is $stats->{'Westminster City Council'}->[1], 5, 'correct number of reports for Westminster';
-$mech->follow_link_ok( { text_regex => qr/Birmingham/ } );
+FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+}, sub {
+ $mech->follow_link_ok( { text_regex => qr/Birmingham/ } );
+ $mech->get_ok('/reports/Westminster');
+};
-$mech->get_ok('/reports/Westminster');
$mech->title_like(qr/Westminster City Council/);
$mech->content_contains('Westminster City Council');
$mech->content_contains('All reports Test 3 for 2504', 'problem to be marked non public visible');
@@ -55,7 +59,11 @@ is scalar @$problems, 5, 'correct number of problems displayed';
my $private = $westminster_problems[2];
ok $private->update( { non_public => 1 } ), 'problem marked non public';
-$mech->get_ok('/reports/Westminster');
+FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+}, sub {
+ $mech->get_ok('/reports/Westminster');
+};
$problems = $mech->extract_problem_list;
is scalar @$problems, 4, 'only public problems are displayed';
@@ -65,24 +73,30 @@ $mech->get_ok('/reports');
$stats = $mech->extract_report_stats;
is $stats->{'Westminster City Council'}->[1], 5, 'non public reports included in stats';
-SKIP: {
- skip( "Need 'emptyhomes' in ALLOWED_COBRANDS config", 8 )
- unless FixMyStreet::Cobrand->exists('emptyhomes');
- ok $mech->host("reportemptyhomes.com"), 'change host to reportemptyhomes';
- $mech->get_ok('/reports');
- # EHA lacks one column the others have
- $mech->content_lacks('state unknown');
-
- skip( "Need 'fiksgatami' in ALLOWED_COBRANDS config", 8 )
- unless FixMyStreet::Cobrand->exists('fiksgatami');
- $mech->create_body_ok(3, 'Oslo');
- mySociety::MaPit::configure('http://mapit.nuug.no/');
- ok $mech->host("fiksgatami.no"), 'change host to fiksgatami';
- $mech->get_ok('/reports');
- # There should only be one Oslo
- $mech->content_contains('Oslo');
- $mech->content_unlike(qr{Oslo">Oslo.*Oslo}s);
-}
+subtest "test emptyhomes all reports page" => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'emptyhomes' ],
+ }, sub {
+ ok $mech->host("reportemptyhomes.com"), 'change host to reportemptyhomes';
+ $mech->get_ok('/reports');
+ # EHA lacks one column the others have
+ $mech->content_lacks('state unknown');
+ };
+};
+
+subtest "test fiksgatami all reports page" => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fiksgatami' ],
+ MAPIT_URL => 'http://mapit.nuug.no/',
+ }, sub {
+ $mech->create_body_ok(3, 'Oslo');
+ ok $mech->host("fiksgatami.no"), 'change host to fiksgatami';
+ $mech->get_ok('/reports');
+ # There should only be one Oslo
+ $mech->content_contains('Oslo');
+ $mech->content_unlike(qr{Oslo">Oslo.*Oslo}s);
+ }
+};
done_testing();
diff --git a/t/app/controller/rss.t b/t/app/controller/rss.t
index ec6a01b50..bafa1ddc0 100644
--- a/t/app/controller/rss.t
+++ b/t/app/controller/rss.t
@@ -42,8 +42,13 @@ my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( {
user_id => $user1->id,
} );
-
-$mech->get_ok("/rss/pc/EH11BB/2");
+$mech->host('www.fixmystreet.com');
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fixmystreet' ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+}, sub {
+ $mech->get_ok("/rss/pc/EH11BB/2");
+};
$mech->content_contains( "Testing, 10th October" );
$mech->content_lacks( 'Nearest road to the pin' );
@@ -111,7 +116,12 @@ $report->geocode(
);
$report->update();
-$mech->get_ok("/rss/pc/EH11BB/2");
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fixmystreet' ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+}, sub {
+ $mech->get_ok("/rss/pc/EH11BB/2");
+};
$mech->content_contains( "Testing, 10th October" );
$mech->content_contains( '18 North Bridge, Edinburgh' );
@@ -168,11 +178,17 @@ my $report_to_county_council = FixMyStreet::App->model('DB::Problem')->find_or_c
subtest "check RSS feeds on cobrand have correct URLs for non-cobrand reports" => sub {
$mech->host('lichfielddc.fixmystreet.com');
- $mech->get_ok("/rss/area/Lichfield");
-
my $expected1 = mySociety::Config::get('BASE_URL') . '/report/' . $report_to_county_council->id;
- my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('lichfielddc')->new();
- my $expected2 = $cobrand->base_url . '/report/' . $report_to_council->id;
+ my $expected2;
+
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'lichfielddc' ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->get_ok("/rss/area/Lichfield");
+ my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('lichfielddc')->new();
+ $expected2 = $cobrand->base_url . '/report/' . $report_to_council->id;
+ };
$mech->content_contains($expected1, 'non cobrand area report point to fixmystreet.com');
$mech->content_contains($expected2, 'cobrand area report point to cobrand url');
diff --git a/t/app/model/alert_type.t b/t/app/model/alert_type.t
index ba48300b2..62add01eb 100644
--- a/t/app/model/alert_type.t
+++ b/t/app/model/alert_type.t
@@ -185,7 +185,11 @@ subtest "correct text for title after URL" => sub {
parameter => $report->id,
}
)->delete;
- FixMyStreet::App->model('DB::AlertType')->email_alerts();
+ FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ FixMyStreet::App->model('DB::AlertType')->email_alerts();
+ };
my $email = $mech->get_email;
(my $title = $report->title) =~ s/ /\\s+/;
@@ -318,7 +322,11 @@ foreach my $test (
$report->geocode( $g );
$report->update();
- FixMyStreet::App->model('DB::AlertType')->email_alerts();
+ FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ FixMyStreet::App->model('DB::AlertType')->email_alerts();
+ };
my $email = $mech->get_email;
my $body = $email->body;
@@ -423,7 +431,11 @@ subtest "check alerts from cobrand send main site url for alerts for different c
}
)->delete;
- FixMyStreet::App->model('DB::AlertType')->email_alerts();
+ FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ FixMyStreet::App->model('DB::AlertType')->email_alerts();
+ };
my $email = $mech->get_email;
my $body = $email->body;
diff --git a/t/app/model/problem.t b/t/app/model/problem.t
index 9138c11a8..18c210f6f 100644
--- a/t/app/model/problem.t
+++ b/t/app/model/problem.t
@@ -497,7 +497,7 @@ foreach my $test ( {
dear => qr'Dear Staffordshire County Council,',
body => '2240',
cobrand => 'lichfielddc',
- url => '',
+ url => 'www.',
}, {
%common,
desc => 'directs NI correctly, 1',
@@ -526,8 +526,13 @@ foreach my $test ( {
},
) {
subtest $test->{ desc } => sub {
- if ( $test->{cobrand} && $test->{cobrand} =~ /lichfielddc/ && !FixMyStreet::Cobrand->exists('lichfielddc') ) {
- plan skip_all => 'Skipping Lichfield tests without Lichfield cobrand';
+ my $override = {
+ ALLOWED_COBRANDS => [ 'fixmystreet' ],
+ BASE_URL => 'http://www.fixmystreet.com',
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ };
+ if ( $test->{cobrand} && $test->{cobrand} =~ /lichfielddc/ ) {
+ $override->{ALLOWED_COBRANDS} = [ 'lichfielddc' ];
}
$mech->clear_emails_ok;
@@ -549,7 +554,9 @@ foreach my $test ( {
cobrand => $test->{ cobrand } || 'fixmystreet',
} );
- FixMyStreet::App->model('DB::Problem')->send_reports();
+ FixMyStreet::override_config $override, sub {
+ FixMyStreet::App->model('DB::Problem')->send_reports();
+ };
$mech->email_count_is( $test->{ email_count } );
if ( $test->{ email_count } ) {
@@ -568,9 +575,8 @@ foreach my $test ( {
}
if ( $test->{url} ) {
- (my $base_url = FixMyStreet->config('BASE_URL')) =~ s{http://}{};
my $id = $problem->id;
- like $email->body, qr[$test->{url}$base_url/report/$id], 'URL present is correct';
+ like $email->body, qr[$test->{url}fixmystreet.com/report/$id], 'URL present is correct';
}
$problem->discard_changes;
diff --git a/t/app/uri_for.t b/t/app/uri_for.t
index bf965fb62..810aade62 100644
--- a/t/app/uri_for.t
+++ b/t/app/uri_for.t
@@ -44,25 +44,29 @@ is(
'FiksGataMi url with lat not zoom'
);
-SKIP: {
- skip( "Need 'emptyhomes' in ALLOWED_COBRANDS config", 2 )
- unless FixMyStreet::Cobrand->exists('emptyhomes');
-
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'emptyhomes' ],
+}, sub {
like(
$reh_en_c->uri_for_email( '/foo' ),
qr{^http://en.},
'adds en to retain language'
);
+};
- # instantiate this here otherwise sets locale to cy and breaks test
- # above
- my $reh_cy_c = ctx_request('http://cy.reportemptyhomes.com/');
+# instantiate this here otherwise sets locale to cy and breaks test
+# above
+my $reh_cy_c;
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'emptyhomes' ],
+}, sub {
+ $reh_cy_c = ctx_request('http://cy.reportemptyhomes.com/');
like(
$reh_cy_c->uri_for_email( '/foo' ),
qr{^http://cy.},
'retains language'
);
-}
+};
done_testing();
diff --git a/t/cobrand/bromley.t b/t/cobrand/bromley.t
index cb2086a84..91a7038ec 100644
--- a/t/cobrand/bromley.t
+++ b/t/cobrand/bromley.t
@@ -2,9 +2,6 @@ use strict;
use warnings;
use Test::More;
-plan skip_all => 'Skipping Bromley test without Bromley cobrand'
- unless FixMyStreet::Cobrand->exists('bromley');
-
use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;
diff --git a/t/cobrand/councils.t b/t/cobrand/councils.t
index 8fb10cfbe..0cf25ebdf 100644
--- a/t/cobrand/councils.t
+++ b/t/cobrand/councils.t
@@ -6,13 +6,13 @@ use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;
foreach my $council (qw/southampton reading bromley/) {
- SKIP: {
- skip( "Need '$council' in ALLOWED_COBRANDS config", 3 )
- unless FixMyStreet::Cobrand->exists($council);
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ $council ],
+ }, sub {
ok $mech->host("$council.fixmystreet.com"), "change host to $council";
$mech->get_ok('/');
- $mech->content_like( qr/$council/i );
- }
+ $mech->content_like( qr/\u$council/ );
+ };
}
done_testing();
diff --git a/t/cobrand/fixmybarangay.t b/t/cobrand/fixmybarangay.t
index 2d9276dc0..b996fa0a6 100644
--- a/t/cobrand/fixmybarangay.t
+++ b/t/cobrand/fixmybarangay.t
@@ -2,9 +2,6 @@ use strict;
use warnings;
use Test::More;
-plan skip_all => 'Skipping FixMyBarangay test without FixMyBarangay cobrand'
- unless FixMyStreet::Cobrand->exists('fixmybarangay');
-
BEGIN {
use FixMyStreet;
FixMyStreet->test_mode(1);
@@ -16,7 +13,11 @@ my $mech = FixMyStreet::TestMech->new;
# Front page test
ok $mech->host("www.fixmybarangay.com"), "change host to FixMyBarangay";
-$mech->get_ok('/');
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fixmybarangay' ],
+}, sub {
+ $mech->get_ok('/');
+};
$mech->content_like( qr/FixMyBarangay/ );
# Set up bodies
@@ -115,7 +116,11 @@ is $luz_report->state, 'confirmed', 'should be confirmed';
$user = $mech->log_in_ok($fmb_test_email);
-$mech->get_ok( '/report/' . $luz_report->id );
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fixmybarangay' ],
+}, sub {
+ $mech->get_ok( '/report/' . $luz_report->id );
+};
$mech->content_contains( "Remove from site" );
$mech->content_lacks( "Report abuse" );
diff --git a/t/cobrand/get_body_sender.t b/t/cobrand/get_body_sender.t
index 245cb1a13..964f5c0e4 100644
--- a/t/cobrand/get_body_sender.t
+++ b/t/cobrand/get_body_sender.t
@@ -21,10 +21,15 @@ my $body = FixMyStreet::App->model('DB::Body')->find_or_create({
});
my $body_area = $body->body_areas->find_or_create({ area_id => 1000 });
-is_deeply $c->get_body_sender( $body ), { method => 'Email' }, 'defaults to email';
-
-$body_area->update({ area_id => 2481 }); # Croydon LBO
-is_deeply $c->get_body_sender( $body ), { method => 'London' }, 'returns london report it if London borough';
+FixMyStreet::override_config {
+ MAPIT_TYPES => [ 'LBO' ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+}, sub {
+ is_deeply $c->get_body_sender( $body ), { method => 'Email' }, 'defaults to email';
+
+ $body_area->update({ area_id => 2481 }); # Croydon LBO
+ is_deeply $c->get_body_sender( $body ), { method => 'London' }, 'returns london report it if London borough';
+};
$body->send_method( 'TestMethod' );
is $c->get_body_sender( $body )->{ method }, 'TestMethod', 'uses send_method in preference to London';
diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t
index 88d1f6365..edc99d758 100644
--- a/t/cobrand/zurich.t
+++ b/t/cobrand/zurich.t
@@ -5,17 +5,8 @@ use strict;
use warnings;
use DateTime;
use Test::More;
+use JSON;
-plan skip_all => 'Skipping Zurich test without Zurich cobrand'
- unless FixMyStreet::Cobrand->exists('zurich');
-
-# To run this test ensure that you have the following in general.yml:
-#
-# BASE_URL: 'http://zurich.127.0.0.1.xip.io'
-#
-# ALLOWED_COBRANDS:
-# - zurich
-#
# Check that you have the required locale installed - the following
# should return a line with de_CH.utf8 in. If not install that locale.
#
@@ -41,7 +32,11 @@ my $mech = FixMyStreet::TestMech->new;
# Front page test
ok $mech->host("zurich.example.com"), "change host to Zurich";
-$mech->get_ok('/');
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+}, sub {
+ $mech->get_ok('/');
+};
$mech->content_like( qr/zurich/i );
# Set up bodies
@@ -70,22 +65,30 @@ my @reports = $mech->create_problems_for_body( 1, 2, 'Test', {
});
my $report = $reports[0];
-$mech->get_ok( '/report/' . $report->id );
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+}, sub {
+ $mech->get_ok( '/report/' . $report->id );
+};
$mech->content_contains('&Uuml;berpr&uuml;fung ausstehend');
# Check logging in to deal with this report
-$mech->get_ok( '/admin' );
-is $mech->uri->path, '/auth', "got sent to the sign in page";
-
-my $user = $mech->log_in_ok( 'dm1@example.org') ;
-$user->from_body( undef );
-$user->update;
-$mech->get_ok( '/admin' );
-is $mech->uri->path, '/my', "got sent to /my";
-$user->from_body( 2 );
-$user->update;
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+}, sub {
+ $mech->get_ok( '/admin' );
+ is $mech->uri->path, '/auth', "got sent to the sign in page";
+
+ my $user = $mech->log_in_ok( 'dm1@example.org') ;
+ $user->from_body( undef );
+ $user->update;
+ $mech->get_ok( '/admin' );
+ is $mech->uri->path, '/my', "got sent to /my";
+ $user->from_body( 2 );
+ $user->update;
-$mech->get_ok( '/admin' );
+ $mech->get_ok( '/admin' );
+};
is $mech->uri->path, '/admin', "am logged in";
$mech->content_contains( 'report_edit/' . $report->id );
@@ -118,8 +121,12 @@ subtest "changing of categories" => sub {
ok ( !$comments_rs->first, "There are no comments yet" );
# change the category via the web interface
- $mech->get_ok( '/admin/report_edit/' . $report->id );
- $mech->submit_form_ok( { with_fields => { category => 'Cat2' } } );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+ }, sub {
+ $mech->get_ok( '/admin/report_edit/' . $report->id );
+ $mech->submit_form_ok( { with_fields => { category => 'Cat2' } } );
+ };
# check changes correctly saved
$report->discard_changes();
@@ -134,39 +141,47 @@ subtest "changing of categories" => sub {
};
-$mech->get_ok( '/admin/report_edit/' . $report->id );
-$mech->content_contains( 'Unbest&auml;tigt' ); # Unconfirmed email
-$mech->submit_form_ok( { with_fields => { state => 'confirmed' } } );
-$mech->get_ok( '/report/' . $report->id );
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+}, sub {
+ $mech->get_ok( '/admin/report_edit/' . $report->id );
+ $mech->content_contains( 'Unbest&auml;tigt' ); # Unconfirmed email
+ $mech->submit_form_ok( { with_fields => { state => 'confirmed' } } );
+ $mech->get_ok( '/report/' . $report->id );
+};
$mech->content_contains('Aufgenommen');
$mech->content_contains('Test Test');
$mech->content_lacks('photo/' . $report->id . '.jpeg');
$mech->email_count_is(0);
-# Photo publishing
-$mech->get_ok( '/admin/report_edit/' . $report->id );
-$mech->submit_form_ok( { with_fields => { publish_photo => 1 } } );
-$mech->get_ok( '/report/' . $report->id );
-$mech->content_contains('photo/' . $report->id . '.jpeg');
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+}, sub {
+ # Photo publishing
+ $mech->get_ok( '/admin/report_edit/' . $report->id );
+ $mech->submit_form_ok( { with_fields => { publish_photo => 1 } } );
+ $mech->get_ok( '/report/' . $report->id );
+ $mech->content_contains('photo/' . $report->id . '.jpeg');
-# Internal notes
-$mech->get_ok( '/admin/report_edit/' . $report->id );
-$mech->submit_form_ok( { with_fields => { new_internal_note => 'Initial internal note.' } } );
-$mech->submit_form_ok( { with_fields => { new_internal_note => 'Another internal note.' } } );
-$mech->content_contains( 'Initial internal note.' );
-$mech->content_contains( 'Another internal note.' );
+ # Internal notes
+ $mech->get_ok( '/admin/report_edit/' . $report->id );
+ $mech->submit_form_ok( { with_fields => { new_internal_note => 'Initial internal note.' } } );
+ $mech->submit_form_ok( { with_fields => { new_internal_note => 'Another internal note.' } } );
+ $mech->content_contains( 'Initial internal note.' );
+ $mech->content_contains( 'Another internal note.' );
-# Original description
-$mech->submit_form_ok( { with_fields => { detail => 'Edited details text.' } } );
-$mech->content_contains( 'Edited details text.' );
-$mech->content_contains( 'Originaltext: &ldquo;Test Test 1 for 2 Detail&rdquo;' );
+ # Original description
+ $mech->submit_form_ok( { with_fields => { detail => 'Edited details text.' } } );
+ $mech->content_contains( 'Edited details text.' );
+ $mech->content_contains( 'Originaltext: &ldquo;Test Test 1 for 2 Detail&rdquo;' );
-$mech->get_ok( '/admin/report_edit/' . $report->id );
-$mech->submit_form_ok( { with_fields => { body_subdivision => 3, send_rejected_email => 1 } } );
+ $mech->get_ok( '/admin/report_edit/' . $report->id );
+ $mech->submit_form_ok( { with_fields => { body_subdivision => 3, send_rejected_email => 1 } } );
-$mech->get_ok( '/report/' . $report->id );
-$mech->content_contains('In Bearbeitung');
-$mech->content_contains('Test Test');
+ $mech->get_ok( '/report/' . $report->id );
+ $mech->content_contains('In Bearbeitung');
+ $mech->content_contains('Test Test');
+};
send_reports_for_zurich();
my $email = $mech->get_email;
@@ -176,33 +191,45 @@ $mech->clear_emails_ok;
$mech->log_out_ok;
-$user = $mech->log_in_ok( 'sdm1@example.org') ;
+my $user = $mech->log_in_ok( 'sdm1@example.org') ;
$user->update({ from_body => undef });
-$mech->get_ok( '/admin' );
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+}, sub {
+ $mech->get_ok( '/admin' );
+};
is $mech->uri->path, '/my', "got sent to /my";
$user->from_body( 3 );
$user->update;
-$mech->get_ok( '/admin' );
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+}, sub {
+ $mech->get_ok( '/admin' );
+};
is $mech->uri->path, '/admin', "am logged in";
$mech->content_contains( 'report_edit/' . $report->id );
$mech->content_contains( DateTime->now->strftime("%d.%m.%Y") );
$mech->content_contains( 'In Bearbeitung' );
-$mech->get_ok( '/admin/report_edit/' . $report->id );
-$mech->content_contains( 'Initial internal note' );
-
-$mech->submit_form_ok( { with_fields => { status_update => 'This is an update.' } } );
-is $mech->uri->path, '/admin/report_edit/' . $report->id, "still on edit page";
-$mech->content_contains('This is an update');
-ok $mech->form_with_fields( 'status_update' );
-$mech->submit_form_ok( { button => 'no_more_updates' } );
-is $mech->uri->path, '/admin/summary', "redirected now finished with report.";
-
-$mech->get_ok( '/report/' . $report->id );
-$mech->content_contains('In Bearbeitung');
-$mech->content_contains('Test Test');
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+}, sub {
+ $mech->get_ok( '/admin/report_edit/' . $report->id );
+ $mech->content_contains( 'Initial internal note' );
+
+ $mech->submit_form_ok( { with_fields => { status_update => 'This is an update.' } } );
+ is $mech->uri->path, '/admin/report_edit/' . $report->id, "still on edit page";
+ $mech->content_contains('This is an update');
+ ok $mech->form_with_fields( 'status_update' );
+ $mech->submit_form_ok( { button => 'no_more_updates' } );
+ is $mech->uri->path, '/admin/summary', "redirected now finished with report.";
+
+ $mech->get_ok( '/report/' . $report->id );
+ $mech->content_contains('In Bearbeitung');
+ $mech->content_contains('Test Test');
+};
send_reports_for_zurich();
$email = $mech->get_email;
@@ -215,7 +242,11 @@ is $report->state, 'planned', 'Report now in planned state';
$mech->log_out_ok;
$user = $mech->log_in_ok( 'dm1@example.org') ;
-$mech->get_ok( '/admin' );
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+}, sub {
+ $mech->get_ok( '/admin' );
+};
$mech->content_contains( 'report_edit/' . $report->id );
$mech->content_contains( DateTime->now->strftime("%d.%m.%Y") );
@@ -226,13 +257,17 @@ $extra->{email_confirmed} = 1;
$report->extra ( { %$extra } );
$report->update;
-$mech->get_ok( '/admin/report_edit/' . $report->id );
-$mech->content_lacks( 'Unbest&auml;tigt' ); # Confirmed email
-$mech->submit_form_ok( { with_fields => { status_update => 'FINAL UPDATE' } } );
-$mech->form_with_fields( 'status_update' );
-$mech->submit_form_ok( { button => 'publish_response' } );
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+}, sub {
+ $mech->get_ok( '/admin/report_edit/' . $report->id );
+ $mech->content_lacks( 'Unbest&auml;tigt' ); # Confirmed email
+ $mech->submit_form_ok( { with_fields => { status_update => 'FINAL UPDATE' } } );
+ $mech->form_with_fields( 'status_update' );
+ $mech->submit_form_ok( { button => 'publish_response' } );
-$mech->get_ok( '/report/' . $report->id );
+ $mech->get_ok( '/report/' . $report->id );
+};
$mech->content_contains('Beantwortet');
$mech->content_contains('Test Test');
$mech->content_contains('FINAL UPDATE');
@@ -253,15 +288,23 @@ $report = $reports[0];
$mech->get_ok( '/admin/report_edit/' . $report->id );
$mech->submit_form_ok( { with_fields => { state => 'planned' } } );
-$mech->get_ok( '/report/' . $report->id );
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+}, sub {
+ $mech->get_ok( '/report/' . $report->id );
+};
$mech->content_contains('In Bearbeitung');
$mech->content_contains('Second Test');
-$mech->get_ok( '/admin/report_edit/' . $report->id );
-$mech->content_contains( 'Unbest&auml;tigt' );
-$mech->submit_form_ok( { button => 'publish_response', with_fields => { status_update => 'FINAL UPDATE' } } );
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+}, sub {
+ $mech->get_ok( '/admin/report_edit/' . $report->id );
+ $mech->content_contains( 'Unbest&auml;tigt' );
+ $mech->submit_form_ok( { button => 'publish_response', with_fields => { status_update => 'FINAL UPDATE' } } );
-$mech->get_ok( '/report/' . $report->id );
+ $mech->get_ok( '/report/' . $report->id );
+};
$mech->content_contains('Beantwortet');
$mech->content_contains('Second Test');
$mech->content_contains('FINAL UPDATE');
@@ -277,9 +320,13 @@ $mech->email_count_is(0);
});
$report = $reports[0];
-$mech->get_ok( '/admin/report_edit/' . $report->id );
-$mech->submit_form_ok( { with_fields => { body_external => 4 } } );
-$mech->get_ok( '/report/' . $report->id );
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+}, sub {
+ $mech->get_ok( '/admin/report_edit/' . $report->id );
+ $mech->submit_form_ok( { with_fields => { body_external => 4 } } );
+ $mech->get_ok( '/report/' . $report->id );
+};
$mech->content_contains('Beantwortet');
$mech->content_contains('Third Test');
$mech->content_contains('Wir haben Ihr Anliegen an External Body weitergeleitet');
@@ -292,13 +339,17 @@ unlike $email->body, qr/test\@example.com/, 'body does not contain email address
$mech->clear_emails_ok;
# Test calling back, and third_personal boolean setting
-$mech->get_ok( '/admin' );
-is $mech->uri->path, '/admin', "am logged in";
-$mech->content_contains( 'report_edit/' . $report->id );
-$mech->get_ok( '/admin/report_edit/' . $report->id );
-$mech->submit_form_ok( { with_fields => { state => 'unconfirmed' } } );
-$mech->submit_form_ok( { with_fields => { body_external => 4, third_personal => 1 } } );
-$mech->get_ok( '/report/' . $report->id );
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+}, sub {
+ $mech->get_ok( '/admin' );
+ is $mech->uri->path, '/admin', "am logged in";
+ $mech->content_contains( 'report_edit/' . $report->id );
+ $mech->get_ok( '/admin/report_edit/' . $report->id );
+ $mech->submit_form_ok( { with_fields => { state => 'unconfirmed' } } );
+ $mech->submit_form_ok( { with_fields => { body_external => 4, third_personal => 1 } } );
+ $mech->get_ok( '/report/' . $report->id );
+};
$mech->content_contains('Beantwortet');
$mech->content_contains('Third Test');
$mech->content_contains('Wir haben Ihr Anliegen an External Body weitergeleitet');
@@ -313,14 +364,25 @@ $mech->log_out_ok;
subtest "only superuser can edit bodies" => sub {
$user = $mech->log_in_ok( 'dm1@example.org' );
- $mech->get( '/admin/body/' . $zurich->id );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+ }, sub {
+ $mech->get( '/admin/body/' . $zurich->id );
+ };
is $mech->res->code, 404, "only superuser should be able to edit bodies";
$mech->log_out_ok;
};
subtest "only superuser can see 'Add body' form" => sub {
$user = $mech->log_in_ok( 'dm1@example.org' );
- $mech->get_ok( '/admin/bodies' );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+ MAPIT_URL => 'http://global.mapit.mysociety.org/',
+ MAPIT_TYPES => [ 'O08' ],
+ MAPIT_ID_WHITELIST => [ 423017 ],
+ }, sub {
+ $mech->get_ok( '/admin/bodies' );
+ };
$mech->content_lacks( '<form method="post" action="bodies"' );
$mech->log_out_ok;
};
@@ -329,6 +391,7 @@ subtest "phone number is mandatory" => sub {
FixMyStreet::override_config {
MAPIT_TYPES => [ 'O08' ],
MAPIT_URL => 'http://global.mapit.mysociety.org/',
+ ALLOWED_COBRANDS => [ 'zurich' ],
}, sub {
$user = $mech->log_in_ok( 'dm1@example.org' );
$mech->get_ok( '/report/new?lat=47.381817&lon=8.529156' );
@@ -338,16 +401,45 @@ subtest "phone number is mandatory" => sub {
};
};
+subtest "phone number is not mandatory for reports from mobile apps" => sub {
+ FixMyStreet::override_config {
+ MAPIT_TYPES => [ 'O08' ],
+ MAPIT_URL => 'http://global.mapit.mysociety.org/',
+ }, sub {
+ $mech->post_ok( '/report/new/mobile?lat=47.381817&lon=8.529156' , {
+ service => 'iPhone',
+ detail => 'Problem-Bericht',
+ lat => 47.381817,
+ lon => 8.529156,
+ email => 'user@example.org',
+ pc => '',
+ name => '',
+ });
+ my $res = $mech->response;
+ ok $res->header('Content-Type') =~ m{^application/json\b}, 'response should be json';
+ unlike $res->content, qr/Diese Information wird ben&ouml;tigt/, 'response should not contain phone error';
+ # Clear out the mailq
+ $mech->clear_emails_ok;
+ };
+};
+
subtest "problems can't be assigned to deleted bodies" => sub {
$user = $mech->log_in_ok( 'dm1@example.org' );
$user->from_body( 1 );
$user->update;
$report->state( 'confirmed' );
$report->update;
- $mech->get_ok( '/admin/body/' . $external_body->id );
- $mech->submit_form_ok( { with_fields => { deleted => 1 } } );
- $mech->get_ok( '/admin/report_edit/' . $report->id );
- $mech->content_lacks( $external_body->name );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+ MAPIT_URL => 'http://global.mapit.mysociety.org/',
+ MAPIT_TYPES => [ 'O08' ],
+ MAPIT_ID_WHITELIST => [ 423017 ],
+ }, sub {
+ $mech->get_ok( '/admin/body/' . $external_body->id );
+ $mech->submit_form_ok( { with_fields => { deleted => 1 } } );
+ $mech->get_ok( '/admin/report_edit/' . $report->id );
+ $mech->content_lacks( $external_body->name );
+ };
$user->from_body( 2 );
$user->update;
$mech->log_out_ok;
@@ -359,15 +451,19 @@ subtest "hidden report email are only sent when requested" => sub {
$extra->{email_confirmed} = 1;
$report->extra ( { %$extra } );
$report->update;
- $mech->get_ok( '/admin/report_edit/' . $report->id );
- $mech->submit_form_ok( { with_fields => { state => 'hidden', send_rejected_email => 1 } } );
- $mech->email_count_is(1);
- $mech->clear_emails_ok;
- $mech->get_ok( '/admin/report_edit/' . $report->id );
- $mech->submit_form_ok( { with_fields => { state => 'hidden', send_rejected_email => undef } } );
- $mech->email_count_is(0);
- $mech->clear_emails_ok;
- $mech->log_out_ok;
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+ }, sub {
+ $mech->get_ok( '/admin/report_edit/' . $report->id );
+ $mech->submit_form_ok( { with_fields => { state => 'hidden', send_rejected_email => 1 } } );
+ $mech->email_count_is(1);
+ $mech->clear_emails_ok;
+ $mech->get_ok( '/admin/report_edit/' . $report->id );
+ $mech->submit_form_ok( { with_fields => { state => 'hidden', send_rejected_email => undef } } );
+ $mech->email_count_is(0);
+ $mech->clear_emails_ok;
+ $mech->log_out_ok;
+ };
};
$mech->delete_problems_for_body( 2 );
diff --git a/templates/web/default/admin/body-form.html b/templates/web/default/admin/body-form.html
index 55a98105a..e876f3e5e 100644
--- a/templates/web/default/admin/body-form.html
+++ b/templates/web/default/admin/body-form.html
@@ -69,9 +69,10 @@
<label for="area_ids">[% loc('Area covered') %]</label>
<select name="area_ids" id="area_ids" multiple>
<option value=""> -- [% loc('Select an area') %] -- </option>
+ [% SET body_areas = body.areas %]
[% FOR area IN areas %]
[% SET aid = area.id %]
- <option value="[% area.id %]"[% ' selected' IF body.areas.$aid %]>[% area.name %]</option>
+ <option value="[% area.id %]"[% ' selected' IF body_areas.$aid %]>[% area.name %]</option>
[% END %]
</select>
</p>
diff --git a/templates/web/zurich/admin/body-form.html b/templates/web/zurich/admin/body-form.html
index 4e570a058..a31dffe7c 100644
--- a/templates/web/zurich/admin/body-form.html
+++ b/templates/web/zurich/admin/body-form.html
@@ -24,9 +24,10 @@
<label for="area_ids">[% loc('Area covered') %]</label>
<select name="area_ids" id="area_ids" multiple>
<option value=""> -- [% loc('Select an area') %] -- </option>
+ [% SET body_areas = body.areas %]
[% FOR area IN areas %]
[% SET aid = area.id %]
- <option value="[% area.id %]"[% ' selected' IF body.areas.$aid %]>[% area.name %]</option>
+ <option value="[% area.id %]"[% ' selected' IF body_areas.$aid %]>[% area.name %]</option>
[% END %]
</select>
</p>
diff --git a/web/cobrands/barnet/_colours.scss b/web/cobrands/barnet/_colours.scss
index 793a8dcdd..2a00dab90 100644
--- a/web/cobrands/barnet/_colours.scss
+++ b/web/cobrands/barnet/_colours.scss
@@ -4,6 +4,13 @@ $primary: #E9E9EA;
$primary_b: #000000;
$primary_text: #3E3D44;
+/* Unused here */
+$base_bg: #fff;
+$base_fg: #1a1a1a;
+$map_nav_bg: #222;
+$nav_fg: #fff;
+$nav_fg_hover: #444;
+
$col_click_map: #E1E3E4;
$col_click_map_dark: darken(#E1E3E4, 10%);
diff --git a/web/cobrands/bromley/_colours.scss b/web/cobrands/bromley/_colours.scss
index 208154370..5627929a0 100644
--- a/web/cobrands/bromley/_colours.scss
+++ b/web/cobrands/bromley/_colours.scss
@@ -6,6 +6,14 @@ $primary: $bromley_blue;
$primary_b: #000000;
$primary_text: #ffffff;
+$base_bg: #9b9b9b url('https://www.bromley.gov.uk/site/styles/css_img/repeater.gif') repeat-x;
+$base_fg: #1a1a1a;
+
+/* Unused here */
+$map_nav_bg: #222;
+$nav_fg: #fff;
+$nav_fg_hover: #444;
+
$col_click_map: $bromley_blue;
$col_click_map_dark: darken($bromley_blue, 10%);
$col_fixed_label: $bromley_blue;
diff --git a/web/cobrands/bromley/layout.scss b/web/cobrands/bromley/layout.scss
index 2dcc73cc4..f5e6e9801 100644
--- a/web/cobrands/bromley/layout.scss
+++ b/web/cobrands/bromley/layout.scss
@@ -1,7 +1,6 @@
@import "_colours";
@import "../sass/layout";
-body { background: #9b9b9b url('https://www.bromley.gov.uk/site/styles/css_img/repeater.gif') repeat-x; }
#bromley-wrapper { background: #fff url('https://www.bromley.gov.uk/site/styles/css_img/header-corners.gif') center 110px no-repeat; margin: 1px auto 0; padding: 0 15px; width: 955px;}
.offline #bromley-wrapper { padding: 0 15px 20px; }
@@ -113,7 +112,7 @@ body.frontpage {
right: 0;
}
-// Pull OpenLayers navigation down a bit
+// OpenLayers navigation always top right
#fms_pan_zoom {
top: 0.5em !important;
}
diff --git a/web/cobrands/default/_colours.scss b/web/cobrands/default/_colours.scss
index 147fb70f2..e8c12f98e 100644
--- a/web/cobrands/default/_colours.scss
+++ b/web/cobrands/default/_colours.scss
@@ -7,6 +7,13 @@ $primary: $orange;
$primary_b: #000000;
$primary_text: #222222;
+$base_bg: $bluey;
+$base_fg: #000;
+
+$map_nav_bg: $bluey;
+$nav_fg: #000;
+$nav_fg_hover: $primary;
+
$col_click_map: $bluey;
$col_click_map_dark: darken($bluey, 10%);
diff --git a/web/cobrands/default/layout.scss b/web/cobrands/default/layout.scss
index 5d1fab968..69e455aa5 100644
--- a/web/cobrands/default/layout.scss
+++ b/web/cobrands/default/layout.scss
@@ -1,39 +1,2 @@
@import "_colours";
@import "../sass/layout";
-
-/*
-Note: The fact that the below has to override the CSS, though it is for the
-default template, is a sign that the CSS is not best organised. It needs
-refactoring, and making more maintainable through the use of SMACSS, OOCSS
-and similar.
-*/
-
-body {
- background: $bluey;
-}
-
-body.mappage {
- .nav-wrapper {
- .nav-wrapper-2 {
- background: $bluey;
- }
- }
-}
-
-#main-nav {
- ul {
- li {
- a, span {
- color: #000;
- }
- }
- &#main-menu {
- li {
- a:hover {
- background: $primary;
- }
- }
- }
- }
-}
-
diff --git a/web/cobrands/fixmindelo/_colours.scss b/web/cobrands/fixmindelo/_colours.scss
index cb261cff3..ac39f72e3 100644
--- a/web/cobrands/fixmindelo/_colours.scss
+++ b/web/cobrands/fixmindelo/_colours.scss
@@ -10,6 +10,13 @@ $primary: $mindelo_blue;
$primary_b: #000000;
$primary_text: #222222;
+$base_bg: #fff url(images/tropical-sea-pattern.jpg);
+$base_fg: $primary_text;
+
+$map_nav_bg: #fff;
+$nav_fg: #000;
+$nav_fg_hover: $primary;
+
$col_click_map: $mindelo_green;
$col_click_map_dark: darken($mindelo_green, 10%);
diff --git a/web/cobrands/fixmindelo/layout.scss b/web/cobrands/fixmindelo/layout.scss
index 502ac29f3..6e1180e2b 100644
--- a/web/cobrands/fixmindelo/layout.scss
+++ b/web/cobrands/fixmindelo/layout.scss
@@ -6,12 +6,8 @@ $image-sprite: 'images/sprite.png';
body {
- background-color: #fff;
- background-image: url(images/tropical-sea-pattern.jpg);
- color: $primary_text;
-
.wrapper{
- background-color: #fff;
+ background-color: #fff;
background: url('images/fixmindelo-header.png') 30% 0% repeat-x;
}
#site-logo {
@@ -19,30 +15,13 @@ body {
}
}
-
-body.mappage {
- .nav-wrapper {
- .nav-wrapper-2 {
- background: #fff;
- }
- }
-}
-
#main-nav {
ul {
- li {
- a, span {
- color: #000;
- }
- }
&#main-menu {
li {
a.report-a-problem-btn {
color: #fff;
}
- a:hover {
- background: $primary;
- }
}
}
}
diff --git a/web/cobrands/fixmybarangay/_colours.scss b/web/cobrands/fixmybarangay/_colours.scss
index bbf419bca..d5544ff07 100644
--- a/web/cobrands/fixmybarangay/_colours.scss
+++ b/web/cobrands/fixmybarangay/_colours.scss
@@ -4,6 +4,13 @@ $primary: #fff; //E6DBD6
$primary_b: #000000;
$primary_text: #222222;
+$base_bg: #C7B299 url(images/pat3.png);
+$base_fg: $primary_text;
+
+$map_nav_bg: url('images/fmb-header.png') 30% 0% repeat-x;
+$nav_fg: #fff;
+$nav_fg_hover: rgba(0,0,0,0.8);
+
$col_click_map: #00BD08;
$col_click_map_dark: #4B8304;
$col_fixed_label: #00BD08;
@@ -11,4 +18,4 @@ $col_fixed_label_dark: #4B8304;
$fmb_base_blue: #046AAA;
$fmb_dark_blue: #084E7A;
-$fmb_tab_yellow: #FFD000; \ No newline at end of file
+$fmb_tab_yellow: #FFD000;
diff --git a/web/cobrands/fixmybarangay/base.scss b/web/cobrands/fixmybarangay/base.scss
index 9088efa71..81cf4785d 100644
--- a/web/cobrands/fixmybarangay/base.scss
+++ b/web/cobrands/fixmybarangay/base.scss
@@ -26,11 +26,6 @@ input.yellow-btn{
}
}
-body.mappage .nav-wrapper div.nav-wrapper-2 {
- background: url('images/fmb-header.png') 30% 0% repeat-x;
- border-bottom: 2px solid #333;
-}
-
#main-nav ul#main-menu li a.report-a-problem-btn:hover {
background: #fff;
}
diff --git a/web/cobrands/fixmybarangay/layout.scss b/web/cobrands/fixmybarangay/layout.scss
index 675a185b1..4a662754d 100644
--- a/web/cobrands/fixmybarangay/layout.scss
+++ b/web/cobrands/fixmybarangay/layout.scss
@@ -13,10 +13,6 @@ $image-sprite: 'images/sprite.png';
}
body {
- background: #C7B299;
- background-image: url(images/pat3.png);
- color: $primary_text;
-
.wrapper{
background: url('images/fmb-header.png') 30% 0% repeat-x;
}
@@ -44,6 +40,10 @@ body.frontpage {
background-image: url(images/ie_front_logo.gif);
}
+body.mappage .nav-wrapper div.nav-wrapper-2 {
+ border-bottom: 2px solid #333;
+}
+
#main-nav ul#mysoc-menu li a#mysoc-logo {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIkAAAAyCAMAAABf9whNAAAA0lBMVEUAAABAQEBAQEBAQEBNTU1NTU1AQEBNTU1AQEBAQEBAQEBAQEBAQEBAQEBAQEBNTU1NTU1AQEBNTU1AQEBNTU1AQEBAQEBNTU2Mxj9NTU33kx5NTU1NTU1NTU3tHCRmLZEpq+JNTU2TJ4/tHCSTJ4/87iEpq+L3kx5NTU387iH87iHtHCSTJ4/3kx51K5CTJ49mLZGMxj/tHCSx0zVmLZH6wSBmLZFmLZFDdb/zYCFbuZGMxj/3kx5AQEBNTU0pq+LtHCSMxj/3kx787iFmLZGTJ49ns3BGAAAAPXRSTlMAQL+AQIAQECBwMGBQj98gn5/Pr+/vzzC/r79wYI9wv69QcK+vcICfv68QQBAwj0AwMBBggIBQr3BwgEBgSmaQCwAAAflJREFUeF7t1Ndy2zAQhtGfAAX2IpFUseSSOLGd3nt27bT3f6UsQHusRFcKmVxkcGa4wvCG34AQ8V/wPM/zPM8zSaOaxGBHtFpF+IfikqwYO0LmELfiHH/XlLokSBrsiurtPdGkMJJFWFWTSQUZC0RhWMFNRQWuvTw9RS/VOolNEBgAudYpkE5pHqRpEACIZQ4x4RkztxMWd6KWa2DDvFDUBeg9urr6cPAZMIqEDogCmDmJKdwtlbjXOCc1sIRnhyxj0vIMNbeQMUNun5DBOTo6/3oASMhUF6krka3IM1lkikqdGaICMVE2sKSNICkR1sxYyMag5TWQd7bFPH4G8eT8zcOUKIGwJUYuSE7hzoldlZAwM7Dkwg4GQjtmXMtvBZHNiZJ7P+5C3P/2oH9SXyKXo1yJq0sbmmLMkg23h7xCryR1W5L8WqKsmz1BSbqjfNSSiMUGMEB/Bp8ePwdeLF/ZAn1TEssFR1MJIZmyGLUENXNrI8pCK6IMx99fn50tvyyBcuvEKuqKXDcuocgAQ/I7conMGgA5BfD23fvLy4/LT0Ba/v4vphRxR9dnlmIMU4ULO0IgsgPr/rya3H7F4JycoCf3sq0vW5ICiLXO3YtsMC4JqbG3uCFKMSb3nYuwNyLKMK6Q6wj7a7oMY4vwJwwG8TzP8zzP834CEcRJKkEhVogAAAAASUVORK5CYII=");
}
@@ -72,18 +72,6 @@ body.frontpage {
}
&#main-menu{
padding: 3px 0;
- li{
- a{
- //@extend .report-a-problem-btn;
- color: #fff;
- padding: 0.7em;
- background-color: rgba(0,0,0,0);
- background-image: none;
- &:hover{
- background-color: rgba(0,0,0,0.8);
- }
- }
- }
}
}
diff --git a/web/cobrands/fixmystreet/_colours.scss b/web/cobrands/fixmystreet/_colours.scss
index 7dcd9ab9b..b04ea8692 100644
--- a/web/cobrands/fixmystreet/_colours.scss
+++ b/web/cobrands/fixmystreet/_colours.scss
@@ -4,6 +4,14 @@ $primary: #FFD000;
$primary_b: #F3B11E; // For the box around the front page postcode form only
$primary_text: #222;
+// Tiled main body background
+$base_bg: #1A1A1A url(/cobrands/fixmystreet/images/tile.jpg) 0 0 repeat;
+$base_fg: #fff;
+
+$map_nav_bg: #222;
+$nav_fg: #fff;
+$nav_fg_hover: #444;
+
// The "Click map" box on /around
$col_click_map: #00BD08;
$col_click_map_dark: #4B8304;
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index d4dfdf99f..b567981f1 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -89,11 +89,13 @@ $(function(){
height: 'auto',
margin: 0
});
- $('#fms_pan_zoom').css({ top: '2.75em !important' });
+ $('#fms_pan_zoom').css({ top: '2.75em' });
$('.big-green-banner')
.addClass('mobile-map-banner')
.appendTo('#map_box')
.html('<a href="/">' + translation_strings.home + '</a> ' + translation_strings.place_pin_on_map);
+ } else {
+ $('#fms_pan_zoom').css({ top: '0.5em' });
}
$('span.report-a-problem-btn').on('click.reportBtn', function(){
$('html, body').animate({scrollTop:0}, 500);
@@ -121,12 +123,12 @@ $(function(){
$('#site-header').show();
banner_text = translation_strings.report_problem_heading;
}
- $('#fms_pan_zoom').css({ top: '4.75em !important' });
$('.big-green-banner')
.removeClass('mobile-map-banner')
.prependTo('#side')
.html(banner_text);
}
+ $('#fms_pan_zoom').css({ top: '4.75em' });
$('span.report-a-problem-btn').css({ cursor:'' }).off('.reportBtn');
}
last_type = type;
diff --git a/web/cobrands/fixmystreet/layout.scss b/web/cobrands/fixmystreet/layout.scss
index bc61f09e4..3bb8509e4 100644
--- a/web/cobrands/fixmystreet/layout.scss
+++ b/web/cobrands/fixmystreet/layout.scss
@@ -66,17 +66,18 @@ h3, h4 {
@import "_colours";
@import "../sass/layout";
-// Tiled main body background
-body {
- background: #1A1A1A url(/cobrands/fixmystreet/images/tile.jpg) 0 0 repeat;
- color: #fff;
-}
-
// Tiled background stripe, not plain colour
#front-main {
background: $primary url(/cobrands/fixmystreet/images/tile-y.jpg);
}
#main-nav {
+ ul#main-menu {
+ li {
+ a:hover {
+ @include background(linear-gradient(#000, #444 10%, #444 95%, #111));
+ }
+ }
+ }
ul#mysoc-menu {
background: $primary url(/cobrands/fixmystreet/images/tile-y.jpg);
}
@@ -86,4 +87,10 @@ body {
@include border-image(url(/cobrands/fixmystreet/images/tile-y-border.jpg) 4 0 0 0);
}
}
-
+body.mappage {
+ .nav-wrapper {
+ .nav-wrapper-2 {
+ @include background(linear-gradient(#000, #222 10%, #222 90%, #000));
+ }
+ }
+}
diff --git a/web/cobrands/oxfordshire/_colours.scss b/web/cobrands/oxfordshire/_colours.scss
index eea046781..900f96d3d 100644
--- a/web/cobrands/oxfordshire/_colours.scss
+++ b/web/cobrands/oxfordshire/_colours.scss
@@ -7,6 +7,14 @@ $primary: $oxfordshire_lt_green;
$primary_b: $oxfordshire_dk_green;
$primary_text: #fff;
+$base_bg: #fff;
+$base_fg: #000;
+
+/* Unused here */
+$map_nav_bg: #222;
+$nav_fg: #fff;
+$nav_fg_hover: #444;
+
$col_click_map: $oxfordshire_lt_green;
$col_click_map_dark: $primary_text;
diff --git a/web/cobrands/oxfordshire/layout.scss b/web/cobrands/oxfordshire/layout.scss
index 7dc6b8be6..ff7f9b373 100644
--- a/web/cobrands/oxfordshire/layout.scss
+++ b/web/cobrands/oxfordshire/layout.scss
@@ -1,11 +1,6 @@
@import "_colours";
@import "../sass/layout";
-body {
- background-color: #fff;
- background-image: none;
-}
-
body, body a {
font-family:"Trebuchet MS",Arial, Helvetica, sans-serif;
}
diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss
index a7670b434..83a04ea6c 100644
--- a/web/cobrands/sass/_base.scss
+++ b/web/cobrands/sass/_base.scss
@@ -1018,11 +1018,10 @@ a:hover.button-left {
// Left and right so that zoom can be left, pan right.
#fms_pan_zoom {
right: 0.5em !important;
- top: 2.75em !important;
+ top: 0.5em;
left: 0.5em !important;
}
// The left and right of the above causes the navigation to move off-screen left in IE6.
-// XXX Need to check IE7
.ie6 #fms_pan_zoom {
left: auto !important;
}
diff --git a/web/cobrands/sass/_layout.scss b/web/cobrands/sass/_layout.scss
index 7de9e0544..b580f1927 100644
--- a/web/cobrands/sass/_layout.scss
+++ b/web/cobrands/sass/_layout.scss
@@ -12,8 +12,8 @@ $image-sprite: '/cobrands/fixmystreet/images/sprite.png' !default;
}
body {
- background: #1A1A1A;
- color: #fff;
+ color: $base_fg;
+ background: $base_bg;
}
/* The OpenLayers popup sets a background image with a white background without setting the CSS colours correctly. */
@@ -32,7 +32,6 @@ h1 {
padding: 0em;
width: 60em;
position: relative;
- z-index:1;
}
//z-index stack order gets reset to 0 in ie6/7 if you position anything,
@@ -138,7 +137,7 @@ h1 {
a,
span {
display: block;
- color:#fff;
+ color: $nav_fg;
background: none;
border-bottom: none;
}
@@ -150,8 +149,7 @@ h1 {
font-size: 0.9em;
}
a:hover{
- background:#444;
- @include background(linear-gradient(#000, #444 10%, #444 95%, #111));
+ background: $nav_fg_hover;
}
a.report-a-problem-btn {
color: $primary_text;
@@ -243,13 +241,17 @@ body.mappage {
.nav-wrapper{
.nav-wrapper-2{
position: fixed;
- background: #222;
- @include background(linear-gradient(#000, #222 10%, #222 90%, #000));
+ background: $map_nav_bg;
}
}
#site-logo{
position: fixed;
}
+ #user-meta {
+ max-width: none;
+ left: 0;
+ margin-left: 1em;
+ }
}
.ie6, .ie7 {
body.mappage {
@@ -268,6 +270,9 @@ body.mappage {
#site-logo {
position: absolute;
}
+ #user-meta {
+ margin-left: 2em;
+ }
}
}
//ie8 needs different stuff on .nav-wrapper so we
@@ -477,11 +482,6 @@ body.twothirdswidthpage {
z-index:1;
}
-// Pull OpenLayers navigation down a bit
-#fms_pan_zoom {
- top: 4.75em !important;
-}
-
// push zoom back over to right
#fms_pan_zoom_zoomin {
left:auto !important;
@@ -536,6 +536,7 @@ body.twothirdswidthpage {
position: relative;
max-width: 57em;
margin:0 auto;
+ left: 1em;
p {
@include inline-block;
position:absolute;
@@ -732,30 +733,30 @@ textarea.form-error {
@include border-radius(0 0 0.25em 0.25em);
}
+#report-a-problem-sidebar, .general-sidebar-notes {
+ position: absolute;
+ left: 29em;
+ width: 15em;
+ @include box-shadow(rgba(0, 0, 0, 0.6) 0px 0px 4px 1px);
+}
// Report a problem sidebar notes
#report-a-problem-sidebar {
- position:absolute;
- z-index:-1;//push behind .content, .container resets z-index for this
- left:29.5em;
top:5em;
- width:15em;
- @include box-shadow(rgba(0, 0, 0, 0.6) 0px 0px 4px 1px);
- .sidebar-tips {
- background:#eeeeee;
+ div {
padding:1em;
font-size:0.75em;
+ background:#eeeeee;
}
.sidebar-notes {
background:#333333;
- padding:1em;
color:#ffffff;
- font-size:0.75em;
}
}
.ie6, .ie7 {
#report-a-problem-sidebar, .general-sidebar-notes {
- left: 29em; // 0.5em left margin gone on .content in IE6/7, so reduce this accordingly.
+ left: 28.5em; // 0.5em left margin gone on .content in IE6/7, so reduce this accordingly.
+ z-index: 1;
}
}
@@ -772,11 +773,6 @@ textarea.form-error {
// More general sidebar notes
.general-sidebar-notes {
- position: absolute;
- left:29.5em;
- width:15em;
- z-index: -1; //push behind .content, .container resets z-index for this
- @include box-shadow(rgba(0, 0, 0, 0.6) 0px 0px 4px 1px);
p {
background:#eeeeee;
font-size:0.75em;
@@ -792,7 +788,7 @@ textarea.form-error {
/* Adjust the above so text flow can be different from display */
#forgotten-pw {
position: relative;
- left: 27em;
+ left: 26.5em;
top: -7em;
margin-bottom: -7em; // So no gap in main flow
}
@@ -853,9 +849,6 @@ body.frontpage {
#site-logo {
top:-1em;
}
- #user-meta p {
- top:-2em;
- }
}
}
.ie6 body.frontpage #site-logo {
@@ -1168,20 +1161,6 @@ $button_bg_col: #a1a1a1; // also search bar (tables)
top: 7em !important;
}
- //fix the left margin on login bit
- #user-meta {
- p {
- left:1em;
- }
- }
- body.frontpage {
- #user-meta {
- p {
- left:auto;
- }
- }
- }
-
//Map becomes percentage width
#map_box{
left: 32em;
diff --git a/web/cobrands/stevenage/_colours.scss b/web/cobrands/stevenage/_colours.scss
index 219f1066a..6b0d1bcdd 100644
--- a/web/cobrands/stevenage/_colours.scss
+++ b/web/cobrands/stevenage/_colours.scss
@@ -5,6 +5,13 @@ $primary: #066539;
$primary_b: $primary;
$primary_text: #fff;
+$base_bg: #dddddb;
+$base_fg: #222;
+
+$map_nav_bg: #6b6969;
+$nav_fg: #fff;
+$nav_fg_hover: #444;
+
$col_click_map: #00BD08;
$col_click_map_dark: #4B8304;
$col_fixed_label: #00BD08;
diff --git a/web/cobrands/stevenage/layout.scss b/web/cobrands/stevenage/layout.scss
index 91499c5a4..07429b302 100644
--- a/web/cobrands/stevenage/layout.scss
+++ b/web/cobrands/stevenage/layout.scss
@@ -4,11 +4,6 @@
// d523b431 - "Stevenage Home page styles"
// 2a23e09f - Moved menu on map page and reverted to full header.
-body {
- color: #222;
- background: #dddddb;
-}
-
// d523b431
.nav-wrapper{
.nav-wrapper-2{
@@ -60,9 +55,6 @@ body {
margin: 0;
@include border-radius(0.25em);
}
- a:hover {
- background: #444;
- }
a.report-a-problem-btn {
padding:0.5em 0.75em;
margin:0;
@@ -113,7 +105,6 @@ body.mappage {
width: 29em;
padding-top: 0.15em;
z-index: 0;
- background-color: #6b6969;
@include background(linear-gradient(#6b6969, #555454));
}
}
diff --git a/web/cobrands/zurich/_colours.scss b/web/cobrands/zurich/_colours.scss
index e2a2587f0..8ae175583 100644
--- a/web/cobrands/zurich/_colours.scss
+++ b/web/cobrands/zurich/_colours.scss
@@ -7,6 +7,15 @@ $primary: $zurich_blue;
$primary_b: $dark_blue;
$primary_text: #fff;
+$base_bg: #fff;
+$base_fg: #3c3c3c;
+
+$map_nav_bg: #fff;
+/* Unused here, main-nav is mobile only */
+$nav_fg: $primary_text;
+$nav_fg_hover: $primary/1.1;
+
+
$col_click_map: $zurich_blue;
$col_click_map_dark: darken($zurich_blue, 20%);
diff --git a/web/cobrands/zurich/layout.scss b/web/cobrands/zurich/layout.scss
index 7984de0b9..03f8b3143 100644
--- a/web/cobrands/zurich/layout.scss
+++ b/web/cobrands/zurich/layout.scss
@@ -4,11 +4,6 @@
// Things to override from parent stylesheet
-body {
- color: #3c3c3c;
- background-color: #fff;
-}
-
// White background, so no shadow or margin needed.
.content {
color: #3c3c3c;
@@ -104,7 +99,6 @@ body.mappage {
.nav-wrapper {
.nav-wrapper-2 {
border-top: none;
- background: #fff;
height: 117px; // 99px+18px for padding
padding: 0 10px;
box-sizing: border-box;
@@ -155,19 +149,6 @@ body.mappage {
}
}
-#main-nav {
- ul#main-menu {
- li {
- a:hover {
- background: $primary/1.1;
- }
- span {
- color: $primary_text;
- }
- }
- }
-}
-
#zurich-main-nav {
margin: -1em -1em 1em -1em; // -1em spreads back out over content's 1em padding
padding: 0;
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index a69b22799..f7a46ee68 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -273,8 +273,13 @@ $(function(){
}, fixmystreet.map_options)
);
- if ($('html').hasClass('mobile') && fixmystreet.page == 'around') {
- $('#fms_pan_zoom').css({ top: '2.75em !important' });
+ // Need to do this here, after the map is created
+ if ($('html').hasClass('mobile')) {
+ if (fixmystreet.page == 'around') {
+ $('#fms_pan_zoom').css({ top: '2.75em' });
+ }
+ } else {
+ $('#fms_pan_zoom').css({ top: '4.75em' });
}
// Set it up our way