aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpezholio <pezholio@gmail.com>2017-03-17 16:36:24 +0000
committerpezholio <pezholio@gmail.com>2017-03-17 16:36:24 +0000
commit5370647bfa52503948148753bad7bca5c463d79c (patch)
tree55865dae808167a0cc51fbd8478dcb23d0770065
parent013710b997f74da134bc9f6f7896fddae4a38879 (diff)
Show loading indicator when loading pins
-rw-r--r--templates/web/base/maps/openlayers.html4
-rw-r--r--web/cobrands/sass/_base.scss18
-rw-r--r--web/i/loading.svg1
-rw-r--r--web/js/map-OpenLayers.js17
4 files changed, 28 insertions, 12 deletions
diff --git a/templates/web/base/maps/openlayers.html b/templates/web/base/maps/openlayers.html
index 18829c5c4..215b69d26 100644
--- a/templates/web/base/maps/openlayers.html
+++ b/templates/web/base/maps/openlayers.html
@@ -33,4 +33,6 @@
[% IF map.copyright %]
<div class="olControlAttribution" style="position: absolute;">[% map.copyright %]</div>
[% END %]
-
+ <div id="loading-indicator" class="hidden" aria-hidden="true">
+ <img src="/i/loading.svg" alt="Loading..." />
+ </div>
diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss
index 33242f5af..25674aedd 100644
--- a/web/cobrands/sass/_base.scss
+++ b/web/cobrands/sass/_base.scss
@@ -1585,6 +1585,24 @@ html.js #map .noscript {
}
}
+// Loading indicator
+
+#loading-indicator {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ background-color: #000;
+ opacity: 0.4;
+ text-align: center;
+
+ img {
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%);
+ }
+}
+
.big-green-banner {
position: relative;
top: -1.75em;
diff --git a/web/i/loading.svg b/web/i/loading.svg
new file mode 100644
index 000000000..0b68e8bc0
--- /dev/null
+++ b/web/i/loading.svg
@@ -0,0 +1 @@
+<svg width='94px' height='94px' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="uil-default"><rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect><rect x='46.5' y='40' width='7' height='20' rx='5' ry='5' fill='#cccccc' transform='rotate(0 50 50) translate(0 -30)'> <animate attributeName='opacity' from='1' to='0' dur='1s' begin='0s' repeatCount='indefinite'/></rect><rect x='46.5' y='40' width='7' height='20' rx='5' ry='5' fill='#cccccc' transform='rotate(30 50 50) translate(0 -30)'> <animate attributeName='opacity' from='1' to='0' dur='1s' begin='0.08333333333333333s' repeatCount='indefinite'/></rect><rect x='46.5' y='40' width='7' height='20' rx='5' ry='5' fill='#cccccc' transform='rotate(60 50 50) translate(0 -30)'> <animate attributeName='opacity' from='1' to='0' dur='1s' begin='0.16666666666666666s' repeatCount='indefinite'/></rect><rect x='46.5' y='40' width='7' height='20' rx='5' ry='5' fill='#cccccc' transform='rotate(90 50 50) translate(0 -30)'> <animate attributeName='opacity' from='1' to='0' dur='1s' begin='0.25s' repeatCount='indefinite'/></rect><rect x='46.5' y='40' width='7' height='20' rx='5' ry='5' fill='#cccccc' transform='rotate(120 50 50) translate(0 -30)'> <animate attributeName='opacity' from='1' to='0' dur='1s' begin='0.3333333333333333s' repeatCount='indefinite'/></rect><rect x='46.5' y='40' width='7' height='20' rx='5' ry='5' fill='#cccccc' transform='rotate(150 50 50) translate(0 -30)'> <animate attributeName='opacity' from='1' to='0' dur='1s' begin='0.4166666666666667s' repeatCount='indefinite'/></rect><rect x='46.5' y='40' width='7' height='20' rx='5' ry='5' fill='#cccccc' transform='rotate(180 50 50) translate(0 -30)'> <animate attributeName='opacity' from='1' to='0' dur='1s' begin='0.5s' repeatCount='indefinite'/></rect><rect x='46.5' y='40' width='7' height='20' rx='5' ry='5' fill='#cccccc' transform='rotate(210 50 50) translate(0 -30)'> <animate attributeName='opacity' from='1' to='0' dur='1s' begin='0.5833333333333334s' repeatCount='indefinite'/></rect><rect x='46.5' y='40' width='7' height='20' rx='5' ry='5' fill='#cccccc' transform='rotate(240 50 50) translate(0 -30)'> <animate attributeName='opacity' from='1' to='0' dur='1s' begin='0.6666666666666666s' repeatCount='indefinite'/></rect><rect x='46.5' y='40' width='7' height='20' rx='5' ry='5' fill='#cccccc' transform='rotate(270 50 50) translate(0 -30)'> <animate attributeName='opacity' from='1' to='0' dur='1s' begin='0.75s' repeatCount='indefinite'/></rect><rect x='46.5' y='40' width='7' height='20' rx='5' ry='5' fill='#cccccc' transform='rotate(300 50 50) translate(0 -30)'> <animate attributeName='opacity' from='1' to='0' dur='1s' begin='0.8333333333333334s' repeatCount='indefinite'/></rect><rect x='46.5' y='40' width='7' height='20' rx='5' ry='5' fill='#cccccc' transform='rotate(330 50 50) translate(0 -30)'> <animate attributeName='opacity' from='1' to='0' dur='1s' begin='0.9166666666666666s' repeatCount='indefinite'/></rect></svg>
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index 49801911b..2a5af940d 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -801,6 +801,9 @@ OpenLayers.Strategy.FixMyStreetFixed = OpenLayers.Class(OpenLayers.Strategy.Fixe
// params to /ajax if the user has filtered the map.
OpenLayers.Protocol.FixMyStreet = OpenLayers.Class(OpenLayers.Protocol.HTTP, {
read: function(options) {
+ // Show the loading indicator over the map
+ $('#loading-indicator').removeClass('hidden');
+ $('#loading-indicator').attr('aria-hidden', false);
// Pass the values of the category, status, and sort fields as query params
$.each({ filter_category: 'filter_categories', status: 'statuses', sort: 'sort' }, function(key, id) {
var val = $('#' + id).val();
@@ -817,17 +820,9 @@ OpenLayers.Protocol.FixMyStreet = OpenLayers.Class(OpenLayers.Protocol.HTTP, {
/* Pan data handler */
OpenLayers.Format.FixMyStreet = OpenLayers.Class(OpenLayers.Format.JSON, {
read: function(json, filter) {
- // Check we haven't received the data after the map has been clicked.
- if (fixmystreet.page == 'new') {
- // If we have, we want to do nothing, which means returning an
- // array of the back-projected version of the current pin
- var pin = fixmystreet.markers.features[0].clone();
- pin.geometry.transform(
- fixmystreet.map.getProjectionObject(),
- new OpenLayers.Projection("EPSG:4326")
- );
- return [ pin ];
- }
+ // Remove loading indicator
+ $('#loading-indicator').addClass('hidden');
+ $('#loading-indicator').attr('aria-hidden', true);
if (typeof json == 'string') {
obj = OpenLayers.Format.JSON.prototype.read.apply(this, [json, filter]);
} else {