Browse Source

updates

pull/1/head
wes 7 years ago
parent
commit
e05c5e8121
  1. 3
      fabfile.py
  2. 22
      src/comment.py
  3. 9
      src/scripts/comment.tag
  4. 23
      src/scripts/comments.tag
  5. 14
      src/scripts/decision.tag
  6. 8
      src/scripts/post.tag
  7. 5
      src/scripts/riotblog.js
  8. 6
      src/styles/riotblog.scss
  9. 2
      src/styles/spectre.min.css
  10. 19
      src/templates/decisions.html
  11. 2
      src/templates/index.html
  12. 8
      src/templates/write.html
  13. 11
      src/website.py

3
fabfile.py

@ -72,9 +72,10 @@ def update():
@task
def locbuild():
local("rm -rf ./build")
local("mkdir -p build/{scripts,styles}")
local("cp requirements.txt ./build/requirements.txt")
#buildLocalVenv()
buildLocalVenv()
buildScss()
buildJS()
copyFiles()

22
src/comment.py

@ -1,7 +1,13 @@
from json import dumps
def comment(author, title, text):
from random import randint
from time import time
def comment(author, title, text, t):
return {
"time" : t,
"id" : randint(1,2**32-1),
"title" : title,
"author" : author,
"text" : text
@ -11,14 +17,14 @@ def comment(author, title, text):
testcomments = {
1 : dumps(
[
comment("Anonymous Coward 0", "Some comment?", "super duper awesome comment here"),
comment("Anonymous Coward 1", "Something? IDEK", "super duper worse comment here"),
comment("Anonymous Coward 2", "Some other comment?", "super duper dang terrible comment here")
comment("Person 1", "Two", "A Comment here", 1),
comment("Person 2", "One", "Some other comment", 2),
comment("Person 3", "Three", "My opinion is correct", 3)
]),
2 : dumps(
[
comment("Anonymous Coward 3", "Some comment?", "super duper awesome comment here"),
comment("Anonymous Coward 4", "Something? IDEK", "super duper worse comment here"),
comment("Anonymous Coward 5", "Some other comment?", "super duper dang terrible comment here")
])
comment("Person 1", "Two", "A cool terrible Comment here", 1),
comment("Person 2", "One", "Some other awful comment", 2),
comment("Person 3", "Three", "My opinion is not correct", 3)
])
}

9
src/scripts/comment.tag

@ -2,15 +2,16 @@
<div class="comment centered">
<div class="card">
<div class="card-header">
<h4 class="card-title">{title} by {author}</h4>
<h4 class="card-title">Comment posted by {author}</h4>
</div>
<div class="card-body comment-body">
{R.join(" ")(R.repeat(text, 20))}
{ text }
</div>
<button if={delete !== undefined} onclick={delete} class="btn">
Delete this comment
</button>
</div>
</div>
<script>
import { default as R } from 'ramda';
this.R = R;
</script>
</comment>

23
src/scripts/comments.tag

