aboutsummaryrefslogtreecommitdiffstats
path: root/web/js
Commit message (Collapse)AuthorAgeLines
* 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.
* Clicking "Report" header links on homepage focusses #pc inputZarino Zappia2018-09-19-1/+13
| | | | | | | Works for both the "Report" button shown in the mobile header, and the "Report a problem" span on the desktop site. Thanks to Louise for suggesting this in mysociety/collideoscope#42!
* Avoid exception if homepage does not include a .report-a-problem-btnZarino Zappia2018-09-19-1/+1
| | | | | | | | Some cobrands (like Collideoscope) don’t have a .report-a-problem-btn in their mobile nav menu, so .querySelector() would raise an exception when we tried to attach an event listener to it. Now we check that the element exists before attaching the listener.
* Handle MultiPolygon geometries for boundary on /reportsDave Arter2018-09-17-1/+2
|
* .js-make-bar-chart now accepts custom chart/bar dimensionsZarino Zappia2018-09-13-2/+4
| | | | | | We needed this for Collideoscope, where we’re displaying small bar charts on the Statistics page, and the default bar height of 30px was much too small when the chart was reduced in size.
* make fixed reports line on reports graph optionalStruan Donald2018-09-12-11/+16
| | | | | Collideoscope doesn't have fixed reports so only add a line for fixed reports if there is data.
* do not generate labels for empty dashboard graphsStruan Donald2018-09-12-0/+3
| | | | | Avoid a JS error if a line graph has no points. This is mostly useful for collideoscope where we only want to show one line.
* Fix inspector dragging of pins.Matthew Somerville2018-08-09-4/+10
|
* [UK] OS map only shown from zoom 12+.Matthew Somerville2018-08-09-1/+1
| | | | Bing no longer shows it at zoom level 11.
* 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.
* Update Bing Maps parameter ID.Matthew Somerville2018-08-01-9/+9
| | | | [fixmystreet.com] Update to use OS OpenMap Local tiles.
* 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.
* [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.