diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-08-15 18:03:10 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-11-06 12:25:34 +0000 |
commit | 917be7924e23fd4e0168927f16fa5d6e64ca4508 (patch) | |
tree | 3cdf0924c629df0dab3f6aa592ad556f7999ec4a | |
parent | 660631a3ff063e6378c9838f40c1d9bfa8dcfd43 (diff) |
Remove Show all pins link and on_map_list_limit.
/around will now show all reports all the time, but we are about to
introduce pagination to stop that.
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 13 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bromley.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 16 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Greenwich.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Nearby.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 5 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map.pm | 14 | ||||
-rw-r--r-- | t/map/tilma/original.t | 6 | ||||
-rwxr-xr-x | templates/web/base/around/display_location.html | 8 | ||||
-rw-r--r-- | templates/web/base/maps/google.html | 1 | ||||
-rw-r--r-- | templates/web/base/maps/openlayers.html | 1 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/map.js | 2 | ||||
-rw-r--r-- | web/cobrands/sass/_base.scss | 4 | ||||
-rw-r--r-- | web/js/map-OpenLayers.js | 36 | ||||
-rw-r--r-- | web/js/map-google.js | 37 |
16 files changed, 15 insertions, 142 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index 33b1dd740..b870c1a19 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -249,16 +249,11 @@ sub map_features : Private { $c->forward( '/reports/stash_report_filter_status' ); $c->forward( '/reports/stash_report_sort', [ 'created-desc' ]); - # Deal with pin hiding/age - my $all_pins = $c->get_param('all_pins') ? 1 : undef; - $c->stash->{all_pins} = $all_pins; - my $interval = $all_pins ? undef : $c->cobrand->on_map_default_max_pin_age; - return if $c->get_param('js'); # JS will request the same (or more) data client side - my ( $on_map_all, $on_map_list, $nearby, $distance ) = + my ( $on_map, $nearby, $distance ) = FixMyStreet::Map::map_features( - $c, interval => $interval, %$extra, + $c, %$extra, categories => [ keys %{$c->stash->{filter_category}} ], states => $c->stash->{filter_problem_states}, order => $c->stash->{sort_order}, @@ -270,11 +265,11 @@ sub map_features : Private { # Here we might have a DB::Problem or a DB::Result::Nearby, we always want the problem. my $p = (ref $_ eq 'FixMyStreet::DB::Result::Nearby') ? $_->problem : $_; $p->pin_data($c, 'around'); - } @$on_map_all, @$nearby; + } @$on_map, @$nearby; } $c->stash->{pins} = \@pins; - $c->stash->{on_map} = $on_map_list; + $c->stash->{on_map} = $on_map; $c->stash->{around_map} = $nearby; $c->stash->{distance} = $distance; } diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 138098d5f..3913f4906 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -521,7 +521,7 @@ sub nearby_json : Private { my $dist = 1; my $nearby = $c->model('DB::Nearby')->nearby( - $c, $dist, [ $p->id ], 5, $p->latitude, $p->longitude, undef, [ $p->category ], undef + $c, $dist, [ $p->id ], 5, $p->latitude, $p->longitude, [ $p->category ], undef ); my @pins = map { my $p = $_->problem; diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm index e7d5e186a..2f47225a7 100644 --- a/perllib/FixMyStreet/Cobrand/Bromley.pm +++ b/perllib/FixMyStreet/Cobrand/Bromley.pm @@ -59,10 +59,6 @@ sub map_type { 'Bromley'; } -sub on_map_default_max_pin_age { - return '1 month'; -} - # Bromley pins always yellow sub pin_colour { my ( $self, $p, $context ) = @_; diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 9e49099aa..ada1058f5 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -437,22 +437,6 @@ sub reports_ordering { return 'updated-desc'; } -=head2 on_map_list_limit - -Return the maximum number of items to be given in the list of reports on the map - -=cut - -sub on_map_list_limit { return undef; } - -=head2 on_map_default_max_pin_age - -Return the default maximum age for pins. - -=cut - -sub on_map_default_max_pin_age { return '6 months'; } - =head2 on_map_default_status Return the default ?status= query parameter to use for filter on map page. diff --git a/perllib/FixMyStreet/Cobrand/Greenwich.pm b/perllib/FixMyStreet/Cobrand/Greenwich.pm index ce4fae381..6ff30e83d 100644 --- a/perllib/FixMyStreet/Cobrand/Greenwich.pm +++ b/perllib/FixMyStreet/Cobrand/Greenwich.pm @@ -57,10 +57,6 @@ sub contact_email { sub reports_per_page { return 20; } -sub on_map_default_max_pin_age { - return '21 days'; -} - sub open311_config { my ($self, $row, $h, $params) = @_; diff --git a/perllib/FixMyStreet/DB/ResultSet/Nearby.pm b/perllib/FixMyStreet/DB/ResultSet/Nearby.pm index 8b8951007..6e5e0220f 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Nearby.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Nearby.pm @@ -10,7 +10,7 @@ sub to_body { } sub nearby { - my ( $rs, $c, $dist, $ids, $limit, $mid_lat, $mid_lon, $interval, $categories, $states ) = @_; + my ( $rs, $c, $dist, $ids, $limit, $mid_lat, $mid_lon, $categories, $states ) = @_; unless ( $states ) { $states = FixMyStreet::DB::Result::Problem->visible_states(); @@ -20,8 +20,6 @@ sub nearby { non_public => 0, state => [ keys %$states ], }; - $params->{'current_timestamp-lastupdate'} = { '<', \"'$interval'::interval" } - if $interval; $params->{id} = { -not_in => $ids } if $ids; $params->{category} = $categories if $categories && @$categories; diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index f1ed50721..5cbf4e8f0 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -140,11 +140,10 @@ sub _recent { # Problems around a location sub around_map { - my ( $rs, $limit, %p) = @_; + my ( $rs, %p) = @_; my $attr = { order_by => $p{order}, }; - $attr->{rows} = $limit if $limit; unless ( $p{states} ) { $p{states} = FixMyStreet::DB::Result::Problem->visible_states(); @@ -156,8 +155,6 @@ sub around_map { latitude => { '>=', $p{min_lat}, '<', $p{max_lat} }, longitude => { '>=', $p{min_lon}, '<', $p{max_lon} }, }; - $q->{'current_timestamp - lastupdate'} = { '<', \"'$p{interval}'::interval" } - if $p{interval}; $q->{category} = $p{categories} if $p{categories} && @{$p{categories}}; my @problems = mySociety::Locale::in_gb_locale { $rs->search( $q, $attr )->include_comment_counts->all }; diff --git a/perllib/FixMyStreet/Map.pm b/perllib/FixMyStreet/Map.pm index b6b618efb..46a098117 100644 --- a/perllib/FixMyStreet/Map.pm +++ b/perllib/FixMyStreet/Map.pm @@ -88,23 +88,17 @@ sub map_features { $p{latitude} = ($p{max_lat} + $p{min_lat} ) / 2; } - # list of problems around map can be limited, but should show all pins - my $around_limit = $c->cobrand->on_map_list_limit || undef; - - my $on_map_all = $c->cobrand->problems_on_map->around_map( undef, %p ); - my $on_map_list = $around_limit - ? $c->cobrand->problems_on_map->around_map( $around_limit, %p ) - : $on_map_all; + my $on_map = $c->cobrand->problems_on_map->around_map( %p ); my $dist = FixMyStreet::Gaze::get_radius_containing_population( $p{latitude}, $p{longitude} ); my $limit = 20; - my @ids = map { $_->id } @$on_map_list; + my @ids = map { $_->id } @$on_map; my $nearby = $c->model('DB::Nearby')->nearby( - $c, $dist, \@ids, $limit, @p{"latitude", "longitude", "interval", "categories", "states"} + $c, $dist, \@ids, $limit, @p{"latitude", "longitude", "categories", "states"} ); - return ( $on_map_all, $on_map_list, $nearby, $dist ); + return ( $on_map, $nearby, $dist ); } sub click_to_wgs84 { diff --git a/t/map/tilma/original.t b/t/map/tilma/original.t index b29155bee..e89251285 100644 --- a/t/map/tilma/original.t +++ b/t/map/tilma/original.t @@ -92,17 +92,17 @@ for my $test ( $report->state($test->{state}); $report->update; - my ( $on_map_all, $on_map_list, $nearby, $dist ) = + my ( $on_map, $nearby, $dist ) = FixMyStreet::Map::map_features($c, bbox => "0,0,0,0"); - ok $on_map_list; + ok $on_map; ok $nearby; ok $dist; my $id = $report->id; my $colour = $test->{colour}; - my $pin_colour = $c->cobrand->pin_colour($on_map_all->[0], 'around'); + my $pin_colour = $c->cobrand->pin_colour($on_map->[0], 'around'); is $pin_colour, $colour, 'pin colour'; }; } diff --git a/templates/web/base/around/display_location.html b/templates/web/base/around/display_location.html index 3ed16d3d3..5d83235b1 100755 --- a/templates/web/base/around/display_location.html +++ b/templates/web/base/around/display_location.html @@ -61,14 +61,6 @@ [% ELSE %] <a id='hide_pins_link' rel='nofollow' href="[% c.uri_with( { no_pins => 1 } ) %]">[% loc('Hide pins') %]</a> [% END %] - [% IF c.cobrand.country == 'GB' || c.cobrand.country == 'NO' %] - <span class="hidden">|</span> - [% IF c.req.params.all_pins %] - <a id='all_pins_link' rel='nofollow' href="[% c.uri_with( { no_pins => undef, all_pins => undef } ) %]">[% loc('Hide old') %]</a> - [% ELSE %] - <a id='all_pins_link' rel='nofollow' href="[% c.uri_with( { no_pins => undef, all_pins => 1 } ) %]">[% loc('Show old') %]</a> - [% END %] - [% END %] </p> <div class="mobile-map-banner"> diff --git a/templates/web/base/maps/google.html b/templates/web/base/maps/google.html index c86c757fb..ec9885a04 100644 --- a/templates/web/base/maps/google.html +++ b/templates/web/base/maps/google.html @@ -18,7 +18,6 @@ map_js = [ var fixmystreet = fixmystreet || {}; $.extend(fixmystreet, { 'area': [ [% map.area.join(',') %] ], - 'all_pins': '[% all_pins %]', 'latitude': [% map.latitude %], 'longitude': [% map.longitude %], [% IF map.any_zoom -%] diff --git a/templates/web/base/maps/openlayers.html b/templates/web/base/maps/openlayers.html index 568a87e7c..12ae88c05 100644 --- a/templates/web/base/maps/openlayers.html +++ b/templates/web/base/maps/openlayers.html @@ -9,7 +9,6 @@ [%- UNLESS c.cobrand.call_hook('hide_areas_on_reports') %] data-area="[% map.area.join(',') %]" [%- END %] - data-all_pins='[% all_pins %]' data-latitude=[% map.latitude %] data-longitude=[% map.longitude %] [% IF map.any_zoom -%] diff --git a/web/cobrands/fixmystreet/map.js b/web/cobrands/fixmystreet/map.js index f3bf1a19f..9303c22b7 100644 --- a/web/cobrands/fixmystreet/map.js +++ b/web/cobrands/fixmystreet/map.js @@ -3,7 +3,7 @@ var fixmystreet = fixmystreet || {}; (function(){ var map_data = document.getElementById('js-map-data'), - map_keys = [ 'area', 'all_pins', 'latitude', 'longitude', 'zoomToBounds', 'zoom', 'pin_prefix', 'pin_new_report_colour', 'numZoomLevels', 'zoomOffset', 'map_type', 'key' ], + map_keys = [ 'area', 'latitude', 'longitude', 'zoomToBounds', 'zoom', 'pin_prefix', 'pin_new_report_colour', 'numZoomLevels', 'zoomOffset', 'map_type', 'key' ], numeric = { zoom: 1, numZoomLevels: 1, zoomOffset: 1, id: 1 }, pin_keys = [ 'lat', 'lon', 'colour', 'id', 'title', 'type' ]; diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss index b13dc636a..384566516 100644 --- a/web/cobrands/sass/_base.scss +++ b/web/cobrands/sass/_base.scss @@ -1505,10 +1505,6 @@ html.js #map .noscript { background-image:url($image-sprite); background-position: flip(right, -341px) -3976px; } - &#all_pins_link { - background-image:url($image-sprite); - background-position: flip(right, -337px) -4022px; - } &#map_permalink { background-image:url($image-sprite); background-position: flip(right, -341px) -4070px; diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index e9a546786..004f0c3e2 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -482,11 +482,6 @@ var fixmystreet = fixmystreet || {}; if (fixmystreet.page == 'around') { fixmystreet.bbox_strategy = fixmystreet.bbox_strategy || new OpenLayers.Strategy.FixMyStreet(); pin_layer_options.strategies = [ fixmystreet.bbox_strategy ]; - pin_layer_options.protocol = new OpenLayers.Protocol.FixMyStreet({ - url: fixmystreet.original.href.split('?')[0] + '?ajax=1', - params: fixmystreet.all_pins ? { all_pins: 1 } : { }, - format: new OpenLayers.Format.FixMyStreet() - }); } if (fixmystreet.page == 'reports') { pin_layer_options.strategies = [ new OpenLayers.Strategy.FixMyStreetRefreshOnZoom() ]; @@ -577,37 +572,6 @@ var fixmystreet = fixmystreet || {}; this.innerHTML = translation_strings.show_pins; } }); - - $('#all_pins_link').click(function(e) { - e.preventDefault(); - fixmystreet.markers.setVisibility(true); - var texts = [ - 'en', 'Show old', 'Hide old', - 'nb', 'Vis gamle', 'Skjul gamle', - 'cy', 'Cynnwys hen adroddiadau', 'Cuddio hen adroddiadau' - ]; - for (var i=0; i<texts.length; i+=3) { - if (this.innerHTML == texts[i+1]) { - this.innerHTML = texts[i+2]; - fixmystreet.markers.protocol.options.params = { all_pins: 1 }; - fixmystreet.markers.refresh( { force: true } ); - lang = texts[i]; - } else if (this.innerHTML == texts[i+2]) { - this.innerHTML = texts[i+1]; - fixmystreet.markers.protocol.options.params = { }; - fixmystreet.markers.refresh( { force: true } ); - lang = texts[i]; - } - } - if (lang == 'cy') { - document.getElementById('hide_pins_link').innerHTML = 'Cuddio pinnau'; - } else if (lang == 'nb') { - document.getElementById('hide_pins_link').innerHTML = 'Skjul nåler'; - } else { - document.getElementById('hide_pins_link').innerHTML = 'Hide pins'; - } - }); - } $(function(){ diff --git a/web/js/map-google.js b/web/js/map-google.js index 6be2a0232..803ac4f3e 100644 --- a/web/js/map-google.js +++ b/web/js/map-google.js @@ -130,9 +130,6 @@ fixmystreet.maps = {}; ajax: 1, bbox: bbox }; - if (fixmystreet.all_pins) { - params.all_pins = 1; - } $.getJSON('/around', params, read_pin_json); } @@ -224,40 +221,6 @@ fixmystreet.maps = {}; this.innerHTML = translation_strings.show_pins; } }); - - $('#all_pins_link').click(function(e) { - var i; - e.preventDefault(); - for (i=0; i<fixmystreet.markers.length; i++) { - fixmystreet.markers[i].setMap(fixmystreet.map); - } - var texts = [ - 'en', 'Show old', 'Hide old', - 'nb', 'Inkluder utdaterte problemer', 'Skjul utdaterte rapporter', - 'cy', 'Cynnwys hen adroddiadau', 'Cuddio hen adroddiadau' - ]; - for (i=0; i<texts.length; i+=3) { - if (this.innerHTML == texts[i+1]) { - this.innerHTML = texts[i+2]; - fixmystreet.markers.protocol.options.params = { all_pins: 1 }; - fixmystreet.markers.refresh( { force: true } ); - lang = texts[i]; - } else if (this.innerHTML == texts[i+2]) { - this.innerHTML = texts[i+1]; - fixmystreet.markers.protocol.options.params = { }; - fixmystreet.markers.refresh( { force: true } ); - lang = texts[i]; - } - } - if (lang == 'cy') { - document.getElementById('hide_pins_link').innerHTML = 'Cuddio pinnau'; - } else if (lang == 'nb') { - document.getElementById('hide_pins_link').innerHTML = 'Gjem nåler'; - } else { - document.getElementById('hide_pins_link').innerHTML = 'Hide pins'; - } - }); - } google.maps.visualRefresh = true; |