forked from mirrors/bookwyrm
Creates re-usable template for cards
This commit is contained in:
parent
8c4e652b2f
commit
d6dc975a2e
2 changed files with 94 additions and 88 deletions
19
bookwyrm/templates/snippets/components/card.html
Normal file
19
bookwyrm/templates/snippets/components/card.html
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<article class="card">
|
||||||
|
<header class="card-header">
|
||||||
|
{% block card-header %}
|
||||||
|
{% endblock %}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section class="card-content">
|
||||||
|
{% block card-content %}
|
||||||
|
{% endblock %}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<footer class="card-footer has-background-white-bis">
|
||||||
|
{% block card-footer %}
|
||||||
|
{% endblock %}
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
{% block card-bonus %}
|
||||||
|
{% endblock %}
|
||||||
|
</article>
|
|
@ -1,101 +1,88 @@
|
||||||
|
{% extends 'snippets/components/card.html' %}
|
||||||
|
|
||||||
{% load bookwyrm_tags %}
|
{% load bookwyrm_tags %}
|
||||||
{% load humanize %}
|
{% load humanize %}
|
||||||
|
|
||||||
{% if not status.deleted %}
|
{% block card-header %}
|
||||||
<article class="card">
|
<h3 class="card-header-title has-background-white-ter is-block">
|
||||||
<header class="card-header">
|
{% include 'snippets/status_header.html' with status=status %}
|
||||||
<div class="card-header-title has-background-white-ter">
|
</h3>
|
||||||
<div class="columns">
|
{% endblock %}
|
||||||
<div class="column is-narrow">
|
|
||||||
{% include 'snippets/status_header.html' with status=status %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<section class="card-content">
|
|
||||||
{% include 'snippets/status_content.html' with status=status %}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<footer>
|
{% block card-content %}
|
||||||
<div class="card-footer has-background-white-bis">
|
{% include 'snippets/status_content.html' with status=status %}
|
||||||
<div class="card-footer-item">
|
{% endblock %}
|
||||||
{% if request.user.is_authenticated %}
|
|
||||||
{% include 'snippets/toggle/toggle_button.html' with controls_text="show-comment" controls_uid=status.id text="Reply" icon='comment' small=True %}
|
|
||||||
{% include 'snippets/boost_button.html' with status=status %}
|
|
||||||
{% include 'snippets/fav_button.html' with status=status %}
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
<a href="/login">
|
|
||||||
<span class="icon icon-comment" title="Reply">
|
|
||||||
<span class="is-sr-only">Reply</span>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span class="icon icon-boost" title="Boost status">
|
{% block card-footer %}
|
||||||
<span class="is-sr-only">Boost status</span>
|
<div class="card-footer-item">
|
||||||
</span>
|
{% if request.user.is_authenticated %}
|
||||||
|
{% include 'snippets/toggle/toggle_button.html' with controls_text="show-comment" controls_uid=status.id text="Reply" icon='comment' small=True %}
|
||||||
|
{% include 'snippets/boost_button.html' with status=status %}
|
||||||
|
{% include 'snippets/fav_button.html' with status=status %}
|
||||||
|
|
||||||
<span class="icon icon-heart" title="Like status">
|
{% else %}
|
||||||
<span class="is-sr-only">Like status</span>
|
<a href="/login">
|
||||||
</span>
|
<span class="icon icon-comment" title="Reply">
|
||||||
</a>
|
<span class="is-sr-only">Reply</span>
|
||||||
{% endif %}
|
</span>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card-footer-item">
|
<span class="icon icon-boost" title="Boost status">
|
||||||
{% include 'snippets/privacy-icons.html' with item=status %}
|
<span class="is-sr-only">Boost status</span>
|
||||||
</div>
|
</span>
|
||||||
|
|
||||||
<div class="card-footer-item">
|
<span class="icon icon-heart" title="Like status">
|
||||||
<a href="{{ status.remote_id }}">{{ status.published_date | post_date }}</a>
|
<span class="is-sr-only">Like status</span>
|
||||||
</div>
|
</span>
|
||||||
{% if status.user == request.user %}
|
</a>
|
||||||
<div class="card-footer-item">
|
{% endif %}
|
||||||
{% include 'snippets/toggle/toggle_button.html' with controls_text="more-info" controls_uid=status.id text="More options" icon="dots-three" small=True %}
|
</div>
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if request.user.is_authenticated %}
|
<div class="card-footer-item">
|
||||||
{% with status.id|uuid as uuid %}
|
{% include 'snippets/privacy-icons.html' with item=status %}
|
||||||
<input class="toggle-control" type="checkbox" name="show-comment-{{ status.id }}" id="show-comment-{{ status.id }}" data-hover-target="id_content_{{ status.id }}-{{ uuid }}">
|
</div>
|
||||||
<div class="toggle-content hidden">
|
|
||||||
<div class="card-footer">
|
|
||||||
<div class="card-footer-item">
|
|
||||||
{% include 'snippets/reply_form.html' with status=status %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endwith %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if status.user == request.user %}
|
<div class="card-footer-item">
|
||||||
<div>
|
<a href="{{ status.remote_id }}">{{ status.published_date | post_date }}</a>
|
||||||
<input class="toggle-control" type="checkbox" name="more-info-{{ status.id }}" id="more-info-{{ status.id }}">
|
</div>
|
||||||
<div class="toggle-content hidden card-footer">
|
{% if status.user == request.user %}
|
||||||
{% if status.user == request.user %}
|
<div class="card-footer-item">
|
||||||
<div class="card-footer-item">
|
{% include 'snippets/toggle/toggle_button.html' with controls_text="more-info" controls_uid=status.id text="More options" icon="dots-three" small=True %}
|
||||||
<form name="delete-{{status.id}}" action="/delete-status/{{ status.id }}" method="post">
|
</div>
|
||||||
{% csrf_token %}
|
|
||||||
<button class="button is-danger is-light" type="submit">
|
|
||||||
Delete post
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</footer>
|
|
||||||
</article>
|
|
||||||
{% else %}
|
|
||||||
<article class="card">
|
|
||||||
<header class="card-header">
|
|
||||||
<p>
|
|
||||||
{% include 'snippets/avatar.html' with user=status.user %}
|
|
||||||
{% include 'snippets/username.html' with user=status.user %}
|
|
||||||
deleted this status
|
|
||||||
</p>
|
|
||||||
</header>
|
|
||||||
</article>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block card-bonus %}
|
||||||
|
{% if request.user.is_authenticated %}
|
||||||
|
{% with status.id|uuid as uuid %}
|
||||||
|
<input class="toggle-control" type="checkbox" name="show-comment-{{ status.id }}" id="show-comment-{{ status.id }}" data-hover-target="id_content_{{ status.id }}-{{ uuid }}">
|
||||||
|
<section class="toggle-content hidden">
|
||||||
|
<div class="card-footer">
|
||||||
|
<div class="card-footer-item">
|
||||||
|
{% include 'snippets/reply_form.html' with status=status %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{% endwith %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if status.user == request.user %}
|
||||||
|
<section>
|
||||||
|
<input class="toggle-control" type="checkbox" name="more-info-{{ status.id }}" id="more-info-{{ status.id }}">
|
||||||
|
<div class="toggle-content hidden card-footer">
|
||||||
|
{% if status.user == request.user %}
|
||||||
|
<div class="card-footer-item">
|
||||||
|
<form name="delete-{{status.id}}" action="/delete-status/{{ status.id }}" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button class="button is-danger is-light" type="submit">
|
||||||
|
Delete post
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue