diff options
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/search_results.py | 4 | ||||
-rw-r--r-- | wqflask/wqflask/templates/search_result_page.html | 13 |
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>", |