Browse Source

implement tags

pull/1/head
wes 8 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"> <div class="card-header">
<h2 class="card-title"> <h2 class="card-title">
{ result[1].title } by { result[1].author } { result[1].title }
</h2> </h2>
</div> </div>
<div class="card-body"> <div class="card-body">

3
src/scripts/editor.tag

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

4
src/website.py

@ -230,14 +230,14 @@ def NeverWhere(configfile=None):
author = request.form.get("author", "no author") author = request.form.get("author", "no author")
title = request.form.get("title", "no title") title = request.form.get("title", "no title")
content = request.form.get("content", "no content") 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) postid = request.form.get("_id", False)
post = { post = {
"author" : author, "author" : author,
"title" : title, "title" : title,
"content" : content, "content" : content,
"categories" : category, "categories" : tags,
"_id" : postid "_id" : postid
} }

Loading…
Cancel
Save