prd-620 fix

This commit is contained in:
Julia Kirnosova 2013-05-16 15:07:14 +04:00 committed by default
parent 0bf8fc99ee
commit 73afc3038f
3 changed files with 17 additions and 2 deletions

View File

@ -1794,6 +1794,10 @@ h6.page-title {
clear: both;
}
.message-list > .new {
cursor: default;
}
.message-list > .discover > .message {
text-decoration: underline;
cursor: pointer;

View File

@ -16,8 +16,19 @@ function(utils, models, commonViews, dialogViews, notificationsListTemplate) {
template: _.template(notificationsListTemplate),
templateHelpers: _.pick(utils, 'urlify'),
events: {
'click .new' : 'markAsRead',
'click .discover' : 'showNodeInfo'
},
markAsRead: function(e) {
var notification = this.notifications.get($(e.currentTarget).data('id'));
notification.toJSON = function() {
return _.pick(notification.attributes, 'id', 'status');
};
notification.save({status: 'read'})
.done(_.bind(function() {
this.notifications.trigger('sync');
}, this));
},
showNodeInfo: function(e) {
if ($(e.target).data('node')) {
var node = this.nodes.get($(e.target).data('node'));

View File

@ -8,10 +8,10 @@
<% if (notifications.deferred.state() != 'pending') { %>
<% _.each(notifications.last(notifications.length).reverse(), function(notification) { %>
<% var topic = notification.get('topic'), icons = {'error': 'icon-attention', 'discover': 'icon-bell'} %>
<li class="notification-box enable-selection <%= notification.get('status') == 'unread' ? 'new' : '' %> <%= topic %>">
<li class="notification-box enable-selection <%= notification.get('status') == 'unread' ? 'new' : '' %> <%= topic %>" data-id="<%= notification.id %>" data-node="<%- notification.get('node_id') %>">
<div class="icon"><i class="<%= icons[topic] || 'icon-info-circled' %>"></i></div>
<div class="datetime"><%= notification.escape('date') %> <%= notification.escape('time') %></div>
<div class="message" data-node="<%- notification.get('node_id') %>"><%= urlify(notification.escape('message')) %></div>
<div class="message"><%= urlify(notification.escape('message')) %></div>
</li>
<% }) %>
<% } else { %>