aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2022-08-02 19:26:28 +0000
committerzsloan2022-08-02 19:26:28 +0000
commita64daab776d2b5637a11204848dc871e3f762308 (patch)
tree380d18ee4a063823ee95d497b6628773134d92a4 /wqflask
parent6a30e25598b2ca665746954bb26a6c6e08021b34 (diff)
downloadgenenetwork2-a64daab776d2b5637a11204848dc871e3f762308.tar.gz
Move logic for creating authors display string to the server-side Python code
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/search_results.py4
-rw-r--r--wqflask/wqflask/templates/search_result_page.html13
2 files changed, 6 insertions, 11 deletions
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py
index a82390cb..eb8879dd 100644
--- a/wqflask/wqflask/search_results.py
+++ b/wqflask/wqflask/search_results.py
@@ -172,6 +172,10 @@ class SearchResultPage:
trait_dict['pubmed_text'] = result[4]
trait_dict['authors'] = result[3]
+ trait_dict['authors_display'] = trait_dict['authors']
+ author_list = trait_dict['authors'].split(",")
+ if len(author_list) >= 2:
+ trait_dict['authors_display'] = (",").join(author_list[:2]) + ", et al."
if result[6] != "" and result[6] != None:
trait_dict['mean'] = f"{result[6]:.3f}"
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html
index 62ee93cc..bd832420 100644
--- a/wqflask/wqflask/templates/search_result_page.html
+++ b/wqflask/wqflask/templates/search_result_page.html
@@ -319,17 +319,8 @@
{% else %}
'width': "500px",
{% endif %}
- 'data': null,
- 'targets': 5,
- 'render': function(data) {
- author_list = data.authors.split(",")
- if (author_list.length >= 2) {
- author_string = author_list.slice(0, 2).join(",") + ", et al."
- } else{
- author_string = data.authors
- }
- return author_string
- }
+ 'data': "authors_display",
+ 'targets': 5
},
{
'title': "<div style='text-align: right;'>Year</div>",