diff --git a/src/posts.py b/src/posts.py
index 350092d..d5a2d40 100644
--- a/src/posts.py
+++ b/src/posts.py
@@ -7,6 +7,7 @@ from werkzeug.local import Local, LocalProxy, LocalManager
from couchdb.http import ResourceConflict, ResourceNotFound
from flask import jsonify, g
from flask_marshmallow import Marshmallow
+from itertools import chain
def get_mistune():
markdown = getattr(g, "markdown", None)
@@ -128,16 +129,14 @@ class Posts:
return jsonify(False)
def categories(self):
- return jsonify(
- [
+ return list(set(chain.from_iterable([
c["key"][1] for c in
self.db.view("blogPosts/categories",
- startkey=["category"],
- endkey=["category", {}],
+ startkey=["categories"],
+ endkey=["categories", {}],
inclusive_end=False,
reduce=True,
group_level=2,
group=True)
- ]
- )
+ ])))
diff --git a/src/scripts/app.tag b/src/scripts/app.tag
index 28ff20b..d0a2fd0 100644
--- a/src/scripts/app.tag
+++ b/src/scripts/app.tag
@@ -19,7 +19,7 @@
title author @@ -42,7 +52,7 @@ onblur={checkplaceholder} oninput={echo} rows="10" - cols="10" + cols="30" __disabled={""} class="editor form-input centered" ref="textarea"> diff --git a/src/scripts/post.tag b/src/scripts/post.tag index 90f4d6b..dc3021d 100644 --- a/src/scripts/post.tag +++ b/src/scripts/post.tag @@ -29,6 +29,7 @@
+