Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- airpim.mainwindows.Notifications = new airpim.Class({
- __extends__: airpim.ui.LogoWindow,
- options: {id: 'notifications'},
- __init__: function(self) {
- self.super_('__init__', self);
- self._data_def = application.session.notificationThreadsList();
- },
- render: function(self, container) {
- var d;
- d = self._data_def;
- delete self._data_def;
- self.super_('render', self, container);
- self.spin(true);
- d.addCallback(self.renderNotificationsThreads);
- },
- renderNotificationsThreads: function(self, notifications) {
- var data, rec, ix, row, title;
- data = [];
- for([ix, rec] in notifications.recipients) {
- title = String.format('%s (%d/%d)', rec.entity.title, rec.thread.unread,
- rec.thread.total);
- title = Ti.UI.createLabel({text: title,
- className: 'notifications_row_contact'});
- row = Ti.UI.createTableViewRow({entity: rec.entity,
- className: 'notifications_row'});
- row.add(title);
- data.push(row);
- }
- self.setupUI(Ti.UI.createTableView({id: 'notifications_table', data: data}),
- self.default_container, {click: self.onNotificationsClick});
- self.spin();
- },
- onNotificationsClick: function(self, event) {
- var thread_;
- thread_ = new airpim.notifications.NotificationThread(event.row.entity);
- thread_.open();
- }
- });
Add Comment
Please, Sign In to add comment