license manager

This commit is contained in:
Serghey Rodin 2015-11-02 15:28:16 +02:00
commit 60ebfe321a
13 changed files with 534 additions and 47 deletions

View file

@ -867,7 +867,7 @@ App.Ajax.request = function(method, data, callback, onError){
callback && callback(reply);
}
catch(e) {
alert('GENERAL ERROR: '+e);
fb.error('GENERAL ERROR with ajax method: ' + data.request_method + ' ' + e);
//App.Helpers.generalError();
}
}

View file

@ -8,6 +8,7 @@ var VE = { // Vesta Events object
menu_active_selector: '.l-stat__col--active'
}
}, // menu and element navigation functions
notifications: {},
callbacks: { // events callback functions
click: {},
mouseover: {},
@ -353,6 +354,57 @@ VE.navigation.switch_menu = function(position){
}
}
VE.notifications.get_list = function(){
/// TODO get notifications only once
$.ajax({
url: "/list/notifications/?ajax=1",
dataType: "json"
}).done(function(data) {
var acc = [];
$.each(data, function(i, elm){
var tpl = Tpl.get('notification', 'WEB');
if(elm.ACK == 'no')
tpl.set(':UNSEEN', 'unseen');
else
tpl.set(':UNSEEN', '');
tpl.set(':ID', elm.ID);
tpl.set(':TYPE', elm.TYPE);
tpl.set(':TOPIC', elm.TOPIC);
tpl.set(':NOTICE', elm.NOTICE);
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.delete = function(id){
$('#notification-'+id).parents('li').remove();
$.ajax({
url: "/delete/notification/?delete=1&notification_id="+id+"&token="+$('#token').attr('token')
});
}
VE.notifications.mark_seen = function(id){
$('#notification-'+id).parents('li').removeClass('unseen');
$.ajax({
url: "/delete/notification/?notification_id="+id+"&token="+$('#token').attr('token')
});
if($('.notification-container .unseen').length == 0)
$('.l-profile__notifications').removeClass('updates');
}
VE.navigation.init = function(){

View file

@ -4,7 +4,14 @@
*/
App.Templates.html = {
WEB: {
hint: ['']
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>\
~!:NOTICE~!\
</li>'
]
},
// file manager
//