SimpleAlert
Installation
Add this line to your application's Gemfile:
Rails 5
gem 'simple_alert'
Rails 4
gem 'simple_alert', '0.1.2'
In application.css
*= require simple_alert
In application.js
//= require simple_alert
Usage
ba("This is a message!")
Call alert with title and message:
ba("Hello!","This is a message!")
Callbacks functions:
ba({
title: "You are sure?",
message: "You want delete this post?",
onConfirm: function(){
ba("Your post has been deleted.")
},
onClose: function(){
ba("Your post is safe :)")
}
})
Add class to butons:
ba({
message: "Adding css class to butons",
closeClass: "btn_blue",
confirmClass: "btn_red"
})
Change text from buttons
ba({
message: "Custom text",
confirmText: "don't confirm that!",
closeText: "close is safe"
})
Click on shadow to close alert
ba({
message: "Click on shadow to close",
closeOnClickShadow: true
})
Set default class to close and confirm buttons
SimpleAlert.bt_confirm_class = "btn btn-success"
SimpleAlert.bt_close_class = "btn btn-default"
Dependencies
License
The gem is available as open source under the terms of the MIT License.