From cd44a4ede91a3816f765ba45c38c0b7c5f7a0ea3 Mon Sep 17 00:00:00 2001 From: laurenwalker Date: Thu, 26 Jan 2017 09:58:30 -0500 Subject: [PATCH] Fix the data package table headers --- .../webapp/js/themes/dataone/css/metacatui.css | 3 +++ .../src/main/webapp/js/views/MetadataView.js | 15 ++++++++++----- .../src/main/webapp/js/views/PackageTableView.js | 12 +++++++++++- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/metacatui/src/main/webapp/js/themes/dataone/css/metacatui.css b/metacatui/src/main/webapp/js/themes/dataone/css/metacatui.css index 09def8b05..75c70912a 100644 --- a/metacatui/src/main/webapp/js/themes/dataone/css/metacatui.css +++ b/metacatui/src/main/webapp/js/themes/dataone/css/metacatui.css @@ -466,6 +466,9 @@ tr.table-header{ tr.table-header th{ text-align: center; } +.table-header a { + color: #FFF; +} .table-header .subtle { color: #D9E4EC; font-weight: lighter; diff --git a/metacatui/src/main/webapp/js/views/MetadataView.js b/metacatui/src/main/webapp/js/views/MetadataView.js index c69420330..7a5505ceb 100644 --- a/metacatui/src/main/webapp/js/views/MetadataView.js +++ b/metacatui/src/main/webapp/js/views/MetadataView.js @@ -481,9 +481,9 @@ define(['jquery', }); } else{ - var title = packageModel.get("id") ? 'Package: ' + packageModel.get("id") + '' : ""; - title = "Files in this dataset " + title; - viewRef.insertPackageTable(packageModel, {title: title}); + // var title = packageModel.get("id") ? 'Package: ' + packageModel.get("id") + '' : ""; + //title = "Files in this dataset " + title; + viewRef.insertPackageTable(packageModel); } //Remove the extra download button returned from the XSLT since the package table will have all the download links @@ -638,7 +638,7 @@ define(['jquery', //Parse text for older versions of Metacat (v2.4.3 and earlier) if(parseText){ var labelEl = $(georegion).find('label:contains("' + direction + '")'); - if(labelEl){ + if(labelEl.length){ var coordinate = $(labelEl).next().html(); if(coordinate.indexOf(" ") > -1) coordinate = coordinate.substring(0, coordinate.indexOf(" ")); } @@ -648,14 +648,19 @@ define(['jquery', } //Save our coordinate value - coordinates.push(coordinate); + if(typeof coordinate != "undefined") + coordinates.push(coordinate); }); + //If there are no coordinates, we have no map to render, so exit. + if(!coordinates.length) return; + //Extract the coordinates var n = coordinates[0]; var s = coordinates[1]; var e = coordinates[2]; var w = coordinates[3]; + } //Create Google Map LatLng objects out of our coordinates diff --git a/metacatui/src/main/webapp/js/views/PackageTableView.js b/metacatui/src/main/webapp/js/views/PackageTableView.js index 6d10e0d0b..3bff44759 100644 --- a/metacatui/src/main/webapp/js/views/PackageTableView.js +++ b/metacatui/src/main/webapp/js/views/PackageTableView.js @@ -29,7 +29,7 @@ define(['jquery', 'underscore', 'backbone', 'models/PackageModel', 'text!templat this.currentlyViewing = options.currentlyViewing || null; this.numVisible = options.numVisible || 4; this.parentView = options.parentView || null; - this.title = options.title || "Files in this dataset"; + this.title = options.title || ""; this.nested = (typeof options.nested === "undefined")? false : options.nested; //Set up the Package model @@ -134,6 +134,16 @@ define(['jquery', 'underscore', 'backbone', 'models/PackageModel', 'text!templat } } + if(!this.title){ + this.title = 'Files in this dataset'; + + if(this.model.get("id")) + this.title += ' Package: ' + this.model.get("id") + ''; + + this.title += ''; + } + this.$el.html(this.template({ downloadButton : downloadButtonHTML, readsEnabled : this.readsEnabled,