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

Location modal not working on some pages #7346

Closed
jywarren opened this issue Jan 24, 2020 · 11 comments
Closed

Location modal not working on some pages #7346

jywarren opened this issue Jan 24, 2020 · 11 comments
Labels
bug the issue is regarding one of our programs which faces problems when a certain task is executed help wanted requires help by anyone willing to contribute

Comments

@jywarren
Copy link
Member

Let's deal with this on Monday! 😅

image

On https://publiclab.org/wiki/unearthing-pvd the Add a location button doesn't seem to work, so I wonder if it's interacting somehow with some of our other mapping code?

I see this error, though, which could be involved:

Uncaught TypeError: element.find(...).tooltip is not a function
    at postProcessContent (xml.js:30)
    at setupWiki (xml.js:30)
    at unearthing-pvd:2108
    at unearthing-pvd:2110
@jywarren jywarren added bug the issue is regarding one of our programs which faces problems when a certain task is executed help wanted requires help by anyone willing to contribute labels Jan 24, 2020
@jywarren jywarren added this to the Geographic features milestone Jan 24, 2020
@jywarren
Copy link
Member Author

Hi @nstjean just checking in about this as well, i'd super appreciate some help on this if you have a moment. I noticed this seems to be the case on both the wiki page above, and also on my dashboard. I can open a separate issue for that; it seems also odd because I already have a location on my profile - let's check if there is conditional logic on that template and we'll break it out as a separate issue!

@jywarren
Copy link
Member Author

Thanks!

@nstjean
Copy link
Contributor

nstjean commented Jan 27, 2020

Hmmm. I'll take a look. There were two FTOs posted regarding the button, I'll check to make sure both were merged!

@jywarren
Copy link
Member Author

Ah, ok, thanks!

@nstjean
Copy link
Contributor

nstjean commented Jan 27, 2020

Ahh here it is. A PR was never submitted for this! #7266 . This is only for the Dashboard, though. It should be working on Wiki pages. I'll keep looking.

@nstjean
Copy link
Contributor

nstjean commented Jan 27, 2020

It looks like that console error is stemming from this code here:

$('[rel="tooltip"]').on('click', function () {
$(this).tooltip('hide')
})
function print_three_column() {
$('body').css('column-count', 3)
.css('column-gap', '50px');
$('.popover').popover('hide');
window.print();
$('body').css('column-count', 1)
.css('column-gap', 0);
}
// Event listner on CLICK on links
$(document).on("click", "#print-command-3-col",print_three_column);
$(document).on("click", "#print-command-no-links",print_linkless);
jQuery(document).ready(function() {
// 304 cached response yields no data to insert, which is not useful
jQuery.ajaxSetup({
cache: false
});
// opens modal to login before you can like;
$("#open-login-like").click(function() {
$("input[name='hash_params']").val($(this).attr("data-hashparams"));
});
// triggers liking and unliking
<% if current_user %>
$('#like-button-<%= node.id %>').on('click', debounce(<% if node.liked_by(current_user.uid) %>clickliked<% else %>clicknotliked<% end %>, 200, true));
// leaving below uncommented for now - possibility useful for implement comment like functionality?
// if(window.location.href.includes("#like")) {
// $('#like-button-<%= node.id %>').click();
// }
<% end %>
});
$('body').on('click', '.nestedPopover', function() {
$(this).popover({
container: 'body',
trigger: 'focus click'
});
$(this).popover('show');
$(this).removeClass("nestedPopover");
});
$('body').on('click', function (e) { // If there's a click event in the body
$('[rel=popover]').each(function () { // For each popover
/*
* The popover will only `hide` if all the conditions below are satisfied :
* 1. The target triggering the `click` event is not `this`
* 2. `this` doesn't have a child triggering the `click` event
* 3. Any element with `.popover` class doesn't have a child triggering the `click` event
*/
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).popover('hide');
}
});
});

It's happening if you click anywhere on the page, not just the button.

@nstjean
Copy link
Contributor

nstjean commented Jan 27, 2020

It does look like that error is interfering though. Here is the same issue:
https://stable.publiclab.org/wiki/inline-maps
Possibly it is the inline maps triggering an error there somehow.

@nstjean
Copy link
Contributor

nstjean commented Jan 27, 2020

I think this is related: #7355

@stale stale bot added the stale label Oct 7, 2020
@publiclab publiclab deleted a comment from stale bot Oct 8, 2020
@stale stale bot removed the stale label Oct 8, 2020
@jywarren
Copy link
Member Author

jywarren commented Mar 9, 2021

I'm now seeing this on /unearthing-pvd:

Access to XMLHttpRequest at 'https://iaspub.epa.gov/enviro/efservice/tri_facility/pref_latitude/BEGINNING/41/PREF_LONGITUDE/BEGINNING/71/rows/0:300/JSON?_=1615315565558' from origin 'https://publiclab.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I believe that's actually a 404 error not CORS: the URL directly gives: The requested URL /enviro/efservice/tri_facility/pref_latitude/BEGINNING/41/PREF_LONGITUDE/BEGINNING/71/rows/0:300/JSON was not found.

I'll open an issue based on #8887 for the tile error i'm seeing and let's circle back here.

@jywarren
Copy link
Member Author

jywarren commented Mar 9, 2021

Here's a page to test on: https://publiclab.org/wiki/gsoc

I am seeing that clicking the button a 2nd time causes a map initialization error. But let's resolve related issues first then circle back:

publiclab/leaflet-environmental-layers#514 - TRI error

publiclab/leaflet-blurred-location#259 - MapBox API change

@jywarren
Copy link
Member Author

Working now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug the issue is regarding one of our programs which faces problems when a certain task is executed help wanted requires help by anyone willing to contribute
Projects
None yet
Development

No branches or pull requests

2 participants