191 lines
10 KiB
HTML
191 lines
10 KiB
HTML
{% extends "base.html" %}
|
|
{% from "_macros.html" import modal %}
|
|
{% block extra_head %}
|
|
<link rel="stylesheet" href="{{ static_url('/static/css/sidebar.css') }}">
|
|
<link rel="stylesheet" href="{{ static_url('/static/css/feed.css') }}">
|
|
<link rel="stylesheet" href="{{ static_url('/static/css/post.css') }}">
|
|
{% endblock %}
|
|
{% block content %}
|
|
<div class="post-page-layout">
|
|
{% if author_gists or author_projects or related_posts %}
|
|
<aside class="post-page-sidebar" role="complementary" aria-label="More to explore">
|
|
{% if author_gists %}
|
|
<div class="sidebar-card">
|
|
<div class="sidebar-heading">Gists from {{ author.get('username', '') if author else '' }}</div>
|
|
<div class="related-list">
|
|
{% for gist in author_gists %}
|
|
<a href="/gists/{{ gist['slug'] or gist['uid'] }}" class="related-link">
|
|
<strong class="related-title">{{ gist.get('title') or 'Untitled gist' }}</strong>
|
|
<span class="related-meta">{{ content_preview(gist.get('description') or gist.get('source_code', ''), 80) }}</span>
|
|
</a>
|
|
{% endfor %}
|
|
</div>
|
|
<div class="topic-links">
|
|
<a href="/profile/{{ author.get('username', '') if author else '' }}?tab=gists">View all</a>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
{% if author_projects %}
|
|
<div class="sidebar-card">
|
|
<div class="sidebar-heading">Projects from {{ author.get('username', '') if author else '' }}</div>
|
|
<div class="related-list">
|
|
{% for project in author_projects %}
|
|
<a href="/projects/{{ project['slug'] or project['uid'] }}" class="related-link">
|
|
<strong class="related-title">{{ project.get('title') or 'Untitled project' }}</strong>
|
|
<span class="related-meta">{{ content_preview(project.get('description', ''), 80) }}</span>
|
|
</a>
|
|
{% endfor %}
|
|
</div>
|
|
<div class="topic-links">
|
|
<a href="/profile/{{ author.get('username', '') if author else '' }}?tab=projects">View all</a>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
{% if related_posts %}
|
|
<div class="sidebar-card">
|
|
<div class="sidebar-heading">Related Discussions</div>
|
|
<div class="related-list">
|
|
{% for item in related_posts %}
|
|
<a href="/posts/{{ item.post['slug'] or item.post['uid'] }}" class="related-link">
|
|
<strong class="related-title">{{ render_title(item.post['title'], author_is_admin=is_admin(item.author)) if item.post.get('title') else content_preview(item.post['content'], 60) }}</strong>
|
|
<span class="related-meta">{{ item.author['username'] }} · {{ dt_ago(item.created_at) if item.created_at else item.time_ago }}</span>
|
|
</a>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</aside>
|
|
{% endif %}
|
|
<div class="post-page">
|
|
<div class="post-nav-row">
|
|
<a href="/feed" class="back-link">← Back to Feed</a>
|
|
{% if next_post_url %}
|
|
<a href="{{ next_post_url }}" class="next-post-link">Next post →</a>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<article class="post-detail">
|
|
<div class="post-detail-header">
|
|
{% set _user = author %}{% set _size = 40 %}{% set _size_class = "md" %}{% include "_avatar_link.html" %}
|
|
<div>
|
|
{% set _user = author %}{% set _class = "post-detail-author" %}{% include "_user_link.html" %}
|
|
<span class="post-detail-level">· Level {{ author.get('level', 1) if author else 1 }}</span>
|
|
</div>
|
|
<span class="post-detail-time">{{ dt_ago(post.created_at) if post.get('created_at') else time_ago }}</span>
|
|
</div>
|
|
|
|
<div class="topic-wrap">
|
|
<span class="badge badge-{{ post['topic'] }}">{{ post['topic'] }}</span>
|
|
</div>
|
|
|
|
{% if post.get('title') %}
|
|
<h1 class="post-detail-title">{{ render_title(post['title'], author_is_admin=is_admin(author)) }}</h1>
|
|
{% endif %}
|
|
|
|
{% if maturity_hidden(maturity, user) %}
|
|
{% set _level = maturity %}{% include "_maturity_gate.html" %}
|
|
{% else %}
|
|
<div class="post-detail-content rendered-content">{{ render_content(post['content'], author_is_admin=is_admin(author)) }}</div>
|
|
{% endif %}
|
|
|
|
{% if project_link %}
|
|
<a href="{{ project_link.url }}" class="project-link">Project: {{ project_link.name }}</a>
|
|
{% endif %}
|
|
|
|
{% if attachments %}
|
|
{% include "_attachment_display.html" %}
|
|
{% endif %}
|
|
|
|
{% if poll %}
|
|
{% set _poll = poll %}{% include "_poll.html" %}
|
|
{% endif %}
|
|
|
|
{% if war %}
|
|
{% set _war = war %}{% include "_opinion_war.html" %}
|
|
{% endif %}
|
|
|
|
<div class="post-detail-actions">
|
|
{% set _uid = post['uid'] %}{% set _my_vote = my_vote %}{% set _count = post.get('stars', 0) %}{% include "_post_votes.html" %}
|
|
{% set _type = "post" %}{% set _uid = post['uid'] %}{% set _reactions = reactions %}{% include "_reaction_bar.html" %}
|
|
<button type="button" class="post-action-btn" data-share="/posts/{{ post['slug'] or post['uid'] }}"><span class="icon">🔗</span><span class="label"> Share</span></button>
|
|
{% set _type = "post" %}{% set _uid = post['uid'] %}{% set _bookmarked = bookmarked %}{% include "_bookmark_button.html" %}
|
|
{% set _type = "post" %}{% set _uid = post['uid'] %}{% set _owner = post['user_uid'] %}{% set _owner_name = (author or {}).get('username', '') %}{% set _class = "post-action-btn" %}{% include "_report_button.html" %}
|
|
{% if is_owner %}
|
|
<button type="button" class="post-action-btn" data-modal="edit-post-modal"><span class="icon">✏️</span><span class="label">Edit</span></button>
|
|
{% endif %}
|
|
{% if is_owner or is_admin(user) %}
|
|
<form method="POST" action="/posts/delete/{{ post['slug'] or post['uid'] }}" class="inline-form">
|
|
<button type="submit" class="post-action-btn" data-confirm="Delete this post?"><span class="icon">🗑️</span><span class="label">Delete</span></button>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
</article>
|
|
|
|
{% if is_owner %}
|
|
{% call modal('edit-post-modal', 'Edit Post') %}
|
|
<form id="edit-post-form" method="POST" action="/posts/edit/{{ post['slug'] or post['uid'] }}">
|
|
{% set _topics = topics %}{% set _selected = post['topic'] %}{% include "_topic_selector.html" %}
|
|
<div class="auth-field auth-field-gap">
|
|
<label for="edit-title">Title</label>
|
|
<input type="text" id="edit-title" name="title" maxlength="500" value="{{ post.get('title') or '' }}">
|
|
</div>
|
|
<div class="auth-field auth-field-gap">
|
|
<label for="edit-content">Content</label>
|
|
<textarea id="edit-content" name="content" required maxlength="125000" class="min-h-200" data-mention>{{ post['content'] }}</textarea>
|
|
</div>
|
|
{% include "_attachment_form.html" %}
|
|
{% if not poll %}
|
|
<div class="auth-field auth-field-gap">
|
|
<button type="button" class="btn btn-secondary btn-sm" data-poll-toggle><span class="icon">📊</span> <span data-poll-toggle-label>Add poll</span></button>
|
|
</div>
|
|
<div class="poll-builder" data-poll-builder hidden>
|
|
<input type="text" name="poll_question" maxlength="200" placeholder="Poll question" aria-label="Poll question" class="poll-builder-question" disabled>
|
|
<div class="poll-builder-options" data-poll-options>
|
|
<div class="poll-builder-row"><input type="text" name="poll_options" maxlength="100" placeholder="Option 1" aria-label="Poll option 1" disabled></div>
|
|
<div class="poll-builder-row"><input type="text" name="poll_options" maxlength="100" placeholder="Option 2" aria-label="Poll option 2" disabled></div>
|
|
</div>
|
|
<button type="button" class="btn-ghost btn-sm" data-poll-add-option>+ Add option</button>
|
|
<p class="poll-builder-error" data-poll-error hidden></p>
|
|
</div>
|
|
{% endif %}
|
|
<div class="modal-footer">
|
|
<button type="button" class="modal-close btn btn-secondary">Cancel</button>
|
|
<button type="submit" class="btn btn-primary"><span class="icon">💾</span>Save Changes</button>
|
|
</div>
|
|
</form>
|
|
{% endcall %}
|
|
{% endif %}
|
|
|
|
{% with target_uid=post['uid'], target_type="post" %}
|
|
{% include "_comment_section.html" %}
|
|
{% endwith %}
|
|
</div>
|
|
|
|
{% if featured_topics %}
|
|
<aside class="feed-right" role="complementary" aria-label="Featured">
|
|
{% for topic in featured_topics %}
|
|
<div class="daily-topic-card card-link-host">
|
|
{% if topic.get('slug') %}
|
|
{% set _href = "/news/" ~ topic['slug'] %}
|
|
{% set _label = topic.get('title', '') %}
|
|
{% include "_card_link.html" %}
|
|
{% endif %}
|
|
<div class="daily-topic-label">Featured</div>
|
|
{% if topic.get('image_url', '') %}
|
|
<img src="{{ topic['image_url'] }}" alt="{{ topic.get('title', '') }}" loading="lazy" class="daily-topic-image">
|
|
{% endif %}
|
|
<h4 class="rendered-title">{{ render_title(topic.get('title', '')) }}</h4>
|
|
<div class="rendered-content">{{ render_content(topic.get('summary', '')) }}</div>
|
|
<div class="topic-links">
|
|
<a href="/news/{{ topic.get('slug', '') }}">Read More</a>
|
|
{% if topic.get('url', '') %}
|
|
<a href="{{ topic['url'] }}" target="_blank" rel="noopener">Source</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</aside>
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %}
|