diff options
author | Zarino Zappia <mail@zarino.co.uk> | 2017-05-30 11:50:28 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-06-10 09:54:28 +0100 |
commit | ce350cc13134bdbbbf50af2689fbc63a04b3773b (patch) | |
tree | 89df9b09e04801f1e35b1322b7e7473cd1378835 /perllib | |
parent | eb8d1b6f0aed5773c08d76041bc5aec57cbc4a31 (diff) |
[Oxfordshire] Show problem state in marker tooltip
Add hook so that cobrands can change pin hover title.
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Oxfordshire.pm | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 5 |
3 files changed, 13 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index 1fe35d0a3..bd9e80dc7 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -314,9 +314,10 @@ sub ajax : Path('/ajax') { # Here we might have a DB::Problem or a DB::Nearby, we always want the problem. my $p = (ref $_ eq 'FixMyStreet::App::Model::DB::Nearby') ? $_->problem : $_; my $colour = $c->cobrand->pin_colour( $p, 'around' ); + my $title = $c->cobrand->call_hook(pin_hover_title => $p, $p->title_safe) || $p->title_safe; [ $p->latitude, $p->longitude, $colour, - $p->id, $p->title_safe + $p->id, $title ] } @$on_map_all, @$nearby; diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm index 7093e80bd..76d7ee31f 100644 --- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm +++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm @@ -120,6 +120,14 @@ sub path_to_pin_icons { return '/cobrands/oxfordshire/images/'; } +sub pin_hover_title { + my ($self, $problem, $title) = @_; + my $state = $self->{c}->render_fragment( + 'report/state-list.html', + { state => $problem->state }); + return "$state: $title"; +} + sub open311_config { my ($self, $row, $h, $params) = @_; diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index c9fd56773..6703a5102 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -1000,13 +1000,14 @@ has get_cobrand_logged => ( sub pin_data { my ($self, $c, $page, %opts) = @_; my $colour = $c->cobrand->pin_colour($self, $page); - + my $title = $opts{private} ? $self->title : $self->title_safe; + $title = $c->cobrand->call_hook(pin_hover_title => $self, $title) || $title; { latitude => $self->latitude, longitude => $self->longitude, colour => $colour, id => $self->id, - title => $opts{private} ? $self->title : $self->title_safe, + title => $title, problem => $self, type => $opts{type}, } |