aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask/templates/gn_editor_commit.html
diff options
context:
space:
mode:
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 %}