From c7984f60ec63b6bdf9462cb573a062273bc8a87c Mon Sep 17 00:00:00 2001 From: Goffi Date: Mon, 16 Oct 2017 07:41:36 +0200 Subject: [PATCH] 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. --- src/tools/common/data_objects.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/tools/common/data_objects.py b/src/tools/common/data_objects.py index 3f4cfeff..df63a5e2 100644 --- a/src/tools/common/data_objects.py +++ b/src/tools/common/data_objects.py @@ -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)