From 42b704beb502eb1b6191a38c4798026c441fe9a3 Mon Sep 17 00:00:00 2001
From: Tanner Prestegard <tanner.prestegard@ligo.org>
Date: Tue, 10 Jul 2018 09:26:45 -0500
Subject: [PATCH] Bugfix to superevent_detail javascript

Link to correct file versions in superevent log comments
---
 gracedb/templates/superevents/superevent_detail_script.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gracedb/templates/superevents/superevent_detail_script.js b/gracedb/templates/superevents/superevent_detail_script.js
index 699c21739..30bf1eb5f 100644
--- a/gracedb/templates/superevents/superevent_detail_script.js
+++ b/gracedb/templates/superevents/superevent_detail_script.js
@@ -639,7 +639,7 @@ require([
                             // Putting this in the innerHTML allows users to create comments in HTML.
                             // Whereas, inserting the comment with the put selector escapes it.
                             commentDiv.innerHTML += value + ' ';
-                            if (object.filename) put(commentDiv, 'a[href=$]', fileDownloadUrl.replace("FAKE_FILE_NAME", object.filename), object.filename);
+                            if (object.filename) put(commentDiv, 'a[href=$]', fileDownloadUrl.replace("FAKE_FILE_NAME", object.filename + "," + object.file_version), object.filename);
                             // Branson, 3/3/15
                             //if (object.filename == 'skymap.json') {
                             var isItJson = object.filename.indexOf(".json");
@@ -799,7 +799,7 @@ require([
                             // Putting this in the innerHTML allows users to create comments in HTML.
                             // Whereas, inserting the comment with the put selector escapes it.
                             commentDiv.innerHTML += value + ' ';
-                            if (object.filename) put(commentDiv, 'a[href=$]', fileDownloadUrl.replace("FAKE_FILE_NAME", object.filename), object.filename);
+                            if (object.filename) put(commentDiv, 'a[href=$]', fileDownloadUrl.replace("FAKE_FILE_NAME", object.filename + "," + object.file_version), object.filename);
                             // Create tag-related features
                             var tagButtonContainer = put(commentDiv, 'div.tagButtonContainerClass');
                             // For each existing tag on a log message, we will make a little widget
@@ -891,7 +891,7 @@ require([
                             // Putting this in the innerHTML allows users to create comments in HTML.
                             // Whereas, inserting the comment with the put selector escapes it.
                             commentDiv.innerHTML += value + ' ';
-                            if (object.filename) put(commentDiv, 'a[href=$]', fileDownloadUrl.replace("FAKE_FILE_NAME", object.filename), object.filename);
+                            if (object.filename) put(commentDiv, 'a[href=$]', fileDownloadUrl.replace("FAKE_FILE_NAME", object.filename + "," + object.file_version), object.filename);
                             // Create tag-related features
                             var tagButtonContainer = put(commentDiv, 'div.tagButtonContainerClass');
                             // For each existing tag on a log message, we will make a little widget
@@ -1233,7 +1233,7 @@ require([
                 sVdiv = put(annotationsDiv, 'div#sV_form_div[style="display: none"]');
                 sVform = put(sVdiv, 'form#sV_form[method="post"][action="$"]', 
                 encodeURI(skymapViewerUrl));
-                put(sVform, 'input[type="hidden"][name="skymapid"][value="{{ object.graceid }}"]'); 
+                put(sVform, 'input[type="hidden"][name="skymapid"][value="{{ superevent.superevent_id }}"]'); 
                 put(sVform, 'input[type="hidden"][name="json"]');
                 put(sVform, 'input[type="hidden"][name="embb"]');
                 put(sVform, 'input[type="submit"][value="View in skymapViewer!"]');
-- 
GitLab