Creates re-usable template for cards

This commit is contained in:
Mouse Reeve 2021-01-16 14:04:09 -08:00
parent 8c4e652b2f
commit d6dc975a2e
2 changed files with 94 additions and 88 deletions

View 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>

View file

@ -1,24 +1,21 @@
{% 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">
<div class="card-header-title has-background-white-ter">
<div class="columns">
<div class="column is-narrow">
{% include 'snippets/status_header.html' with status=status %} {% include 'snippets/status_header.html' with status=status %}
</div> </h3>
</div> {% endblock %}
</div>
</header>
<section class="card-content">
{% block card-content %}
{% include 'snippets/status_content.html' with status=status %} {% include 'snippets/status_content.html' with status=status %}
</section> {% endblock %}
<footer>
<div class="card-footer has-background-white-bis"> {% block card-footer %}
<div class="card-footer-item"> <div class="card-footer-item">
{% if request.user.is_authenticated %} {% 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/toggle/toggle_button.html' with controls_text="show-comment" controls_uid=status.id text="Reply" icon='comment' small=True %}
@ -54,23 +51,25 @@
{% include 'snippets/toggle/toggle_button.html' with controls_text="more-info" controls_uid=status.id text="More options" icon="dots-three" small=True %} {% 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 %} {% endif %}
</div> {% endblock %}
{% block card-bonus %}
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
{% with status.id|uuid as uuid %} {% 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 }}"> <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 class="toggle-content hidden"> <section class="toggle-content hidden">
<div class="card-footer"> <div class="card-footer">
<div class="card-footer-item"> <div class="card-footer-item">
{% include 'snippets/reply_form.html' with status=status %} {% include 'snippets/reply_form.html' with status=status %}
</div> </div>
</div> </div>
</div> </section>
{% endwith %} {% endwith %}
{% endif %} {% endif %}
{% if status.user == request.user %} {% if status.user == request.user %}
<div> <section>
<input class="toggle-control" type="checkbox" name="more-info-{{ status.id }}" id="more-info-{{ status.id }}"> <input class="toggle-control" type="checkbox" name="more-info-{{ status.id }}" id="more-info-{{ status.id }}">
<div class="toggle-content hidden card-footer"> <div class="toggle-content hidden card-footer">
{% if status.user == request.user %} {% if status.user == request.user %}
@ -84,18 +83,6 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div> </section>
{% 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 %}