aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask/templates/gn_editor_commit.html
diff options
context:
space:
mode:
authorAlexander_Kabui2024-08-12 14:55:01 +0300
committerBonfaceKilz2024-08-29 18:58:56 +0300
commit1663442724c43cf763d56592f505981cd911cceb (patch)
tree86814a003dd97cada25244fd8ce79c02383c2f7c /gn2/wqflask/templates/gn_editor_commit.html
parente2e3a61aa12cd4376fa77431a6ddf03de0fd5b14 (diff)
downloadgenenetwork2-1663442724c43cf763d56592f505981cd911cceb.tar.gz
Use localstorage to track current commit.
Diffstat (limited to 'gn2/wqflask/templates/gn_editor_commit.html')
-rw-r--r--gn2/wqflask/templates/gn_editor_commit.html27
1 files changed, 21 insertions, 6 deletions
diff --git a/gn2/wqflask/templates/gn_editor_commit.html b/gn2/wqflask/templates/gn_editor_commit.html
index 7c419c0b..0ea20adb 100644
--- a/gn2/wqflask/templates/gn_editor_commit.html
+++ b/gn2/wqflask/templates/gn_editor_commit.html
@@ -1,5 +1,5 @@
<section classs="row commit-content" style="padding-top:25px">
- <form action="/editor/commit" method="POST" class="col-sm-10 col-sm-offset-1">
+ <div class="col-sm-10 col-sm-offset-1">
<div>
<div>
<h2> <i>Commit your Changes</i></h2>
@@ -13,7 +13,7 @@
</div>
<br>
<div class="row">
- <textarea rows="12" class="col-sm-12" name="message" required>
+ <textarea rows="12" class="col-sm-12" name="message" required id="commit-message">
</textarea>
</div>
@@ -21,14 +21,29 @@
<br>
<br>
<div class="row">
- <button hx-post="/editor/commit"
- hx-target="#output"
- hx-swap= "innerHTML"
+ <button id="btn-commit"
class="btn btn-primary col-sm-2 col-sm-offset-1">
Commit
</button>
</div>
<br>
- </form>
+ </div>
</section>
+{% block js %}
+
+ <script>
+ htmx.on("#btn-commit", "click", function(event){
+ let msg = htmx.find("#commit-message").value.trim()
+ if (msg != ""){
+ //fire custom event here re
+ htmx.find("#output").dispatchEvent(
+ new CustomEvent("commitEvent", {
+ bubbles: true,
+ detail: {action: 'didInitialize', payload: msg},
+ }),
+ );
+ }
+ })
+</script>
+{% endblock %}