Skip to content

Commit

Permalink
Merge branch 'develop' of git://github.com/CartoDB/cartodb.js into de…
Browse files Browse the repository at this point in the history
…velop
  • Loading branch information
iriberri committed May 29, 2015
2 parents 90c76d8 + e947529 commit 6d8fc5c
Show file tree
Hide file tree
Showing 41 changed files with 1,988 additions and 1,322 deletions.
9 changes: 9 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
3.14.X ()
* Hide <img> tag of infowindow covers when the url is invalid.
* Expose legend model in sublayers/layers so that users can customize legends (#480).
* Handle tooltip overflow (#482).
* Only show tooltips when they have fields (#486).
* Updated Torque to 2.11.3
* Fix scrolling of infowindows with images (#490).
* Fix dropdown bind events not being unbound on clean (#493)

3.14.2 (06//05//2015)
* Allow to specify a template for the items of a custom legend.
* The NOKIA geocoder doesn't encode the whitespaces anymore.
Expand Down
12 changes: 6 additions & 6 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- Create a new branch to prepare the release:

```
git flow release start 3.14.2
git flow release start 3.14.3
```

- Build CartoDB.js files, choosing the new version:
Expand All @@ -25,7 +25,7 @@ grunt build
- Update the NEWS file and commit the changes. Take into account that new CartoDB.js version will be replaced in ```API.md```, ```RELEASING.md```, ```README.md```, ```package.json```, ```cartodb.js``` and ```examples``` files.

```
git commit -am "Files changed for version 3.14.2"
git commit -am "Files changed for version 3.14.3"
```

- Release it.
Expand All @@ -36,8 +36,8 @@ grunt publish

- Check if those files have been updated in the CDN:
```
http://libs.cartocdn.com.s3.amazonaws.com/cartodb.js/v3/3.14.2/cartodb.js
http://libs.cartocdn.com/cartodb.js/v3/3.14.2/cartodb.js
http://libs.cartocdn.com.s3.amazonaws.com/cartodb.js/v3/3.14.3/cartodb.js
http://libs.cartocdn.com/cartodb.js/v3/3.14.3/cartodb.js
http://libs.cartocdn.com.s3.amazonaws.com/cartodb.js/v3/3.13/cartodb.js
http://libs.cartocdn.com/cartodb.js/v3/3.13/cartodb.js
```
Expand All @@ -46,7 +46,7 @@ http://libs.cartocdn.com/cartodb.js/v3/3.13/cartodb.js
- And to finish: close the release and push it.

```
git flow release finish 3.14.2
git flow release finish 3.14.3
git push --all
git push --tags
```
Expand All @@ -69,7 +69,7 @@ grunt build
grunt publish
```

For example, if we are in 3.14.2 and we want to go back to 3.13.4
For example, if we are in 3.14.3 and we want to go back to 3.13.4

```
git checkout 3.13.4
Expand Down
19 changes: 15 additions & 4 deletions doc/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ Toggles the visibility of the sublayer and returns a boolean that indicates the

**sublayer.infowindow** is a Backbone model where we modify the parameters of the infowindow.

##### Arguments
##### Attributes

- **template**: Custom HTML template for the infowindow. You can write simple HTML or use [Mustache templates](http://mustache.github.com/).
- **sanitizeTemplate**: By default all templates are sanitized from unsafe tags/attrs (e.g. `<script>`), set this to `false`
Expand Down Expand Up @@ -697,6 +697,17 @@ to skip sanitization, or a function to provide your own sanitization (e.g. `func

[Grab the complete example source code](https://github.com/CartoDB/cartodb.js/blob/develop/examples/custom_infowindow.html)

#### sublayer.legend

**sublayer.legend** is a Backbone model with the information about the legend.

##### Attributes

- **template**: Custom HTML template for the legend. You can write simple HTML.
- **title**: Title of the legend.
- **show_title**: Set this to `false` if you don't want the title to be displayed.
- **items**: An array with the items that are displayed in the legend.
- **visible**: Set this to `false` if you want to hide the legend.

## Events

Expand Down Expand Up @@ -1361,7 +1372,7 @@ You can use all the functionality of CartoDB.js with HTTPs support. Be sure to u
center: [0,0],
zoom: 2
})
cartodb.createLayer(map, 'http://examples.cartodb.com/api/v1/viz/15589/viz.json', { https: true })
cartodb.createLayer(map, 'https://examples.cartodb.com/api/v1/viz/15589/viz.json', { https: true })
.addTo(map)
.on('error', function(err) {
alert("some error occurred: " + err);
Expand Down Expand Up @@ -1391,10 +1402,10 @@ Or, by running the following in your code:
alert(cartodb.VERSION)
```
Once you know which version of CartoDB.js you're using, you can point your site to that release. If the current version of CartoDB.js is 3.14.2, the URL would be:
Once you know which version of CartoDB.js you're using, you can point your site to that release. If the current version of CartoDB.js is 3.14.3, the URL would be:
```html
<script src="http://libs.cartocdn.com/cartodb.js/v3/3.14.2/cartodb.js"></script>
<script src="http://libs.cartocdn.com/cartodb.js/v3/3.14.3/cartodb.js"></script>
```
You can do the same for the CSS documents we provide:
Expand Down
63 changes: 63 additions & 0 deletions examples/leaflet_control_multilayer2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html>
<head>
<title>Leaflet control example with createLayer | CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
padding: 0;
margin: 0;
}
</style>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/3.14/themes/css/cartodb.css" />
</head>
<body>
<div id="map"></div>

<!-- include cartodb.js library -->
<script src="http://libs.cartocdn.com/cartodb.js/v3/3.14/cartodb.js"></script>

<script>
function main() {
var map = new L.Map('map', {
zoomControl: false,
center: [-37.81083500928111, 144.9632692337036],
zoom: 15
});

L.tileLayer('http://cartocdn_b.global.ssl.fastly.net/base-light/{z}/{x}/{y}.png', {
attribution: 'CartoDB'
}).addTo(map);

var layer1;
var layer2;

cartodb.createLayer(map, 'https://documentation.cartodb.com/api/v2/viz/793c84c0-045b-11e5-9678-0e4fddd5de28/viz.json')
.addTo(map)
.done(function(layer)
{
layer1 = layer;

cartodb.createLayer(map, 'https://documentation.cartodb.com/api/v2/viz/969ce5d2-045b-11e5-8c43-0e0c41326911/viz.json')
.done(function(layer)
{
layer2 = layer;

var overlayMaps = {
"Layer1": layer1,
"Layer2": layer2
};
L.control.layers(null, overlayMaps).addTo(map);
});
});

}//main

// you could use $(window).load(main);
window.onload = main;
</script>
</body>
</html>
3 changes: 3 additions & 0 deletions grunt/tasks/concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ module.exports = {
'src/cartodb.js',
'src/api/core_lib.js',
'src/core/profiler.js',
'src/core/util.js',
'src/api/sql.js',
'src/geo/layer_definition.js',
'src/geo/sublayer.js',
'src/core/loader.js',
'src/vis/image.js',
'src/api/tiles.js'
Expand Down Expand Up @@ -142,6 +144,7 @@ module.exports = {
files: {
// Torque library
'<%= config.dist %>/cartodb.mod.torque.uncompressed.js': [
'./grunt/templates/torque_header.js',
'vendor/mod/carto.js',
'vendor/mod/torque.uncompressed.js',
'src/geo/gmaps/torque.js',
Expand Down
3 changes: 2 additions & 1 deletion grunt/tasks/jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module.exports = {
"src/geo/ui/tooltip.js",
"src/geo/ui/time_slider.js",
"src/geo/ui/fullscreen.js",
"src/geo/sublayer.js",
"src/geo/layer_definition.js",
"src/geo/common.js",
"src/geo/leaflet/leaflet.geometry.js",
Expand Down Expand Up @@ -89,7 +90,7 @@ module.exports = {
outfile: 'test/SpecRunner.html',
specs: 'test/spec/**/*.js',
helpers: 'test/spec/SpecHelper.js',
vendor: [ "https://maps.googleapis.com/maps/api/js?v=3.exp" ],
vendor: [ "http://maps.googleapis.com/maps/api/js?sensor=false&v=3.12" ],
summary: true,
display: 'short'
}
Expand Down
4 changes: 4 additions & 0 deletions grunt/templates/torque_footer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Restores any previous global libraries, e.g. jQuery
for (var lib in window._prev){
window[lib] = window._prev[lib];
}

cartodb.moduleLoad('torque', torque);

Expand Down
7 changes: 7 additions & 0 deletions grunt/templates/torque_header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if(cartodb){
// Keep the global version of jQuery, if there is any
if(window.$){
window._prev = {jQuery: window.$, $: window.$}
}
window.$ = window.jQuery = cartodb.$;
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cartodb.js",
"version": "3.14.2",
"version": "3.14.3",
"description": "CartoDB javascript library",
"repository": {
"type": "git",
Expand Down
15 changes: 7 additions & 8 deletions src/api/layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,21 @@
*/

cartodb.createLayer = function(map, layer, options, callback) {

var promise = new _Promise();
var layerView, MapType;
options = options || {};
if(map === undefined) {
throw new TypeError("map should be provided");
}
if(layer === undefined) {
throw new TypeError("layer should be provided");
}
var args = arguments,
fn = args[args.length -1];

var layerView, MapType;
var options = options || {};
var args = arguments;
var fn = args[args.length -1];
if(_.isFunction(fn)) {
callback = fn;
}
var promise = new _Promise();

promise.addTo = function(map, position) {
promise.on('done', function() {
Expand All @@ -94,6 +94,7 @@
promise.trigger('error');
return;
}

// extract layer data from visualization data
if(visData.layers) {
if(visData.layers.length < 2) {
Expand All @@ -114,7 +115,6 @@
return;
}


// update options
if(options && !_.isFunction(options)) {
layerData.options = layerData.options || {};
Expand Down Expand Up @@ -221,7 +221,6 @@
});

return promise;

};


Expand Down
4 changes: 3 additions & 1 deletion src/cartodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

var cdb = root.cdb = {};

cdb.VERSION = "3.14.2";
cdb.VERSION = "3.14.3";
cdb.DEBUG = false;

cdb.CARTOCSS_VERSIONS = {
Expand Down Expand Up @@ -58,6 +58,7 @@
'core/model.js',
'core/view.js',
'core/loader.js',
'core/util.js',

'geo/geocoder.js',
'geo/geometry.js',
Expand All @@ -81,6 +82,7 @@
'geo/ui/tooltip.js',
'geo/ui/fullscreen.js',

'geo/sublayer.js',
'geo/layer_definition.js',
'geo/common.js',

Expand Down
Loading

0 comments on commit 6d8fc5c

Please sign in to comment.