Compare commits

...

2 Commits

Author SHA1 Message Date
Ivan Malagon 831fc227f6 Added dataset.js to Buble
8 years ago
Ivan Malagon 881e16f1f7 First try working
8 years ago

@ -34,7 +34,6 @@ module.exports = CoreView.extend({
},
_loadImage: function (imageUrl, color) {
var self = this;
var isSVG = this._isSVG(imageUrl);
var $imgContainer = this.$('.js-image-container');
if ($imgContainer.length === 0) {
@ -42,11 +41,11 @@ module.exports = CoreView.extend({
}
if (isSVG) {
this._requestImage(imageUrl, function (content) {
this._requestImage(imageUrl, (content) => {
var svg = content.cloneNode(true);
var $svg = $(svg);
$svg = $svg.removeAttr('xmlns:a');
$svg.attr('class', self._imageClass + ' js-image');
$svg.attr('class', this._imageClass + ' js-image');
for (var attribute in IMAGE_FILE_ATTRS) {
$svg.attr(attribute, IMAGE_FILE_ATTRS[attribute]);
@ -59,7 +58,7 @@ module.exports = CoreView.extend({
});
} else {
var $img = $('<img crossorigin="anonymous"/>');
$img.attr('class', self._imageClass + ' js-image');
$img.attr('class', this._imageClass + ' js-image');
$img.attr('src', imageUrl + '?req=markup');
for (var attribute in IMAGE_FILE_ATTRS) {
@ -71,19 +70,18 @@ module.exports = CoreView.extend({
},
_requestImage: function (url, callback) {
var self = this;
var completeUrl = url + '?req=ajax';
if (this._lastImage.url === completeUrl) {
callback && callback(this._lastImage.content);
} else {
$.ajax(completeUrl)
.done(function (data) {
self._lastImage.url = completeUrl;
var content = self._lastImage.content = data.getElementsByTagName('svg')[0];
.done((data) => {
this._lastImage.url = completeUrl;
var content = this._lastImage.content = data.getElementsByTagName('svg')[0];
callback && callback(content);
})
.fail(function () {
.fail((data) => {
throw new Error("Couldn't get " + completeUrl + ' file.');
});
}

@ -156,7 +156,7 @@ var widgetDefinitionsCollection = new WidgetDefinitionsCollection(null, {
layerDefinitionsCollection: layerDefinitionsCollection
});
vizJSON.widgets.forEach(function (d) {
vizJSON.widgets.forEach((d) => {
widgetDefinitionsCollection.add(d);
});

@ -104,7 +104,7 @@ describe('components/img-loader-view', function () {
jasmine.Ajax.stubRequest(new RegExp('^http(s)?.*/logo.svg.*'))
.andReturn({ status: 500 });
var foo = function () {
const foo = () => {
this.view._requestImage(svgUrl, obj.callback);
};

@ -1,3 +1,5 @@
var bubleify = require('bubleify');
/**
* Entry point bundles that are expected to be minimized and distributed on CDNs goes here.
*
@ -145,7 +147,8 @@ module.exports = {
],
dest: '<%= assets_dir %>/javascripts/dataset.js',
options: {
external: editor3Bundles.vendor.concat(editor3Bundles.common)
external: editor3Bundles.vendor.concat(editor3Bundles.common),
transform: ['bubleify']
}
},
@ -155,7 +158,8 @@ module.exports = {
],
dest: '<%= assets_dir %>/javascripts/editor3.js',
options: {
external: editor3Bundles.vendor.concat(editor3Bundles.common)
external: editor3Bundles.vendor.concat(editor3Bundles.common),
transform: ['bubleify']
}
},
@ -182,6 +186,9 @@ module.exports = {
'lib/assets/test/spec/node_modules/**/*.spec.js',
'lib/assets/test/spec/cartodb3/deep-insights-integrations.spec.js'
],
dest: '.grunt/cartodb3-specs.js'
dest: '.grunt/cartodb3-specs.js',
options: {
transform: ['bubleify']
}
}
};

@ -42,6 +42,7 @@
"brfs": "^1.4.3",
"browserify": "13.0.0",
"browserify-resolutions": "1.1.0",
"bubleify": "^0.7.0",
"cartoassets": "cartodb/CartoAssets#master",
"csswring": "^3.0.5",
"git-rev": "0.2.1",

Loading…
Cancel
Save