aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-05-13 12:44:43 +0100
committerStruan Donald <struan@exo.org.uk>2011-05-13 12:44:43 +0100
commitae9bd9cab0b338a1f07721e7ec4a8cba68ff8f7b (patch)
treedf0679adc4f459a8f3946b40d71cb484df258af1
parent76715723f615a5858587586df395072745f9e5cb (diff)
perltidy
-rw-r--r--perllib/FixMyStreet/App/Controller/Contact.pm46
-rw-r--r--t/app/controller/contact.t34
2 files changed, 41 insertions, 39 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm
index 9a19f471e..05475719a 100644
--- a/perllib/FixMyStreet/App/Controller/Contact.pm
+++ b/perllib/FixMyStreet/App/Controller/Contact.pm
@@ -2,7 +2,7 @@ package FixMyStreet::App::Controller::Contact;
use Moose;
use namespace::autoclean;
-BEGIN {extends 'Catalyst::Controller'; }
+BEGIN { extends 'Catalyst::Controller'; }
=head1 NAME
@@ -16,12 +16,11 @@ Contact us page
=cut
-
=head2 index
=cut
-sub index :Path :Args(0) {
+sub index : Path : Args(0) {
my ( $self, $c ) = @_;
$c->stash->{contact_email} = $c->cobrand->contact_email;
@@ -38,25 +37,25 @@ sub index :Path :Args(0) {
# my %input_h = map { $_ => $q->param($_) ? ent($q->param($_)) : '' } @vars;
# my $out = '';
-# my $cobrand = Page::get_cobrand($q);
-# my $form_action = Cobrand::url($cobrand, '/contact', $q);
-#
-# my $intro = '';
-# my $item_title = '';
-# my $item_body = '';
-# my $item_meta = '';
-# my $hidden_vals = '';
+ # my $cobrand = Page::get_cobrand($q);
+ # my $form_action = Cobrand::url($cobrand, '/contact', $q);
+ #
+ # my $intro = '';
+ # my $item_title = '';
+ # my $item_body = '';
+ # my $item_meta = '';
+ # my $hidden_vals = '';
# my $cobrand_form_elements = Cobrand::form_elements(Page::get_cobrand($q), 'contactForm', $q);
# my %vars = (
# header => $header,
# errors => $errors,
# intro => $intro,
-# item_title => $item_title,
+# item_title => $item_title,
# item_meta => $item_meta,
# item_body => $item_body,
# hidden_vals => $hidden_vals,
-# form_action => $form_action,
+# form_action => $form_action,
# input_h => \%input_h,
# field_errors => \%field_errors,
# label_name => _('Your name:'),
@@ -74,15 +73,15 @@ sub index :Path :Args(0) {
sub determine_contact_type : Private {
my ( $self, $c ) = @_;
- my $id = $c->req->param('id');
+ my $id = $c->req->param('id');
my $update_id = $c->req->param('update_id');
- $id = undef unless $id && $id =~ /^[1-9]\d*$/;
+ $id = undef unless $id && $id =~ /^[1-9]\d*$/;
$update_id = undef unless $update_id && $update_id =~ /^[1-9]\d*$/;
if ($id) {
my $problem = $c->model('DB::Problem')->find(
{ id => $id },
- {
+ {
'select' => [
'title', 'detail', 'name',
'anonymous',
@@ -92,13 +91,14 @@ sub determine_contact_type : Private {
-as => 'confirmed'
}
]
- }
+ }
);
- if ( $update_id ) {
+ if ($update_id) {
+
# my $u = dbh()->selectrow_hashref(
# 'select comment.text, comment.name, problem.title, extract(epoch from comment.confirmed) as confirmed
-# from comment, problem where comment.id=?
+# from comment, problem where comment.id=?
# and comment.problem_id = problem.id
# and comment.problem_id=?', {}, $update_id ,$id);
# if (! $u) {
@@ -111,8 +111,10 @@ sub determine_contact_type : Private {
# $item_body = ent($u->{text});
# $hidden_vals .= '<input type="hidden" name="update_id" value="' . $update_id . '">';
# }
- } elsif ( $problem ) {
+ }
+ elsif ($problem) {
$c->stash->{problem} = $problem;
+
# $intro .= $q->p(_('You are reporting the following problem report for being abusive, containing personal information, or similar:'));
# $item_title = ent($p->{title});
# my $date_time = Page::prettify_epoch($q, $p->{confirmed});
@@ -123,11 +125,11 @@ sub determine_contact_type : Private {
# );
# $item_body = ent($p->{detail});
}
-# $hidden_vals .= '<input type="hidden" name="id" value="' . $id . '">';
+
+ # $hidden_vals .= '<input type="hidden" name="id" value="' . $id . '">';
}
}
-
=head1 AUTHOR
Struan Donald
diff --git a/t/app/controller/contact.t b/t/app/controller/contact.t
index d4c31bd20..9d232c8ff 100644
--- a/t/app/controller/contact.t
+++ b/t/app/controller/contact.t
@@ -6,10 +6,9 @@ use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;
-
-$mech->get_ok( '/contact' );
-$mech->title_like( qr/Contact Us/ );
-$mech->content_contains( "We'd love to hear what you think about this site" );
+$mech->get_ok('/contact');
+$mech->title_like(qr/Contact Us/);
+$mech->content_contains("We'd love to hear what you think about this site");
subtest 'check reporting a problem displays correctly' => sub {
my $user = FixMyStreet::App->model('DB::User')->find_or_create(
@@ -21,28 +20,29 @@ subtest 'check reporting a problem displays correctly' => sub {
my $problem = FixMyStreet::App->model('DB::Problem')->create(
{
- title => 'Some problem or other',
- detail => 'More detail on the problem',
- postcode => 'EH99 1SP',
+ title => 'Some problem or other',
+ detail => 'More detail on the problem',
+ postcode => 'EH99 1SP',
confirmed => '2011-05-04 10:44:28.145168',
- latitude => 0,
+ latitude => 0,
longitude => 0,
- areas => 0,
- used_map => 0,
- name => 'Problem User',
+ areas => 0,
+ used_map => 0,
+ name => 'Problem User',
anonymous => 0,
- state => 'confirmed',
- user => $user
+ state => 'confirmed',
+ user => $user
}
);
ok $problem, 'succesfully create a problem';
$mech->get_ok( '/contact?id=' . $problem->id );
- $mech->content_contains( 'reporting the following problem' );
- $mech->content_contains( 'Some problem or other' );
- $mech->content_contains( 'Reported by A User' );
- $mech->content_contains( 'Reported by A User at 10:44, Wednesday 4 May 2011' );
+ $mech->content_contains('reporting the following problem');
+ $mech->content_contains('Some problem or other');
+ $mech->content_contains('Reported by A User');
+ $mech->content_contains(
+ 'Reported by A User at 10:44, Wednesday 4 May 2011');
$problem->delete;
};