From 9f0e97e29d4afa8bdae03028a2ef9a28c079209d Mon Sep 17 00:00:00 2001
From: Mees Fix
Date: Wed, 7 Apr 2021 11:30:36 -0400
Subject: [PATCH] Adding html and js updates for view all headers in single
table. UI is still buggy with displaying tables.
---
jwql/utils/utils.py | 24 +++++++++
jwql/website/apps/jwql/static/js/jwql.js | 12 +++++
.../apps/jwql/templates/combined_table.html | 54 +++++++++++++++++++
.../apps/jwql/templates/view_header.html | 52 +++++++++++-------
jwql/website/apps/jwql/views.py | 5 +-
5 files changed, 125 insertions(+), 22 deletions(-)
create mode 100644 jwql/website/apps/jwql/templates/combined_table.html
diff --git a/jwql/utils/utils.py b/jwql/utils/utils.py
index f16dd31b3..32d9c5f1a 100644
--- a/jwql/utils/utils.py
+++ b/jwql/utils/utils.py
@@ -29,6 +29,7 @@
- JWST TR JWST-STScI-004800, SM-12
"""
+from bs4 import BeautifulSoup
import datetime
import getpass
import json
@@ -110,6 +111,29 @@ def _validate_config(config_file_dict):
)
+def combine_header_tables(header_info):
+ """Take file header and combine all html headers into one.
+ """
+
+ html_list = []
+
+ for header_ext in range(len(header_info)):
+ html = header_info[header_ext]['table']
+ soup = BeautifulSoup(html, features="lxml")
+ html_list += soup.findAll('tr')
+
+ with open('/Users/mfix/Desktop/jwql/jwql/website/apps/jwql/templates/combined_table.html', 'r') as f:
+ contents = f.read()
+ soup = BeautifulSoup(contents, 'lxml')
+
+ for thead in soup.findAll('thead'):
+ [thead.insert_after(tag) for tag in html_list]
+
+ html_string = str(soup)
+
+ return html_string
+
+
def get_config():
"""Return a dictionary that holds the contents of the ``jwql``
config file.
diff --git a/jwql/website/apps/jwql/static/js/jwql.js b/jwql/website/apps/jwql/static/js/jwql.js
index b46ebd9c9..65af4ca97 100644
--- a/jwql/website/apps/jwql/static/js/jwql.js
+++ b/jwql/website/apps/jwql/static/js/jwql.js
@@ -549,3 +549,15 @@ function version_url(version_string) {
a_line += '">JWQL v' + version_string + '';
return a_line;
};
+
+/**
+ * Show div that is hidden by radio button
+ * @param {String} version_string - The x.y.z version number
+ */
+
+function display_div(div_name, button_name) {
+ $("[name="+button_name+"]").click(function(){
+ $('.toHide').hide();
+ $("#"+div_name).show('slow');
+ });
+ };
diff --git a/jwql/website/apps/jwql/templates/combined_table.html b/jwql/website/apps/jwql/templates/combined_table.html
new file mode 100644
index 000000000..b02fe1885
--- /dev/null
+++ b/jwql/website/apps/jwql/templates/combined_table.html
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Key
+
Value
+
+
+
+
+
\ No newline at end of file
diff --git a/jwql/website/apps/jwql/templates/view_header.html b/jwql/website/apps/jwql/templates/view_header.html
index da9ee76d8..07dd1beaf 100644
--- a/jwql/website/apps/jwql/templates/view_header.html
+++ b/jwql/website/apps/jwql/templates/view_header.html
@@ -16,32 +16,44 @@