diff options
author | zsloan | 2022-03-17 22:23:04 +0000 |
---|---|---|
committer | zsloan | 2022-03-17 17:25:44 -0500 |
commit | 66550944f147df384764dec56fa03876c5793afc (patch) | |
tree | 447dd8313e88deff7fdeb9ba3f971e09ea2c7b60 /wqflask | |
parent | 77f3bd8ab928d635a52d1d7666d4fbe4a75619c4 (diff) | |
download | genenetwork2-66550944f147df384764dec56fa03876c5793afc.tar.gz |
Fix/change Authors column in phenotype search results
- Limit number of full names to 2 followed by "et al."
- Fix wrong logic that was using the full length of the authors string instead of the truncated length when determining the width of the column, resulting in it always being at least 500px wide
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/search_results.py | 4 | ||||
-rw-r--r-- | wqflask/wqflask/templates/search_result_page.html | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index 807e7305..858ca56d 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -203,8 +203,8 @@ class SearchResultPage: for i, trait in enumerate(trait_list): for key in trait.keys(): if key == "authors": - authors_string = ",".join(str(trait[key]).split(",")[:6]) + ", et al." - self.max_widths[key] = max(len(authors_string), self.max_widths[key]) if key in self.max_widths else len(str(trait[key])) + authors_string = ",".join(str(trait[key]).split(",")[:2]) + ", et al." + self.max_widths[key] = max(len(authors_string), self.max_widths[key]) if key in self.max_widths else len(str(authors_string)) else: self.max_widths[key] = max(len(str(trait[key])), self.max_widths[key]) if key in self.max_widths else len(str(trait[key])) diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index c6e4b4d2..b9859229 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -313,8 +313,8 @@ { 'title': "Authors", 'type': "natural", - {% if (max_widths.authors * 7) < 500 %} - 'width': "{{ max_widths.authors * 7 }}px", + {% if (max_widths.authors * 5) < 500 %} + 'width': "{{ max_widths.authors * 5 }}px", {% else %} 'width': "500px", {% endif %} @@ -322,8 +322,8 @@ 'targets': 5, 'render': function(data, type, row, meta) { author_list = data.authors.split(",") - if (author_list.length >= 6) { - author_string = author_list.slice(0, 6).join(",") + ", et al." + if (author_list.length >= 2) { + author_string = author_list.slice(0, 2).join(",") + ", et al." } else{ author_string = data.authors } |