Skip to content
Extraits de code Groupes Projets
Valider 2a51eb45 rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

refs #4179 better var naming

parent e793504a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -52,49 +52,56 @@ ...@@ -52,49 +52,56 @@
template += message; template += message;
template += '</div>'; template += '</div>';
var notificationNode = $(template).appendTo('#notificationContainer'); var $notificationNode = $(template).appendTo('#notificationContainer');
if ('persistent' == options.type) { if ('persistent' == options.type) {
addPersistentEvent(notificationNode); addPersistentEvent($notificationNode);
} }
if ('toast' == options.type) { if ('toast' == options.type) {
addToastEvent(notificationNode); addToastEvent($notificationNode);
} }
if (!options.noclear) { if (!options.noclear) {
addCloseEvent(notificationNode); addCloseEvent($notificationNode);
} }
}; };
exports.Notification = Notification; exports.Notification = Notification;
function addToastEvent(notificationNode) function addToastEvent($notificationNode)
{ {
setTimeout(function () { setTimeout(function () {
notificationNode.fadeOut( 'slow', function() { $notificationNode.fadeOut( 'slow', function() {
notificationNode.remove(); $notificationNode.remove();
notificationNode = null; $notificationNode = null;
}); });
}, 15 * 1000); }, 15 * 1000);
} }
function addCloseEvent(notificationNode) { function addCloseEvent($notificationNode) {
$(notificationNode).on('click', '.close', function (event) { $notificationNode.on('click', '.close', function (event) {
if (event.delegateTarget) { if (event && event.delegateTarget) {
$(event.delegateTarget).remove(); $(event.delegateTarget).remove();
} }
}); });
}; };
function addPersistentEvent(notificationNode) { function addPersistentEvent($notificationNode) {
$(notificationNode).on('click', '.close', function (event) {
var notificationId = $notificationNode.data('id');
if (!notificationId) {
return;
}
$notificationNode.on('click', '.close', function (event) {
var ajaxHandler = new ajaxHelper(); var ajaxHandler = new ajaxHelper();
ajaxHandler.addParams({ ajaxHandler.addParams({
module: 'CoreHome', module: 'CoreHome',
action: 'markNotificationAsRead' action: 'markNotificationAsRead'
}, 'GET'); }, 'GET');
ajaxHandler.addParams({notificationId: $(notificationNode).data('id')}, 'POST'); ajaxHandler.addParams({notificationId: notificationId}, 'POST');
ajaxHandler.send(true); ajaxHandler.send(true);
}); });
}; };
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter