Allowing for templated urls in iFrame (#460)

* Allowing for templated urls in iFrame

This can allow for passing {{ width }} and {{ height }} as dynamic
attributes in the iFrame's URL.

The new method Slice.render_template method could do more eventually
exposing more variables to be used in dynamic strings.

* Passing function references

* js linting
This commit is contained in:
Maxime Beauchemin
2016-05-11 17:00:46 -07:00
parent 6c333d5010
commit aa6e6bdf7a
4 changed files with 17 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
var $ = require('jquery');
var jQuery = $;
var d3 = require('d3');
var Mustache = require('mustache');
// vis sources
var sourceMap = {
@@ -215,6 +216,13 @@ var px = (function () {
getWidgetHeader: function () {
return this.container.parents("li.widget").find(".chart-header");
},
render_template: function (s) {
var context = {
width: this.width,
height: this.height
};
return Mustache.render(s, context);
},
jsonEndpoint: function () {
var parser = document.createElement('a');
parser.href = data.json_endpoint;