aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/map-OpenLayers.js
Commit message (Collapse)AuthorAgeLines
* When inspector changing asset, prevent background map click.M Somerville2020-08-13-2/+7
|
* Only create one admin drag control.M Somerville2020-08-13-1/+4
| | | | | | It was previously creating one on each report you looked at. A side effect of which was upping the z-index of the layer by one each time, making adding asset layers bit trickier.
* Allow inspectors to change report asset.M Somerville2020-08-13-6/+3
| | | | | This hopefully copes with assets displayed by category or by group, and updates the button to show/hide on category change.
* Factor together BNG inspector pin field function.M Somerville2020-08-13-11/+18
| | | | Update all name= fields, that should be fine.
* Add aerial view toggle to Bing Maps & subclasses.Struan Donald2020-07-10-0/+2
| | | | | Co-authored-by: Dave Arter <davea@mysociety.org> Co-authored-by: Matthew Somerville <matthew@mysociety.org>
* Add lazy image loading on list items.Matthew Somerville2020-06-15-0/+3
|
* base files for displaying WMS mapsStruan Donald2020-02-17-3/+16
| | | | | Basic config and setup files for using WMS based map tiles. These still require config in appropriate cobrand perl and javascript files
* Restrict lat/lon in URL/fields to 6dp.Matthew Somerville2020-01-31-2/+2
|
* Use our own Permalink class.Matthew Somerville2020-01-10-53/+73
| | | | | We are overriding quite a bit of it and not using other bits, so it will be less code to only have our own Control.
* Reduce duplicate Permalink.updateLink calls when zooming mapDave Arter2020-01-09-0/+18
|
* Merge branch 'cheshire-east-maps'Matthew Somerville2020-01-09-4/+8
|\
| * Use variables for marker size boundaries.Matthew Somerville2020-01-08-4/+8
| |
* | Display GPS marker on /around & /report/new if geolocate link usedDave Arter2020-01-08-0/+94
|/ | | | | | Attempts to allow for CSS animations by not destroying the marker's DOM element each time a location update is received - with limited success.
* Add map filter debouncing.Matthew Somerville2019-10-15-2/+15
|
* Merge branch 'zurich-staging'Matthew Somerville2019-09-30-0/+15
|\
| * [OpenLayers] Never send X-Requested-With header.Matthew Somerville2019-09-30-0/+15
| |
* | [IsleOfWight] fix wmts bbox strategy settingStruan Donald2019-09-27-1/+1
|/ | | | | | Change the way we set the BBOX strategy for the map layer as otherwise when we check for bbox_strategy in display_around this is set but has not been associated with a layer so .activate fails.
* Improve map JavaScript defensiveness.Matthew Somerville2019-07-10-0/+7
| | | | | Add more checking for map things so e.g. on a skipped map page we stop getting JavaScript errors given there is no map present.
* [Bromley] Initial heatmap page.Matthew Somerville2019-02-28-1/+8
|
* Duplicate suggestion UI when reporting problems.Zarino Zappia2019-02-25-4/+4
| | | | | | | | | | | | | | | | | | The previously staff-only fixmystreet.set_up.manage_duplicates() has been promoted from staff.js to its own file so that we can use it to display the duplicate suggestions on the `/report/new` form. render_duplicate_list (the old refresh_duplicate_list) no longer filters or slices the reports_list returned by the ajax call, since it turns out the server handles all of that (`sub _nearby_json` in `Report.pm` and `sub nearby` in `Nearby.pm`). Since the expandable list items include the "fancybox" image previews, the fancybox CSS now has to be included in the `/report/new` page head, hence the addition of "photo-js.html" in `fill_in_details.html`. The “Get updates” flow reuses the same JavaScript that handles the submission of the "Get updates" drawer at the bottom of around pages.
* Add parameter to URL when “Show older” clicked.Matthew Somerville2019-02-14-2/+1
| | | | | The behaviour should be the same whether “Show older” or “Show older reports” is clicked, but only the latter was updating the URL.
* Fix typo in d4c2211cf.Matthew Somerville2019-02-13-1/+1
|
* Improve use of OL ArgParser/missing zoom in URL.Matthew Somerville2019-02-04-9/+17
| | | | | | Remove the server-side zoom-in-url fix, instead use an ArgParser subclass to default to the provided data if nothing in URL. Then we can switch to using short lat/lon in geocoder URLs.
* Update URL whenever map moves, using replaceState.Dave Arter2019-02-04-16/+51
| | | | | | Fixes #2242. Co-authored-by: Matthew Somerville <matthew@mysociety.org>
* Make staff JavaScript more self-contained.Matthew Somerville2019-01-29-2/+2
| | | | So it can run even when fixmystreet.js is not loaded.
* Don't draw a pin for a problem with no location.Martin Wright2018-12-03-0/+3
|
* Restore zoom level when navigating back to /around from /reportDave Arter2018-11-27-0/+16
| | | | Fixes #1649.
* Disable two-tap marker highlighting on touchscreensDave Arter2018-11-22-11/+14
| | | | Fixes #2294
* Update any lat/lon fields when changed.Matthew Somerville2018-11-09-2/+2
| | | | | Cobrands might include the fields elsewhere, e.g. in moderation. Also only use 6 decimal places.
* Fix history API bug.Matthew Somerville2018-10-02-9/+17
| | | | | | replace_query_parameter() was stringifying select multiples, meaning they were incorrectly recorded by the pushState and thus breaking on navigation.
* Handle MultiPolygon geometries for boundary on /reportsDave Arter2018-09-17-1/+2
|
* Fix inspector dragging of pins.Matthew Somerville2018-08-09-4/+10
|
* Merge remote-tracking branch 'origin/2012-new-report-near-here'Matthew Somerville2018-08-07-0/+16
|\
| * "Report a problem here" button in nav when viewing a locationZarino Zappia2018-08-07-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #2016. When you load a page that includes either a problem report, or is centered on a location, the "Report a problem" button in the nav bar (that normally takes you to the homepage) becomes a "Report a(nother) problem here" button, that leads directly to the new report form for the location in question. On full map pages (/around and any /report/<id> pages loaded via it) the reporting form will be rendered client-side, avoiding a full page reload. On pages lacking the full map (eg: missing fixmystreet.bbox_strategy), namely /reports/<area> and any /report/<id> page that hasn’t been client-side loaded via /around, we fall back to a server-side page load. Finally, as you’d expect, the text and URL for the button dynamically update as you move around the map, or switch between the different client-side states of the reporting flow. We also hide the button entirely when you’re reporting a problem, which was something suggested a long time ago.
* | call inspector setup when display reportStruan Donald2018-08-07-0/+4
|/ | | | | | | | If an inspector clicks on a report from an around page the code to setup the pin dragging needs to be called. This adds a method to the map to allow the setup code to be called on report load. Fixes #2073
* [UK] Pull in cobrand asset files on national site.Struan Donald2018-08-03-2/+2
| | | | | | | Also add body name to layer defaults, so they are only used where appropriate. Switch mapit area javascript calls to GeoJSON, so we can drop KML support in OpenLayers.wfs.js which saves a small amount of bandwidth.
* Allow asset layer display to be body dependent.Struan Donald2018-08-03-0/+42
| | | | | | | | | | | Return a list of associated bodies on around/new pages and in category ajax calls, and use that when deciding whether to show/hide layers. If the layer has no body information, then we show it as before, maybe based on category selected; if it does, it is only shown if the layer body matches the bodies for the point. As part of this create a new VectorAsset class to handle all the visibility changes for asset layers as it makes it a bit tidier.
* Only display reports from last 6 months on around.Struan Donald2018-07-03-4/+25
| | | | | | | Add a checkbox to show older reports, plus if we get to the end of the new reports then instead of a Next button show a "show older" button that will reload the current page but with older reports also loaded. Wire it all up into the pushState code as well.
* fix pushState paginationStruan Donald2018-07-03-5/+5
| | | | | | | | | | | | Using `$('.pagination')` everywhere in javascript was causing issues because that returns two elements. This was especially true when triggering events as it was triggering two events so the data was being loaded twice. This was also resulting in resetting the page to the initial page so clicking the back button would always return to the first page of results. This also sets `use_page` when clicking the back button otherwise it also loads the initial page.
* Use CSV escaping for categories in URLs.Matthew Somerville2018-06-21-3/+15
| | | | | Categories could contain commas, so splitting on comma is not good enough. Let’s escape the fields as if it’s a line in CSV. Fixes #2166.
* Fix pin clicking on non-/around pages.Matthew Somerville2018-06-07-1/+3
| | | | | The fix in de36c49d1 broke pin clicking on other map list pages, such as /my and /reports.
* Fix pointer event issue selecting pin on map.Matthew Somerville2018-06-06-1/+4
| | | | | | | | | | | | | | | On a mobile device that implements pointer events, there are two events that can happen on an /around page – touching the map starts a new report (or goes back to the map if already on a report page); touching a pin pulls in that report’s page. The map touch, which uses an OpenLayers.Handler.Click, operates on click, whereas the pin touch, which uses an OpenLayers.Handler.Feature, operates on touchstart. Neither event cancels the other, which means you can end up either starting a new report, and then it tries to pull in an undefined pin ID report and errors, or the pin report loads and then you instantly go back to the map page. In order to work around this, we disable the map click control when the feature control event starts, and reactivate once the report data has been loaded.
* Improve handling of loading spinner display.Matthew Somerville2018-05-31-5/+17
| | | | | | | | | Going back to /around from /report/new can trigger loadend (and the spinner hiding function) twice (if the strategy activation starts a read), with triggerRead aborting that read and triggering the event itself. This means the spinner is not displayed, as the count falls below 0. We could pin the count above 0, but instead let’s log each layer ID while ‘active’ and switch off when they’re all gone.
* Some IE8/old JS workarounds.Matthew Somerville2018-05-02-1/+1
|
* Drop unused copy of function.Matthew Somerville2018-04-30-14/+0
| | | | This is already defined in fixmystreet.utils further up.
* Fix issues with new report pin, improve cursor.Matthew Somerville2018-03-26-1/+1
| | | | | | | | | | The "coerce pin ID to integer" behaviour to fix a previous issue was coercing undefined to NaN, which then caused other problems with the new report pin, such as fading out when hovered, and being the wrong size. Also improve the cursor handling, showing the grab/ grabbing cursors where available.
* Fix race condition making a new report.Matthew Somerville2018-03-26-0/+4
| | | | | | If you started a new report by clicking the map before the server had responded with the map list pins, when they did arrive they would replace the new report pin.
* Update some tight JS coupling to use events.Matthew Somerville2018-03-13-6/+1
| | | | Remove 'hooks' functions, and Split out USRN handling to its own object.
* Populate `usrn` field with USRN of clicked asset, if availableDave Arter2018-02-22-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | Some cobrands require reports to include the USRN of the clicked road. This commit allows an asset layer to be added and designated as a 'USRN provider' by setting its `usrn_field` property when calling fixmystreet.assets.add. Initially this feature used OpenLayers' getFeatureFromEvent method, however that doesn't work if the layer isn't topmost. This is because it uses the clicked element in the DOM to determine which feature was clicked. This doesn't work if the layer you're trying to get the feature from wasn't actually the DOM element that was clicked. Instead, we add a new method, OpenLayers.Layer.Vector.getFeatureAtPoint method which takes a Point object and iterates through the features' geometries to find the matching point. To make things a little more user-friendly, if an asset isn't clicked directly we find the closest to the clicked point and use that for the USRN. To accomplish this, this commit factors out the ‘select nearest asset’ code into a new method OpenLayers.Layer.Vector.getNearestFeature, which takes a Point and a distance threshold and finds the nearest feature.
* Show loading spinner on map for assets as well as markersDave Arter2018-02-08-2/+2
|