fixed friends template
This commit is contained in:
parent
bbc7cda33f
commit
436331bc72
2 changed files with 13 additions and 7 deletions
|
|
@ -6,12 +6,12 @@ fn main() {
|
|||
let data = friends::render(
|
||||
&env,
|
||||
friends::FriendsData {
|
||||
friends: std::iter::from_fn(|| Some(Friend {
|
||||
friends: std::array::from_fn::<_, 10, _>(|i| Friend {
|
||||
name: "maiboyer".into(),
|
||||
image: "https://friends.42paris.fr/proxy/resize/512/03c61af252becbca11aac5ff49a2e61c/maiboyer.jpg".into(),
|
||||
position: Some("f1r1s1".into()),
|
||||
last_active: None,
|
||||
})).take(10).collect(),
|
||||
position: (i < 5).then_some("f1r1s1".into()),
|
||||
last_active: (i > 6).then_some("Last thuesday".into()),
|
||||
}).to_vec(),
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
|
|
|
|||
|
|
@ -42,7 +42,15 @@
|
|||
<h5 class="card-title">
|
||||
<i class="fa-solid {{ "fa-2xs fa-circle online" if friend.position else "fa-xs fa-person-walking offline" }}"></i> {{ friend.name }}
|
||||
</h5>
|
||||
<p class="card-text">{{ friend.position if friend.position else 'Absent' }} {{ friend.last_active }}
|
||||
{%- set position = "Absent" -%}
|
||||
{% if friend.position %}
|
||||
{%- set position = friend.position -%}
|
||||
{% endif%}
|
||||
{%- set last_active = "" -%}
|
||||
{% if friend.last_active %}
|
||||
{%- set last_active = friend.last_active -%}
|
||||
{% endif%}
|
||||
<p class="card-text">{{ position }} {{ last_active }}
|
||||
{% if friend.position %}
|
||||
<a class="fa-solid fa-users-viewfinder" href="/goto/{{ friend.position }}"></a>
|
||||
{% endif %}
|
||||
|
|
@ -50,7 +58,6 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if add %}
|
||||
<div class="card p-0 m-2 shadow card-size grow" onclick="openAddFriend();">
|
||||
<div class="m-1 w-100 card-img-top text-center card-not-img-size">
|
||||
<i class="fa-solid fa-plus fa-5x"></i>
|
||||
|
|
@ -59,7 +66,6 @@
|
|||
<h5 class="card-title">Ajouter un ami</h5>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue