Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Tab now changes when coming in on a data download permalink

Mike McGann317433115c83
diff --git a/src/js/Worldview/DataDownload/Results/TimeLabel.js b/src/js/Worldview/DataDownload/Results/TimeLabel.js
index 46e1850f7..c0c9b08c3 100644
--- a/src/js/Worldview/DataDownload/Results/TimeLabel.js
+++ b/src/js/Worldview/DataDownload/Results/TimeLabel.js
@@ -42,7 +42,7 @@ Worldview.DataDownload.Results.TimeLabel = function(time) {
granule.label = displayStart + " - " + displayEnd + suffix;
granule.downloadLabel = timeStart.toISOStringDate() + ": " +
- displayStart + " - " + displayEnd;
+ displayStart + "-" + displayEnd;
return granule;
};
diff --git a/src/js/main.js b/src/js/main.js
index 16764fe3c..3a9670853 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -137,6 +137,10 @@ $(function() {// Initialize "static" vars
.on("dataDownloadUnselect", function() {
dataDownloadModel.deactivate();
});
+ dataDownloadModel.events
+ .on("activate", function() {
+ products.selectTab("download");
+ });
// Register event listeners
diff --git a/src/js/products.js b/src/js/products.js
index 6b024fd31..2f2813b46 100644
--- a/src/js/products.js
+++ b/src/js/products.js
@@ -67,25 +67,25 @@ SOTE.widget.Products = function(containerId, config){
this.init();
-}
+};
SOTE.widget.Products.HTML_TAB_ACTIVE_SELECTED =
"<img class='productsIcon selected' src='images/missing-icon.svg'>" +
- "Active"
+ "Active";
SOTE.widget.Products.HTML_TAB_ACTIVE_UNSELECTED =
"<img class='productsIcon' src='images/missing-icon.svg' title='Activce Layers'>";
SOTE.widget.Products.HTML_TAB_ADD_SELECTED =
"<img class='productsIcon selected' src='images/missing-icon.svg'>" +
- "Add Layers"
+ "Add Layers";
SOTE.widget.Products.HTML_TAB_ADD_UNSELECTED =
"<img class='productsIcon' src='images/missing-icon.svg' title='Add Layers'>";
SOTE.widget.Products.HTML_TAB_DOWNLOAD_SELECTED =
"<img class='productsIcon selected' src='images/missing-icon.svg'>" +
- "Download"
+ "Download";
SOTE.widget.Products.HTML_TAB_DOWNLOAD_UNSELECTED =
"<img class='productsIcon' src='images/missing-icon.svg' title='Download'>";
@@ -168,7 +168,7 @@ SOTE.widget.Products.prototype.render = function(){
var self = this;
$('#'+this.id).tabs({show: function(e, ui) {
e.data = { self: self };
- SOTE.widget.Products.change(e, ui)
+ SOTE.widget.Products.change(e, ui);
}});
this.b = new SOTE.widget.Bank("products", {
paletteWidget: this.paletteWidget,
@@ -312,6 +312,17 @@ SOTE.widget.Products.toggle = function(e,ui){
}
};
+SOTE.widget.Products.prototype.selectTab = function(tabName) {
+ var selectedTab = $("#" + this.id).tabs("option", "selected");
+ if ( tabName === "download" ) {
+ if ( selectedTab !== 2 ) {
+ $("#" + this.id).tabs("select", 2);
+ }
+ } else {
+ throw new Error("Invalid tab: " + tabName);
+ }
+};
+
/**
* Fires an event to the registry when the state of the component is changed
*