Display profile after handle search

main
Bob Mottram 2020-11-12 23:38:58 +00:00
parent 7c6924acd2
commit a4aa41c315
1 changed files with 33 additions and 13 deletions

View File

@ -209,19 +209,13 @@ def htmlProfileAfterSearch(cssCache: {},
if '<' in avatarDescription: if '<' in avatarDescription:
avatarDescription = removeHtml(avatarDescription) avatarDescription = removeHtml(avatarDescription)
profileStr = ' <div class="hero-image">\n' profileStr = \
profileStr += ' <div class="hero-text">\n' getProfileHeaderAfterSearch(baseDir, searchNickname,
if avatarUrl: searchDomainFull,
profileStr += \ translate,
' <img loading="lazy" src="' + avatarUrl + \ displayName,
'" alt="' + avatarDescription + '" title="' + \ profileDescriptionShort,
avatarDescription + '" class="title">\n' avatarUrl)
profileStr += ' <h1>' + displayName + '</h1>\n'
profileStr += ' <p><b>@' + searchNickname + '@' + \
searchDomainFull + '</b></p>\n'
profileStr += ' <p>' + profileDescriptionShort + '</p>\n'
profileStr += ' </div>\n'
profileStr += '</div>\n'
profileStr += '<div class="container">\n' profileStr += '<div class="container">\n'
profileStr += ' <form method="POST" action="' + \ profileStr += ' <form method="POST" action="' + \
@ -309,6 +303,32 @@ def getProfileHeader(baseDir: str, nickname: str, domain: str,
return htmlStr return htmlStr
def getProfileHeaderAfterSearch(baseDir: str, searchNickname: str,
searchDomainFull: str,
translate: {},
displayName: str,
profileDescriptionShort: str,
avatarUrl: str) -> str:
"""The header of a searched for handle, containing background
image and avatar
"""
htmlStr = '\n\n <figure class="profileHeader">\n'
# htmlStr += ' <img class="profileBackground" ' + \
# 'src="/users/' + nickname + '/image.png" /></a>\n'
htmlStr += ' <figcaption>\n'
if avatarUrl:
htmlStr += \
' <img loading="lazy" src="' + avatarUrl + '" ' + \
' class="title">\n'
htmlStr += ' <h1>' + displayName + '</h1>\n'
htmlStr += \
' <p><b>@' + searchNickname + '@' + searchDomainFull + '</b><br>\n'
htmlStr += ' <p>' + profileDescriptionShort + '</p>\n'
htmlStr += ' </figcaption>\n'
htmlStr += ' </figure>\n\n'
return htmlStr
def htmlProfile(rssIconAtTop: bool, def htmlProfile(rssIconAtTop: bool,
cssCache: {}, iconsAsButtons: bool, cssCache: {}, iconsAsButtons: bool,
defaultTimeline: str, defaultTimeline: str,