Browse Source

Oops added library.html file!

Nathan Schneider 4 years ago
parent
commit
dbbfc326f9
1 changed files with 54 additions and 0 deletions
  1. 54 0
      _layouts/library.html

+ 54 - 0
_layouts/library.html

@@ -0,0 +1,54 @@
+---
+layout: default
+---
+
+<style type="text/css">
+  #rulename {
+      font-size: 1.2em;
+  }
+</style>
+
+<script>
+  function printLibrary() {
+      const store = new SteinStore(
+          "https://api.steinhq.com/v1/storages/5e8b937ab88d3d04ae0816a5"
+      );
+      var rules = "";
+      store.read("rules", { limit: 0, offset: 0 }).then(data => {
+          console.log(data);
+          rules = data.reverse();
+          libHTML = "";
+          for (var i = 0; i < rules.length; i++) {
+              var title = rules[i]["communityname"]
+              if (title == null) { title = "Untitled"; }
+              libHTML += "<h2 id='rulename'>" +
+                  "<a href='/create/?r=" + rules[i]["ruleID"] + "'>" +
+                  title + "</a></h2>\n";
+              libHTML += "<p>" + rules[i]["structure"] + "</p>\n\n";
+          }
+          document.getElementById("libraryList").innerHTML = libHTML;
+      });
+  }
+
+  window.onload = function() {
+      printLibrary();
+  }
+</script>
+
+
+<article class="post">
+
+  <header class="post-header">
+    <h1 class="post-title">{{ page.title }}</h1>
+  </header>
+
+  <div class="post-content">
+    {{ content }}
+
+<hr /><br />
+    
+    <div id="libraryList">
+    </div>    
+  </div>
+
+</article>