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

View File

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