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

Use javascript template literal in Popup #962

Merged
merged 5 commits into from
Sep 29, 2018

Conversation

Conengmo
Copy link
Member

@jtbaker can you check if this works for you as well?

@ocefpaf
Copy link
Member

ocefpaf commented Sep 17, 2018

@Conengmo the CI failure was due to a conda-forge issue with fiona upstream. I just fixed this and this is good to be merged as soon as @jtbaker gives his 👍

@jtbaker
Copy link
Contributor

jtbaker commented Sep 19, 2018

I checked it and normal content seems to look good. Only issue was trying to add a VegaLite object to object as a child - I think this is because my version of Altair is compiling to a newer spec than the one we're supporting via CDN to in the header.

However, I went into the HTML and manually changed the CDN links and switched vg.embed to vegaEmbed as per #959 and my chart would still not render. Could that have something to do with the changes in this PR?

            {% for name, element in this.html._children.items() %}
                var {{ name }} = `{{ element.render(**kwargs).replace('\\n', ' ') }}`;
                {{this.get_name()}}.setContent({{name}});
            {% endfor %}

The way the template compiles right now, vegaEmbed is inserted after the Popup.setContent method has executed. I'm not sure that it will work like that. My vegaEmbed doesn't seem to be able to hit the div in the Popup content (perhaps because it isn't in the document until the click event?) I think it might need to be set inside of the .setContent method.

Not sure if you saw the discussion on the parse_html in #955 or had any thoughts on it - I'm fine with the structure either way.

@Conengmo
Copy link
Member Author

Thanks for checking this. Im away right now and will look at the Vega stuff after the weekend. That needs to be fixed before merging this.

About the parse_html argument, I'm leaning towards keeping it as it is. Because the argument became less important with the template literals, only power users will need it. And because when in doubt, don't change the API. But I do agree it is not a very intuitive choice of words.

@ocefpaf
Copy link
Member

ocefpaf commented Sep 20, 2018

Because the argument became less important with the template literals, only power users will need it. And because when in doubt, don't change the API. But I do agree it is not a very intuitive choice of words.

👍

It's necessary for vega charts
@Conengmo
Copy link
Member Author

The Vega and Vega Lite charts were broken because I removed the jQuery code. Worked fine for normal text, but broke the charts. I restored that and now it seems fine.

This PR is now quite trivial, so I'll wait a bit and then go ahead and merge this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants