about summary refs log tree commit diff
path: root/gn2/wqflask/templates
diff options
context:
space:
mode:
authorAlexander Kabui2024-09-16 15:27:12 +0300
committerGitHub2024-09-16 15:27:12 +0300
commit1ee4e945dbc3b0fd8788341667f2e39f776cc3c4 (patch)
tree314fa913381eca6cf40a02cec2500192e5e891e2 /gn2/wqflask/templates
parente823d509b2e2485ab65b1e26a7d4c40042714c25 (diff)
parent304f3f35bfea61bdf9e6be2286b8f6e83b71edb6 (diff)
downloadgenenetwork2-1ee4e945dbc3b0fd8788341667f2e39f776cc3c4.tar.gz
Merge pull request #869 from genenetwork/features/Integrate-editing-doc-files
Integrate gn editor for files.
Diffstat (limited to 'gn2/wqflask/templates')
-rw-r--r--gn2/wqflask/templates/base.html16
-rw-r--r--gn2/wqflask/templates/blogs_list.html4
-rw-r--r--gn2/wqflask/templates/facilities.html4
-rw-r--r--gn2/wqflask/templates/generic_gn_docs.html14
-rw-r--r--gn2/wqflask/templates/glossary.html2
-rw-r--r--gn2/wqflask/templates/gn_editor.html9
-rw-r--r--gn2/wqflask/templates/gn_editor_commit.html10
-rw-r--r--gn2/wqflask/templates/gn_editor_results_page.html17
-rwxr-xr-xgn2/wqflask/templates/index_page.html2
-rw-r--r--gn2/wqflask/templates/links.html4
-rw-r--r--gn2/wqflask/templates/news.html2
-rw-r--r--gn2/wqflask/templates/policies.html4
-rw-r--r--gn2/wqflask/templates/references.html4
-rw-r--r--gn2/wqflask/templates/search-syntax.html4
14 files changed, 61 insertions, 35 deletions
diff --git a/gn2/wqflask/templates/base.html b/gn2/wqflask/templates/base.html
index 9c4ebfdd..7db9aed6 100644
--- a/gn2/wqflask/templates/base.html
+++ b/gn2/wqflask/templates/base.html
@@ -82,16 +82,16 @@
                         <li class="">
                             <a href="/help" class="dropdow-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Help <span class="caret"></a>
                                 <ul class="dropdown-menu">
-                                    <li><a href="{{ url_for('references_blueprint.references') }}">References</a></li>
+                                    <li><a href="{{ url_for('gn_docs_blueprint.references') }}">References</a></li>
                                     <li><a href="/tutorials">Webinars, Tutorials/Primers</a></li>
-                                    <li><a href="{{ url_for('blogs_blueprint.blogs_list') }}">Blogs</a></li>
-                                    <li><a href="{{ url_for('glossary_blueprint.glossary') }}">Glossary of Term</a></li>
+                                    <li><a href="{{ url_for('gn_docs_blueprint.blogs_list') }}">Blogs</a></li>
+                                    <li><a href="{{ url_for('gn_docs_blueprint.glossary') }}">Glossary of Term</a></li>
                                     <li><a href="http://gn1.genenetwork.org/faq.html">FAQ</a></li>
-                                    <li><a href="{{ url_for('policies_blueprint.policies') }}">Policies</a></li>
-                                    <li><a href="{{ url_for('links_blueprint.links') }}">Links</a></li>
-                                    <li><a href="{{ url_for('facilities_blueprint.facilities') }}">Facilities</a></li>
-                                    <li><a href="{{ url_for('environments_blueprint.environments') }}">Environments</a></li>
-                                    <li><a href="/news">GN1 News</a></li>
+                                    <li><a href="{{ url_for('gn_docs_blueprint.policies') }}">Policies</a></li>
+                                    <li><a href="{{ url_for('gn_docs_blueprint.links') }}">Links</a></li>
+                                    <li><a href="{{ url_for('gn_docs_blueprint.facilities') }}">Facilities</a></li>
+                                    <li><a href="{{ url_for('gn_docs_blueprint.environments') }}">Environments</a></li>
+                                    <li><a href="{{ url_for('gn_docs_blueprint.news') }}">GN1 News</a></li>
                                 </ul>
                         </li>
                         <li class="">
