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
|
# after selecting a shared item from the left column then show it
|
||||||
if htmlGET and '?showshare=' in self.path and '/users/' in self.path:
|
if htmlGET and '?showshare=' in self.path and '/users/' in self.path:
|
||||||
itemID = self.path.split('?showshare=')[1]
|
itemID = self.path.split('?showshare=')[1]
|
||||||
|
if ';' in itemID:
|
||||||
|
itemID = itemID.split(';')[0]
|
||||||
usersPath = self.path.split('?showshare=')[0]
|
usersPath = self.path.split('?showshare=')[0]
|
||||||
nickname = usersPath.replace('/users/', '')
|
nickname = usersPath.replace('/users/', '')
|
||||||
itemID = urllib.parse.unquote_plus(itemID.strip())
|
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]
|
"itemCurrency": item['DFC:price'].split(' ')[1]
|
||||||
}
|
}
|
||||||
return sharesJson
|
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 htmlHeaderWithExternalStyle
|
||||||
from webapp_utils import htmlFooter
|
from webapp_utils import htmlFooter
|
||||||
from webapp_utils import getBannerFile
|
from webapp_utils import getBannerFile
|
||||||
|
from shares import shareCategoryIcon
|
||||||
|
|
||||||
|
|
||||||
def _linksExist(baseDir: str) -> bool:
|
def _linksExist(baseDir: str) -> bool:
|
||||||
|
@ -57,7 +58,11 @@ def _getLeftColumnShares(baseDir: str,
|
||||||
shareId = item['shareId']
|
shareId = item['shareId']
|
||||||
# selecting this link calls htmlShowShare
|
# selecting this link calls htmlShowShare
|
||||||
shareLink = actor + '?showshare=' + shareId
|
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
|
ctr += 1
|
||||||
if ctr >= maxSharesInLeftColumn:
|
if ctr >= maxSharesInLeftColumn:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue