diff options
author | John Nduli | 2024-09-10 17:44:05 +0300 |
---|---|---|
committer | BonfaceKilz | 2024-09-11 16:56:35 +0300 |
commit | 61c4b9a2cebe94db400c41c4a7bef4ab7f1b3a40 (patch) | |
tree | e155c5d21c1e28f57d56e1a0310241aeafe1f627 /gn2/wqflask/templates/gsearch_gene.html | |
parent | 6e1d21b50ecda42364fd081f0c2cfa6dd39a5ec5 (diff) | |
download | genenetwork2-61c4b9a2cebe94db400c41c4a7bef4ab7f1b3a40.tar.gz |
feat: ai_search result loaded by javascript
Diffstat (limited to 'gn2/wqflask/templates/gsearch_gene.html')
-rw-r--r-- | gn2/wqflask/templates/gsearch_gene.html | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/gn2/wqflask/templates/gsearch_gene.html b/gn2/wqflask/templates/gsearch_gene.html index fb13ca22..ecb8de8f 100644 --- a/gn2/wqflask/templates/gsearch_gene.html +++ b/gn2/wqflask/templates/gsearch_gene.html @@ -16,27 +16,8 @@ </h3> </div> - {% if ai_result %} - <div class="row"> - <div class="col-sm-6"> - <div class="panel panel-info"> - <div class="panel-heading" role="tab" id="ai_heading"> - <h4 class="panel-title"> - <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#ai_results" aria-expanded="false" aria-controls="ai_results"> - AI Search: {{ ai_result["search_term"] }} (Click for more details) - </a> - </h4> - </div> - <div id="ai_results" class="panel-collapse collapse" role="tabpanel" aria-labelledby="ai_heading"> - <div class="panel-body"> - <p>{{ ai_result["search_result"] }}</p> - <p><a class="btn btn-default" href="{{ ai_result["search_url"] }}" role="button">See References</a></p> - </div> - </div> - </div> - </div> + <div class="row" id="ai_result"> </div> - {% endif %} <p>To study a record, click on its Record ID below.<br />Check records below and click Add button to add to selection.</p> <div> @@ -291,4 +272,33 @@ }); </script> + <script type='text/javascript'> + function ai_content_div(search_term, search_result) { + return ` + <div class="col-sm-6"> + <div class="panel panel-info"> + <div class="panel-heading" role="tab" id="ai_heading"> + <h4 class="panel-title"> + <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#ai_results" aria-expanded="false" aria-controls="ai_results"> + AI Search: ${search_term} (Click for more details) + </a> + </h4> + </div> + <div id="ai_results" class="panel-collapse collapse" role="tabpanel" aria-labelledby="ai_heading"> + <div class="panel-body"> + <p>${ search_result }</p> + <p><a class="btn btn-default" href="${search_term}" role="button">See References</a></p> + </div> + </div> + </div> + </div> + ` + } + + $(document).ready( function () { + let ai_div = ai_content_div("this is a test", "test contains some text"); + $("#ai_result").append(ai_div); + }) + + </script> {% endblock %} |