Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support post tags, auto generate TOC by tag #20

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions css/ZeroBlog.css
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ blockquote { border-left: 3px solid #333; margin-left: 0px; padding-left: 1em }
.pager a { border: 2px solid #333; padding: 10px 20px; font-size: 15px; display: none; transition: all 0.3s }
.pager a:hover { color: white; box-shadow: inset 150px 0px 0px 0px #333; }
.pager a:active { color: white; box-shadow: inset 150px 0px 0px 0px #AF3BFF; transition: none; border-color: #AF3BFF }
.pager .next { float: right }
.pager .prev:hover { box-shadow: inset -150px 0px 0px 0px #333; }
.pager .prev:active { box-shadow: inset -150px 0px 0px 0px #AF3BFF; }

.pager .currentpage:hover{}
.pager .currentpage { color: white; box-shadow: inset 150px 0px 0px 0px #AF3BFF; transition: none; border-color: #AF3BFF }
.pager .pagershow {display:inline-block; margin:1px}
/* Score */
/*
.score {
Expand Down
11 changes: 10 additions & 1 deletion dbschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"to_keyvalue": [ "cert_user_id" ]
},
"data.json": {
"to_table": [ "post" ],
"to_table": [ "post" ,"tag"],
"to_keyvalue": [ "title", "description", "links", "next_post_id", "demo", "modified" ]
}

Expand Down Expand Up @@ -51,6 +51,15 @@
"indexes": ["CREATE UNIQUE INDEX post_uri ON post(json_id, post_id)", "CREATE INDEX post_id ON post(post_id)"],
"schema_changed": 1426195823
},
"tag": {
"cols":[
["value","TEXT NOT NULL CHECK(length(value)!=0)"],
["post_id","REFERENCES post(post_id)"],
["json_id", "INTEGER REFERENCES json (json_id)"]
],
"indexes": ["CREATE UNIQUE INDEX tag_post_uri ON tag(value,post_id)"],
"schema_changed": 1426195822
},
"post_vote": {
"cols": [
["post_id", "INTEGER"],
Expand Down
17 changes: 13 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ <h1><a href="?Home" class="nolink" data-editable="title" data-editable-mode="sim
<h2 data-editable="description"></h2>
<a href="#Follow" class="feed-follow"><span class='text-follow'>Follow in Newsfeed</span><span class='text-following'>Following</span><div class="icon-feed"></div></a>
<hr>
<a href="?Toc=dateDesc">TOC by date</a>
<br>
<a href="?Toc=tagAll">TOC by tag</a>
<hr>
<div class="links" data-editable="links"></div>

<!-- Last comments -->
Expand Down Expand Up @@ -84,7 +88,7 @@ <h3>Latest comments:</h3>

<!-- Template: post -->
<div class="post template" data-object="Post:23" data-deletable="True">
<h1 class="title"><a href="?Post:23:Title" data-editable="title" data-editable-mode="simple" class="editable">Title</a></h1>
<h1 class="title"><a href="#" data-editable="title" data-editable-mode="simple" class="editable">Title</a></h1>
<div class="details">
<span class="published" data-editable="date_published" data-editable-mode="timestamp">21 hours ago &middot; 2 min read</span>
<a href="?Post:23:title" class="comments-num">&middot; <div class="icon-comment"></div> <span class="num">3 comments</span></a>
Expand All @@ -93,6 +97,8 @@ <h1 class="title"><a href="?Post:23:Title" data-editable="title" data-editable-m
<span class="score-inactive"> <span class="icon-up">^</span><span class="score-num">0</span> </span>
<span class="score-active"> <span class="icon-up">^</span><span class="score-num">1</span> </span>
</a>-->
<br>
<span class="tag" data-editable="tag" data-editable-mode="simple">tag: </span>
</div>
<div class="body" data-editable="body">Body</div>
<a class="more" href="#"><span class='readmore'>Read more</span> →</a>
Expand All @@ -104,10 +110,12 @@ <h1 class="title"><a href="?Post:23:Title" data-editable="title" data-editable-m

<!-- Single Post show -->
<div class="post post-full" data-object="Post:23" data-deletable="True">
<h1 class="title"><a href="?Post:23:Title" data-editable="title" data-editable-mode="simple" class="editable">Title</a></h1>
<h1 class="title"><a href="#" data-editable="title" data-editable-mode="simple" class="editable">Title</a></h1>
<div class="details">
<span class="published" data-editable="date_published" data-editable-mode="timestamp">21 hours ago &middot; 2 min read</span>
<a href="#Like" class="like" title="Like this post"><div class="icon-heart"></div><div class="icon-heart icon-heart-anim"></div> <span class="num"></span></a>
<br>
<span class="tag" data-editable="tag" data-editable-mode="simple">tag: </span>
</div>

<div class="body" data-editable="body"></div>
Expand Down Expand Up @@ -152,8 +160,9 @@ <h2 id="Comments">0 Comments:</h2>

<!-- Pager -->
<div class="pager">
<a class="prev" href="#">← <span>Prev page</span></a>
<a class="next" href="#"><span>Next page</span> →</a>
<a class="first" href="?page=1">&lt;&lt;</a>
<a class="currentpage" href="javascript:void"></a>
<a class="last" href="#">&gt;&gt;</a>
</div>
<!-- EOF Pager -->

Expand Down
Loading