0

if there is only one world, shouldnt show the world selector

This commit is contained in:
Lucas Hereld
2012-02-23 09:10:17 -08:00
parent ae820079d1
commit 4654595238

View File

@@ -36,21 +36,23 @@ overviewer.views.WorldView = Backbone.View.extend({
overviewer.views.WorldSelectorView = Backbone.View.extend({ overviewer.views.WorldSelectorView = Backbone.View.extend({
initialize: function() { initialize: function() {
// a div will have already been created for us, we just if(overviewer.collections.worldViews.length > 1) {
// need to register it with the google maps control // a div will have already been created for us, we just
var selectBox = document.createElement('select'); // need to register it with the google maps control
$.each(overviewer.collections.worldViews, function(index, elem) { var selectBox = document.createElement('select');
var o = document.createElement("option"); $.each(overviewer.collections.worldViews, function(index, elem) {
o.value = elem.model.get("name"); var o = document.createElement("option");
o.innerHTML = elem.model.get("name"); o.value = elem.model.get("name");
$(o).data("viewObj", elem); o.innerHTML = elem.model.get("name");
selectBox.appendChild(o); $(o).data("viewObj", elem);
selectBox.appendChild(o);
}); });
this.el.appendChild(selectBox); this.el.appendChild(selectBox);
overviewer.map.controls[google.maps.ControlPosition.TOP_LEFT].push(this.el); overviewer.map.controls[google.maps.ControlPosition.TOP_LEFT].push(this.el);
}, }
},
events: { events: {
"change select": "changeWorld" "change select": "changeWorld"
}, },