Created
February 29, 2012 02:35
-
-
Save akagomez/1937108 to your computer and use it in GitHub Desktop.
express-messages-bootstrap2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
messages: function(req, res) { | |
var buf, i, j, len, messages, msg, msgs, type, types, _ref; | |
buf = []; | |
messages = req.flash(); | |
types = Object.keys(messages); | |
len = types.length; | |
if (!len) { | |
return ''; | |
} | |
buf.push('<div id="messages">'); | |
for (i = 0; (0 <= len ? i < len : i > len); (0 <= len ? i += 1 : i -= 1)) { | |
type = types[i]; | |
msgs = messages[type]; | |
if (msgs != null) { | |
buf.push("<div class=\"alert alert-" + type + "\" data-alert=\"alert\">"); | |
buf.push("<a class=\"close\" href=\"#\">×</a>"); | |
for (j = 0, _ref = msgs.length; (0 <= _ref ? j < _ref : j > _ref); (0 <= _ref ? j += 1 : j -= 1)) { | |
msg = msgs[j]; | |
buf.push("" + msg + ""); | |
} | |
buf.push("</div>"); | |
} | |
} | |
buf.push("</div>"); | |
return buf.join('\n'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment