Mercurial > libervia-backend
diff src/tools/common/data_objects.py @ 2383:a37457da2bb7
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.
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 16 Oct 2017 07:41:36 +0200 |
parents | 173d56315529 |
children | 8b37a62336c3 |
line wrap: on
line diff
--- a/src/tools/common/data_objects.py Mon Oct 16 07:39:54 2017 +0200 +++ b/src/tools/common/data_objects.py Mon Oct 16 07:41:36 2017 +0200 @@ -195,3 +195,17 @@ 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)