Skip to content

Commit

Permalink
Not display title and/or message if they are not provided (alert module)
Browse files Browse the repository at this point in the history
  • Loading branch information
gzot committed Jun 24, 2016
1 parent 479ceb1 commit b44dcc9
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions modules/default/alert/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,17 @@ Module.register("alert",{
},
show_notification: function(message) {
if (this.config.effect == "slide") {this.config.effect = this.config.effect + "-" + this.config.position;}
message = "<span class='thin' style='line-height: 35px; font-size:24px' color='#4A4A4A'>" + message.title + "</span><br /><span class='light' style='font-size:28px;line-height: 30px;'>" + message.message + "</span>";

msg = "";
if (message.title) {
msg += "<span class='thin' style='line-height: 35px; font-size:24px' color='#4A4A4A'>" + message.title + "</span>";
}
if (message.message){
msg += "<br /><span class='light' style='font-size:28px;line-height: 30px;'>" + message.message + "</span>";
}

new NotificationFx({
message: message,
message: msg,
layout: "growl",
effect: this.config.effect,
ttl: this.config.display_time
Expand Down Expand Up @@ -67,7 +75,15 @@ Module.register("alert",{
this.hide_alert(sender);
}

message = "<span class='light' style='line-height: 35px; font-size:30px' color='#4A4A4A'>" + params.title + "</span><br /><span class='thin' style='font-size:22px;line-height: 30px;'>" + params.message + "</span>";
//Display title and message only if they are provided in notification parameters
message ="";
if (params.title) {
message += "<span class='light' style='line-height: 35px; font-size:30px' color='#4A4A4A'>" + params.title + "</span>"
}
if (params.message) {
message += "<br /><span class='thin' style='font-size:22px;line-height: 30px;'>" + params.message + "</span>";
}

//Store alert in this.alerts
this.alerts[sender.name] = new NotificationFx({
message: image + message,
Expand Down

0 comments on commit b44dcc9

Please sign in to comment.