diff options
-rw-r--r-- | gn2/wqflask/templates/gn_editor.html | 13 | ||||
-rw-r--r-- | gn2/wqflask/templates/gn_editor_commit.html | 5 | ||||
-rw-r--r-- | gn2/wqflask/templates/gn_editor_results_page.html | 18 | ||||
-rw-r--r-- | gn2/wqflask/views.py | 5 |
4 files changed, 25 insertions, 16 deletions
diff --git a/gn2/wqflask/templates/gn_editor.html b/gn2/wqflask/templates/gn_editor.html index 112180e1..dca6d161 100644 --- a/gn2/wqflask/templates/gn_editor.html +++ b/gn2/wqflask/templates/gn_editor.html @@ -30,12 +30,10 @@ <div> <div class="row"> <section class="col-sm-6" id="editor" style="height:100vh"> - </section> <section class="col-sm-6"> <div class="row"> <section class="col-sm-10 col-sm-offset-1" id="output" style="height:100vh;overflow-y:scroll" id="swap"> - Tristique nulla aliquet enim tortor, at auctor urna nunc id cursus metus aliquam eleifend mi in nulla posuere sollicitudin aliquam ultrices sagittis orci, a scelerisque! Laoreet suspendisse interdum consectetur libero. </section> </div> @@ -118,8 +116,6 @@ document.querySelector("#output").addEventListener("updateEditor", function(event){ - console.log(event.detail.payload) - console.log(event) editor.setOptions({ ...editor_configurations, ...event.detail.payload @@ -147,17 +143,20 @@ previewContent = document.querySelector("#output"); var markdownContent = editor.getValue(); var htmlContent = new_marked.parse(markdownContent) + console.log(htmlContent) previewContent.innerHTML = htmlContent; } - editor.getSession().on("change", function(e){ + editor.getSession().on("change", function(e){ updatePreview() }) - + //do the fetch here + var data = {{ content|tojson }} + editor.setValue(data, -1); + }); - </script> {% endblock %} diff --git a/gn2/wqflask/templates/gn_editor_commit.html b/gn2/wqflask/templates/gn_editor_commit.html index 214ca169..7c419c0b 100644 --- a/gn2/wqflask/templates/gn_editor_commit.html +++ b/gn2/wqflask/templates/gn_editor_commit.html @@ -13,7 +13,7 @@ </div> <br> <div class="row"> - <textarea class="col-sm-12" name="message" required> + <textarea rows="12" class="col-sm-12" name="message" required> </textarea> </div> @@ -21,9 +21,6 @@ <br> <br> <div class="row"> - <button class="btn btn-secondary col-sm-2 col-sm-offset-1"> - Cancel - </button> <button hx-post="/editor/commit" hx-target="#output" hx-swap= "innerHTML" diff --git a/gn2/wqflask/templates/gn_editor_results_page.html b/gn2/wqflask/templates/gn_editor_results_page.html index f19ef7ab..9453ba02 100644 --- a/gn2/wqflask/templates/gn_editor_results_page.html +++ b/gn2/wqflask/templates/gn_editor_results_page.html @@ -6,11 +6,21 @@ </div> </div> <br> - <div> - <h3>Commit Sha:</h3> - - <h3>Commit Message</h3> + {% if error %} + <h1> error occurred *error message hereh </h1> + {% else %} + <div> + <h3>Commit Sha: <span class="lead"> + <mark style="font-family: 'Linux Libertine','Georgia','Times','Source Serif Pro',serif;"><b><i>commit hash</i></b></mark> + </span></h3> + <br/> + <div class="lead"> <h3>Commit Message: + <mark style="font-family: 'Linux Libertine','Georgia','Times','Source Serif Pro',serif;"><b><i>commit message</i></b></mark> + </h3> + + </div> </div> + {% endif %} <br> </div> </section> diff --git a/gn2/wqflask/views.py b/gn2/wqflask/views.py index ce8cabd0..cfcbf150 100644 --- a/gn2/wqflask/views.py +++ b/gn2/wqflask/views.py @@ -312,7 +312,10 @@ def gnqna(): @app.route("/editor/", methods=["GET"]) def edit_gn_file(): - return render_template("gn_editor.html") + import requests + results = requests.get("http://localhost:8091/edit?file_path=test.md") + data = results.json() + return render_template("gn_editor.html", **data) @app.route("/editor/settings", methods=["GET"]) |