11 changed files with 176 additions and 27 deletions
@ -0,0 +1,6 @@ |
|||||
|
default: |
||||
|
sass blog.scss > styles/blog.min.css |
||||
|
riot tags/ scripts/tags.js |
||||
|
|
||||
|
watch: |
||||
|
while true; do make ; inotifywait -qre close_write .; done |
@ -0,0 +1,21 @@ |
|||||
|
.post-text { |
||||
|
text-align: center; |
||||
|
} |
||||
|
|
||||
|
.blog-title { |
||||
|
@extend .post-text; |
||||
|
} |
||||
|
|
||||
|
.post { |
||||
|
@extend .post-text; |
||||
|
} |
||||
|
|
||||
|
.post-content { |
||||
|
max-width: 50%; |
||||
|
text-align: justify; |
||||
|
} |
||||
|
|
||||
|
.comments { |
||||
|
margin-top: 5%; |
||||
|
max-width: 30%; |
||||
|
} |
@ -0,0 +1,5 @@ |
|||||
|
riot.mount("post", |
||||
|
{ |
||||
|
"creator" : "wes", |
||||
|
"title" : "A cool post here" |
||||
|
}); |
@ -0,0 +1,41 @@ |
|||||
|
riot.tag2('comments', '<textarea class="form-input comments centered" name="textarea" rows="10" cols="50"> Comment here! </textarea>', '', '', function(opts) { |
||||
|
}); |
||||
|
|
||||
|
riot.tag2('post', '<div class="post centered"> <h4>{opts.title}</h4> <h5>By {opts.creator}</h5> <p class="post-content centered text-break">{content}</p> <comments> </comments> <button onclick="{prev}">Previous Post</button> <button onclick="{next}">Next Post</button> </div>', '', '', function(opts) { |
||||
|
var self = this; |
||||
|
this.pid = 1; |
||||
|
content = ""; |
||||
|
|
||||
|
this.prev = function() { |
||||
|
if (self.pid > 0) { |
||||
|
self.pid--; |
||||
|
self.setPost(self.pid); |
||||
|
self.update(); |
||||
|
} |
||||
|
}.bind(this) |
||||
|
|
||||
|
this.next = function() { |
||||
|
self.pid++; |
||||
|
self.setPost(self.pid); |
||||
|
self.update(); |
||||
|
}.bind(this) |
||||
|
|
||||
|
this.setPost = function(pid) { |
||||
|
fetch("/switchpost/"+pid) |
||||
|
.then( |
||||
|
function(resp) { |
||||
|
return resp.text(); |
||||
|
}) |
||||
|
.then( |
||||
|
function(body) { |
||||
|
self.content = R.join(" ")(R.repeat(body, 20)); |
||||
|
self.update(); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
this.on("mount", function() { this.setPost(self.pid) }); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
riot.tag2('posts', '<yield></yield>', '', '', function(opts) { |
||||
|
}); |
@ -0,0 +1,10 @@ |
|||||
|
.post-text, .blog-title, .post { |
||||
|
text-align: center; } |
||||
|
|
||||
|
.post-content { |
||||
|
max-width: 50%; |
||||
|
text-align: justify; } |
||||
|
|
||||
|
.comments { |
||||
|
margin-top: 5%; |
||||
|
max-width: 30%; } |
File diff suppressed because one or more lines are too long
@ -0,0 +1,8 @@ |
|||||
|
<comments> |
||||
|
<textarea class="form-input comments centered" |
||||
|
name="textarea" |
||||
|
rows="10" |
||||
|
cols="50"> |
||||
|
Comment here! |
||||
|
</textarea> |
||||
|
</comments> |
@ -0,0 +1,48 @@ |
|||||
|
<post> |
||||
|
<div class="post centered"> |
||||
|
<h4>{ opts.title }</h4> |
||||
|
<h5>By { opts.creator }</h5> |
||||
|
<p class="post-content centered text-break">{ content }</p> |
||||
|
<comments> |
||||
|
</comments> |
||||
|
<button onclick={prev}>Previous Post</button> |
||||
|
<button onclick={next}>Next Post</button> |
||||
|
</div> |
||||
|
|
||||
|
<script> |
||||
|
var self = this; |
||||
|
this.pid = 1; |
||||
|
content = ""; |
||||
|
|
||||
|
prev() { |
||||
|
if (self.pid > 0) { |
||||
|
self.pid--; |
||||
|
self.setPost(self.pid); |
||||
|
self.update(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
next() { |
||||
|
self.pid++; |
||||
|
self.setPost(self.pid); |
||||
|
self.update(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
this.setPost = function(pid) { |
||||
|
fetch("/switchpost/"+pid) |
||||
|
.then( |
||||
|
function(resp) { |
||||
|
return resp.text(); |
||||
|
}) |
||||
|
.then( |
||||
|
function(body) { |
||||
|
self.content = R.join(" ")(R.repeat(body, 20)); |
||||
|
self.update(); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
this.on("mount", function() { this.setPost(self.pid) }); |
||||
|
|
||||
|
</script> |
||||
|
</post> |
@ -0,0 +1,3 @@ |
|||||
|
<posts> |
||||
|
<yield/> |
||||
|
</posts> |
Loading…
Reference in new issue