aboutsummaryrefslogtreecommitdiffstats
path: root/web/js
Commit message (Collapse)AuthorAgeLines
* 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.
* Use standard JS translation for show/hide pins.Matthew Somerville2017-08-03-35/+17
|
* New version of /reports main page.Matthew Somerville2017-07-14-0/+142
| | | | | | | | | | | This is a much broader summary page, plus a body name autocomplete. This was originally implemented for fixmystreet.com in 8a6a4ccb7. It also adds '(no longer exists)' in the autocomplete next to bodies not covering any areas. You can supply the `--table` argument to `update-all-reports` to generate the old-style data.
* [FixaMinGata] Consolidate with upstream.Jon Kristensen2017-07-07-2/+4
| | | | | Add hook for post-title field content in report form. Update translations.
* Resize photos client-side before uploadingDave Arter2017-06-30-28/+42
| | | | | | | | | | | | | | | | The newest version of Dropzone has added support for client-side resizing of images, so this commit upgrades to version 5.1.1 and takes advantage of that in order to reduce the disc space consumed by uploaded images. The target size & JPEG quality is quite aggressive, resulting in files in the region of 200-300KB instead of several MB. I've tried to pick a value which doesn't impact the usefulness of the photos in identifying problems. Handily the new version also correctly rotates images according to the EXIF tag so our patch has be reduced dramatically to deal with the sync nature of the mini EXIF library in use. Related to the disc space part of #1411, though EXIF metadata isn't stripped.
* Allow cobrands to define pin colour for new reportsZarino Zappia2017-06-09-1/+1
| | | | | | Previously, a green marker would be used for reports as they were being created. Now, cobrands can override `pin_new_report_colour` to show a different pin image when users are creating a new report.
* Linting fixes to jquery.multi-select.jsZarino Zappia2017-05-31-4/+2
|
* Fix linting errorspezholio2017-05-23-59/+58
|
* Move third party libraries into vendor directoriesMatthew Somerville2017-05-23-13543/+0
| | | | | | | | This makes the git hook that lints our own JavaScript easier, and keeps things more cleanly separated. We also remove unused third party libraries (select2 and jquery.placeholder).
* Allow inspectors to shortlist all reports in viewpezholio2017-05-05-2/+7
| | | | If zoom level is >= 14, then inspectors can click a button that marks all reports in the map view as shortlisted
* On /reports maps, only include reports in view.Matthew Somerville2017-04-13-2/+36
| | | | | | | | | Update the reports with a bounding box, similar to on around pages. This is made slightly trickier because we don't want to do anything on page load (we already have the pins), we need to reload when the zoom changes, and we don't want the strategy to get confused by its first redraw, e.g. on pin hover, We also need to turn off the zoom- to-bounds if we've got a bounding box in the URL.
* Use lat/lon on inspection form if local coordinates aren’t availableDave Arter2017-03-30-0/+2
|
* Add ability to override Google Maps road style.Dave Arter2017-03-30-1/+17
|
* Show loading indicator when loading pinspezholio2017-03-17-11/+6
|
* Move staff-only JavaScript to separate file.Matthew Somerville2017-03-10-125/+0
|
* [Oxfordshire] Add Exor RDI file download featureDave Arter2017-02-15-2/+16
| | | | | | | | | | The RDI file format encapsulates information about inspections that have taken place, and can be uploaded into Exor to create defects in bulk. This commit adds a page to the Oxfordshire cobrand's admin allowing RDI files to be generated and downloaded from FMS. For mysociety/fixmystreetforcouncils#127