warning to save edits on first profile upload

This commit is contained in:
Norbert Renner 2014-05-28 19:54:54 +02:00
parent 1527a07d0e
commit 1aefa9df04
4 changed files with 58 additions and 21 deletions

44
js/control/Message.js Normal file
View file

@ -0,0 +1,44 @@
BR.Message = function () {
this.messageTimeout = null;
};
BR.Message.prototype = {
_show: function (msg, type) {
window.clearTimeout(this.messageTimeout);
var ele = L.DomUtil.get('message');
ele.innerHTML = msg;
L.DomUtil.removeClass(ele, 'hidden');
L.DomUtil.addClass(ele, type);
return ele;
},
_hide: function (type) {
window.clearTimeout(this.messageTimeout);
var ele = L.DomUtil.get('message');
if (!L.DomUtil.hasClass(ele, 'hidden')) {
L.DomUtil.addClass(ele, 'hidden');
ele.innerHTML = '';
}
if (L.DomUtil.hasClass(ele, type)) {
L.DomUtil.removeClass(ele, type);
}
},
showError: function (err) {
this._show(err, 'error');
},
hideError: function () {
this._hide('error');
},
showWarning: function (msg) {
this._show(msg, 'warning');
this.messageTimeout = window.setTimeout(L.bind(function () {
this._hide('warning');
}, this), 10000);
}
};
// singleton
BR.message = new BR.Message();