Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix map errors with new LEL 2.2.1 #7545

Merged
merged 7 commits into from
Feb 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ group :test, :development do
gem 'timecop'
gem 'pry-rails'
gem 'action-cable-testing'
gem "webmock", "~> 3.8"
end

group :production do
Expand Down
31 changes: 31 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ GEM
activerecord (~> 5.2.1)
concurrent-ruby (1.1.5)
connection_pool (2.2.2)
cookiejar (0.3.3)
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.5)
declarative (0.0.10)
declarative-option (0.1.0)
Expand Down Expand Up @@ -128,8 +131,20 @@ GEM
dry-equalizer (~> 0.3)
dry-inflector (~> 0.1, >= 0.1.2)
dry-logic (~> 1.0, >= 1.0.2)
em-http-request (1.1.5)
addressable (>= 2.3.4)
cookiejar (!= 0.3.1)
em-socksify (>= 0.3)
eventmachine (>= 1.0.3)
http_parser.rb (>= 0.6.0)
em-socksify (0.3.2)
eventmachine (>= 1.0.0.beta.4)
em-synchrony (1.0.6)
eventmachine (>= 1.0.0.beta.1)
equalizer (0.0.11)
erubi (1.9.0)
eventmachine (1.2.7)
eventmachine_httpserver (0.2.1)
execjs (2.7.0)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
Expand Down Expand Up @@ -198,6 +213,7 @@ GEM
railties (>= 3.2.12)
grape-swagger-ui (2.2.8)
railties (>= 3.1)
hashdiff (1.0.0)
hashie (3.6.0)
highline (2.0.1)
http (3.3.0)
Expand Down Expand Up @@ -352,6 +368,14 @@ GEM
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (4.0.3)
puffing-billy (2.3.0)
addressable (~> 2.5)
em-http-request (~> 1.1, >= 1.1.0)
em-synchrony
eventmachine (~> 1.2)
eventmachine_httpserver
http_parser.rb (~> 0.6.0)
multi_json
puma (4.3.1)
nio4r (~> 2.0)
rack (2.1.1)
Expand Down Expand Up @@ -452,6 +476,7 @@ GEM
ruby-openid (2.9.2)
ruby-progressbar (1.10.1)
rubyzip (2.0.0)
safe_yaml (1.0.5)
sanitize (5.1.0)
crass (~> 1.0.2)
nokogiri (>= 1.8.0)
Expand Down Expand Up @@ -543,6 +568,10 @@ GEM
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
webmock (3.8.2)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.7.1)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4)
Expand Down Expand Up @@ -614,6 +643,7 @@ DEPENDENCIES
php-serialize
progress_bar
pry-rails
puffing-billy (~> 2.3)
puma (~> 4.3)
rack-cors
rack-openid
Expand Down Expand Up @@ -653,6 +683,7 @@ DEPENDENCIES
uglifier (>= 1.0.3)
unicode-emoji
web-console (>= 3.3.0)
webmock (~> 3.8)
whenever
will_paginate (>= 3.0.6)
will_paginate-bootstrap4
Expand Down
16 changes: 9 additions & 7 deletions app/assets/javascripts/leaflet_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@

function setupLEL(map, markers_hash = null, params = {}) {
var options = {};
options.layers = params.layers || [];
options.layers = params.layers || []; // display these layers on the map
options.limitMenuTo = params.limitMenuTo || []; // limit available layers in menu to only those listed, default all layers in menu
options.setHash = params.setHash || false;
options.mainContent = params.mainContent || "";
options.displayLayers = params.displayLayers || false;
options.mainContent = params.mainContent || ""; // "content" to show site content, default "" shows no site content
options.displayAllLayers = params.displayAllLayers || false; // turn on display for all maps available in menu

if (typeof options.layers === "string") {
options.layers = options.layers.split(',');
Expand All @@ -105,11 +106,12 @@
circleSpiralSwitchover: 0
});

var optionsLEL = {
addLayersToMap: options.displayLayers,
};
var optionsLEL = { };
if (options.layers.length > 0) {
optionsLEL.include = options.layers;
optionsLEL.addLayersToMap = options.displayAllLayers;
optionsLEL.display = options.layers;
optionsLEL.include = options.limitMenuTo;
optionsLEL.hash = options.setHash;
}
L.LayerGroup.EnvironmentalLayers(optionsLEL).addTo(map);

