Sha256: 058bf017462f7e3b8bb15bfb2e829296ea969d54448fad45a6e797760e204d26
Contents?: true
Size: 1.19 KB
Versions: 7
Compression:
Stored size: 1.19 KB
Contents
# Glow Glowing flashes! Okay... not really. This simply adds handling of the Fash Hash in Javascript. Depends on jQuery. ## Usage Any flash messages set in ajax responses fire a `glow:flash` event on `document`. flash[:notice] = 'Ajax man!' respond_to do |format| format.js { head :ok } end Handle it any way you want: $(document).bind('glow:flash', function(evt, flash) { alert(flash.type); alert(flash.message); } Also adds a `Flash` object that enables you to fire `glow:flash`. Flash.success('Yeah this worked!'); Flash.error('Something went wrong!'); Flash.notice('This is a flash message'); Flash.fire('type', 'message'); This can be used to unify your Flash message handling (also in non-xhr responses). <% flash.each |type, message| %> <%= javascript_tag "Flash.fire('#{type}', '#{message}')" %> <% end %> ## Installation In your gemfile add gem "glow" . ### Rails 3.0 Run rails generate glow:install Then add javascipt_include_tag 'glow' to your layout. ### Rails 3.1 TODO ## License See MIT-LICENSE. ## TODO - Test in 3.1 - Automatically add //= require glow to application.js in 3.1 (via generator)
Version data entries
7 entries across 7 versions & 1 rubygems
Version | Path |
---|---|
glow-0.0.7 | README.md |
glow-0.0.6 | README.md |
glow-0.0.5 | README.md |
glow-0.0.4 | README.md |
glow-0.0.3 | README.md |
glow-0.0.2 | README.md |
glow-0.0.1 | README.md |