From e2e3a61aa12cd4376fa77431a6ddf03de0fd5b14 Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Thu, 8 Aug 2024 17:30:46 +0300 Subject: Code refactoring. --- gn2/wqflask/templates/gn_editor.html | 13 ++++++------- gn2/wqflask/templates/gn_editor_commit.html | 5 +---- gn2/wqflask/templates/gn_editor_results_page.html | 18 ++++++++++++++---- 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 @@
-
- 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.
@@ -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); + }); - {% 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 @@

-
@@ -21,9 +21,6 @@

-

-
-

Commit Sha:

- -

Commit Message

+ {% if error %} +

error occurred *error message hereh

+ {% else %} +
+

Commit Sha: + commit hash +

+
+

Commit Message: + commit message +

+ +
+ {% endif %}
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"]) -- cgit v1.2.3