Expand Down
23 changes: 23 additions & 0 deletions app/assets/stylesheets/map.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* Control layer order on maps */
#content .leaflet-pane {
z-index: auto;
}
#content .leaflet- {
z-index: auto;
}
#content .leaflet-marker-pane {
z-index: 720;
}
#content .leaflet-tooltip-pane {
z-index: 740;
}
#content .leaflet-popup-pane {
z-index: 760;
}
.leaflet-top{
z-index:800 !important;
}
.leaflet-popup-content {
width: 800px !important;
}

4 changes: 4 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,13 @@ def list

@map_lat = nil
@map_lon = nil
@map_zoom = nil
if current_user&.has_power_tag("lat") && current_user&.has_power_tag("lon")
@map_lat = current_user.get_value_of_power_tag("lat").to_f
@map_lon = current_user.get_value_of_power_tag("lon").to_f
if current_user&.has_power_tag("zoom")
@map_zoom = current_user.get_value_of_power_tag("zoom").to_f
end
end
# allow admins to view recent users
@users = if params[:id]
Expand Down
11 changes: 11 additions & 0 deletions app/views/home/subscriptions.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
<script>
$("body").on("mouseup", function(e) {
var el = $(e.target);
if (el[0].className.indexOf("popover") == -1) {
$(".popover").each(function() {
$(this).popover("hide");
});
}
});
</script>

<div class="col-lg-3">

<p><b><%=raw translation('home.subscriptions.title') %></b> <%=raw translation('home.subscriptions.up_to_date_emails') %></p>
Expand Down
39 changes: 6 additions & 33 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,13 @@
I18n.locale = "<%= I18n.locale %>";
I18n.fallbacks = true;
$(function () {
$("[data-toggle=popover]").popover({
html: true,
content: function() {
return $('#popover-content').html();

}

});
$("body").on("mouseup", function(e) {
var el = $(e.target);
if (el[0].className.indexOf("popover") == -1) {
$(".popover").each(function() {
$(this).popover("hide");
});
}
$("[data-toggle=popover]").popover({
html: true,
content: function() {
return $('#popover-content').html();
}
});
});
})

</script>

<% cache('feature_header', skip_digest: true) do %>
Expand All @@ -98,26 +87,10 @@
<style type="text/css">
.pac-container { z-index: 100000; }

#content .leaflet-pane {
z-index: auto;
}
#content .leaflet-control-layers {
max-height: 200px;
overflow: auto;
}

.leaflet-top{
z-index:800 !important;
}

#ex1Slider .slider-selection {
background: #BABABA;
}

.leaflet-popup-content {
width: 800px !important;
}

</style>

<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/10.2.0/bootstrap-slider.js"></script>
Expand Down
3 changes: 1 addition & 2 deletions app/views/map/_inlineLeaflet.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@
var options<%= unique_id %> = {
mainContent: main_layer<%= unique_id %>,
layers: primary_layers<%= unique_id %>,
setHash: false,
displayLayers: true
setHash: false
}
setupLEL(map<%= unique_id %>, markers_hash<%= unique_id %>, options<%= unique_id %>);

Expand Down
3 changes: 3 additions & 0 deletions app/views/map/_mapDependencies.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

<%= stylesheet_link_tag "/lib/leaflet-environmental-layers/dist/LeafletEnvironmentalLayers.css" %>

<%= javascript_include_tag('/lib/leaflet-blurred-location/dist/Leaflet.BlurredLocation.js') %>
<%= javascript_include_tag('/lib/leaflet.blurred-location-display/dist/Leaflet.BlurredLocationDisplay.js') %>

<%= javascript_include_tag('/lib/leaflet-environmental-layers/dist/LeafletEnvironmentalLayers.js') %>
<%= javascript_include_tag('/lib/leaflet-environmental-layers/src/windRoseLayer.js') %>
<%= javascript_include_tag('/lib/leaflet-fullhash/leaflet-fullHash.js') %>
Expand Down
Loading