Skip to content

Commit

Permalink
Adds spinner on layers loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyxelio committed Sep 19, 2017
1 parent 18928c5 commit bf5733a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
26 changes: 19 additions & 7 deletions app/assets/javascripts/map_editor.js.coffee
Expand Up @@ -300,13 +300,25 @@
setDynamicSeries: ->
return unless @options.dynamic_series?

$.getJSON @options.dynamic_series, (data) =>
$.extend(true, @options.show, data.show)
@_refreshReferenceLayerGroup()
@_refreshControls()

#Ensure edition layer is on top
@edition.bringToFront() if @edition
$.ajax
method: 'GET'
dataType: 'json'
url: @options.dynamic_series
beforeSend: () =>
@dynamic_loading = new L.control(position: "bottomleft")
@dynamic_loading.onAdd = (map) =>
L.DomUtil.create('div', 'leaflet-dynamic-loading')

@map.addControl @dynamic_loading
success: (data) =>
$.extend(true, @options.show, data.show)
@_refreshReferenceLayerGroup()
@_refreshControls()
complete: () =>
@map.removeControl @dynamic_loading

#Ensure edition layer is on top
@edition.bringToFront() if @edition

updateFeature: (feature_id, attributeName, attributeValue) ->
this.updateFeatureProperties(feature_id, attributeName, attributeValue)
Expand Down
11 changes: 11 additions & 0 deletions app/themes/tekyla/stylesheets/leaflet.scss
Expand Up @@ -1076,4 +1076,15 @@ span.leaflet-importer-geojson, span.leaflet-importer-gml {
display: block;
height: 44px;
}
}

.leaflet-dynamic-loading {
color: $text-color;
@include is-icon;
@include use-icon(circle-o-notch);
@include animation(loading-rotate 2s infinite linear);
@include text-align(center);
width: $map-button-size;
height: $map-button-size;
line-height: $map-button-size;
}

0 comments on commit bf5733a

Please sign in to comment.