use splices for rendering and url-encode the public key link
This commit is contained in:
@ -17,23 +17,21 @@ fn peers_template(peers: Vec<HashMap<String, String>>) -> Markup {
|
|||||||
),
|
),
|
||||||
None => (
|
None => (
|
||||||
// set a fall-back value for name in case the data is unavailable
|
// set a fall-back value for name in case the data is unavailable
|
||||||
"name unavailable".to_string(),
|
"Name unavailable".to_string(),
|
||||||
"Profile image".to_string()
|
"Profile image".to_string()
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
@let profile_link = format!("/scuttlebutt/profile?public_key={}", peer["id"]);
|
@let url_safe_peer_id = peer["id"].replace('/', "%2F");
|
||||||
li {
|
li {
|
||||||
a class="list-item link" href=(profile_link) {
|
a class="list-item link" href={ "/scuttlebutt/profile/" (url_safe_peer_id) } {
|
||||||
@if peer.get("blob_path").is_some() && peer["blob_exists"] == "true" {
|
@if peer.get("blob_path").is_some() && peer["blob_exists"] == "true" {
|
||||||
@let blob_path = format!("/blob/{}", peer["blob_path"]);
|
img id="peerImage" class="icon list-icon" src={ "/blob/" (peer["blob_path"]) } alt=(name_alt);
|
||||||
img id="peerImage" class="icon list-icon" src=(blob_path) alt=(name_alt);
|
|
||||||
} @else {
|
} @else {
|
||||||
// use a placeholder image if we don't have the blob
|
// use a placeholder image if we don't have the blob
|
||||||
img id="peerImage" class="icon icon-active list-icon" src="/icons/user.svg" alt="Placeholder profile image";
|
img id="peerImage" class="icon icon-active list-icon" src="/icons/user.svg" alt="Placeholder profile image";
|
||||||
}
|
}
|
||||||
p id="peerName" class="font-normal list-text" { (name) };
|
p id="peerName" class="font-normal list-text " { (name) };
|
||||||
@let name_title = format!("{}'s public key", name);
|
label class="label-small label-ellipsis list-label font-gray" for="peerName" title={ (name) "'s public key" } {
|
||||||
label class="label-small label-ellipsis list-label font-gray" for="peerName" title=(name_title) {
|
|
||||||
(peer["id"])
|
(peer["id"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user