@ -1,6 +1,6 @@
<comments>
<div if={loading} class="loading comments-loader"></div>
<comment if={!loading} each={this.comments} data="{this}"></comment>
<comment if={!loading} each={R.sortBy(R.prop("time"), R.values(this.comments))} data="{this}"></comment>
<textarea onfocus={clearplaceholder}
onblur={checkplaceholder}
oninput={echo}
@ -12,6 +12,9 @@
maxlength={this.maxlength}>
{ placeholder }
</textarea>
<button onclick={submit} class="btn comment-submit">
Submit Comment
</button>
<div if={this.warn} class="toast toast-danger maxwarn centered">
<button
onclick={this.closewarning}
@ -21,11 +24,13 @@
</div>
<script>
import 'whatwg-fetch';
import { default as R } from 'ramda';
this.R = R;
this.comments = [];
this.maxlength = 700;
this.placeholder = "Comment here!";
this.placeholder = "Comment on this post";
this.focused = false;
this.maxed = "";
this.warn = false;
@ -80,14 +85,26 @@ getComments(pid) {
})
.then(
function(body) {
var parsed =JSON.parse(body);
parsed.map(function(comment) { self.comments[comment["id"]] = comment; } );
self.update();
self.update(
{
"comments" : JSON.parse(body),
"loading" : false
});
});
}
submit() {
var id = Math.random();
this.comments[id] = {
"author" : "name",
"text" : this.refs.textarea.value,
"delete" : (() => { delete self.comments[id]; self.update(); })
};
this.update();
}
this.on("mount",
function() {
this.getComments(self.opts.pid);

14
src/scripts/decision.tag

@ -0,0 +1,14 @@
<decision>
<h1 class="blog-title">IDK What this would do</h1>
<h2 class="blog-title">Complete the current step before moving ahead</h2>
<ul class="step">
<li each={steps} data={this} class={"step-item"+ (active ? " active" : "")}>
<a href="#" class="tooltip" data-tooltip={stepname}>{stepname}</a>
</li>
</ul>
<script>
this.steps = [];
</script>
</decision>

8
src/scripts/post.tag

@ -10,8 +10,10 @@
<div if={!(this.loading || this.nomore)} class="post centered">
<h4>{ opts.title }</h4>
<h5>By { opts.creator }</h5>
<p class="post-content centered text-break">{ this.content }</p>
<h5>Posted by { opts.creator }</h5>
<p class="post-content centered text-break">
{ this.content }
</p>
<div class="divider"></div>
<comments pid={this.pid}>
@ -76,7 +78,7 @@ setPost(pid) {
self.update()
}
else {
self.content = R.join(" ")(R.repeat(body, 20));
self.content = body;
route(`/${pid}`);
}

5
src/scripts/riotblog.js

@ -4,11 +4,12 @@ import './comment.tag';
import './bbutton.tag';
import './post.tag';
import './posts.tag';
import "./decision.tag";
riot.mount("post",
{
"creator" : "wes",
"title" : "A cool post here"
"creator" : "author"
});
riot.mount("decision");
riot.mount("bbutton");

6
src/styles/riotblog.scss

@ -1,7 +1,11 @@
.post-text, .blog-title, .post, .postnav {
.post-text, .ltb-title, .post, .postnav {
text-align: center;
}
.comment-submit {
margin-top: 10px;
}
.post-content {
max-width: 50%;
text-align: justify;

2
src/styles/spectre.min.css

File diff suppressed because one or more lines are too long

19
src/templates/decisions.html

@ -0,0 +1,19 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
<meta name="viewport" content="width=device-width, initial-scale=1">
<header class="text-center nav navbar">
<section class="centered page-top navbar-section">
</section>
</header>
<html>
<body>
<decision>
</decision>
<footer class="footer">
</footer>
<link rel="stylesheet" href="/blog/styles/spectre.min.css">
<link rel="stylesheet" href="/blog/styles/blog.min.css">
<script type="text/javascript" src="/blog/scripts/blog.min.js"></script>
</body>
</html>

2
src/templates/index.html

@ -2,7 +2,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<header class="text-center nav navbar">
<section class="centered page-top navbar-section">
<h1 class="blog-title">nowhere</h1>
<h1 class="blog-title">blog title</h1>
</section>
</header>

8
src/templates/write.html

@ -22,17 +22,13 @@
{% block styles %}
<link rel="stylesheet" href="/blog/styles/spectre.min.css">
<link rel="stylesheet" href="/blog/styles/riotblog.min.css">
<link rel="stylesheet" href="/blog/styles/blog.min.css">
{% endblock %}
{% block scripts %}
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/fetch/1.0.0/fetch.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/ramda/0.22.1/ramda.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/riot/2.6.7/riot+compiler.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/riot-route/3.0.2/route.min.js"></script>
<script type="text/javascript" src="/blog/scripts/tags.min.js"></script>
<script type="text/javascript" src="/blog/scripts/riotblog.min.js"></script>
<script type="text/javascript" src="/blog/scripts/blog.min.js"></script>
{% endblock %}
</body>

11
src/website.py

@ -17,7 +17,7 @@ cache = MemcachedCache(['127.0.0.1:11211'])
import os
from posts import Posts
posts = Posts()
#posts = Posts()
def cacheit(key, thunk):
"""
@ -43,6 +43,11 @@ def NeverWhere(configfile=None):
#return send_from_directory("/srv/http/goal/favicon.ico",
#'favicon.ico', mimetype='image/vnd.microsoft.icon')
@app.route("/blog/decision/", methods=("GET", "POST"))
def decision():
print("matched decision")
return render_template("decisions.html")
@app.route("/blog/", methods=("GET", "POST"))
def index():
print("matched index")
@ -60,8 +65,8 @@ def NeverWhere(configfile=None):
@app.route("/blog/switchpost/<pid>")
def switchPost(pid):
posts = {
"1" : "Post one is now changed as before! ",
"2" : "Post two here and it's changed again and again! "
"1" : "post 1",
"2" : "post 2"
}
return posts.get(pid, "false")

Loading…
Cancel
Save