-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Card] Add .card-body
print condition
#155
Conversation
This exact use-case is the reason, why I added the |
Yeah it works! I have:
<div class="table-responsive">
<table class="table table-vcenter">
<tbody>
{# ... #}
</tbody>
</table>
</div>
{% embed '@Tabler/embeds/card.html.twig' with {fullsize: true} %}
{% block box_type_class %}card-table{% endblock %}
{% block box_body %}
{% include 'produit/_partials/_list.html.twig' with {produits : paginator.results} %}
{% endblock %}
{% endembed %}
<div class="modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
{# ... #}
</div>
<div class="modal-body">
{% include 'produit/_partials/_list.html.twig' with {produits : paginator.results} %}
</div>
<div class="modal-footer">
{# ... #}
</div>
</div>
</div>
</div> (3) I don't want to have the It is maybe a Tabler issue with how that class behavior works 🤔 |
I didn't post the solution.. Here's how it should be, to work today:
- <div class="table-responsive">
<table class="table table-vcenter">
<tbody>
{# ... #}
</tbody>
</table>
- </div>
{% embed '@Tabler/embeds/card.html.twig' %}
- {% block box_type_class %}card-table{% endblock %}
+ {% block box_type_class %}card-table table-responsive{% endblock %}
{% block box_body %}
{% include 'produit/_partials/_list.html.twig' with {produits : paginator.results} %}
{% endblock %}
{% endembed %}
<div class="modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
{# ... #}
</div>
<div class="modal-body">
+ <div class="table-responsive">
{% include 'produit/_partials/_list.html.twig' with {produits : paginator.results} %}
+ </div>
</div>
<div class="modal-footer">
{# ... #}
</div>
</div>
</div>
</div> |
.card-body
print condition
The HTML setup as used by me and what I posted previously comes directly from preview.tabler.io. |
Yeah, I've also searched for how they intend to use it.
|
No I don't think so.. Once again, I'm following Tabler of "How you should do it".
That homemade card extends "TablerBundle card" and uses those See here "invoices" table ATE, this is why I've made this PR 😄 to be able to replicate exactly that card template. |
That is IMO stupid from Tabler side. What if you:
Wouldn't that work? |
😆
Maybe, but I'm brainlessly following what they say "how to do". To add more complexity, Tabler really likes to put
This means that if we don't stick to how they intend it, and move a class or wrap it with another div, |
Side note: I also use card with multiple bodies. And Tabler is okay with that. |
Can you please give it a try? |
I join you on that point, it is more natural to me to do it that way.. ATE there is:
|
TBH, I really don't like
I'd rather have a I can give other examples that I use today. 1. If I want to do a ribbon without a card body:<div class="ribbon ribbon-top bg-yellow">
<!-- Content -->
</div> I'll not replace the <div class="card">
<div class="card-header">
<h3 class="card-title">Card title</h3>
</div>
<div class="ribbon ribbon-top bg-yellow">
<svg></svg>
</div>
<!-- NO body-->
</div> 2. Same case for a card with a progress bar
|
The name is not ideal but That's why I proposed a block around the body div, so you can easily empty/remove it. But with the current setup, you should be able to use the box_type_class to achieve both your progress: {% block box_type_class %}progress progress-sm card-progress{% endblock %}
{% block box_body %}
<div class="progress-bar" style="width: 38%" role="progressbar" aria-valuenow="38" aria-valuemin="0" aria-valuemax="100" aria-label="38% Complete">
<span class="visually-hidden">38% Complete</span>
</div>
{% endblock %} and ribbon example: {% block box_type_class %}ribbon ribbon-top bg-yellow{% endblock %}
{% block box_body %}
<svg></svg>
{% endblock %} And with all the learnings from the card monster, we can create a card-v2 embed later that cleans up that "creative" mess. |
you don't like that one? |
Ah, I missed that one. Your posts are always so long 🙈 You mean like that:
? |
Yeah I don't know why 😆
Looks good, but here's why I did that PR.
{% if _fullsize %}p-0{% endif %} {% if _collapsible %} {{ _collapsible_class ~ (_collapsed ? ' collapse' : ' show') }} {% endif %}" Do I need the fullsize condition if I want to do a ribbon? So why using box_body block at all if i want to remove everything? I know I'm a pain in the ass, but I'd rather we all agree than skipping things. (sorry 😝) |
And here is why I proposed the block instead of a variable: you have more control for yet unknown use-cases. I bet at some point one of us wants to use the body and put something entirely different in there. Anyway ... looks good to me now after the discussion! And I will release it directly after merging, as I need to fix my uses of the box_body_type class. |
released 0.15 |
Description
A Card with a fullsized table from Tabler should apparently not be inside
card-body
.See here for Tabler demo: https://preview.tabler.io/tables.html (see
invoices
table)With empty body and no padding (
fullsize
card template option) + Table inside card-bodyI've added condition to not always print this part.
Types of changes
Checklist