Commit 8b35f74c authored by marc duez's avatar marc duez
Browse files

com.js : flash popup can display a link to a db page

needed to display server notification with link
parent 2f0c0667
...@@ -149,7 +149,7 @@ Com.prototype = { ...@@ -149,7 +149,7 @@ Com.prototype = {
if (typeof obj.msg != "undefined") text += obj.msg if (typeof obj.msg != "undefined") text += obj.msg
switch (obj.type) { switch (obj.type) {
case "flash": case "flash":
this.flash(text, obj.priority) this.flash(text, obj.priority, obj.call)
break; break;
case "popup": case "popup":
this.popupMsg(text) this.popupMsg(text)
...@@ -195,8 +195,6 @@ Com.prototype = { ...@@ -195,8 +195,6 @@ Com.prototype = {
document.body.appendChild(this.log_container); document.body.appendChild(this.log_container);
document.body.appendChild(this.popup_container); document.body.appendChild(this.popup_container);
this.div_dataBox = document.createElement("div"); this.div_dataBox = document.createElement("div");
this.div_dataBox.className = "modal data-container"; this.div_dataBox.className = "modal data-container";
...@@ -220,9 +218,10 @@ Com.prototype = { ...@@ -220,9 +218,10 @@ Com.prototype = {
* @param {string} str - message to display * @param {string} str - message to display
* @param {integr} priority * @param {integr} priority
* */ * */
flash: function (str, priority){ flash: function (str, priority, call){
priority = typeof priority !== 'undefined' ? priority : 0; priority = typeof priority !== 'undefined' ? priority : 0;
if (priority >= this.min_priority){ if (priority >= this.min_priority){
var div = jQuery('<div/>', { var div = jQuery('<div/>', {
'text': str, 'text': str,
...@@ -232,6 +231,24 @@ Com.prototype = { ...@@ -232,6 +231,24 @@ Com.prototype = {
}).appendTo(this.flash_container) }).appendTo(this.flash_container)
.slideDown(200); .slideDown(200);
if (call){
var div2 = jQuery('<div/>').appendTo(div);
jQuery('<div/>', {
'text': "see details",
'class': "button",
'click': function(){ db.call(call.path, call.args); }
}).appendTo(div2);
if (priority >= this.ERROR){
jQuery('<div/>', {
'text': "dismiss",
'class': "button",
'click': function(){$(this).fadeOut(25, function() { $(this).remove();} );}
}).appendTo(div2);
}
}
if (priority < this.ERROR){ if (priority < this.ERROR){
setTimeout(function(){ setTimeout(function(){
div.fadeOut('slow', function() { div.remove();}); div.fadeOut('slow', function() { div.remove();});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment