Notifications display

This commit is contained in:
Paul Schneider 2015-10-19 18:46:48 +02:00
commit 3b67420d4d
3 changed files with 20 additions and 14 deletions

View file

@ -18,11 +18,17 @@ self.showHide = function () {
}
};
self.message = function (msg) {
if (msg) {
$("#message").removeClass("hidden");
$("#message").text(msg);
} else { $("#message").addClass("hidden"); } };
self.dimiss = function () {
$(this).parent().remove();
};
self.notice = function (msg, msgok) {
if (!msgok) msgok='Ok';
if (msg) {
var note = $('<div class="notification">'+msg+'<br></div>');
$('<a class="actionlink"><i class="fa fa-check">'+msgok+'</i></a>').click(self.dimiss).appendTo(note);
note.appendTo("#notifications");
} };
self.onAjaxBadInput = function (data)
@ -36,13 +42,14 @@ self.message = function (msg) {
errspan.innerHTML=value.errors.join("<br/>");
});
}
};
self.onAjaxError = function (xhr, ajaxOptions, thrownError) {
if (xhr.status!=400)
Yavsc.message(xhr.status+" : "+xhr.responseText);
else Yavsc.message(false);
}
Yavsc.notice(xhr.status+" : "+xhr.responseText);
else Yavsc.notice(false);
};
return self;
})();