# HG changeset patch # User Thierry Florac # Date 1464877664 -7200 # Node ID 4ce6e8538a8d310458287fd7807c916fbc08bbe9 # Parent 2dec7379f93526641b8df72edb7d9e650960fdfb Updated activity viewlet diff -r 2dec7379f935 -r 4ce6e8538a8d src/pyams_skin/interfaces/viewlet.py --- a/src/pyams_skin/interfaces/viewlet.py Thu May 12 11:00:58 2016 +0200 +++ b/src/pyams_skin/interfaces/viewlet.py Thu Jun 02 16:27:44 2016 +0200 @@ -253,7 +253,10 @@ message = Text(title="Initial message") loading_text = TextLine(title="Tab loading text", - default=_("<i class='fa fa-refresh fa-spin'></i> Loading...")) + default=_("<i class='fa fa-refresh fa-spin'></i>")) + + refresh_handler = TextLine(title="Refresh button click handler", + default="MyAMS.skin.refreshNotificationsPanel") def get_last_update(self): """Get last update time""" @@ -262,6 +265,8 @@ class IActivityViewlet(IViewlet): """User activity panel viewlet""" + name = TextLine(title="Tab input value") + label = TextLine(title="Tab label") click_handler = TextLine(title="Tab click handler", diff -r 2dec7379f935 -r 4ce6e8538a8d src/pyams_skin/templates/layout.pt --- a/src/pyams_skin/templates/layout.pt Thu May 12 11:00:58 2016 +0200 +++ b/src/pyams_skin/templates/layout.pt Thu Jun 02 16:27:44 2016 +0200 @@ -108,9 +108,9 @@
- - 8 +
diff -r 2dec7379f935 -r 4ce6e8538a8d src/pyams_skin/viewlet/activity/__init__.py --- a/src/pyams_skin/viewlet/activity/__init__.py Thu May 12 11:00:58 2016 +0200 +++ b/src/pyams_skin/viewlet/activity/__init__.py Thu Jun 02 16:27:44 2016 +0200 @@ -14,15 +14,16 @@ # import standard library -from babel.dates import format_datetime from datetime import datetime +from babel.dates import format_datetime # import interfaces from pyams_skin.interfaces.viewlet import IActivityViewletManager, IActivityViewlet from pyams_skin.layer import IPyAMSLayer # import packages from pyams_template.template import template_config +from pyams_utils.date import format_datetime from pyams_viewlet.manager import TemplateBasedViewletManager, WeightOrderedViewletManager, viewletmanager_config from pyams_viewlet.viewlet import Viewlet from zope.interface import implementer @@ -39,18 +40,21 @@ header = FieldProperty(IActivityViewletManager['header']) message = FieldProperty(IActivityViewletManager['message']) loading_text = FieldProperty(IActivityViewletManager['loading_text']) + refresh_handler = FieldProperty(IActivityViewletManager['refresh_handler']) - _update_time = _("Last update: {0}") + update_time = _("Last update: {0}") def get_last_update(self): - now = datetime.now() - return self._update_time.format(format_datetime(now, format='medium', locale=self.request.locale_name)) + translate = self.request.localizer.translate + return translate(self.update_time).format(format_datetime(datetime.utcnow(), + request=self.request)) @implementer(IActivityViewlet) class ActivityViewlet(Viewlet): """Activity viewlet panel""" + name = FieldProperty(IActivityViewlet['name']) label = FieldProperty(IActivityViewlet['label']) url = FieldProperty(IActivityViewlet['url']) click_handler = FieldProperty(IActivityViewlet['click_handler']) diff -r 2dec7379f935 -r 4ce6e8538a8d src/pyams_skin/viewlet/activity/manager.pt --- a/src/pyams_skin/viewlet/activity/manager.pt Thu May 12 11:00:58 2016 +0200 +++ b/src/pyams_skin/viewlet/activity/manager.pt Thu Jun 02 16:27:44 2016 +0200 @@ -1,32 +1,48 @@ - -
- - - -
- -
-
-

- + + +
+ + + + + +
- -
- + + +
+ + +
+

+ +
+ +
+
+ - - - - - - + + + + + + +