54 lines
2.3 KiB
Plaintext
54 lines
2.3 KiB
Plaintext
<div class="content">
|
|
<div class="article-image">
|
|
<img alt={article.title} src={`/a/${article.image}`}>
|
|
</div>
|
|
<div class="article-meta">
|
|
<h1 class="article-title">{article.title}</h1>
|
|
<blockquote>
|
|
<p>Author: <img class="avatar" alt={article.author.realname} src={`/u/${article.author.avatar || 'default.jpg'}`}> <strong>{article.author.realname}</strong></p>
|
|
<p>Category: <strong><a href={`/c/${article.category.slug}`}>{article.category.name}</a></strong></p>
|
|
<p>Published: <strong>{new Date(article.created_at).toLocaleString()}</strong></p>
|
|
{#if article.updated_at}
|
|
<p>Last Updated: <strong>{new Date(article.updated_at).toLocaleString()}</strong></p>
|
|
{/if}
|
|
<p>Views: <strong>{article.views}</strong></p>
|
|
</blockquote>
|
|
</div>
|
|
<div class="article-content">
|
|
{@html article.html}
|
|
</div>
|
|
<hr>
|
|
<h3>Comments</h3>
|
|
<div class="comments">
|
|
{#each comments as comment}
|
|
<div class="comment">
|
|
{#if comment.author_user}
|
|
<img class="avatar" alt={comment.author_user.realname} src={`/u/${comment.author_user.avatar || 'default.jpg'}`}>
|
|
{/if}
|
|
<p class="comment-meta">
|
|
{#if comment.author_user}
|
|
<span class="comment-username">{comment.author_user.realname}</span> <span class="comment-verified">(verified)</span> - {new Date(comment.created_at).toLocaleString()}
|
|
{:else}
|
|
<span class="comment-username">{comment.author}</span> - {new Date(comment.created_at).toLocaleString()}
|
|
{/if}
|
|
</p>
|
|
<div class="comment-content">{comment.content}</div>
|
|
</div>
|
|
{:else}
|
|
<p>No comments.</p>
|
|
{/each}
|
|
</div>
|
|
<h3>Add a Comment</h3>
|
|
<form method="POST" action={`/a/${article.slug}/comments`}>
|
|
<p>Name:
|
|
{#if $session.user}
|
|
<input type="text" disabled value={$session.user.realname}>
|
|
{:else}
|
|
<input type="text" bind:value={author} name="author" maxlength="100" placeholder="Anonymous">
|
|
{/if}
|
|
</p>
|
|
<p><textarea name="content" bind:value={content} maxlength="5000"></textarea></p>
|
|
<p><button type="submit" on:click|preventDefault={postComment}>Submit</button></p>
|
|
</form>
|
|
</div>
|