Browse Source

implement tags

pull/1/head
wes 7 years ago
parent
commit
5ac5c018ef
  1. 2
      src/scripts/browse.tag
  2. 3
      src/scripts/editor.tag
  3. 4
      src/website.py

2
src/scripts/browse.tag

@ -57,7 +57,7 @@
>
<div class="card-header">
<h2 class="card-title">
{ result[1].title } by { result[1].author }
{ result[1].title }
</h2>
</div>
<div class="card-body">

3
src/scripts/editor.tag

@ -33,6 +33,7 @@
<p>
<span>title</span><input ref="title">
<span>author</span><input ref="author"></input>
<span>tags</span><input ref="tags"></input>
<span>Editing post {!this.isNewPost ? this._id : ""}</span>
<p>
<button
@ -173,6 +174,7 @@ self.submit = () => {
"title" : this.refs.title.value,
"author" : this.refs.author.value,
"content" : this.refs.textarea.value,
"tags" : this.refs.tags.value,
"csrf_token" : this.opts.csrf_token
};
@ -229,6 +231,7 @@ self.loadPost = (_id) => {
self.refs.textarea.value = resp.data.content;
self.refs.title.value = resp.data.title;
self.refs.author.value = resp.data.author;
self.refs.tags.value = resp.data.categories;
self._id = resp.data._id;
self.focused = true;
self.isNewPost = false;

4
src/website.py

@ -230,14 +230,14 @@ def NeverWhere(configfile=None):
author = request.form.get("author", "no author")
title = request.form.get("title", "no title")
content = request.form.get("content", "no content")
category = request.form.get("categories", ["programming"])
tags = [t for t in request.form.get("tags", "programming").split(",") if t]
postid = request.form.get("_id", False)
post = {
"author" : author,
"title" : title,
"content" : content,
"categories" : category,
"categories" : tags,
"_id" : postid
}

Loading…
Cancel
Save