mirror of https://gitlab.com/bashrc2/epicyon
Shared item category icons
parent
418897b7ce
commit
4b63bd9b60
|
@ -12587,6 +12587,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
# after selecting a shared item from the left column then show it
|
||||
if htmlGET and '?showshare=' in self.path and '/users/' in self.path:
|
||||
itemID = self.path.split('?showshare=')[1]
|
||||
if ';' in itemID:
|
||||
itemID = itemID.split(';')[0]
|
||||
usersPath = self.path.split('?showshare=')[0]
|
||||
nickname = usersPath.replace('/users/', '')
|
||||
itemID = urllib.parse.unquote_plus(itemID.strip())
|
||||
|
|
14
shares.py
14
shares.py
|
@ -1840,3 +1840,17 @@ def _dfcToSharesFormat(catalogJson: {},
|
|||
"itemCurrency": item['DFC:price'].split(' ')[1]
|
||||
}
|
||||
return sharesJson
|
||||
|
||||
|
||||
def shareCategoryIcon(category: str) -> str:
|
||||
"""Returns unicode icon for the given category
|
||||
"""
|
||||
categoryIcons = {
|
||||
'accommodation': '🏠',
|
||||
'clothes': '👚',
|
||||
'tools': '🔧',
|
||||
'food': '🍏'
|
||||
}
|
||||
if categoryIcons.get(category):
|
||||
return categoryIcons[category]
|
||||
return ''
|
||||
|
|
|
@ -20,6 +20,7 @@ from webapp_utils import headerButtonsFrontScreen
|
|||
from webapp_utils import htmlHeaderWithExternalStyle
|
||||
from webapp_utils import htmlFooter
|
||||
from webapp_utils import getBannerFile
|
||||
from shares import shareCategoryIcon
|
||||
|
||||
|
||||
def _linksExist(baseDir: str) -> bool:
|
||||
|
@ -57,7 +58,11 @@ def _getLeftColumnShares(baseDir: str,
|
|||
shareId = item['shareId']
|
||||
# selecting this link calls htmlShowShare
|
||||
shareLink = actor + '?showshare=' + shareId
|
||||
linksList.append(sharedesc + ' ' + shareLink)
|
||||
if item.get('category'):
|
||||
shareLink += ';category=' + item['category']
|
||||
shareCategory = shareCategoryIcon(item['category'])
|
||||
|
||||
linksList.append(shareCategory + sharedesc + ' ' + shareLink)
|
||||
ctr += 1
|
||||
if ctr >= maxSharesInLeftColumn:
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue