blob: 8cb807e09bd9382843161959e7319efefe3ce132 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
package FixMyStreet::App::Controller::My;
use Moose;
use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller'; }
=head1 NAME
FixMyStreet::App::Controller::My - Catalyst Controller
=head1 DESCRIPTION
Catalyst Controller.
=head1 METHODS
=cut
=head2 index
=cut
sub my : Path : Args(0) {
my ( $self, $c ) = @_;
$c->detach( '/auth/redirect' ) unless $c->user;
my $pins = [];
my $problems = {};
foreach my $problem ( $c->user->problems ) {
push @$pins, {
latitude => $problem->latitude,
longitude => $problem->longitude,
colour => $problem->state eq 'fixed' ? 'green' : 'red',
id => $problem->id,
title => $problem->title,
};
push @{ $problems->{$problem->state} }, $problem;
}
$c->stash->{problems} = $problems;
FixMyStreet::Map::display_map(
$c,
latitude => $pins->[0]{latitude},
longitude => $pins->[0]{longitude},
pins => $pins,
any_zoom => 1,
)
if @$pins;
}
__PACKAGE__->meta->make_immutable;
1;
|