Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Render list of layers when categories arent available

Taylor Gunnoe217f788e4822
diff --git a/web/js/layers/wv.layers.modal.js b/web/js/layers/wv.layers.modal.js
index 979f84e77..b0a479e8a 100644
--- a/web/js/layers/wv.layers.modal.js
+++ b/web/js/layers/wv.layers.modal.js
@@ -118,8 +118,8 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
removeSearch();
- if( projection === 'geographic' ) {
-
+ if( projection === 'geographic' && config.categories ) {
+ console.log('categories');
$allLayers.hide();
drawCategories();
}
@@ -385,40 +385,43 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
_.each( config.layerOrder, function( layerId ) {
var current = config.layers[layerId];
+ if ( !current ) {
+ console.warn("In layer order but not defined", layerId);
+ }
+ else {
+ var $layerItem = $( '<li></li>' )
+ .attr('id', 'layer-flat-' + current.id )
+ .attr("data-layer", encodeURIComponent(current.id))
+ .addClass('layers-all-layer')
+ .click( function( e ){
+ $( this ).find('input#' + encodeURIComponent(current.id))
+ .iCheck('toggle');
+ });
- var $layerItem = $( '<li></li>' )
- .attr('id', 'layer-flat-' + current.id )
- .attr("data-layer", encodeURIComponent(current.id))
- .addClass('layers-all-layer')
- .click( function( e ){
- $( this ).find('input#' + encodeURIComponent(current.id))
- .iCheck('toggle');
- });
-
- var $layerTitle = $( '<h3></h3>' )
- .text( current.title );
+ var $layerTitle = $( '<h3></h3>' )
+ .text( current.title );
- var $layerSubtitle = $('<h5></h5>')
- .append( current.subtitle );
+ var $layerSubtitle = $('<h5></h5>')
+ .append( current.subtitle );
- var $checkbox = $("<input></input>")
- .attr("id", encodeURIComponent(current.id))
- .attr("value", current.id)
- .attr("type", "checkbox")
- .attr("data-layer", current.id)
- .on('ifChecked', addLayer)
- .on('ifUnchecked', removeLayer);
+ var $checkbox = $("<input></input>")
+ .attr("id", encodeURIComponent(current.id))
+ .attr("value", current.id)
+ .attr("type", "checkbox")
+ .attr("data-layer", current.id)
+ .on('ifChecked', addLayer)
+ .on('ifUnchecked', removeLayer);
- if ( _.find(model.active, {id: current.id}) ) {
- $checkbox.attr("checked", "checked");
- }
+ if ( _.find(model.active, {id: current.id}) ) {
+ $checkbox.attr("checked", "checked");
+ }
- $layerItem.append( $checkbox );
- $layerItem.append( $layerTitle );
- $layerItem.append( $layerSubtitle );
-
+ $layerItem.append( $checkbox );
+ $layerItem.append( $layerTitle );
+ $layerItem.append( $layerSubtitle );
- $fullLayerList.append( $layerItem );
+ $fullLayerList.append( $layerItem );
+ }
});
@@ -809,7 +812,7 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
else{
searchBool = false;
- if (models.proj.selected.id === 'geographic'){
+ if (models.proj.selected.id === 'geographic' && config.categories){
$allLayers.hide();
$categories.show().isotope();
$nav.show();