Flashtastic

Flashtastic is a Rails (3.1 and above) gem that replaces rails flash messages with Messenger (Version 1.3.6) javascript library for notifications.

Features

  • Adds Messenger js and css into your asset pipeline
  • Out of the box integration with rails flash messages
  • Works for ajax requests
  • Adds a default notification handler for ajax errors

About Messenger

  • Show transactional messages in your app.
  • Wrap AJAX requests with progress, success and error messages, and add retry to your failed requests.
  • Add actions (undo, cancel, etc.) to your messages.
  • 4kb minified and compressed.
  • Works in everything modern, and IE7 and above.

Demo and Usage of Messenger

Requirement/Dependency:

  1. jQuery

  2. Plays well with, but doesn't require, Bootstrap

Installation

Add this line to your application's Gemfile:

gem 'flashtastic'

And then execute:

$ bundle

Or install it yourself as:

$ gem install flashtastic

After gem installation do:

$ rails g flashtastic:install

Thats it!

Alternative Manual Installation

After installing the gem, if you don't want to run rails g flashtastic:install, do the following:

Copy the following coffeescript file in your assets:

flashtastic_initializer.js.coffee

Add the following directive to your application.coffee / application.js.

//= require messenger
//= require messenger-theme-flat
//= require flashtastic_initializer // This will add integration with rails flash messages.

Add the following directive to your application.scss / application.css. There are Five themes/styles provided (flat, future, air, block and ice), change required stylesheet as needed.

*= require messenger
*= require messenger-spinner
*= require messenger-theme-flat

Include Flashtastic module in Application controller

include Flashtastic

Thats it!

Usage

If you have included flashtastic_initializer.js.coffee in your assets, your regular rails flash messages will show up as messenger messages. Even for ajax requests.

Modify flashtastic_initializer.js.coffee as needed.

Demo and Usage of Messenger

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Author

Amit Gaur