diff --git a/gn2/wqflask/templates/blogs_list.html b/gn2/wqflask/templates/blogs_list.html
index 6bad4628..a74d24a2 100644
--- a/gn2/wqflask/templates/blogs_list.html
+++ b/gn2/wqflask/templates/blogs_list.html
@@ -40,7 +40,7 @@
             <div class="blog_title">
                 <ul>
                     <li>
-                        <a href="{{ url_for('blogs_blueprint.display_blog',blog_path = blog.full_path)}}">{{blog['subtitle']}}</a>
+                        <a href="{{ url_for('gn_docs_blueprint.display_blog',blog_path = blog.full_path)}}">{{blog['subtitle']}}</a>
                     </li>
                 </ul>
             </div>
@@ -49,4 +49,4 @@
         {%endfor%}
     </div>
 </div>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/gn2/wqflask/templates/facilities.html b/gn2/wqflask/templates/facilities.html
index 56b127f9..ee4c84db 100644
--- a/gn2/wqflask/templates/facilities.html
+++ b/gn2/wqflask/templates/facilities.html
@@ -10,7 +10,7 @@
 
  <div class="github-btn-container">
     <div class="github-btn">
-        <a href="https://github.com/genenetwork/gn-docs/blob/master/general/help/facilities.md">
+        <a href="/editor/edit?file-path=general/help/facilities.md">
             Edit Text
             <img src="/static/images/edit.png">
         </a>
@@ -21,4 +21,4 @@
 
 </div>
 
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/gn2/wqflask/templates/generic_gn_docs.html b/gn2/wqflask/templates/generic_gn_docs.html
new file mode 100644
index 00000000..57723f0b
--- /dev/null
+++ b/gn2/wqflask/templates/generic_gn_docs.html
@@ -0,0 +1,14 @@
+{% extends "base.html" %}
+{% block title %}{{ file_title|capitalize }}{% endblock %}
+{% block css %}<link rel="stylesheet" type="text/css" href="/static/new/css/markdown.css" />{% endblock %}
+{% block content %}
+    <div class="github-btn-container">
+        <div class="github-btn">
+            <a href="/editor/edit?file-path={{ file_path }}">
+                Edit Text
+                <img src="/static/images/edit.png">
+            </a>
+        </div>
+    </div>
+    <div id="markdown" class="container">{{ rendered_markdown|safe }}</div>
+{% endblock %}
diff --git a/gn2/wqflask/templates/glossary.html b/gn2/wqflask/templates/glossary.html
index aaee7c5a..4922d39e 100644
--- a/gn2/wqflask/templates/glossary.html
+++ b/gn2/wqflask/templates/glossary.html
@@ -10,7 +10,7 @@
 
 <div class="github-btn-container">
     <div class="github-btn">
-        <a href="https://github.com/genenetwork/gn-docs/blob/master/general/glossary/glossary.md">
+        <a href="/editor/edit?file-path=general/glossary/glossary.md">
             Edit Text
             <img src="/static/images/edit.png">
         </a>
diff --git a/gn2/wqflask/templates/gn_editor.html b/gn2/wqflask/templates/gn_editor.html
index e5c649d1..d89aaf0a 100644
--- a/gn2/wqflask/templates/gn_editor.html
+++ b/gn2/wqflask/templates/gn_editor.html
@@ -157,11 +157,13 @@
       let fileExt =   (filePath.substring(filePath.lastIndexOf('.')+1, filePath.length) || "md").toLowerCase();
       let data = {{ content|tojson }}
 
