Guest User

Untitled

a guest
Nov 18th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. airpim.mainwindows.Notifications = new airpim.Class({
  2. __extends__: airpim.ui.LogoWindow,
  3. options: {id: 'notifications'},
  4. __init__: function(self) {
  5. self.super_('__init__', self);
  6. self._data_def = application.session.notificationThreadsList();
  7. },
  8.  
  9. render: function(self, container) {
  10. var d;
  11. d = self._data_def;
  12. delete self._data_def;
  13. self.super_('render', self, container);
  14. self.spin(true);
  15. d.addCallback(self.renderNotificationsThreads);
  16. },
  17.  
  18. renderNotificationsThreads: function(self, notifications) {
  19. var data, rec, ix, row, title;
  20. data = [];
  21. for([ix, rec] in notifications.recipients) {
  22. title = String.format('%s (%d/%d)', rec.entity.title, rec.thread.unread,
  23. rec.thread.total);
  24. title = Ti.UI.createLabel({text: title,
  25. className: 'notifications_row_contact'});
  26. row = Ti.UI.createTableViewRow({entity: rec.entity,
  27. className: 'notifications_row'});
  28. row.add(title);
  29. data.push(row);
  30. }
  31. self.setupUI(Ti.UI.createTableView({id: 'notifications_table', data: data}),
  32. self.default_container, {click: self.onNotificationsClick});
  33. self.spin();
  34. },
  35. onNotificationsClick: function(self, event) {
  36. var thread_;
  37. thread_ = new airpim.notifications.NotificationThread(event.row.entity);
  38. thread_.open();
  39. }
  40. });
Add Comment
Please, Sign In to add comment