This commit is contained in:
syuilo 2017-02-25 14:45:43 +09:00
parent c338c1b844
commit 8cf95522aa
2 changed files with 24 additions and 11 deletions

View file

@ -1,14 +1,25 @@
<mk-post-detail-sub title={ title }><a class="avatar-anchor" href={ CONFIG.url + '/' + post.user.username }><img class="avatar" src={ post.user.avatar_url + '?thumbnail&size=64' } alt="avatar" data-user-preview={ post.user_id }/></a> <mk-post-detail-sub title={ title }>
<a class="avatar-anchor" href={ CONFIG.url + '/' + post.user.username }>
<img class="avatar" src={ post.user.avatar_url + '?thumbnail&size=64' } alt="avatar" data-user-preview={ post.user_id }/>
</a>
<div class="main"> <div class="main">
<header> <header>
<div class="left"><a class="name" href={ CONFIG.url + '/' + post.user.username } data-user-preview={ post.user_id }>{ post.user.name }</a><span class="username">@{ post.user.username }</span></div> <div class="left">
<div class="right"><a class="time" href={ url }> <a class="name" href={ CONFIG.url + '/' + post.user.username } data-user-preview={ post.user_id }>{ post.user.name }</a>
<mk-time time={ post.created_at }></mk-time></a></div> <span class="username">@{ post.user.username }</span>
</div>
<div class="right">
<a class="time" href={ url }>
<mk-time time={ post.created_at }></mk-time>
</a>
</div>
</header> </header>
<div class="body"> <div class="body">
<div class="text" ref="text"></div> <div class="text" ref="text"></div>
<div class="media" if={ post.media }> <div class="media" if={ post.media }>
<virtual each={ file in post.media }><img src={ file.url + '?thumbnail&size=512' } alt={ file.name } title={ file.name }/></virtual> <virtual each={ file in post.media }>
<img src={ file.url + '?thumbnail&size=512' } alt={ file.name } title={ file.name }/>
</virtual>
</div> </div>
</div> </div>
</div> </div>
@ -115,10 +126,10 @@
this.title = this.dateStringify(this.post.created_at); this.title = this.dateStringify(this.post.created_at);
this.on('mount', () => { this.on('mount', () => {
if (this.p.text) { if (this.post.text) {
const tokens = this.analyze(this.p.text); const tokens = this.analyze(this.post.text);
this.refs.text.innerHTML = this.refs.text.innerHTML.replace('<p class="dummy"></p>', this.compile(tokens)); this.refs.text.innerHTML = this.compile(tokens);
this.refs.text.children.forEach(e => { this.refs.text.children.forEach(e => {
if (e.tagName == 'MK-URL') riot.mount(e); if (e.tagName == 'MK-URL') riot.mount(e);

View file

@ -41,8 +41,10 @@
<virtual each={ file in p.media }><img src={ file.url + '?thumbnail&size=512' } alt={ file.name } title={ file.name }/></virtual> <virtual each={ file in p.media }><img src={ file.url + '?thumbnail&size=512' } alt={ file.name } title={ file.name }/></virtual>
</div> </div>
<mk-poll if={ p.poll } post={ p }></mk-poll> <mk-poll if={ p.poll } post={ p }></mk-poll>
</div><a class="time" href={ url }> </div>
<mk-time time={ p.created_at } mode="detail"></mk-time></a> <a class="time" href={ url }>
<mk-time time={ p.created_at } mode="detail"></mk-time>
</a>
<footer> <footer>
<button onclick={ reply } title="返信"><i class="fa fa-reply"></i> <button onclick={ reply } title="返信"><i class="fa fa-reply"></i>
<p class="count" if={ p.replies_count > 0 }>{ p.replies_count }</p> <p class="count" if={ p.replies_count > 0 }>{ p.replies_count }</p>
@ -82,7 +84,7 @@
</article> </article>
<div class="replies"> <div class="replies">
<virtual each={ post in replies }> <virtual each={ post in replies }>
<mk-post-detail-sub post={ post }></mk-post-detail-sub> <mk-post-preview post={ post }></mk-post-preview>
</virtual> </virtual>
</div> </div>
</div> </div>