Browse Source

tweak loading

pull/1/head
wes 8 years ago
parent
commit
e7c99fe4fe
  1. 12
      build/scripts/riotblog.min.js
  2. 15
      src/scripts/post.tag
  3. 2
      src/scripts/postcontrols.tag

12
build/scripts/riotblog.min.js

File diff suppressed because one or more lines are too long

15
src/scripts/post.tag

@ -5,17 +5,11 @@
if={this.swipe} if={this.swipe}
class={`animated ${this.transition}`} class={`animated ${this.transition}`}
> >
<div if={this.nomore}>
<h4>No more posts!</h4>
</div>
<div if={!this.nomore}>
<h4>{ this.title }</h4> <h4>{ this.title }</h4>
<h5>Posted by { this.author }</h5> <h5>Posted by { this.author }</h5>
<p class="post-content centered text-break"> <p class="post-content centered text-break">
{ this.content } { this.content }
</p> </p>
</div>
<div class="divider"></div> <div class="divider"></div>
</div> </div>
</div> </div>
@ -78,8 +72,7 @@ next(ev) {
} }
setPost(pid, transition) { setPost(pid, transition) {
this.opts.state.pid = pid; fetch(`/blog/switchpost/${pid-1}`)
fetch(`/blog/switchpost/${this.opts.state.pid-1}`)
.then((resp) => resp.text()) .then((resp) => resp.text())
.then( .then(
(body) => { (body) => {
@ -87,8 +80,6 @@ setPost(pid, transition) {
self.nomore = true; self.nomore = true;
self.prevloading = ""; self.prevloading = "";
self.nextloading = ""; self.nextloading = "";
self.swipe = true;
self.transition = transition;
self.update() self.update()
return; return;
} }
@ -99,10 +90,12 @@ setPost(pid, transition) {
self.nextloading = ""; self.nextloading = "";
self.nomore = true; self.nomore = true;
self.swipe = true; self.swipe = true;
self.transition = transition; self.transition = "";
self.opts.state.pid--;
self.update(); self.update();
return; return;
} }
self.opts.state.pid = pid;
self.author = postcontent[0].doc.author[0]; self.author = postcontent[0].doc.author[0];
self.content = postcontent[0].doc.content[0]; self.content = postcontent[0].doc.content[0];
self.title = postcontent[0].doc.title[0]; self.title = postcontent[0].doc.title[0];

2
src/scripts/postcontrols.tag

@ -1,5 +1,5 @@
<postcontrols> <postcontrols>
<div class="container centered"> <div class="container">
<div class="columns"> <div class="columns">
<div class="column col-6"> <div class="column col-6">
<button class={"btn btn-lg nav-button float-right " + (this.opts.state.pid <= 1 ? "disabled" : " ") + this.opts.prevloading} <button class={"btn btn-lg nav-button float-right " + (this.opts.state.pid <= 1 ? "disabled" : " ") + this.opts.prevloading}

Loading…
Cancel
Save