]> git.openstreetmap.org Git - chef.git/commitdiff
Sort imagery layers by name
authorTom Hughes <tom@compton.nu>
Tue, 31 May 2016 17:39:49 +0000 (18:39 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 31 May 2016 17:40:15 +0000 (18:40 +0100)
cookbooks/imagery/templates/default/imagery.js.erb

index a5ac8f42a6eca69df349deeafe99b30655ce4abe..44e8bd21809c291f2cff2bf249da072042d865af 100644 (file)
@@ -11,7 +11,7 @@ function createMap(divName) {
     maxZoom: 19
   }), "OpenStreetMap");
 
-  <% @layers.each do |layer| -%>
+  <% @layers.sort_by { |layer| layer[:name] }.each do |layer| -%>
   // Add <%= layer[:name].to_json %> layer
   layers.addBaseLayer(L.tileLayer(<%= layer[:url].to_json %>, {
     attribution: <%= layer[:attribution].to_json %>,
@@ -19,7 +19,7 @@ function createMap(divName) {
   }), <%= layer[:name].to_json %>);
 
   <% end -%>
-  <% @overlays.each do |layer| -%>
+  <% @overlays.sort_by { |layer| layer[:name] }.each do |layer| -%>
   // Add <%= layer[:name].to_json %> layer
   layers.addOverlay(L.tileLayer(<%= layer[:url].to_json %>, {
     attribution: <%= layer[:attribution].to_json %>,