diff --git a/webapp_search.py b/webapp_search.py index d9d822ea5..f7b87c1d8 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -119,6 +119,56 @@ def _matchSharedItem(searchStrLowerList: [], return False +def _htmlSearchResultShare(sharedItem: {}, translate: {}, + httpPrefix: str, domainFull: str, + contactNickname: str, name: str, + actor: str) -> str: + """Returns the html for an individual shared item + """ + sharedItemsForm = '
' + sharedItem['summary'] + '
\n' + if sharedItem.get('itemQty'): + sharedItemsForm += \ + '' + translate['Quantity'] + \ + ': ' + str(sharedItem['itemQty']) + ' ' + sharedItemsForm += \ + '' + translate['Type'] + ': ' + sharedItem['itemType'] + ' ' + sharedItemsForm += \ + '' + translate['Category'] + ': ' + sharedItem['category'] + ' ' + sharedItemsForm += \ + '' + translate['Location'] + ': ' + sharedItem['location'] + if sharedItem.get('itemPrice') and \ + sharedItem.get('itemCurrency'): + if isfloat(sharedItem['itemPrice']): + if float(sharedItem['itemPrice']) > 0: + sharedItemsForm += \ + ' ' + translate['Price'] + \ + ': ' + sharedItem['itemPrice'] + \ + ' ' + sharedItem['itemCurrency'] + sharedItemsForm += '
\n' + contactActor = \ + httpPrefix + '://' + domainFull + '/users/' + contactNickname + sharedItemsForm += \ + '\n' + if actor.endswith('/users/' + contactNickname): + sharedItemsForm += \ + ' \n' + sharedItemsForm += '
' + sharedItem['summary'] + '
\n' - if sharedItem.get('itemQty'): - sharedItemsForm += \ - '' + translate['Quantity'] + \ - ': ' + str(sharedItem['itemQty']) + ' ' - sharedItemsForm += \ - '' + translate['Type'] + \ - ': ' + sharedItem['itemType'] + ' ' - sharedItemsForm += \ - '' + translate['Category'] + \ - ': ' + sharedItem['category'] + ' ' - sharedItemsForm += \ - '' + translate['Location'] + \ - ': ' + sharedItem['location'] - if sharedItem.get('itemPrice') and \ - sharedItem.get('itemCurrency'): - if isfloat(sharedItem['itemPrice']): - if float(sharedItem['itemPrice']) > 0: - sharedItemsForm += \ - ' ' + translate['Price'] + \ - ': ' + sharedItem['itemPrice'] + \ - ' ' + sharedItem['itemCurrency'] - sharedItemsForm += '
\n' - contactActor = \ - httpPrefix + '://' + domainFull + \ - '/users/' + contactNickname - sharedItemsForm += \ - '\n' - if actor.endswith('/users/' + contactNickname): - sharedItemsForm += \ - ' \n' - sharedItemsForm += '