story.html (3107B)
1 <div class="story-page"> 2 <article class="story-full"> 3 <div class="story-header"> 4 <div class="story-vote"> 5 <span id="vote-story-{{ story.id }}"> 6 {% if is_logged_in %} 7 <button 8 class="vote-btn{% if story.user_voted %} voted{% endif %}" 9 data-on:click="@post('/vote/story/{{ story.id }}')" 10 >▲</button> 11 {% else %} 12 <span class="vote-placeholder">▲</span> 13 {% endif %} 14 </span> 15 </div> 16 <div class="story-content"> 17 <h1 class="story-title-full"> 18 {% match story.url %} 19 {% when Some with (url) %} 20 <a href="{{ url }}" rel="nofollow">{{ story.title }}</a> 21 {% match story.domain %} 22 {% when Some with (domain) %} 23 <span class="story-domain">(<a href="/search?q=site:{{ domain }}">{{ domain }}</a>)</span> 24 {% when None %} 25 {% endmatch %} 26 {% when None %} 27 {{ story.title }} 28 {% endmatch %} 29 </h1> 30 <div class="story-meta"> 31 <span class="story-score" id="score-story-{{ story.id }}">{{ story.score }} point{% if story.score != 1 %}s{% endif %}</span> 32 by 33 {% match story.author_username %} 34 {% when Some with (username) %} 35 <a href="/user/{{ username }}" class="story-author">{{ username }}</a> 36 {% when None %} 37 <span class="story-author">anonymous</span> 38 {% endmatch %} 39 <span class="story-time">{{ story.time_ago }}</span> 40 | 41 <span class="story-comments">{{ story.comment_count }} comment{% if story.comment_count != 1 %}s{% endif %}</span> 42 {% match current_user_id %} 43 {% when Some with (uid) %} 44 {% match story.created_by %} 45 {% when Some with (author_id) %} 46 {% if uid == author_id %} 47 | <a href="/story/{{ story.id }}/edit">edit</a> 48 {% endif %} 49 {% when None %} 50 {% endmatch %} 51 {% when None %} 52 {% endmatch %} 53 {% if !story.tags.is_empty() %} 54 | 55 {% for tag in story.tags %} 56 {% match tag.name %} 57 {% when Some with (name) %} 58 <a href="/tag/{{ name }}" class="story-tag">{{ name }}</a> 59 {% when None %} 60 {% endmatch %} 61 {% endfor %} 62 {% endif %} 63 </div> 64 </div> 65 </div> 66 67 {% if !story.text.is_empty() %} 68 <div class="story-text"> 69 {{ story.text }} 70 </div> 71 {% endif %} 72 </article> 73 74 {% if is_logged_in %} 75 <form class="comment-form" action="/story/{{ story.id }}/comment" method="post"> 76 <textarea name="text" placeholder="Add a comment..." rows="4" required></textarea> 77 <button type="submit">Add Comment</button> 78 </form> 79 {% else %} 80 <p class="login-prompt"><a href="/login">Log in</a> to comment.</p> 81 {% endif %} 82 83 <section class="comments" id="comments-section" 84 data-init="@get('/story/{{ story.id }}/comments-stream', {requestCancellation: 'cleanup'})"> 85 {% include "comments.html" %} 86 </section> 87 </div>