Last active
December 16, 2015 15:09
-
-
Save anderson-mota/5454193 to your computer and use it in GitHub Desktop.
Plugin Alert para Bootstrap e Handlebars.
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
function(){ | |
var alertTpl = Handlebars.compile($("#alert-tpl").html()); | |
$.fn.alertIntra = function(message, _class){ | |
_class = _class || "alert-info"; | |
var icon_class = "icon-info-sign"; | |
if(_class == "alert-warning"){ | |
icon_class = "icon-exclamation-sign"; | |
}else if(_class == "alert-error"){ | |
icon_class = "icon-warning-sign"; | |
}else if(_class == "alert-success"){ | |
icon_class = "icon-ok-sign"; | |
} | |
var context = { | |
message: message, | |
_class: _class, | |
icon_class: icon_class | |
}; | |
$(this).find('.alert').remove(); | |
$(this).prepend(alertTpl(context)); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment