aboutsummaryrefslogtreecommitdiffstats
path: root/web/js
Commit message (Collapse)AuthorAgeLines
* 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.
* [Zurich] Update to new map server.Matthew Somerville2018-05-23-60/+47
|
* Some IE8/old JS workarounds.Matthew Somerville2018-05-02-2/+2
|
* Fix/tidy front-only hover behaviour.Matthew Somerville2018-05-02-0/+7
|
* Drop unused copy of function.Matthew Somerville2018-04-30-14/+0
| | | | This is already defined in fixmystreet.utils further up.
* Add layer attribution to attribution controlStruan Donald2018-04-10-0/+1
| | | | | If a layer has an attribution option then add it to the attribution control when the layer becomes visible.
* No longer horizontally align label with JS.Martin Wright2018-04-06-3/+1
| | | | | Fixes positioning bugs in all versions of IE due to calculating the wrong horizontal position.
* Don't run through this JavaScript in IE9Martin Wright2018-04-06-0/+3
|
* 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.
* [UK] Properly align Dashboard bar chart value labelsZarino Zappia2018-03-01-2/+3
|
* [UK] Linebreak long Y-axis labels on Dashboard bar chartZarino Zappia2018-03-01-2/+22
| | | | | | | | | Y-axis labels in the Dashboard ranking tables now break onto multiple lines if they are more than 4 words long. /web/vendor/chart.min.js showing as modified because we updated it to include a recent fix to label alignment on vertical scales: https://github.com/mysociety/Chart.js/commit/4130c31
* 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
|
* Factor map loading spinner code out so multiple things can load at onceDave Arter2018-02-08-6/+28
|
* Add length/common password checking.Matthew Somerville2018-02-06-1/+7
|
* [Zurich] Add filters to /reports, fix photo bug.Matthew Somerville2018-01-18-1/+1
| | | | The photo JavaScript needs including in case a report is pulled in.
* Zoom out as much as necessary, even on mobile.Matthew Somerville2018-01-15-3/+0
| | | | | This also fixes an inconsistency between what you can see on the map and the list of reports underneath.
* Only work out bounds/resolution on BBOX strategiesMatthew Somerville2018-01-10-4/+7
| | | | The /my page uses a Fixed strategy which cannot do this.
* Add JSHint configuration, tidy up any warnings.Matthew Somerville2018-01-10-19/+24
|
* Switch on monotone cubic interpolation.Matthew Somerville2018-01-09-0/+5
| | | | This prevents e.g. the all reports graph dipping down.
* Merge branch '1907-stop-tile-load-on-mappage'Matthew Somerville2018-01-05-0/+31
|\
| * [fixmystreet.com] Lazy load images in the footer.Matthew Somerville2018-01-05-0/+29
|/ | | | | This uses an IntersectionObserver, which currently works in Chrome, Edge, and Firefox.
* Fix colour wrapping bug, where it only added red.Matthew Somerville2017-12-19-2/+2
| | | | | As colours.length increased as colours were added, it would always return the first entry.
* Make sure bar chart is given enough colours.Matthew Somerville2017-12-18-0/+4
|
* Add bar chart functionality, for area summary pageZarino Zappia2017-12-15-43/+147
|
* Second, more prominent Hide Pins linkZarino Zappia2017-11-27-6/+12
| | | | An experiment towards fixing #525.
* Add js=1 to links to /around from the front pageDave Arter2017-11-24-0/+5
| | | | | | The location disambiguation page uses the frontpage JavaScript and has lots of links pointing to /around, so the code should make sure those links include the `js` parameter.
* Hide geolocation link if not on HTTPSDave Arter2017-11-24-1/+2
| | | | | | | Modern browsers disable geolocation on non-HTTPS pages, but sadly still report it as available with the `navigator.geolocation` object. This commit adds a check for HTTPS and hides the link if it won’t work.
* Move jquery.multi-select.js into vendor directoryZarino Zappia2017-11-20-337/+0
| | | | | The multi-select plugin is a separate project, and should be treated as a vendor file.
* Upgrade to latest version of jquery.multi-select.jsDave Arter2017-11-20-35/+38
| | | | | | | In particular, this lets us ensure only one multiselect can be open at a time – for example in the "Show [X] reports about [Y]" list filters. Fixes mysociety/fixmystreetforcouncils#247.
* Merge branch '1901-js-deferring'Matthew Somerville2017-11-15-0/+55
|\ | | | | | | Updated geolocation.js with concurrent changes.
| * Have front page load minimal JS necessary.Matthew Somerville2017-11-15-0/+13
| | | | | | | | | | | | By creating a small file with only what is needed (focus, js flagging), we can drop loading jQuery and all the application JavaScript on the front page, prefetching them instead.
| * Factor out geolocation to pages that need it.Matthew Somerville2017-11-15-0/+41
|/
* Remove unused nicetable/promo CSS/JS.Matthew Somerville2017-11-06-81/+0
|
* Merge branch 'around-and-about-pagination'Matthew Somerville2017-11-06-94/+88
|\
| * Add pagination to around page.Matthew Somerville2017-11-06-17/+83
| |
| * Remove Show all pins link and on_map_list_limit.Matthew Somerville2017-11-06-73/+0
| | | | | | | | | | /around will now show all reports all the time, but we are about to introduce pagination to stop that.
| * Have /around ajax use same format as others.Matthew Somerville2017-11-02-5/+6
| | | | | | | | | | Both /reports and /my work by using the same URL with ajax=1. We should use the same on /around for consistency.
* | Update Bing Maps parameter ID.Matthew Somerville2017-11-06-8/+8
|/
* [Zurich] Fix map offset bug.Matthew Somerville2017-09-20-13/+4
| | | | | | | | | The upgrade to OpenLayers in 31b8337e3 was not accompanied by fixing the tileOrigin manually tweaked as an old workaround. This moved the map c. 100m out of alignment. Bristol fixed this in a7f60abb by adding topLeftCorners, but this is better done by fixing origin_x/y.
* Make sure pin ID is an integer.Matthew Somerville2017-09-07-2/+3
| | | | | | | | | | The JavaScript assumes it is, but due to a string comparison in DBIx::Class [1] when a has_many prefetch is in use (as it is on a /reports page when a shortlist-using staff user is logged in) all IDs bar the first were being given an internal string value and JSON encoding was outputting them as a string. [1] https://github.com/dbsrgits/dbix-class/blob/v0.08209/lib/DBIx/Class/ResultSet.pm#L1331
* [Zurich] Upgrade OpenLayers to master, matching others.Matthew Somerville2017-08-18-12/+1
|
* Make sure /around permalink/redirect have js paramMatthew Somerville2017-08-18-0/+4
| | | | | The change in 17e38922 would not deal with the URL construted by the map permalink code, or the redirect after inspection.
* Fix replaced sidebar losing hover behaviour.Matthew Somerville2017-08-17-1/+1
| | | | | If the list was replaced by JavaScript, the event handlers were being dropped. Switch the handlers to the parent that remains present.
* Refactor /around list code to share with others.Matthew Somerville2017-08-17-10/+3
| | | | | Both /reports and /my share an ID and a /reports/ajax function, use these also on /around (and share ajax/non-ajax code).
* [Zurich] Fix map on /reportsDave Arter2017-08-14-1/+4
| | | | | | | | | | | | | | | | | | A seemingly unrelated change in ef6ffbdb was causing JS errors on the /reports page which meant the map loading spinner was permanently present. This commit fixes that, and also fixes another bug which was uncovered where the ?ajax=1 param was being ignored by the Zürich /reports page, leading to HTML being returned and another JS error. The call to `new OpenLayers.Bounds` in OpenLayers.Strategy.FixMyStreet.getMapBounds was causing three of the 4 bounds params to be lost when run on OpenLayers 2.11, as this version doesn’t accept an array to the Bounds constructor. This in turn was using an invalid `bbox` parameter (only the west value was present) in the AJAX call to /reports which returned a 500 error. This then crashed the JS and caused the loading spinner to get stuck.