-      localStorage.setItem("gn_editor_sha" ,hash)
+	localStorage.setItem("gn_editor_sha" ,hash)
+	htmx.on("#output", "updateDataEvent", function(event){
+	  data = editor.getValue()
+	})
       htmx.on("#output", "commitEvent", function(event){
           htmx.ajax("POST", "/editor/commit", {target: "#output", swap:"innerHTML",values: {'msg':event.detail.payload, 'content': editor.getValue(), "hash": localStorage.getItem("gn_editor_sha"), "file_path": filePath}})
-      })
-
+	})
       htmx.on("#output", "diffEvent", function(event){
           var fileName = "{{ file_path }}"
           var diffContent = Diff.createTwoFilesPatch(fileName,fileName, data, editor.getValue())
@@ -186,7 +188,6 @@
 
       htmx.on("#diffBtn","click",function(event){
           //dispatch your event here
-	  console.log("Clicked diff btn here")
 	  htmx.find("#output").dispatchEvent(
           new CustomEvent("diffEvent", {
               bubbles: true,
diff --git a/gn2/wqflask/templates/gn_editor_commit.html b/gn2/wqflask/templates/gn_editor_commit.html
index 84ebd818..2eb3e60c 100644
--- a/gn2/wqflask/templates/gn_editor_commit.html
+++ b/gn2/wqflask/templates/gn_editor_commit.html
@@ -23,15 +23,17 @@
         <br>
         <br>
         <div class="row">
-            <button id="btn-commit" class="btn btn-primary col-lg-3 col-lg-offset-1 col-sm-4 col-sm-offset-1">Commit</button>
-            <button id="btn-diff" class="btn col-lg-3 col-lg-offset-1  col-sm-4 col-sm-offset-1">Show Diff</button>
+            <button id="btn-commit"
+                    class="btn btn-primary col-lg-3 col-lg-offset-1 col-sm-4 col-sm-offset-1">Commit</button>
+            <button id="btn-diff"
+                    class="btn col-lg-3 col-lg-offset-1  col-sm-4 col-sm-offset-1">Show Diff</button>
         </div>
         <br>
         <div id="diff_page"></div>
     </div>
 </section>
 {% block js %}
-    <script>
+<script>
   htmx.on("#btn-commit", "click", function(event){
       let msg = htmx.find("#commit-message").value.trim()
       if (msg != ""){
@@ -51,5 +53,5 @@
           }),
       );
   })
-    </script>
+</script>
 {% endblock %}
diff --git a/gn2/wqflask/templates/gn_editor_results_page.html b/gn2/wqflask/templates/gn_editor_results_page.html
index 666bd432..6eaeb941 100644
--- a/gn2/wqflask/templates/gn_editor_results_page.html
+++ b/gn2/wqflask/templates/gn_editor_results_page.html
@@ -37,10 +37,19 @@
 </section>
 {% block js %}
     <script>
-  var commitSha = "{{ commit_sha }}";
-  if (commitSha !="" && commitSha!= undefined){
-      localStorage.setItem("gn_editor_sha", commitSha)
-  }
+      var commitSha = "{{ commit_sha }}";
+      if (commitSha !="" && commitSha!= undefined){
+	  prev_commit = localStorage.getItem("gn_editor_sha")
+          localStorage.setItem("gn_editor_sha", commitSha)
+	  if (prev_commit !=  commitSha) {
+	      //update the contennt
+      htmx.find("#output").dispatchEvent(
+          new CustomEvent("updateDataEvent", {
+              bubbles: true,
+              detail: {},
+          }),
+      );
+   }}
 
     </script>
 {% endblock %}
diff --git a/gn2/wqflask/templates/index_page.html b/gn2/wqflask/templates/index_page.html
index f0840425..734cd075 100755
--- a/gn2/wqflask/templates/index_page.html
+++ b/gn2/wqflask/templates/index_page.html
@@ -257,7 +257,7 @@
                             Gene Ontology</a>.</li>
 
                         <li><b>RIF=diabetes LRS=(9 999 Chr2 100 105) transLRS=(9 999 10)</b>
-                        finds diabetes-associated transcripts with peak <a href="{{ url_for('glossary_blueprint.glossary') }}#E">
+                        finds diabetes-associated transcripts with peak <a href="{{ url_for('gn_docs_blueprint.glossary') }}#E">
                         trans eQTLs</a> on Chr 2 between 100 and 105 Mb with LRS
                         scores between 9 and 999.</li>
                       </ul>
diff --git a/gn2/wqflask/templates/links.html b/gn2/wqflask/templates/links.html
index 6e91adae..4a134c96 100644
--- a/gn2/wqflask/templates/links.html
+++ b/gn2/wqflask/templates/links.html
@@ -10,7 +10,7 @@
 
 <div class="github-btn-container">
     <div class="github-btn ">
-        <a href="https://github.com/genenetwork/gn-docs/blob/master/general/links/links.md">
+        <a href="/editor/edit?file-path=general/links/links.md">
             Edit Text
             <img src="/static/images/edit.png">
         </a>
@@ -21,4 +21,4 @@
    {{ rendered_markdown|safe }}
 
 </div>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/gn2/wqflask/templates/news.html b/gn2/wqflask/templates/news.html
index a615564b..df8e02ef 100644
--- a/gn2/wqflask/templates/news.html
+++ b/gn2/wqflask/templates/news.html
@@ -10,7 +10,7 @@
 
  <div class="github-btn-container">
     <div class="github-btn">
-        <a href="https://github.com/genenetwork/gn-docs/blob/master/general/news/news.md">
+        <a href="/editor/edit?file-path=general/news/news.md">
             Edit Text
             <img src="/static/images/edit.png">
         </a>
diff --git a/gn2/wqflask/templates/policies.html b/gn2/wqflask/templates/policies.html
index e36c9e08..d7b0e3f9 100644
--- a/gn2/wqflask/templates/policies.html
+++ b/gn2/wqflask/templates/policies.html
@@ -10,7 +10,7 @@
 
  <div class="github-btn-container">
     <div class="github-btn ">
-        <a href="https://github.com/genenetwork/gn-docs/blob/master/general/policies/policies.md">
+        <a href="/editor/edit?file-path=general/policies/policies.md">
             Edit Text
             <img src="/static/images/edit.png">
         </a>
@@ -20,4 +20,4 @@
    {{ rendered_markdown|safe }}
 
 </div>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/gn2/wqflask/templates/references.html b/gn2/wqflask/templates/references.html
index 04e60361..d858e10f 100644
--- a/gn2/wqflask/templates/references.html
+++ b/gn2/wqflask/templates/references.html
@@ -6,7 +6,7 @@
 {% block content %}
 <div class="github-btn-container">
     <div class="github-btn">
-        <a href="https://github.com/genenetwork/gn-docs/blob/master/general/references/references.md">
+        <a href="/editor/edit?file-path=general/references/references.md">
             Edit Text
             <img src="/static/images/edit.png">
         </a>
@@ -16,4 +16,4 @@
     {{ rendered_markdown|safe }}
 </div>
 
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/gn2/wqflask/templates/search-syntax.html b/gn2/wqflask/templates/search-syntax.html
index 52538826..e4ab7907 100644
--- a/gn2/wqflask/templates/search-syntax.html
+++ b/gn2/wqflask/templates/search-syntax.html
@@ -10,7 +10,7 @@
 
  <div class="github-btn-container">
     <div class="github-btn">
-        <a href="https://github.com/genenetwork/gn-docs/blob/master/general/search/xapian_syntax.md">
+        <a href="/editor/edit?file-path=general/search/xapian_syntax.md">
             Edit Text
             <img src="/static/images/edit.png">
         </a>
@@ -21,4 +21,4 @@
 
 </div>
 
-{% endblock %}
\ No newline at end of file
+{% endblock %}