If you are tired of integrating flash messages in your rails application over and over again then this gem is for you!
Add this line to your application's Gemfile:
gem 'flash_notifier'
And then execute:
$ bundle
Or install it yourself as:
$ gem install flash_notifier
Add this helper method in your layout and make sure you have bootstrap installed!
<%= build_bootstrap_flash %>
You can make the flash dismissible by passing following optional options to the above helper method
<%= build_bootstrap_flash dismiss: true, timeout: 5000 %>
You can add your own wrapper class by passing following parameter
<%= build_bootstrap_flash wrapper_class: 'my-flash-notification' %>
For Noty JS 3.1.4 (Official Website)
Import noty library in your application.js
//= require noty_lib
Add noty stylesheet in your application.scss
@import "noty";
For Toastr JS 2.1.4 (Official Website)
Import noty library in your application.js
//= require toastr_lib
Add noty stylesheet in your application.scss
@import "toastr.min";
In your layout add this helper method
<%= build_flash %>
To manage progress bar pass param
<%= build_flash progressBar: true %>
To set auto hide timeout pass param
<%= build_flash timeout: 3500 %>
To set default theme pass param (Note this param works only for Noty JS)
<%= build_flash theme: 'mint' %>
Bug reports and pull requests are welcome on GitHub at https://github.com/fakhir-shad/flash_notifier. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the FlashNotifier project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.