Show wanted items on profile screen

merge-requests/30/head
Bob Mottram 2021-08-09 21:05:14 +01:00
parent d6246ec017
commit 105b125559
2 changed files with 24 additions and 9 deletions

View File

@ -871,7 +871,12 @@ def htmlProfile(rssIconAtTop: bool,
profileStr += \ profileStr += \
_htmlProfileShares(actor, translate, _htmlProfileShares(actor, translate,
nickname, domainFull, nickname, domainFull,
extraJson) + licenseStr extraJson, 'shares') + licenseStr
elif selected == 'wanted':
profileStr += \
_htmlProfileShares(actor, translate,
nickname, domainFull,
extraJson, 'wanted') + licenseStr
# end of #timeline # end of #timeline
profileStr += '</div>' profileStr += '</div>'
@ -1044,13 +1049,15 @@ def _htmlProfileSkills(translate: {}, nickname: str, domain: str,
def _htmlProfileShares(actor: str, translate: {}, def _htmlProfileShares(actor: str, translate: {},
nickname: str, domain: str, sharesJson: {}) -> str: nickname: str, domain: str, sharesJson: {},
sharesFileType: str) -> str:
"""Shows shares on the profile screen """Shows shares on the profile screen
""" """
profileStr = '' profileStr = ''
for item in sharesJson['orderedItems']: for item in sharesJson['orderedItems']:
profileStr += htmlIndividualShare(domain, item['shareId'], profileStr += htmlIndividualShare(domain, item['shareId'],
actor, item, translate, False, False) actor, item, translate, False, False,
sharesFileType)
if len(profileStr) > 0: if len(profileStr) > 0:
profileStr = '<div class="share-title">' + profileStr + '</div>\n' profileStr = '<div class="share-title">' + profileStr + '</div>\n'
return profileStr return profileStr

View File

@ -923,7 +923,8 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
def htmlIndividualShare(domain: str, shareId: str, def htmlIndividualShare(domain: str, shareId: str,
actor: str, item: {}, translate: {}, actor: str, item: {}, translate: {},
showContact: bool, removeButton: bool) -> str: showContact: bool, removeButton: bool,
sharesFileType: str) -> str:
"""Returns an individual shared item as html """Returns an individual shared item as html
""" """
profileStr = '<div class="container">\n' profileStr = '<div class="container">\n'
@ -968,10 +969,16 @@ def htmlIndividualShare(domain: str, shareId: str,
'<a href="' + contactActor + '"><button class="button">' + \ '<a href="' + contactActor + '"><button class="button">' + \
translate['View'] + '</button></a>\n' translate['View'] + '</button></a>\n'
if removeButton and domain in shareId: if removeButton and domain in shareId:
profileStr += \ if sharesFileType == 'shares':
' <a href="' + actor + '?rmshare=' + shareId + \ profileStr += \
'"><button class="button">' + \ ' <a href="' + actor + '?rmshare=' + shareId + \
translate['Remove'] + '</button></a>\n' '"><button class="button">' + \
translate['Remove'] + '</button></a>\n'
else:
profileStr += \
' <a href="' + actor + '?rmwanted=' + shareId + \
'"><button class="button">' + \
translate['Remove'] + '</button></a>\n'
profileStr += '</div>\n' profileStr += '</div>\n'
return profileStr return profileStr
@ -1028,7 +1035,8 @@ def _htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
timelineStr += \ timelineStr += \
htmlIndividualShare(domain, item['shareId'], htmlIndividualShare(domain, item['shareId'],
actor, item, translate, actor, item, translate,
showContactButton, showRemoveButton) showContactButton, showRemoveButton,
sharesFileType)
timelineStr += separatorStr timelineStr += separatorStr
ctr += 1 ctr += 1