Skip to content

Instantly share code, notes, and snippets.

@anderson-mota
Last active December 16, 2015 15:09
Show Gist options
  • Save anderson-mota/5454193 to your computer and use it in GitHub Desktop.
Save anderson-mota/5454193 to your computer and use it in GitHub Desktop.
Plugin Alert para Bootstrap e Handlebars.
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