notification centre improvements

This commit is contained in:
Serghey Rodin 2016-10-28 17:55:58 +03:00
parent 1bb6ecb2ba
commit addd9a8f02
34 changed files with 80 additions and 13 deletions

View file

@ -406,12 +406,16 @@ VE.notifications.get_list = function(){
acc.push(tpl.finalize());
});
if(!Object.keys(data).length){
var tpl = Tpl.get('notification_empty', 'WEB');
acc.push(tpl.finalize());
}
$('.notification-container').html(acc.done()).show();
$('.notification-container .mark-seen').click(function(event){
/// TODO add token
VE.notifications.mark_seen($(event.target).attr('id').replace("notification-", ""));
// VE.notifications.delete($(event.target).attr('id').replace("notification-", ""));
// VE.notifications.mark_seen($(event.target).attr('id').replace("notification-", ""));
VE.notifications.delete($(event.target).attr('id').replace("notification-", ""));
});
});
@ -419,10 +423,12 @@ VE.notifications.get_list = function(){
VE.notifications.delete = function(id){
$('#notification-'+id).parents('li').remove();
$('#notification-'+id).parents('li').hide();
$.ajax({
url: "/delete/notification/?delete=1&notification_id="+id+"&token="+$('#token').attr('token')
});
if($('.notification-container li:visible').length == 0)
$('.l-profile__notifications').removeClass('updates').removeClass('active');
}
VE.notifications.mark_seen = function(id){

View file

@ -63,3 +63,4 @@ App.Constants.FM_READ_BY_OTHERS = '<?=__('read by others')?>';
App.Constants.FM_WRITE_BY_OTHERS = '<?=__('write by others')?>';
App.Constants.FM_EXECUTE_BY_OTHERS = '<?=__('execute/search by others')?>';
App.Constants.NOTIFICATIONS_EMPTY = '<?=__('no notifications')?>';

View file

@ -6,13 +6,18 @@ App.Templates.html = {
WEB: {
hint: [''],
notification: [
'<li class="~!:UNSEEN~!"><span class="mark-seen" id="notification-~!:ID~!">&nbsp;</span>\
<span class="title"><span class="icon ~!:TYPE~!">&nbsp;</span>~!:TOPIC~!</span>\
'<li class="~!:UNSEEN~!"><span class="unselectable mark-seen" id="notification-~!:ID~!">&nbsp;</span>\
<span class="title"><span class="unselectable icon ~!:TYPE~!">&nbsp;</span>~!:TOPIC~!</span>\
~!:NOTICE~!\
</li>'
],
notification_empty: [
'<li class="empty">\
'+App.Constants.NOTIFICATIONS_EMPTY+'\
</li>'
]
},
// file manager
//