Add empty state on table
This commit is contained in:
parent
9a7c06b81d
commit
9317484deb
@ -11,6 +11,7 @@ common:
|
|||||||
search: Search
|
search: Search
|
||||||
reset: Reset
|
reset: Reset
|
||||||
show: Show
|
show: Show
|
||||||
|
no_result: No results
|
||||||
close: Close
|
close: Close
|
||||||
confirmation: Confirmation
|
confirmation: Confirmation
|
||||||
are_you_sure: Are you sure?
|
are_you_sure: Are you sure?
|
||||||
|
|||||||
@ -11,6 +11,7 @@ common:
|
|||||||
search: Filtrer
|
search: Filtrer
|
||||||
reset: Réini.
|
reset: Réini.
|
||||||
show: Voir
|
show: Voir
|
||||||
|
no_result: Aucun résultat
|
||||||
close: Fermer
|
close: Fermer
|
||||||
confirmation: Confirmation
|
confirmation: Confirmation
|
||||||
are_you_sure: Êtes-vous sûr ?
|
are_you_sure: Êtes-vous sûr ?
|
||||||
|
|||||||
@ -25,7 +25,7 @@ use crate::{
|
|||||||
#[derive(Template, WebTemplate)]
|
#[derive(Template, WebTemplate)]
|
||||||
#[template(path = "users/index.html")]
|
#[template(path = "users/index.html")]
|
||||||
struct UsersIndexTemplate {
|
struct UsersIndexTemplate {
|
||||||
user_with_books_number: Vec<UserWithBookNumber>,
|
users_with_books_number: Vec<UserWithBookNumber>,
|
||||||
query: IndexQuery,
|
query: IndexQuery,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ pub async fn index(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ok(UsersIndexTemplate {
|
Ok(UsersIndexTemplate {
|
||||||
user_with_books_number: result,
|
users_with_books_number: result,
|
||||||
query,
|
query,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,6 +90,15 @@
|
|||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|
||||||
{% call cards::card() %}
|
{% call cards::card() %}
|
||||||
|
{% if books_with_user.is_empty() %}
|
||||||
|
<div class="d-flex flex-column align-items-center justify-content-center">
|
||||||
|
<h2>{{ t!("common.no_result") }}</h2>
|
||||||
|
|
||||||
|
<a class="btn btn-success text-white text-nowrap mt-3" href="/books/new">
|
||||||
|
{{ t!("book.new.button_short") }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -147,5 +156,7 @@
|
|||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@ -34,6 +34,15 @@
|
|||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|
||||||
{% call cards::card() %}
|
{% call cards::card() %}
|
||||||
|
{% if users_with_books_number.is_empty() %}
|
||||||
|
<div class="d-flex flex-column align-items-center justify-content-center">
|
||||||
|
<h2>{{ t!("common.no_result") }}</h2>
|
||||||
|
|
||||||
|
<a class="btn btn-success text-white text-nowrap mt-3" href="//new">
|
||||||
|
{{ t!("user.index.button") }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -45,7 +54,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for user_information in user_with_books_number %}
|
{% for user_information in users_with_books_number %}
|
||||||
<tr class="align-middle">
|
<tr class="align-middle">
|
||||||
<th scope="row">{{ user_information.user.id }}</th>
|
<th scope="row">{{ user_information.user.id }}</th>
|
||||||
<td>{{ user_information.user.name }}</td>
|
<td>{{ user_information.user.name }}</td>
|
||||||
@ -58,5 +67,6 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{% endif %}
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user