about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander_Kabui2024-05-29 14:27:40 +0300
committerAlexander_Kabui2024-08-29 11:51:25 +0300
commitc7d18638c8147d453b8fd4730ceb43c7217a25fb (patch)
tree269db2af4e1d65208277f3f835a7a85b5c7a76a0
parent98f35d5117ea9510d54051574b07153d5687e628 (diff)
downloadgenenetwork2-c7d18638c8147d453b8fd4730ceb43c7217a25fb.tar.gz
Add htmx js api for delete functionality.
-rw-r--r--gn2/wqflask/templates/gnqa_search_history.html18
1 files changed, 6 insertions, 12 deletions
diff --git a/gn2/wqflask/templates/gnqa_search_history.html b/gn2/wqflask/templates/gnqa_search_history.html
index c1e66541..976fd7fd 100644
--- a/gn2/wqflask/templates/gnqa_search_history.html
+++ b/gn2/wqflask/templates/gnqa_search_history.html
@@ -1,4 +1,4 @@
-<section class="container-fluid  gnqa-copy">
+<section class="container-fluid  gnqa-copy" id="search-hist">
   <header class="row">
     <div class="panel panel default col-sm-6 col-sm-offset-3">
       <div class="panel panel-default">
@@ -15,8 +15,8 @@
       <div class="col-sm-6 col-sm-offset-3" style="margin-bottom:10px">
 	<button type="button" class="btn btn-danger" id="delete-btn">Delete Selected </button>
       </div>
-      <div>
-	<div class="panel panel-default col-sm-6 col-sm-offset-3 ">
+      <div >
+      <div class="panel panel-default col-sm-6 col-sm-offset-3 ">
       <div>
 	<ul class="list-group list-group-flush" style="overflow-y:scroll">
     {% for item in  prev_queries %}
@@ -44,15 +44,9 @@
   </div>
   </div>
 </section>
-{% block js %}
-  <script>
+<script>
   htmx.on("#delete-btn", "click", function(evt){
-      // todo: complete this for delete /export functionality
-      htmx.ajax("POST", "/gnqna/hist", {target:"",
-				swap:"innerHTML",values:
-			Array.from(htmx.findAll("input[type=checkbox]:checked"), e => e.value);}
-      )
+      htmx.ajax("DELETE","/gnqna/hist", {target: "#search-hist","swap" :"outerHTML",
+				      values: Array.from(htmx.findAll("input[type=checkbox]:checked"), e => e.value)}) 
   })
 </script>
-
-{% endblock %}