tools (common/data_objects): new OnClick class

OnClick is used to specify what do to when clicking on element.
For now it only handles target URL.
This commit is contained in:
Goffi 2017-10-16 07:41:36 +02:00
commit c7984f60ec

View file

@ -195,3 +195,17 @@ class Identities(object):
def __contains__(self, jid_str):
return jid_str in self.identities
class OnClick(object):
"""Class to handle clickable elements targets"""
def __init__(self, url=None):
self.url = url
def formatUrl(self, item):
"""Use an item to format URL
item will be formatted using "item=item" in format()
"""
return self.url.format(item=item)